problem
stringlengths
26
131k
labels
class label
2 classes
static inline int vertClassify_altivec(uint8_t src[], int stride, PPContext *c) { DECLARE_ALIGNED(16, short, data)[8] = { ((c->nonBQP*c->ppMode.baseDcDiff)>>8) + 1, data[0] * 2 + 1, c->QP * 2, c->QP * 4 }; int numEq; uint8_t *src2 = src; vector signed short v_dcOffset; vector signed short v2QP; vector unsigned short v4QP; vector unsigned short v_dcThreshold; const int properStride = (stride % 16); const int srcAlign = ((unsigned long)src2 % 16); const int two_vectors = ((srcAlign > 8) || properStride) ? 1 : 0; const vector signed int zero = vec_splat_s32(0); const vector signed short mask = vec_splat_s16(1); vector signed int v_numEq = vec_splat_s32(0); vector signed short v_data = vec_ld(0, data); vector signed short v_srcAss0, v_srcAss1, v_srcAss2, v_srcAss3, v_srcAss4, v_srcAss5, v_srcAss6, v_srcAss7; register int j0 = 0, j1 = stride, j2 = 2 * stride, j3 = 3 * stride, j4 = 4 * stride, j5 = 5 * stride, j6 = 6 * stride, j7 = 7 * stride; vector unsigned char v_srcA0, v_srcA1, v_srcA2, v_srcA3, v_srcA4, v_srcA5, v_srcA6, v_srcA7; v_dcOffset = vec_splat(v_data, 0); v_dcThreshold = (vector unsigned short)vec_splat(v_data, 1); v2QP = vec_splat(v_data, 2); v4QP = (vector unsigned short)vec_splat(v_data, 3); src2 += stride * 4; #define LOAD_LINE(i) \ { \ vector unsigned char perm##i = vec_lvsl(j##i, src2); \ vector unsigned char v_srcA2##i; \ vector unsigned char v_srcA1##i = vec_ld(j##i, src2); \ if (two_vectors) \ v_srcA2##i = vec_ld(j##i + 16, src2); \ v_srcA##i = \ vec_perm(v_srcA1##i, v_srcA2##i, perm##i); \ v_srcAss##i = \ (vector signed short)vec_mergeh((vector signed char)zero, \ (vector signed char)v_srcA##i); } #define LOAD_LINE_ALIGNED(i) \ v_srcA##i = vec_ld(j##i, src2); \ v_srcAss##i = \ (vector signed short)vec_mergeh((vector signed char)zero, \ (vector signed char)v_srcA##i) if (properStride && srcAlign) { LOAD_LINE_ALIGNED(0); LOAD_LINE_ALIGNED(1); LOAD_LINE_ALIGNED(2); LOAD_LINE_ALIGNED(3); LOAD_LINE_ALIGNED(4); LOAD_LINE_ALIGNED(5); LOAD_LINE_ALIGNED(6); LOAD_LINE_ALIGNED(7); } else { LOAD_LINE(0); LOAD_LINE(1); LOAD_LINE(2); LOAD_LINE(3); LOAD_LINE(4); LOAD_LINE(5); LOAD_LINE(6); LOAD_LINE(7); } #undef LOAD_LINE #undef LOAD_LINE_ALIGNED #define ITER(i, j) \ const vector signed short v_diff##i = \ vec_sub(v_srcAss##i, v_srcAss##j); \ const vector signed short v_sum##i = \ vec_add(v_diff##i, v_dcOffset); \ const vector signed short v_comp##i = \ (vector signed short)vec_cmplt((vector unsigned short)v_sum##i, \ v_dcThreshold); \ const vector signed short v_part##i = vec_and(mask, v_comp##i); { ITER(0, 1) ITER(1, 2) ITER(2, 3) ITER(3, 4) ITER(4, 5) ITER(5, 6) ITER(6, 7) v_numEq = vec_sum4s(v_part0, v_numEq); v_numEq = vec_sum4s(v_part1, v_numEq); v_numEq = vec_sum4s(v_part2, v_numEq); v_numEq = vec_sum4s(v_part3, v_numEq); v_numEq = vec_sum4s(v_part4, v_numEq); v_numEq = vec_sum4s(v_part5, v_numEq); v_numEq = vec_sum4s(v_part6, v_numEq); } #undef ITER v_numEq = vec_sums(v_numEq, zero); v_numEq = vec_splat(v_numEq, 3); vec_ste(v_numEq, 0, &numEq); if (numEq > c->ppMode.flatnessThreshold){ const vector unsigned char mmoP1 = (const vector unsigned char) {0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x01, 0x12, 0x13, 0x08, 0x09, 0x1A, 0x1B}; const vector unsigned char mmoP2 = (const vector unsigned char) {0x04, 0x05, 0x16, 0x17, 0x0C, 0x0D, 0x1E, 0x1F, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f}; const vector unsigned char mmoP = (const vector unsigned char) vec_lvsl(8, (unsigned char*)0); vector signed short mmoL1 = vec_perm(v_srcAss0, v_srcAss2, mmoP1); vector signed short mmoL2 = vec_perm(v_srcAss4, v_srcAss6, mmoP2); vector signed short mmoL = vec_perm(mmoL1, mmoL2, mmoP); vector signed short mmoR1 = vec_perm(v_srcAss5, v_srcAss7, mmoP1); vector signed short mmoR2 = vec_perm(v_srcAss1, v_srcAss3, mmoP2); vector signed short mmoR = vec_perm(mmoR1, mmoR2, mmoP); vector signed short mmoDiff = vec_sub(mmoL, mmoR); vector unsigned short mmoSum = (vector unsigned short)vec_add(mmoDiff, v2QP); if (vec_any_gt(mmoSum, v4QP)) return 0; else return 1; } else return 2; }
1threat
How do I animate my javascript path? : I'm making a maze. The point is to draw out the path instead of just having the solution... That's my problem I have the js path. When I use it on my page it's already drawn. I would like to animate the whole path not just have it all drawn out.. Help? Here is my js path: function path(){ ctx.save(); ctx.fillStyle = "rgba(0, 0, 0, 0)"; ctx.strokeStyle = "blue"; ctx.lineWidth = 5; ctx.lineCap = "square"; ctx.lineJoin = "round"; ctx.beginPath(); ctx.moveTo(306.26420364278204,3.0891496659235713); ctx.lineTo(305.28255450186555,43.07710241377171); ctx.translate(299,298.99999999999994); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,256,-1.5462526341887264,-1.0062913968529807,0); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299,-298.99999999999994); ctx.lineTo(444.5193526092904,69.19983025207966); ctx.translate(299.0000000000001,299.00000000000006); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,272,-1.0062913968529812,-0.8590292412159607,0); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299.0000000000001,-299.00000000000006); ctx.lineTo(487.1137787706877,80.92385220613244); ctx.translate(299.0000000000001,299.00000000000006); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,288,-0.8590292412159597,-0.7117670855789384,0); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299.0000000000001,-299.00000000000006); ctx.lineTo(492.84546470566,131.78775220383315); ctx.translate(298.99999999999864,298.9999999999984); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,256,-0.7117670855789293,-0.7363107781850984,1); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-298.99999999999864,-298.9999999999984); ctx.lineTo(476.8282700851902,137.82585083671557); ctx.translate(299,299); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,240,-0.7363107781851078,-0.4417864669110653,0); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299,-299); ctx.lineTo(530.4212590396015,189.54589608184776); ctx.translate(299,298.9999999999997); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,256,-0.4417864669110634,-0.22089323345553116,0); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299,-298.9999999999997); ctx.lineTo(580.0022134510962,235.8988428348215); ctx.translate(299.0000000000002,299.00000000000114); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,288,-0.22089323345553627,-0.12271846303085567,0); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299.0000000000002,-299.00000000000114); ctx.lineTo(568.9544334108491,265.7042963458132); ctx.translate(298.99999999999983,298.9999999999995); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,272,-0.12271846303084974,-0.17180584824318773,1); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-298.99999999999983,-298.9999999999995); ctx.lineTo(551.2310764515689,255.23375647736285); ctx.translate(299.00000000000006,299.00000000000074); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,256,-0.1718058482431939,-0.049087385212345055,0); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299.00000000000006,-299.00000000000074); ctx.lineTo(522.7301821899587,288.00884095065834); ctx.translate(299.0000000000001,299.0000000000003); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,224,-0.04908738521234027,-0.24543692606170187,1); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299.0000000000001,-299.0000000000003); ctx.lineTo(500.7665006644652,248.4601225801211); ctx.translate(299.00000000000006,299.0000000000003); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,208,-0.2454369260617036,-0.3436116964863819,1); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299.00000000000006,-299.0000000000003); ctx.lineTo(464.7117554722116,239.70738580296927); ctx.translate(299.0000000000001,299.00000000000045); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,176,-0.3436116964863862,-0.24543692606170558,0); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299.0000000000001,-299.00000000000045); ctx.lineTo(423.16400040890164,267.8985369723822); ctx.translate(299.00000000000006,299); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,128,-0.24543692606170267,-0.44178646691106427,1); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299.00000000000006,-299); ctx.lineTo(429.1744582097758,237.43206654603938); ctx.translate(298.99999999999994,298.99999999999994); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,144,-0.44178646691106416,-0.5399612373357459,1); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-298.99999999999994,-298.99999999999994); ctx.lineTo(463.68389312005223,200.29227311490143); ctx.translate(299,298.99999999999994); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,192,-0.5399612373357452,-0.8344855486097881,1); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299,-298.99999999999994); ctx.lineTo(417.19437605307525,168.59260193752718); ctx.translate(299,299); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,176,-0.834485548609789,-1.0308350894591511,1); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299,-299); ctx.lineTo(381.25643907091546,161.76342239995645); ctx.translate(298.9999999999997,298.9999999999998); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,160,-1.0308350894591487,-0.932660319034467,0); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-298.9999999999997,-298.9999999999998); ctx.lineTo(375.24951097503146,196.18943597047746); ctx.translate(299.00000000000045,299.0000000000003); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,128,-0.9326603190344739,-0.8835729338221313,0); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299.00000000000045,-299.0000000000003); ctx.lineTo(359.90175527970996,224.79099647717726); ctx.translate(298.99999999999994,298.99999999999994); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,96,-0.8835729338221285,-1.0799224746714902,1); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-298.99999999999994,-298.99999999999994); ctx.lineTo(329.16939115686387,242.55703908170528); ctx.translate(299,299); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,64,-1.0799224746714915,-1.3744467859455356,1); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299,-299); ctx.lineTo(308.36433545677414,251.92230654064494); ctx.translate(299,299); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,48,-1.3744467859455347,-0.9817477042468099,0); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299,-299); ctx.lineTo(316.77824745662724,272.39297240631856); ctx.translate(298.99999999999994,299); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,32,-0.9817477042468098,0.9817477042468098,0); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-298.99999999999994,-299); ctx.lineTo(325.6673711849409,338.91054139052216); ctx.translate(299,299); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,48,0.9817477042468107,1.374446785945534,0); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299,-299); ctx.lineTo(311.48578060903225,361.77025794580675); ctx.translate(299,299); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,64,1.3744467859455345,1.7671458676442582,0); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299,-299); ctx.lineTo(289.63566454322586,346.07769345935503); ctx.translate(298.9999999999998,298.99999999999994); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,48,1.7671458676442546,2.1598449493429785,0); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-298.9999999999998,-298.99999999999994); ctx.lineTo(263.44350508674546,352.21405518736293); ctx.translate(299.00000000000045,299.00000000000034); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,64,2.1598449493429923,2.2580197197676717,0); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299.00000000000045,-299.00000000000034); ctx.lineTo(238.09824472029004,373.20900352282274); ctx.translate(299,299); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,96,2.258019719767664,2.061670178918302,1); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299,-299); ctx.lineTo(246.20356547548826,397.7751816070158); ctx.translate(299.00000000000017,299.0000000000001); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,112,2.0616701789183036,2.2580197197676646,0); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299.00000000000017,-299.0000000000001); ctx.lineTo(217.7976596270534,397.9453380304303); ctx.translate(299,298.99999999999994); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,128,2.2580197197676632,2.454369260617024,0); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299,-298.99999999999994); ctx.lineTo(212.4228292233735,370.05204782632836); ctx.translate(299,299); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,112,2.4543692606170255,3.8288160465625607,0); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299,-299); ctx.lineTo(249.52733098478484,258.3988298135267); ctx.translate(299,299); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,64,-2.454369260617026,-2.5525440310417076,1); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299,-299); ctx.lineTo(272.39297240631856,281.22175254337276); ctx.translate(299.00000000000006,299); ctx.rotate(0); ctx.scale(1,1); ctx.arc(0,0,32,-2.5525440310417085,-4.319689898685965,1); ctx.scale(1,1); ctx.rotate(0); ctx.translate(-299.00000000000006,-299); ctx.lineTo(289.81559762323786,321.17310878027087); ctx.fill(); ctx.stroke(); ctx.restore(); }
0debug
Open chm file in Windows and Linux from C++ program : <p>I have an application developed in <code>C++</code> running in both <code>Windows</code> and <code>Linux</code>. The help file is generated as <code>.chm</code> file using <code>HTML Help workshop</code>. Is there a single way by which I can open the file in both. I found <code>HTMLHelp WINAPI</code>. But nothing in Linux. </p>
0debug
Slick Carousel Easing Examples : <p>I am using Slick Carousel (<a href="http://kenwheeler.github.io/slick/" rel="noreferrer">http://kenwheeler.github.io/slick/</a>), but don't know how to incorporate different slide transitions. Does anyone have an example to share?</p> <p>Here's what I currently have:</p> <pre><code> $('.slider1').slick({ autoplay:true, autoplaySpeed: 4500, arrows:false, slide:'.slider-pic', slidesToShow:1, slidesToScroll:1, dots:false, easing: 'easeOutElastic', responsive: [ { breakpoint: 1024, settings: { dots: false } }] }); </code></pre> <p>On site - <a href="http://lantecctc.businesscatalyst.com/" rel="noreferrer">http://lantecctc.businesscatalyst.com/</a></p>
0debug
Python: return first value by condition of nested dictionary in array : <p>Have some array with nested dictionaries:<br> <code>data = [{'id':1, 'name':'test'}, {'id':2, 'name':'test'}, ....., {'id':N, 'name':'test'}]</code></p> <p>Trying to return first <code>id</code> value where <code>name=test</code>: </p> <p><code>val = [x['id'] for x in data if x['name'] == 'test'][0]</code> </p> <p>expected result: <code>val = 1</code></p> <p>But having exception: <code>list index out of range</code><br> What's wrong?</p>
0debug
String indices or integer indices for dicionaries in Python? : <p>I have a dictionary that acts as a counter for different keys, i.e., the value of a key is the number of times a key occurred. Is it faster for me to use a string indexed dictionary or an integer indexed one? Which has a better performance?</p>
0debug
static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame, int frame_off) { unsigned val, saved_val = 0; int tmplen = src_len; const uint8_t *src, *source_end = source + src_len; uint8_t *frame_end = frame + SCREEN_WIDE * SCREEN_HIGH; uint8_t *dst, *dst_end; int len, mask; int forward = (frame_off <= -SCREEN_WIDE) || (frame_off >= 0); int read_two_nibbles, flag; int advance_mode; int mode = 0; int i; if (src_len <= 0) return AVERROR_INVALIDDATA; if (forward) { src = source; dst = frame; dst_end = frame_end; } else { src = source + src_len - 1; dst = frame_end - 1; dst_end = frame - 1; } for (;;) { int shift = 0; flag = 0; if (!mode || (tmplen == 4)) { if (src < source || src >= source_end) return AVERROR_INVALIDDATA; val = *src; read_two_nibbles = 1; } else { val = saved_val; read_two_nibbles = 0; } if (!(val & 0xC)) { for (;;) { if(shift>22) return -1; if (!read_two_nibbles) { if (src < source || src >= source_end) return AVERROR_INVALIDDATA; shift += 2; val |= *src << shift; if (*src & 0xC) break; } read_two_nibbles = 0; shift += 2; mask = (1 << shift) - 1; val = ((val >> 2) & ~mask) | (val & mask); NEXT_BYTE(src); if ((val & (0xC << shift))) { flag = 1; break; } } } else if (mode) { flag = tmplen != 4; } if (flag) { tmplen = 4; } else { saved_val = val >> (4 + shift); tmplen = 0; val &= (1 << (shift + 4)) - 1; NEXT_BYTE(src); } advance_mode = val & 1; len = (val >> 1) - 1; av_assert0(len>0); mode += 1 + advance_mode; if (mode >= 4) mode -= 3; if (len <= 0 || FFABS(dst_end - dst) < len) return AVERROR_INVALIDDATA; switch (mode) { case 1: if (forward) { if (dst - frame + SCREEN_WIDE < frame_off || dst - frame + SCREEN_WIDE + frame_off < 0 || frame_end - dst < frame_off + len || frame_end - dst < len) return AVERROR_INVALIDDATA; for (i = 0; i < len; i++) dst[i] = dst[frame_off + i]; dst += len; } else { dst -= len; if (dst - frame + SCREEN_WIDE < frame_off || dst - frame + SCREEN_WIDE + frame_off < 0 || frame_end - dst < frame_off + len || frame_end - dst < len) return AVERROR_INVALIDDATA; for (i = len - 1; i >= 0; i--) dst[i] = dst[frame_off + i]; } break; case 2: if (forward) { if (source + src_len - src < len) return AVERROR_INVALIDDATA; memcpy(dst, src, len); dst += len; src += len; } else { if (src - source < len) return AVERROR_INVALIDDATA; dst -= len; src -= len; memcpy(dst, src, len); } break; case 3: val = forward ? dst[-1] : dst[1]; if (forward) { memset(dst, val, len); dst += len; } else { dst -= len; memset(dst, val, len); } break; } if (dst == dst_end) return 0; } }
1threat
Hyperlinks in bot suing node.js : I am trying to use Bing search API to display news. But, I want it to be printed as hyperlinks, but I am not able to do it. The language I am using is Node.js. Please help me with this.
0debug
Python: How to refer to subclasses in the superclass : I am defining a Python Holiday class and three subclasses: one for fixed date holidays, a second for relative holidays, and a third for floating Monday holidays. I would like to create a set of constants in the superclass Holiday, but the subclasses obviously do not exist when the parent class is instantiated. How can I do this? class Holiday(object): NEW_YEARS = FixedHoliday(1, 1) MLK_BIRTHDAY = FloatingMonday(1, 15) ...
0debug
Python - none returns from try and except clauses : <p>the return from this code (date) is 'none' if an invalid entry is provided, then a valid entry is given. However if a valid entry is given first time, the correct return for date is given. Any tips on how I can solve it?</p> <pre><code>def getDate(): date = input("Please enter the date in DD/MM/YYYY format: ") try: strptime(date, "%d/%m/%Y") return date except: print ("Invalid Date, please enter again") getDate() </code></pre>
0debug
Please suggest on below vba code, which steps can be remove/omit to run more faster : I wrote below vba coding for automation purpose. But could you suggest me which steps can i remove to run more faster. Sub listof() LQCC = Sheets(1).Cells(Rows.Count, 6).End(xlUp).Row - 1 ytqcl = Sheets(1).Cells(Rows.Count, 1).End(xlUp).Row - 1 tr = Sheets(1).Cells(Rows.Count, 1).End(xlUp).Row - 1 tqcp = Sheets(1).Cells(Rows.Count, 6).End(xlUp).Row - 1 ssel = Int(tr / tqcp) Dim ListofQCUsers() As Variant ReDim ListofQCUsers(LQCC) As Variant For y = 1 To UBound(ListofQCUsers) ListofQCUsers(y) = Range("f" & y + 1).Value Next y sampleselection = 0 If ListofQCUsers(UBound(ListofQCUsers)) = Range("a2").Value Then Range("f2").Value = ListofQCUsers(UBound(ListofQCUsers)) Range("f" & LQCC + 1).Value = ListofQCUsers(1) For y = 1 To UBound(ListofQCUsers) ListofQCUsers(y) = Range("f" & y + 1).Value Next y End If Range("f2", "f" & LQCC + 1).Delete For Z = ytqcl To 1 Step -1 For x = 1 To UBound(ListofQCUsers) For d = 1 To ssel And Z <> 0 If Z > 0 Then If ListofQCUsers(x) <> Range("a" & Z).Offset(1, 0).Value Then LSN = Sheets(3).Cells(Rows.Count, 1).End(xlUp).Row + 1 Range("a" & Z).Offset(1, 0).Resize(1, 3).Copy Sheets(3).Range("a" & LSN).PasteSpecial xlPasteAll Sheets(3).Range("a" & LSN).Value = ListofQCUsers(x) Range("a" & Z).Offset(1, 0).Resize(1, 3).Delete sampleselection = sampleselection + 1 End If Z = Z - 1 End If Next d sampleselection = 1 Z = Sheets(1).Cells(Rows.Count, 1).End(xlUp).Row - 1 If x = 1 Then Exit Sub End If Next x ytqcl = Sheets(1).Cells(Rows.Count, 1).End(xlUp).Row - 1 Next Z ytqcl = Sheets(1).Cells(Rows.Count, 1).End(xlUp).Row Range("a2", "a" & ytqcl).Resize(1, 3).EntireRow.Delete End Sub I want to assign processed claims for qc to different persons i.e., process person should not get the same claim for to do qc. Above code giving 100% accurate data but i want to know where which steps are not required again and again.
0debug
Docker and Git versionning - which branch is used to build the docker? : As I would like to run a dockerfile to test a [parse-dashboard](https://github.com/ParsePlatform/parse-dashboard), I have fallen on their famous "Parse Dashboard can only be remotely accessed via HTTPS" message that you can normally bypass by adding the line :`"allowInsecureHTTP": true`in your parse-dashboard-config.json file. But even if I have add this option in my config file, the same message was display. So I have decided to enter in the docker and then edit this config file. Then I discover that it wasn't at all the file that I was expecting for. In fact, my project is a branch of a github repository. Locally, I'm working on the development branch. So, if I open the config file with my IDE, I can see the right content. But what it is upload to my docker, it's in fact the config file of my master branch. Is there any way to let docker know which version of your project to use for your deployment in the docker ? (as we can do on Heroku by example when you deploy a github sync project)
0debug
static void kvm_pit_put(PITCommonState *pit) { KVMPITState *s = KVM_PIT(pit); struct kvm_pit_state2 kpit; struct kvm_pit_channel_state *kchan; struct PITChannelState *sc; int i, ret; if (s->vm_stopped) { kvm_pit_update_clock_offset(s); } kpit.flags = pit->channels[0].irq_disabled ? KVM_PIT_FLAGS_HPET_LEGACY : 0; for (i = 0; i < 3; i++) { kchan = &kpit.channels[i]; sc = &pit->channels[i]; kchan->count = sc->count; kchan->latched_count = sc->latched_count; kchan->count_latched = sc->count_latched; kchan->status_latched = sc->status_latched; kchan->status = sc->status; kchan->read_state = sc->read_state; kchan->write_state = sc->write_state; kchan->write_latch = sc->write_latch; kchan->rw_mode = sc->rw_mode; kchan->mode = sc->mode; kchan->bcd = sc->bcd; kchan->gate = sc->gate; kchan->count_load_time = sc->count_load_time - s->kernel_clock_offset; } ret = kvm_vm_ioctl(kvm_state, kvm_has_pit_state2() ? KVM_SET_PIT2 : KVM_SET_PIT, &kpit); if (ret < 0) { fprintf(stderr, "%s failed: %s\n", kvm_has_pit_state2() ? "KVM_SET_PIT2" : "KVM_SET_PIT", strerror(ret)); abort(); } }
1threat
C# do-while,for QUEST for newbie : I'm starting to learn and practice my tasks over the Internet, I have reached a task that is not very clear to me, would anyone be kind enough to help me? quest : Random numbers from 10 to 60 are generated until the number is divisible by 5. This number should be displayed on the screen. Show trial number and average value I START WITH : int a; do { Random rnd = new Random(); a = rnd.Next(10, 60); }while BUT I THINK its wrong
0debug
Azure Functions: Singleton for expensive object : <p>I've created some very simple Azure functions. They read and write data from Couchbase (which is running in Azure on a VM).</p> <p>I'm concerned about the connection(s) that I make to Couchbase in an Azure Function. I create a <code>Cluster</code> object each time. This is an expensive operation, and I would typically only do it once in a normal web app. But in the Azure Function, I'm <code>new</code>ing it up every time.</p> <p>There are a lot of expensive to instantiate objects like this beyond just Couchbase. Is there way to create a singleton, or some sort of shared object that Azure Functions can reuse between calls?</p> <ul> <li>You can see a description of what I'm doing here: <a href="https://blog.couchbase.com/azure-functions-couchbase-server/" rel="noreferrer">https://blog.couchbase.com/azure-functions-couchbase-server/</a></li> <li>The full source code here: <a href="https://github.com/couchbaselabs/blog-source-code/tree/master/Groves/074AzureFunctions/src/CouchbaseWithAzureFunctions" rel="noreferrer">https://github.com/couchbaselabs/blog-source-code/tree/master/Groves/074AzureFunctions/src/CouchbaseWithAzureFunctions</a></li> </ul>
0debug
Docker error: standard_init_linux.go:185: exec user process caused "no such file or directory" : <p>I'm trying to set my elixir-phoenix app with postgresql database to run with Docker. This is what my Dockerfile looks like:</p> <pre><code># ./Dockerfile # Starting from the official Elixir 1.5.2 image: # https://hub.docker.com/_/elixir/ FROM elixir:1.5.2 ENV DEBIAN_FRONTEND=noninteractive # Install hex RUN mix local.hex # Install rebar RUN mix local.rebar # Install the Phoenix framework itself RUN mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez # Install NodeJS 6.x and the NPM RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - RUN apt-get install -y -q nodejs # Set /lib as workdir WORKDIR /lib </code></pre> <p>And this is my docker-compose.yml file:</p> <pre><code>web: build: . dockerfile: Dockerfile env_file: .env command: mix phx.server # Start the server if no other command is specified environment: - MIX_ENV=dev - PORT=4000 - PG_HOST=postgres - PG_USERNAME=postgres volumes: - .:/lib ports: - "4000:4000" links: - postgres test: image: phoenixbootstrap_web env_file: .env command: mix test environment: - MIX_ENV=test - PORT=4001 - PG_HOST=postgres - PG_USERNAME=postgres volumes_from: - web links: - postgres postgres: image: postgres:10.0 ports: - "5432" </code></pre> <p>The image builds successfully, but when I try to install the dependencies with the following command:</p> <pre><code>docker-compose run web mix do deps.get </code></pre> <p>I get these Error:</p> <pre><code>standard_init_linux.go:185: exec user process caused "no such file or directory" </code></pre> <p>PS: I found a couple of answers like <a href="https://stackoverflow.com/questions/42494853/standard-init-linux-go178-exec-user-process-caused-exec-format-error">this one</a>, pointing out a missing line at the beginning of a bash file but it doesn't seem to be my case. I run no bash script and my error appears in line 185, not 179.</p>
0debug
Trying to call function in fragment from different class (Java - Android Studio) : I need to call the function in my portfolioActivity fragment that comes from the class portfolioListAdapter. It says my parameters are incorrect. This function works just fine when I'm not using a fragment, but as I am linking my fragment to a navigation drawer, it is necessary to keep it this way. Here is my fragment: public class portfolioActivity extends Fragment { ListView portfolioList; String[] stockTicker={"AAPL", "GOOG", "MSFT"}; double[] stockPrice={138.96, 830.63, 64.01}; int[] shares={5, 2, 10}; double[] percentChange={0.59, 0.55, 1.43}; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.portfolio_layout, container, false); portfolioList = (ListView) getView().findViewById(R.id.portfolioListView); //ADAPTER ListAdapter adapter = new portfolioListAdapter(this, stockTicker, stockPrice, shares, percentChange); portfolioList.setAdapter(adapter); } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); getActivity().setTitle("Portfolio"); } } My error comes when I try to call portfolioListAdapter(). It says there is a problem with the "this" parameter. Here is my other class: public class portfolioListAdapter extends ArrayAdapter<String> { //DECLARATIONS String[] stockTicker={}; double[] stockPrice={}; int[] shares={}; double[] percentChange={}; Context c; LayoutInflater inflater; public portfolioListAdapter(Context context, String[] stockTicker, double[] stockPrice, int[] shares, double[] percentChange) { super(context, R.layout.portfolio_row_model, stockTicker); this.c=context; this.stockTicker=stockTicker; this.stockPrice=stockPrice; this.shares=shares; this.percentChange=percentChange; } public class ViewHolder { TextView stockTicker; TextView stockPrice; TextView shares; TextView totalValue; TextView percentChange; } @NonNull @Override public View getView(int position, View convertView, ViewGroup parent) { if(convertView==null) { inflater=(LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView=inflater.inflate(R.layout.portfolio_row_model, null); } // OUR VIEWHOLDER OBJECT final ViewHolder holder = new ViewHolder(); //INITIALIZE VIEWS holder.stockTicker= (TextView) convertView.findViewById(R.id.list_portfolio_ticker); holder.stockPrice= (TextView) convertView.findViewById(R.id.list_portfolio_price); holder.shares= (TextView) convertView.findViewById(R.id.list_portfolio_shares); holder.totalValue= (TextView) convertView.findViewById(R.id.list_portfolio_value); holder.percentChange= (TextView) convertView.findViewById(R.id.list_portfolio_change); //ASSIGN VIEWS holder.stockTicker.setText(stockTicker[position]); holder.stockPrice.setText(String.valueOf("$"+stockPrice[position])); holder.shares.setText(String.valueOf(shares[position])); holder.totalValue.setText(String.valueOf("$"+(stockPrice[position]*shares[position]))); holder.percentChange.setText(String.valueOf(percentChange[position]+"%")); //return super.getView(position, convertView, parent); return convertView; } }
0debug
Amazon S3 console: download multiple files at once : <p>When I log to my <strong>S3 console</strong> I am unable to download multiple selected files (the WebUI allows downloads only when one file is selected):</p> <p><a href="https://console.aws.amazon.com/s3" rel="noreferrer">https://console.aws.amazon.com/s3</a></p> <p>Is this something that can be changed in the user policy or is it a limitation of Amazon?</p>
0debug
How to ma ke alignmet in css? : What is the type of alignment of text on the image? [The result I need][1] I tryied to apply text-align: center; and text-align: left; but effect was differen [My 2 results][2] Any ideas? [1]: https://i.stack.imgur.com/3nrpu.png [2]: https://i.stack.imgur.com/IEfE7.png
0debug
I just uploaded my website and my images are not showing : my code for every image is <img src="img/image1.jpg"> I have a lot of images just kept it simple with image1 image2 image3... but i also have subpages that have folders with images that dont work. I also did responsive page that works on computer when I shrink the window but not on phone
0debug
Sharing Cookie between different ports : <p>I have an application1(C#) that is hosted on port:80 and application 2(nodejs) that is hosted on port:3030. Both are on localhost.</p> <p><strong>The request workflow is as following:</strong> </p> <ul> <li>browsers sends request to application 1</li> <li>application 1 sends back number of cookies</li> <li>later on browser sends the request to application 2 </li> <li>^ problem is on the last step, the cookies doesnt get included in the request.</li> </ul> <p><strong>Things I have tried/understood:</strong> </p> <ul> <li>I understand that this is a same-origin policy restriction and because of different port # the browser treats them as different domains.</li> <li><p>In Application 1 (its using System.Web.HttpCookie) i have tried to set the domain to be port specific ("127.0.0.1:3030") but seems like the browser doesnt accept it or ignore it. </p> <pre><code>//c# code var testCookie1 = new HttpCookie("Test", "testValue"); testCookie1.Domain = "127.0.0.1:3030"; testCookie1.Path = "/"; testCookie1.Expires = DateTime.Now.AddDays(1); Response.SetCookie(testCookie1); var testCookie2 = new HttpCookie("Test2", "testValue2"); testCookie2.Domain = "127.0.0.1"; testCookie2.Path = "/"; testCookie2.Expires = DateTime.Now.AddDays(1); Response.SetCookie(testCookie2); </code></pre></li> </ul> <p><a href="https://i.stack.imgur.com/PsxQN.png" rel="noreferrer"><img src="https://i.stack.imgur.com/PsxQN.png" alt="Cookies that come back from server"></a> <a href="https://i.stack.imgur.com/ZeY1d.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ZeY1d.png" alt="Cookies that get stored in browser"></a></p> <p>The server sends back a cookie with the port number attached to it but the browser seems like it ignores it.</p> <p>and here is my ajax calls: </p> <pre><code> var request = $.ajax({ url: 'http://127.0.0.1:3030/SomeTask', type: 'POST', crossDomain: true, }); </code></pre>
0debug
TFS Visual Studio. Download dll for all developper : When I use TFS with my colleagues and I download DLL with NuGet Packages and Push project into TFS server my colleagues can't have the dll when they get project by TFS. They must download too the same DLL by NuGet. **Is there a solution to have DLL download by one developper when all developper get project in TFS ?**
0debug
Deloyment failed in aws beanstalk, getting 502 error : Everything worked in my local, I googled few questions, all have to do with port problem. But since I'm using express, I think I will not have hardcoded port problem, as you can see below is partially the code in www var port = normalizePort(process.env.PORT || '3000'); app.set('port', port); I have a app.js and below is my package.json { "name": "my app", "version": "0.0.1", "private": true, "scripts": { "start": "node ./bin/www" }, "dependencies": { .. .. } } What I've tried : 1. rename app.js to main.js 2. created nodecommand.config file like someone suggested
0debug
VLANClientState *qdev_get_vlan_client(DeviceState *dev, NetCanReceive *can_receive, NetReceive *receive, NetReceiveIOV *receive_iov, NetCleanup *cleanup, void *opaque) { NICInfo *nd = dev->nd; assert(nd); return qemu_new_vlan_client(nd->vlan, nd->model, nd->name, can_receive, receive, receive_iov, cleanup, opaque); }
1threat
vcard_emul_login(VCard *card, unsigned char *pin, int pin_len) { PK11SlotInfo *slot; unsigned char *pin_string = NULL; int i; SECStatus rv; if (!nss_emul_init) { return VCARD7816_STATUS_ERROR_CONDITION_NOT_SATISFIED; } slot = vcard_emul_card_get_slot(card); pin_string = g_malloc(pin_len+1); memcpy(pin_string, pin, pin_len); pin_string[pin_len] = 0; for (i = pin_len-1; i >= 0 && (pin_string[i] == 0xff); i--) { pin_string[i] = 0; } rv = PK11_Authenticate(slot, PR_FALSE, pin_string); memset(pin_string, 0, pin_len); g_free(pin_string); if (rv == SECSuccess) { return VCARD7816_STATUS_SUCCESS; } return VCARD7816_STATUS_ERROR_CONDITION_NOT_SATISFIED; }
1threat
static void scsi_disk_emulate_write_data(SCSIRequest *req) { SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, req, req); if (r->iov.iov_len) { int buflen = r->iov.iov_len; DPRINTF("Write buf_len=%zd\n", buflen); r->iov.iov_len = 0; scsi_req_data(&r->req, buflen); return; } switch (req->cmd.buf[0]) { case MODE_SELECT: case MODE_SELECT_10: scsi_req_complete(&r->req, GOOD); break; default: abort(); } }
1threat
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference : <p>i have the error that "java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference".i think maybe i forgot to appoint value for something, but i don't know what it is exactly.is there something wrong with my arrayadapter or arraylist?</p> <pre><code>package com.example.lyn.finalproject; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.PopupMenu; import java.util.ArrayList; /** * Created by lyn on 2016/10/22. */ public class SecondActivity extends Activity { Button bn1; Button bn2; Button bn3; Button bn4; Button bn5; Button bn6; EditText etext1; EditText etext2; EditText etext3; EditText etext4; EditText etext5; EditText etext6; String cname1; String cname2; String cname3; String cname4; String cname5; String cname6; String ctime1; String ctime2; String ctime3; String ctime4; String ctime5; String ctime6; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_second); etext1=(EditText) findViewById(R.id.adcourse1); etext2=(EditText) findViewById(R.id.adcourse2); etext3=(EditText) findViewById(R.id.adcourse3); etext4=(EditText) findViewById(R.id.adcourse4); etext5=(EditText) findViewById(R.id.adcourse5); etext6=(EditText) findViewById(R.id.adcourse6); bn1=(Button) findViewById(R.id.menub1); bn2=(Button) findViewById(R.id.menub2); bn3=(Button) findViewById(R.id.menub3); bn4=(Button) findViewById(R.id.menub4); bn5=(Button) findViewById(R.id.menub5); bn6=(Button) findViewById(R.id.menub6); //为每一个按钮绑定popupMenu,并且接收用户点击的课程时间信息 bn1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { PopupMenu menu1=new PopupMenu(SecondActivity.this,bn1); menu1.getMenuInflater().inflate(R.menu.time_choose_menu, menu1.getMenu()); menu1.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { ctime1=menuItem.getTitle()+""; Log.d("TAG",ctime1); return true; } }); menu1.show(); } }); bn2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { PopupMenu menu2=new PopupMenu(SecondActivity.this,bn2); menu2.getMenuInflater().inflate(R.menu.time_choose_menu,menu2.getMenu()); menu2.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { ctime2=menuItem.getTitle()+""; Log.d("TAG",ctime2); return true; } }); menu2.show(); } }); bn3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { PopupMenu menu3=new PopupMenu(SecondActivity.this,bn3); menu3.getMenuInflater().inflate(R.menu.time_choose_menu,menu3.getMenu()); menu3.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { ctime3=menuItem.getTitle()+""; Log.d("TAG",ctime3); return true; } }); menu3.show(); } }); bn4.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { PopupMenu menu4=new PopupMenu(SecondActivity.this,bn4); menu4.getMenuInflater().inflate(R.menu.time_choose_menu,menu4.getMenu()); menu4.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { ctime4=menuItem.getTitle()+""; Log.d("TAG",ctime4); return true; } }); menu4.show(); } }); bn5.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { PopupMenu menu5=new PopupMenu(SecondActivity.this,bn5); menu5.getMenuInflater().inflate(R.menu.time_choose_menu,menu5.getMenu()); menu5.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { ctime5=menuItem.getTitle()+""; Log.d("TAG",ctime5); return true; } }); menu5.show(); } }); bn6.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { PopupMenu menu6=new PopupMenu(SecondActivity.this,bn6); menu6.getMenuInflater().inflate(R.menu.time_choose_menu,menu6.getMenu()); menu6.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { ctime6=menuItem.getTitle()+""; Log.d("TAG",ctime6); return true; } }); menu6.show(); } }); //接受用户输入的课程名称 cname1=etext1.getText()+""; cname2=etext2.getText()+""; cname3=etext3.getText()+""; cname4=etext4.getText()+""; cname5=etext5.getText()+""; cname6=etext6.getText()+""; Button bn=(Button) findViewById(R.id.bn); bn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ArrayList&lt;String&gt; courseName=new ArrayList&lt;String&gt;(); courseName.add(0,cname1); courseName.add(1,cname2); courseName.add(2,cname3); courseName.add(3,cname4); courseName.add(4,cname5); courseName.add(5,cname6); ArrayList&lt;String&gt; courseTime=new ArrayList&lt;String&gt;(); courseTime.add(0,ctime1); courseTime.add(1,ctime2); courseTime.add(2,ctime3); courseTime.add(3,ctime4); courseTime.add(4,ctime5); courseTime.add(5,ctime6); Intent intent=new Intent(SecondActivity.this,ThirdActivity.class); intent.putStringArrayListExtra("list", courseName); intent.putStringArrayListExtra("list",courseTime); startActivity(intent); } }); } } package com.example.lyn.finalproject; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; import java.util.ArrayList; import java.util.List; /** * Created by lyn on 2016/10/23. */ public class ThirdActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_third); Intent intent1=getIntent(); Intent intent2=getIntent(); Log.d("TAG","HI"); ArrayList&lt;String&gt; courseName=intent1.getStringArrayListExtra("courseName"); ArrayList&lt;String&gt; courseTime=intent2.getStringArrayListExtra("courseTime"); ArrayAdapter&lt;String&gt; adapter1=new ArrayAdapter&lt;&gt;(ThirdActivity.this,android.R.layout.simple_list_item_1,courseName); ArrayAdapter&lt;String&gt; adapter2=new ArrayAdapter&lt;&gt;(ThirdActivity.this,android.R.layout.simple_list_item_1,courseTime); ListView listView1=(ListView) findViewById(R.id.list_view1); ListView listView2=(ListView) findViewById(R.id.list_view2); listView1.setAdapter(adapter1); listView2.setAdapter(adapter2); } } </code></pre> <p>activity_third.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;ListView android:id="@+id/list_view1" android:layout_width="wrap_content" android:layout_height="match_parent"&gt; &lt;/ListView&gt; &lt;ListView android:id="@+id/list_view2" android:layout_width="wrap_content" android:layout_height="match_parent"&gt; &lt;/ListView&gt; &lt;/LinearLayout&gt; </code></pre>
0debug
av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact) { int mm_flags = av_get_cpu_flags(); if (EXTERNAL_MMX(mm_flags)) { c->ac3_exponent_min = ff_ac3_exponent_min_mmx; c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmx; c->ac3_lshift_int16 = ff_ac3_lshift_int16_mmx; c->ac3_rshift_int32 = ff_ac3_rshift_int32_mmx; } if (EXTERNAL_AMD3DNOW(mm_flags)) { c->extract_exponents = ff_ac3_extract_exponents_3dnow; if (!bit_exact) { c->float_to_fixed24 = ff_float_to_fixed24_3dnow; } } if (EXTERNAL_MMXEXT(mm_flags)) { c->ac3_exponent_min = ff_ac3_exponent_min_mmxext; c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmxext; } if (EXTERNAL_SSE(mm_flags)) { c->float_to_fixed24 = ff_float_to_fixed24_sse; } if (EXTERNAL_SSE2(mm_flags)) { c->ac3_exponent_min = ff_ac3_exponent_min_sse2; c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_sse2; c->float_to_fixed24 = ff_float_to_fixed24_sse2; c->compute_mantissa_size = ff_ac3_compute_mantissa_size_sse2; c->extract_exponents = ff_ac3_extract_exponents_sse2; if (!(mm_flags & AV_CPU_FLAG_SSE2SLOW)) { c->ac3_lshift_int16 = ff_ac3_lshift_int16_sse2; c->ac3_rshift_int32 = ff_ac3_rshift_int32_sse2; } } if (EXTERNAL_SSSE3(mm_flags)) { c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_ssse3; if (!(mm_flags & AV_CPU_FLAG_ATOM)) { c->extract_exponents = ff_ac3_extract_exponents_ssse3; } } #if HAVE_SSE_INLINE && HAVE_7REGS if (INLINE_SSE(mm_flags)) { c->downmix = ac3_downmix_sse; } #endif }
1threat
Traverse javascript array of objects : <p>I have an javascript array of objects as follows :</p> <pre><code>list = [ { "employee_work_rights_id":74, "amazon_id":173, "employee_id":3, "work_rights":"australian_citizen", "document_type":"password", "display_name":"a.pdf", "filename":"abc.pdf", "s3bucket":"xyz", "filepath":"employer27\/employee3\/" }, { "employee_work_rights_id":75, "amazon_id":175, "employee_id":3, "work_rights":"australian_citizen", "document_type":"password", "display_name":"a.pdf", "filename":"xyz.pdf", "s3bucket":"zyx", "filepath":"employer27\/employee3\/" } ] </code></pre> <p>I tried to access amazon_id as follows :</p> <pre><code>console.log(list[0].amazon_id); </code></pre> <p>This is giving me undefined. How can I access this ?</p>
0debug
error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class : <p>First time using firestore and I'm getting this error. It seems to be a problem with Ivy, from my research. I don't have a lot of experience modifying tsconfig.app.json, which is the direction I've been pointed to, following other answers.</p> <p>The only thing I was able to modify from the original project was to use Angular Fire 6 instead of 5, which I had done initially to follow a tutorial. </p> <p>Here's package.json:</p> <pre><code>{ "name": "language", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/animations": "~9.0.1", "@angular/cdk": "^9.0.0", "@angular/common": "~9.0.1", "@angular/compiler": "~9.0.1", "@angular/core": "~9.0.1", "@angular/fire": "^6.0.0-rc.1", "@angular/flex-layout": "^9.0.0-beta.29", "@angular/forms": "~9.0.1", "@angular/material": "^9.0.0", "@angular/platform-browser": "~9.0.1", "@angular/platform-browser-dynamic": "~9.0.1", "@angular/router": "~9.0.1", "firebase": "^7.8.2", "rxjs": "~6.5.4", "rxjs-compat": "^6.5.4", "tslib": "^1.10.0", "zone.js": "~0.10.2" }, "devDependencies": { "@angular-devkit/build-angular": "~0.900.2", "@angular/cli": "~9.0.2", "@angular/compiler-cli": "~9.0.1", "@angular/language-service": "~9.0.1", "@types/node": "^12.11.1", "@types/jasmine": "~3.3.8", "@types/jasminewd2": "~2.0.3", "codelyzer": "^5.1.2", "jasmine-core": "~3.4.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~4.1.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "~2.0.1", "karma-jasmine": "~2.0.1", "karma-jasmine-html-reporter": "^1.4.0", "protractor": "~5.4.0", "ts-node": "~7.0.0", "tslint": "~5.15.0", "typescript": "~3.7.5", "@angular-devkit/architect": "^0.900.0-0 || ^0.900.0", "firebase-tools": "^7.12.1", "fuzzy": "^0.1.3", "inquirer": "^6.2.2", "inquirer-autocomplete-prompt": "^1.0.1" } } </code></pre> <p>angular.json</p> <pre><code>{ "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "version": 1, "newProjectRoot": "projects", "projects": { "language": { "projectType": "application", "schematics": { "@schematics/angular:component": { "style": "scss" } }, "root": "", "sourceRoot": "src", "prefix": "app", "architect": { "build": { "builder": "@angular-devkit/build-angular:browser", "options": { "outputPath": "dist/language", "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.app.json", "aot": true, "assets": [ "src/favicon.ico", "src/assets" ], "styles": [ "./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css", "src/styles.scss" ], "scripts": [] }, "configurations": { "production": { "fileReplacements": [ { "replace": "src/environments/environment.ts", "with": "src/environments/environment.prod.ts" } ], "optimization": true, "outputHashing": "all", "sourceMap": false, "extractCss": true, "namedChunks": false, "extractLicenses": true, "vendorChunk": false, "buildOptimizer": true, "budgets": [ { "type": "initial", "maximumWarning": "2mb", "maximumError": "5mb" }, { "type": "anyComponentStyle", "maximumWarning": "6kb", "maximumError": "10kb" } ] } } }, "serve": { "builder": "@angular-devkit/build-angular:dev-server", "options": { "browserTarget": "language:build" }, "configurations": { "production": { "browserTarget": "language:build:production" } } }, "extract-i18n": { "builder": "@angular-devkit/build-angular:extract-i18n", "options": { "browserTarget": "language:build" } }, "test": { "builder": "@angular-devkit/build-angular:karma", "options": { "main": "src/test.ts", "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.spec.json", "karmaConfig": "karma.conf.js", "assets": [ "src/favicon.ico", "src/assets" ], "styles": [ "./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css", "src/styles.scss" ], "scripts": [] } }, "lint": { "builder": "@angular-devkit/build-angular:tslint", "options": { "tsConfig": [ "tsconfig.app.json", "tsconfig.spec.json", "e2e/tsconfig.json" ], "exclude": [ "**/node_modules/**" ] } }, "e2e": { "builder": "@angular-devkit/build-angular:protractor", "options": { "protractorConfig": "e2e/protractor.conf.js", "devServerTarget": "language:serve" }, "configurations": { "production": { "devServerTarget": "language:serve:production" } } }, "deploy": { "builder": "@angular/fire:deploy", "options": {} } } } }, "defaultProject": "language" } </code></pre> <p>tsconfig.app.json</p> <pre><code>{ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "./out-tsc/app", "types": [], }, "files": [ "src/main.ts", "src/polyfills.ts" ], "include": [ "src/**/*.d.ts" ], "exclude": [ "src/test.ts", "src/**/*.spec.ts" ] } </code></pre> <p>Thanks!</p>
0debug
How to create a section of StaticTableView with variable rows in Swift/xCode? : so basically I have a view controller with a static table view with 2 sections. the first section will have 1 row and represent a main category I want the second section to have variable amount of rows depending on how many entries the user has for that category; so if the category is "Activities" and they have "Baseball, softball" as activities I want there to be 2 rows in that section how do you do this? it keeps crashing when I code it
0debug
void virtio_scsi_common_realize(DeviceState *dev, Error **errp, HandleOutput ctrl, HandleOutput evt, HandleOutput cmd) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VirtIOSCSICommon *s = VIRTIO_SCSI_COMMON(dev); int i; virtio_init(vdev, "virtio-scsi", VIRTIO_ID_SCSI, sizeof(VirtIOSCSIConfig)); if (s->conf.num_queues <= 0 || s->conf.num_queues > VIRTIO_PCI_QUEUE_MAX) { error_setg(errp, "Invalid number of queues (= %" PRId32 "), " "must be a positive integer less than %d.", s->conf.num_queues, VIRTIO_PCI_QUEUE_MAX); virtio_cleanup(vdev); return; } s->cmd_vqs = g_malloc0(s->conf.num_queues * sizeof(VirtQueue *)); s->sense_size = VIRTIO_SCSI_SENSE_SIZE; s->cdb_size = VIRTIO_SCSI_CDB_SIZE; s->ctrl_vq = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE, ctrl); s->event_vq = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE, evt); for (i = 0; i < s->conf.num_queues; i++) { s->cmd_vqs[i] = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE, cmd); } if (s->conf.iothread) { virtio_scsi_set_iothread(VIRTIO_SCSI(s), s->conf.iothread); } }
1threat
int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque) #endif { AVDictionary *options = NULL; AVDictionaryEntry *e; int ret=0; if (args && *args) { if (!filter->filter->priv_class) { av_log(filter, AV_LOG_ERROR, "This filter does not take any " "options, but options were provided: %s.\n", args); return AVERROR(EINVAL); } #if FF_API_OLD_FILTER_OPTS if (!strcmp(filter->filter->name, "scale") && strchr(args, ':') < strchr(args, '=')) { char *copy = av_strdup(args); char *p; av_log(filter, AV_LOG_WARNING, "The <w>:<h>:flags=<flags> option " "syntax is deprecated. Use either <w>:<h>:<flags> or " "w=<w>:h=<h>:flags=<flags>.\n"); if (!copy) { ret = AVERROR(ENOMEM); goto fail; } p = strrchr(copy, ':'); if (p) { *p++ = 0; ret = av_dict_parse_string(&options, p, "=", ":", 0); } if (ret >= 0) ret = process_options(filter, &options, copy); av_freep(&copy); if (ret < 0) goto fail; } else if (!strcmp(filter->filter->name, "format") || !strcmp(filter->filter->name, "noformat") || !strcmp(filter->filter->name, "frei0r") || !strcmp(filter->filter->name, "frei0r_src") || !strcmp(filter->filter->name, "ocv") || !strcmp(filter->filter->name, "pan") || !strcmp(filter->filter->name, "pp") || !strcmp(filter->filter->name, "aevalsrc")) { char *copy = av_strdup(args); char *p = copy; int nb_leading = 0; int deprecated = 0; if (!copy) { ret = AVERROR(ENOMEM); goto fail; } if (!strcmp(filter->filter->name, "frei0r") || !strcmp(filter->filter->name, "ocv")) nb_leading = 1; else if (!strcmp(filter->filter->name, "frei0r_src")) nb_leading = 3; while (nb_leading--) { p = strchr(p, ':'); if (!p) { p = copy + strlen(copy); break; } p++; } deprecated = strchr(p, ':') != NULL; if (!strcmp(filter->filter->name, "aevalsrc")) { deprecated = 0; while ((p = strchr(p, ':')) && p[1] != ':') { const char *epos = strchr(p + 1, '='); const char *spos = strchr(p + 1, ':'); const int next_token_is_opt = epos && (!spos || epos < spos); if (next_token_is_opt) { p++; break; } deprecated = 1; *p++ = '|'; } if (p && *p == ':') { deprecated = 1; memmove(p, p + 1, strlen(p)); } } else while ((p = strchr(p, ':'))) *p++ = '|'; if (deprecated) av_log(filter, AV_LOG_WARNING, "This syntax is deprecated. Use " "'|' to separate the list items.\n"); av_log(filter, AV_LOG_DEBUG, "compat: called with args=[%s]\n", copy); ret = process_options(filter, &options, copy); av_freep(&copy); if (ret < 0) goto fail; #endif } else { #if CONFIG_MP_FILTER if (!strcmp(filter->filter->name, "mp")) { char *escaped; if (!strncmp(args, "filter=", 7)) args += 7; ret = av_escape(&escaped, args, ":=", AV_ESCAPE_MODE_BACKSLASH, 0); if (ret < 0) { av_log(filter, AV_LOG_ERROR, "Unable to escape MPlayer filters arg '%s'\n", args); goto fail; } ret = process_options(filter, &options, escaped); av_free(escaped); } else #endif ret = process_options(filter, &options, args); if (ret < 0) goto fail; } } if (filter->filter->priv_class) { ret = av_opt_set_dict(filter->priv, &options); if (ret < 0) { av_log(filter, AV_LOG_ERROR, "Error applying options to the filter.\n"); goto fail; } } if (filter->filter->init_opaque) ret = filter->filter->init_opaque(filter, opaque); else if (filter->filter->init) ret = filter->filter->init(filter); else if (filter->filter->init_dict) ret = filter->filter->init_dict(filter, &options); if (ret < 0) goto fail; if ((e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX))) { av_log(filter, AV_LOG_ERROR, "No such option: %s.\n", e->key); ret = AVERROR_OPTION_NOT_FOUND; goto fail; } fail: av_dict_free(&options); return ret; }
1threat
I want to make a apps where people can upload their status,image or video what I need to know for this? : <p>I want to make a apps where people can upload their status,image or video what I need to know for this?</p>
0debug
static int xen_pt_long_reg_read(XenPCIPassthroughState *s, XenPTReg *cfg_entry, uint32_t *value, uint32_t valid_mask) { XenPTRegInfo *reg = cfg_entry->reg; uint32_t valid_emu_mask = 0; valid_emu_mask = reg->emu_mask & valid_mask; *value = XEN_PT_MERGE_VALUE(*value, cfg_entry->data, ~valid_emu_mask); return 0; }
1threat
uint32_t cpu_inl(CPUState *env, pio_addr_t addr) { uint32_t val; val = ioport_read(2, addr); LOG_IOPORT("inl : %04"FMT_pioaddr" %08"PRIx32"\n", addr, val); #ifdef CONFIG_KQEMU if (env) env->last_io_time = cpu_get_time_fast(); #endif return val; }
1threat
static void gen_spr_403 (CPUPPCState *env) { spr_register(env, SPR_403_PBL1, "PBL1", SPR_NOACCESS, SPR_NOACCESS, &spr_read_403_pbr, &spr_write_403_pbr, 0x00000000); spr_register(env, SPR_403_PBU1, "PBU1", SPR_NOACCESS, SPR_NOACCESS, &spr_read_403_pbr, &spr_write_403_pbr, 0x00000000); spr_register(env, SPR_403_PBL2, "PBL2", SPR_NOACCESS, SPR_NOACCESS, &spr_read_403_pbr, &spr_write_403_pbr, 0x00000000); spr_register(env, SPR_403_PBU2, "PBU2", SPR_NOACCESS, SPR_NOACCESS, &spr_read_403_pbr, &spr_write_403_pbr, 0x00000000); spr_register(env, SPR_40x_DAC2, "DAC2", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_40x_IAC2, "IAC2", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); }
1threat
Msg 208, Level 16, State 1, Line 1 Invalid object name 't' : SELECT t.ACCOUNTDATE ,t.PropertyName ,isnull(t.FOODREVENUE_TODAY,0) AS FOODREVENUE_TODAY_CY,isnull(y.FOODREVENUE_TODAY,0) AS FOODREVENUE_TODAY_PY ,isnull(t.FOODREVENUE_MTOD,0) AS FOODREVENUE_MTOD_CY,isnull(y.FOODREVENUE_MTOD,0) AS FOODREVENUE_MTOD_PY ,isnull(t.FOODREVENUE_YTOD,0) AS FOODREVENUE_YTOD_CY,isnull(y.FOODREVENUE_YTOD,0) AS FOODREVENUE_YTOD_PY ,isnull(t.LIQUORREVENUE_TODAY,0) AS LIQUORREVENUE_TODAY_CY,isnull(y.LIQUORREVENUE_TODAY,0) AS LIQUORREVENUE_TODAY_PY ,isnull(t.LIQUORREVENUE_MTOD,0) AS LIQUORREVENUE_MTOD_CY,isnull(y.LIQUORREVENUE_MTOD,0) AS LIQUORREVENUE_MTOD_PY ,isnull(t.LIQUORREVENUE_YTOD,0) AS LIQUORREVENUE_YTOD_CY,isnull(y.LIQUORREVENUE_YTOD,0) AS LIQUORREVENUE_YTOD_PY ,isnull(t.SOFTDRINKSREVENUE_TODAY,0) AS SOFTDRINKSREVENUE_TODAY_CY,isnull(y.SOFTDRINKSREVENUE_TODAY,0) AS SOFTDRINKSREVENUE_TODAY_PY ,isnull(t.SOFTDRINKSREVENUE_MTOD,0) AS SOFTDRINKSREVENUE_MTOD_CY,isnull(y.SOFTDRINKSREVENUE_MTOD,0) AS SOFTDRINKSREVENUE_MTOD_PY ,isnull(t.SOFTDRINKSREVENUE_YTOD,0) AS SOFTDRINKSREVENUE_YTOD_CY,isnull(y.SOFTDRINKSREVENUE_YTOD,0) AS SOFTDRINKSREVENUE_YTOD_PY ,isnull(t.TOBACCOREVENUE_TODAY,0) AS TOBACCOREVENUE_TODAY_CY,isnull(y.TOBACCOREVENUE_TODAY,0) AS TOBACCOREVENUE_TODAY_PY ,isnull(t.TOBACCOREVENUE_MTOD,0) AS TOBACCOREVENUE_MTOD_CY,isnull(y.TOBACCOREVENUE_MTOD,0) AS TOBACCOREVENUE_MTOD_PY ,isnull(t.TOBACCOREVENUE_YTOD,0) AS TOBACCOREVENUE_YTOD_CY,isnull(y.TOBACCOREVENUE_YTOD,0) AS TOBACCOREVENUE_YTOD_PY ,isnull(t.OTHERREVENUE_TODAY,0) AS OTHERREVENUE_TODAY_CY,isnull(y.OTHERREVENUE_TODAY,0) AS OTHERREVENUE_TODAY_PY ,isnull(t.OtherRevenue_MTOD,0) AS OTHERREVENUE_MTOD_CY,isnull(y.OtherRevenue_MTOD,0) AS OTHERREVENUE_MTOD_PY ,isnull(t.OTHERREVENUE_YTOD,0) AS OTHERREVENUE_YTOD_CY,isnull(y.OTHERREVENUE_YTOD,0) AS OTHERREVENUE_YTOD_PY ,isnull(t.FOODCOVERS_TODAY,0) AS FOODCOVERS_TODAY_CY,isnull(y.FOODCOVERS_TODAY,0) AS FOODCOVERS_TODAY_PY ,isnull(t.FOODCOVERS_MTOD,0) AS FOODCOVERS_MTOD_CY,isnull(y.FOODCOVERS_MTOD,0) AS FOODCOVERS_MTOD_PY ,isnull(t.FOODCOVERS_YTOD,0) AS FOODCOVERS_YTOD_CY,isnull(y.FOODCOVERS_YTOD,0) AS FOODCOVERS_YTOD_PY ,isnull(t.LIQUORCOVERS_TODAY,0) AS LIQUORCOVERS_TODAY_CY,isnull(y.LIQUORCOVERS_TODAY,0) AS LIQUORCOVERS_TODAY_PY ,isnull(t.LIQUORCOVERS_MTOD,0) AS LIQUORCOVERS_MTOD_CY,isnull(y.LIQUORCOVERS_MTOD,0) AS LIQUORCOVERS_MTOD_PY ,isnull(t.LIQUORCOVERS_YTOD,0) AS LIQUORCOVERS_YTOD_CY,isnull(y.LIQUORCOVERS_YTOD,0) AS LIQUORCOVERS_YTOD_PY ,isnull(t.OTHERCOVERS_TODAY,0) AS OTHERCOVERS_TODAY_CY,isnull(y.OTHERCOVERS_TODAY,0) AS OTHERCOVERS_TODAY_PY ,isnull(t.OTHERCOVERS_MTOD,0) AS OTHERCOVERS_MTOD_CY,isnull(y.OTHERCOVERS_MTOD,0) AS OTHERCOVERS_MTOD_PY ,isnull(t.OTHERCOVERS_YTOD,0) AS OTHERCOVERS_YTOD_CY,isnull(y.OTHERCOVERS_YTOD,0) AS OTHERCOVERS_YTOD_PY ,isnull(t.TOBACCOCOVERS_TODAY,0) AS TOBACCOCOVERS_TODAY_CY,isnull(y.TOBACCOCOVERS_TODAY,0) AS TOBACCOCOVERS_TODAY_PY ,isnull(t.TOBACCOCOVERS_MTOD,0) AS TOBACCOCOVERS_MTOD_CY,isnull(y.TOBACCOCOVERS_MTOD,0) AS TOBACCOCOVERS_MTOD_PY ,isnull(t.TOBACCOCOVERS_YTOD,0) AS TOBACCOCOVERS_YTOD_CY,isnull(y.TOBACCOCOVERS_YTOD,0) AS TOBACCOCOVERS_YTOD_PY FROM (select B.FullDate AS ACCOUNTDATE ,C.PropertyName ,(A.FOODREVENUE) AS FOODREVENUE_TODAY,(D.FOODREVENUE_MTOD) AS FOODREVENUE_MTOD,(D.FOODREVENUE_YTOD) AS FOODREVENUE_YTOD ,(A.LIQUORREVENUE) AS LIQUORREVENUE_TODAY,(D.LIQUORREVENUE_MTOD) AS LIQUORREVENUE_MTOD,(D.LIQUORREVENUE_YTOD) AS LIQUORREVENUE_YTOD ,(A.SOFTDRINKSREVENUE) AS SOFTDRINKSREVENUE_TODAY,(D.SOFTDRINKSREVENUE_MTOD) AS SOFTDRINKSREVENUE_MTOD,(D.SOFTDRINKSREVENUE_YTOD) AS SOFTDRINKSREVENUE_YTOD ,(A.TOBACCOREVENUE) AS TOBACCOREVENUE_TODAY,(D.TOBACCOREVENUE_MTOD) AS TOBACCOREVENUE_MTOD,(D.TOBACCOREVENUE_YTOD) AS TOBACCOREVENUE_YTOD ,(A.OtherRevenue) AS OTHERREVENUE_TODAY,(D.OtherRevenue_MTOD) AS OTHERREVENUE_MTOD,(D.OTHERREVENUE_YTOD) AS OTHERREVENUE_YTOD ,(A.FOODCOVERS) AS FOODCOVERS_TODAY,(D.FOODCOVERS_MTOD) AS FOODCOVERS_MTOD,(D.FOODCOVERS_YTOD) AS FOODCOVERS_YTOD ,(A.LIQUORCOVERS) AS LIQUORCOVERS_TODAY,(D.LIQUORCOVERS_MTOD) AS LIQUORCOVERS_MTOD,(D.LIQUORCOVERS_YTOD) AS LIQUORCOVERS_YTOD ,(A.OTHERCOVERS) AS OTHERCOVERS_TODAY,(D.OTHERCOVERS_MTOD) AS OTHERCOVERS_MTOD,(D.OTHERCOVERS_YTOD) AS OTHERCOVERS_YTOD ,(A.TOBACCOCOVERS) AS TOBACCOCOVERS_TODAY,(D.TOBACCOCOVERS_MTOD) AS TOBACCOCOVERS_MTOD,(D.TOBACCOCOVERS_YTOD) AS TOBACCOCOVERS_YTOD FROM Fact_MisCovers A INNER JOIN DimDate B ON A.Datekey=B.DateKey INNER JOIN Dim_MisCovers C ON A.Fact_MisCovers_id=C.Dim_MisCovers_id INNER JOIN Fact_MisCovers D ON a.Fact_MisCovers_id=d.Fact_MisCovers_id) as t LEFT JOIN t as y ON DATEADD(YEAR,-1,t.ACCOUNTDATE) = y.ACCOUNTDATE order by t.ACCOUNTDATE
0debug
static void dump_op_count(void) { int i; FILE *f; f = fopen("/tmp/op.log", "w"); for(i = INDEX_op_end; i < NB_OPS; i++) { fprintf(f, "%s %" PRId64 "\n", tcg_op_defs[i].name, tcg_table_op_count[i]); } fclose(f); }
1threat
ReactNative TextInput not visible iOS : <p>I have the following stripped down render result:</p> <pre><code>return ( &lt;View style={{backgroundColor:'red'}}&gt; &lt;TextInput value={'Hello'}/&gt; &lt;/View&gt; ); </code></pre> <p>The generated TextInput is not visible in iOS, unless I specify the height, and when using flexDirection:'row' in its container, I need to specify its width as well.</p> <p>This only happens with iOS, Android seems to work as expected. </p> <p>Is there a way of displaying a TextInput in iOS without fixed size? </p> <p>Current dependencies:</p> <pre><code> "dependencies": { "react-native": "=0.18.1", "react-native-orientation": "=1.12.2", "react-native-vector-icons": "=1.1.0" }, </code></pre> <p>iOS: </p> <p><a href="https://i.stack.imgur.com/bKPlY.png"><img src="https://i.stack.imgur.com/bKPlY.png" alt="enter image description here"></a></p> <p>Android: </p> <p><a href="https://i.stack.imgur.com/gg7VC.png"><img src="https://i.stack.imgur.com/gg7VC.png" alt="enter image description here"></a></p> <p>Changing the render like this: </p> <pre><code>return ( &lt;View style={{backgroundColor:'red'}}&gt; &lt;Text&gt;text&lt;/Text&gt; &lt;TextInput value={'Hello'}/&gt; &lt;/View&gt; ); </code></pre> <p>has the following result:</p> <p>iOS:</p> <p><a href="https://i.stack.imgur.com/SEGN0.png"><img src="https://i.stack.imgur.com/SEGN0.png" alt="enter image description here"></a></p> <p>Android:</p> <p><a href="https://i.stack.imgur.com/MHzvI.png"><img src="https://i.stack.imgur.com/MHzvI.png" alt="enter image description here"></a></p>
0debug
i need helped when code java android : I have a problem when writing code, I have questions about the alarm manager, how can I let n run continuously from opening the application, without having to press any button or something
0debug
Opening zip files in browser with FileReader and JSZip.js : <p>I'm trying to open up zip files inside the browser with FileReader and JSZip.js, then handle the files contained inside. I can't figure out how to correctly pass the FileReader object to JSZip.</p> <p>Here's a stripped version of the page I use to load the javascript:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset="UTF-8" /&gt; &lt;script type="text/javascript" src="zipscan.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jszip.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jquery-1.8.3.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="openFile"&gt;&lt;input type="file" id="inputFile" /&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>And the javascript in zipscan.js after removing all unnecessary code:</p> <pre><code>function checkFiles() { //Check support for the File API support if ( window.File &amp;&amp; window.FileReader &amp;&amp; window.FileList &amp;&amp; window.Blob ) { var fileSelected = document.getElementById( "inputFile" ); fileSelected.addEventListener( "change", handleFile, false ); } else { alert( "Files are not supported" ); } } function handleFile( evt ) { //Set wanted file object var fileToRead = evt.target.files[0]; //Create fileReader object var fileReader = new FileReader(); fileReader.onload = function ( e ) { //Create JSZip instance var archive = new JSZip().loadAsync( e.target ); //Testing that it is loaded correctly alert( e.target ); alert( archive.file( "hello.txt" ).name ); } fileReader.readAsArrayBuffer( fileToRead ); } window.addEventListener( "load", checkFiles, false ); </code></pre> <p>The first alert displays [object FileReader], and the second results in a TypeError, archive.file(...) is being null.</p> <p>I have used FileReader's readAsText method with the same code to open text files successfully, so if there is an error it's either in using readAsArrayBuffer (JSZip documentation suggested it) or in the way I'm using it. Almost all the resources I've found about JSZip use the old method with constructor parameters instead of loadAsync so it could be I'm not using it right. </p>
0debug
static void rtas_ibm_get_config_addr_info2(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { sPAPRPHBState *sphb; sPAPRPHBClass *spc; PCIDevice *pdev; uint32_t addr, option; uint64_t buid; if ((nargs != 4) || (nret != 2)) { goto param_error_exit; } buid = ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2); sphb = find_phb(spapr, buid); if (!sphb) { goto param_error_exit; } spc = SPAPR_PCI_HOST_BRIDGE_GET_CLASS(sphb); if (!spc->eeh_set_option) { goto param_error_exit; } option = rtas_ld(args, 3); switch (option) { case RTAS_GET_PE_ADDR: addr = rtas_ld(args, 0); pdev = find_dev(spapr, buid, addr); if (!pdev) { goto param_error_exit; } rtas_st(rets, 1, (pci_bus_num(pdev->bus) << 16) + 1); break; case RTAS_GET_PE_MODE: rtas_st(rets, 1, RTAS_PE_MODE_SHARED); break; default: goto param_error_exit; } rtas_st(rets, 0, RTAS_OUT_SUCCESS); return; param_error_exit: rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); }
1threat
static void div64(uint64_t *plow, uint64_t *phigh, uint64_t b) { uint64_t q, r, a1, a0; int i, qb; a0 = *plow; a1 = *phigh; if (a1 == 0) { q = a0 / b; r = a0 % b; *plow = q; *phigh = r; } else { for(i = 0; i < 64; i++) { a1 = (a1 << 1) | (a0 >> 63); if (a1 >= b) { a1 -= b; qb = 1; } else { qb = 0; } a0 = (a0 << 1) | qb; } #if defined(DEBUG_MULDIV) printf("div: 0x%016llx%016llx / 0x%016llx: q=0x%016llx r=0x%016llx\n", *phigh, *plow, b, a0, a1); #endif *plow = a0; *phigh = a1; } }
1threat
static int openpic_load(QEMUFile* f, void *opaque, int version_id) { OpenPICState *opp = (OpenPICState *)opaque; unsigned int i; if (version_id != 1) { return -EINVAL; } qemu_get_be32s(f, &opp->gcr); qemu_get_be32s(f, &opp->vir); qemu_get_be32s(f, &opp->pir); qemu_get_be32s(f, &opp->spve); qemu_get_be32s(f, &opp->tfrr); qemu_get_be32s(f, &opp->nb_cpus); for (i = 0; i < opp->nb_cpus; i++) { qemu_get_sbe32s(f, &opp->dst[i].ctpr); openpic_load_IRQ_queue(f, &opp->dst[i].raised); openpic_load_IRQ_queue(f, &opp->dst[i].servicing); qemu_get_buffer(f, (uint8_t *)&opp->dst[i].outputs_active, sizeof(opp->dst[i].outputs_active)); } for (i = 0; i < OPENPIC_MAX_TMR; i++) { qemu_get_be32s(f, &opp->timers[i].tccr); qemu_get_be32s(f, &opp->timers[i].tbcr); } for (i = 0; i < opp->max_irq; i++) { uint32_t val; val = qemu_get_be32(f); write_IRQreg_idr(opp, i, val); val = qemu_get_be32(f); write_IRQreg_ivpr(opp, i, val); qemu_get_be32s(f, &opp->src[i].ivpr); qemu_get_be32s(f, &opp->src[i].idr); qemu_get_be32s(f, &opp->src[i].destmask); qemu_get_sbe32s(f, &opp->src[i].last_cpu); qemu_get_sbe32s(f, &opp->src[i].pending); } return 0; }
1threat
How to make switch case syntax smaller? : <p>i'm making simple name generator, and it's working like that: I got an array with name values it's 4 elements, and i'm using random class to pick specific name from array, and next i'm using switch case to validate which one is picked and print it to console.</p> <p>But, it's only 4 element, but what when i'll try to make 100 elements 4example? I've tried to make switch case in for loop to increment everything in one case, but it turns out that case index should be const. Well, is there any other possible way to make switch case more flexible, and smaller?</p> <p>Here's code for intersed <a href="http://pastebin.com/bbCxLtRq" rel="nofollow">http://pastebin.com/bbCxLtRq</a></p>
0debug
Angular 6: How to set response type as text while making http call : <p>I trying to make http request to the spring rest API.. API returns a string value ("success" or "fail")... but I dont know how to set the response type as string value while making call to the API..<strong>its throwing error as Backend returned code 200, body was: [object Object]</strong></p> <p>My angular code is like below,</p> <p>order.service.ts</p> <pre><code>import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { ProductSearch } from '../_models/product-search'; import { ProductView } from '../_models/product-view'; import { Observable } from 'rxjs'; import { catchError } from 'rxjs/operators'; import { ErrorHandlerService } from './error-handler.service'; import { Category } from '../_models/category'; @Injectable({ providedIn: 'root' }) export class OrderService { constructor(private http: HttpClient, private errorHandlerService: ErrorHandlerService) { } addToCart(productId: number, quantity: number): Observable&lt;any&gt; { const headers = new HttpHeaders().set('Content-Type', 'text/plain; charset=utf-8'); console.log("--------order.service.ts----------addToCart()-------productId:"+productId+":------quantity:"+quantity); return this.http.post&lt;any&gt;('http://localhost:8080/order/addtocart', { dealerId: 13, createdBy: "-1", productId: productId, quantity: quantity}, {headers: headers}) .pipe(catchError(this.errorHandlerService.handleError)); } } </code></pre> <p>error-handler.service.ts</p> <pre><code>import { Injectable } from '@angular/core'; import { HttpErrorResponse, HttpResponse } from '@angular/common/http'; import { Observable, throwError } from 'rxjs'; import { catchError, retry } from 'rxjs/operators'; @Injectable({ providedIn: 'root' }) export class ErrorHandlerService { constructor() { } public handleError(error: HttpErrorResponse) { if (error.error instanceof ErrorEvent) { // A client-side or network error occurred. Handle it accordingly. console.error('An error occurred:', error.error.message); } else { // The backend returned an unsuccessful response code. // The response body may contain clues as to what went wrong, console.error( `Backend returned code ${error.status}, ` + `body was: ${error.error}`); } // return an observable with a user-facing error message return throwError( 'Something bad happened; please try again later.'); }; } </code></pre> <p>Any help would be appreciated... thanks in advance..</p>
0debug
Can you determine the terminating boolean expression of a for loop at runtime? : I'm in a situation where it would be really nice to be able to determine what boolean expression I use for the terminating statement of a for loop at runtime. Or in more simpler words, decide whether I want i > 0, or i < file.length and decrement or increment `i` respectively. I know you can use lambdas to make the iterator either decrement or increment at runtime, explained in [this][1] SO question, but is something along the same lines possible for the terminator? From trying to attempt this myself with `System.Action` to act as an anonymous function so I can still access the objects the for loop uses whilst inside action having some logic to determine whether or not I go forwards or backwards (this ended up with me realising that this wont work), it seems as if this is very much so the case of, if it is possible, it's far more complicated and is not worth the boilerplate code required compared to just having two loops within an if/else statement. I can't be the only one that has wondered this, surely! [1]: http://stackoverflow.com/questions/14255618/store-an-operator-in-a-variable
0debug
static int waveformat_from_audio_settings (WAVEFORMATEX *wfx, audsettings_t *as) { memset (wfx, 0, sizeof (*wfx)); wfx->wFormatTag = WAVE_FORMAT_PCM; wfx->nChannels = as->nchannels; wfx->nSamplesPerSec = as->freq; wfx->nAvgBytesPerSec = as->freq << (as->nchannels == 2); wfx->nBlockAlign = 1 << (as->nchannels == 2); wfx->cbSize = 0; switch (as->fmt) { case AUD_FMT_S8: case AUD_FMT_U8: wfx->wBitsPerSample = 8; break; case AUD_FMT_S16: case AUD_FMT_U16: wfx->wBitsPerSample = 16; wfx->nAvgBytesPerSec <<= 1; wfx->nBlockAlign <<= 1; break; case AUD_FMT_S32: case AUD_FMT_U32: wfx->wBitsPerSample = 32; wfx->nAvgBytesPerSec <<= 2; wfx->nBlockAlign <<= 2; break; default: dolog ("Internal logic error: Bad audio format %d\n", as->freq); return -1; } return 0; }
1threat
vba remvoving Directory : <p>Have a bit of a brain teaser. How do you delete a directory with all its contents, including all sub folders, all files, etc.</p> <p>I have the following code that has a recursive call, but it only deletes leaf folders.</p> <p>It deletes all files and it deletes leaf folders (last nodes).</p> <p>Anybody know of a way to kill one whole path in VBA, including all files and folders?</p> <p>Maybe there is an easier way than recursion.... Thanks...</p> <pre><code>Sub DeleteFiles() Call RecursiveFolderDelete("C:\tmp1") 'RmDir ("C:\tmp1") End Sub Sub RecursiveFolderDelete(MyPath As String) Dim FileSys As FileSystemObject Dim objFolder As Folder Dim objSubFolder As Folder Dim objFile As File 'On Error GoTo 0 Set FileSys = CreateObject("Scripting.FileSystemObject") Set objFolder = FileSys.GetFolder(MyPath) For Each objFile In objFolder.Files If Left(objFile.Name, 1) &lt;&gt; "~" And objFile.Name &lt;&gt; ThisWorkbook.Name Then objFile.Delete End If Next objFile Dim Count As Integer Count = 0 For Each objSubFolder In objFolder.SubFolders Count = Count + 1 RecursiveFolderDelete MyPath &amp; "\" &amp; objSubFolder.Name Next objSubFolder If Count = 0 Then RmDir MyPath End If Set FileSys = Nothing Set objFolder = Nothing Set objSubFolder = Nothing Set objFile = Nothing End Sub </code></pre>
0debug
ASP.NET, MVC, EntityFrameworks and understanding of models : I faced with misunderstanging 1. I use EntityFramework in my project with CodeFirst methodology 2. Please correct me if I think incorrect Models which are using for Entity Framework and describing structure of DB and Models which are using for View should be located separately or use [NotMapped] attribute? For example: Now i have below models: public class Title { public int ID { get; set; } public int UserTypeID { get; set; } .... [NotMapped] public virtual ICollection<UserType> UserTypes { get; set; } public virtual UserType UserType { get; set; } } public class UserType { public int ID { get; set; } ... public virtual ICollection<Title> Titles { get; set; } } Model "Title" I use in my controller to view/edit/create new records And the same can be done in separated modelView file? For example: public class TitleViewModel { public virtual Title Titles { get; set; } public virtual UserType UserType { get; set; } public virtual ICollection<UserType> UserTypes { get; set; } } and then below code can be removed from "Title" model? [NotMapped] public virtual ICollection<UserType> UserTypes { get; set; } public virtual UserType UserType { get; set; } Is it correct? )
0debug
How to fetch fields or schema of a FaunaDB class : <p>Is it possible to fetch FaunaDB class schema or fields through fauna-shell or fauna-java API?</p> <p>I am expecting fields and it datatypes for a given class or instance</p>
0debug
void helper_divl_EAX_T0(void) { unsigned int den, q, r; uint64_t num; num = ((uint32_t)EAX) | ((uint64_t)((uint32_t)EDX) << 32); den = T0; if (den == 0) { raise_exception(EXCP00_DIVZ); } #ifdef BUGGY_GCC_DIV64 r = div32(&q, num, den); #else q = (num / den); r = (num % den); #endif EAX = (uint32_t)q; EDX = (uint32_t)r; }
1threat
How can I use a LetsEncrypt SSL cert in my Heroku Node Express app? : <p>I have a Node Express app running on Heroku that I want to encrypt with a free-of-charge SSL cert from LetsEncrypt. However, the methods I've seen require opening up ports 443 and 80 to allow the ACME process to work. </p> <p>Heroku only gives you one port, and doesn't let you choose which port. So how can I use LetsEncrypt?</p> <p>I spent a bunch of time figuring this out yesterday. First time in a long time there were no answers on StackOverflow for something I was trying to do!</p>
0debug
How can i copy an object in javascript correctly? : <p>I'm trying to copy an object in other using spread operator but wheni change one item from array in a copy object, the original is changed to. Any one knows how can i make the change only in object 2 ?</p> <p>Follow a simple example:</p> <pre><code>let obj1 = { a:'hello', b:'hi', c: [1,2,3] } let obj2 = { ...obj1 } obj2.c[1] = 44 </code></pre>
0debug
Global Timer i.e. A Timer which works on multiple forms. - C# : <p>I was wondering if it would be possible to create a timer which isnt bound to a single form. Basically im making a quiz and i want the user to only have 2 minutes to answer all questions. Once the 2 minutes are up the current form will close and an endscreen will appear. The time must also be visible at all times. Any help would be great.</p>
0debug
static void compute_chapters_end(AVFormatContext *s) { unsigned int i, j; int64_t max_time = s->duration + ((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time); for (i = 0; i < s->nb_chapters; i++) if (s->chapters[i]->end == AV_NOPTS_VALUE) { AVChapter *ch = s->chapters[i]; int64_t end = max_time ? av_rescale_q(max_time, AV_TIME_BASE_Q, ch->time_base) : INT64_MAX; for (j = 0; j < s->nb_chapters; j++) { AVChapter *ch1 = s->chapters[j]; int64_t next_start = av_rescale_q(ch1->start, ch1->time_base, ch->time_base); if (j != i && next_start > ch->start && next_start < end) end = next_start; } ch->end = (end == INT64_MAX) ? ch->start : end; } }
1threat
void mips_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...)) { int i; for (i = 0; i < ARRAY_SIZE(mips_defs); i++) { (*cpu_fprintf)(f, "MIPS '%s'\n", mips_defs[i].name); } }
1threat
static int mxf_parse_physical_source_package(MXFContext *mxf, MXFTrack *source_track, AVStream *st) { MXFPackage *temp_package = NULL; MXFPackage *physical_package = NULL; MXFTrack *physical_track = NULL; MXFStructuralComponent *component = NULL; MXFStructuralComponent *sourceclip = NULL; MXFTimecodeComponent *mxf_tc = NULL; MXFPulldownComponent *mxf_pulldown = NULL; int i, j, k; AVTimecode tc; int flags; int64_t start_position; for (i = 0; i < source_track->sequence->structural_components_count; i++) { component = mxf_resolve_strong_ref(mxf, &source_track->sequence->structural_components_refs[i], SourceClip); if (!component) continue; for (j = 0; j < mxf->packages_count; j++) { temp_package = mxf_resolve_strong_ref(mxf, &mxf->packages_refs[j], SourcePackage); if (!temp_package) continue; if (!memcmp(temp_package->package_uid, component->source_package_uid, 16)){ physical_package = temp_package; sourceclip = component; break; } } if (!physical_package) break; if (physical_package->name[0]) av_dict_set(&st->metadata, "reel_name", physical_package->name, 0); for (j = 0; j < physical_package->tracks_count; j++) { if (!(physical_track = mxf_resolve_strong_ref(mxf, &physical_package->tracks_refs[j], Track))) { av_log(mxf->fc, AV_LOG_ERROR, "could not resolve source track strong ref\n"); continue; } if (!(physical_track->sequence = mxf_resolve_strong_ref(mxf, &physical_track->sequence_ref, Sequence))) { av_log(mxf->fc, AV_LOG_ERROR, "could not resolve source track sequence strong ref\n"); continue; } for (k = 0; k < physical_track->sequence->structural_components_count; k++) { component = mxf_resolve_strong_ref(mxf, &physical_track->sequence->structural_components_refs[k], TimecodeComponent); if (!component){ component = mxf_resolve_strong_ref(mxf, &physical_track->sequence->structural_components_refs[k], PulldownComponent); if (!component) continue; mxf_pulldown = (MXFPulldownComponent*)component; component = mxf_resolve_strong_ref(mxf, &mxf_pulldown->input_segment_ref, TimecodeComponent); if (!component) continue; } mxf_tc = (MXFTimecodeComponent*)component; flags = mxf_tc->drop_frame == 1 ? AV_TIMECODE_FLAG_DROPFRAME : 0; start_position = av_rescale_q(sourceclip->start_position, physical_track->edit_rate, source_track->edit_rate); if (av_timecode_init(&tc, mxf_tc->rate, flags, start_position + mxf_tc->start_frame, mxf->fc) == 0) { mxf_add_timecode_metadata(&st->metadata, "timecode", &tc); return 0; } } } } return 0; }
1threat
Javascript CSS HTML how to align a text and a button element in the div right next to each other? : I am trying to implement a text and a button right next to each other in the center of a relatively small height div. I current made a div with width 100% and a height of 70px and appended a text that is centered in the middle of the div. I want to make a button that will be right next to the text. Here is the code: ``` var temp = document.createElement("div"); temp.setAttribute("id", "bar"); $("#bar").css("width", "100%"); $("#bar").css("height", 70); $("#bar").css("background-color", "white"); $("#bar").css({ "display": "flex", "justify-content": "center", "align-items" : "center", "font-size": "20px", "font-weight" : "bold" }); $("#bar").append("SOME TEXT"); ``` Wanted result: [[---------{"SOME TEXT" *button*}---------]] That {"SOME TEXT" *button*} should be in the middle of that div. Any helps would be much appreciated.
0debug
Why do we need TensorFlow tf.Graph? : <p>What is the purpose of:</p> <pre><code>with tf.Graph().as_default() </code></pre> <p>I have some tensorflow code that uses the above. However, the code has only one graph, so why do we need this?</p>
0debug
PHP JavaBridge Error : I am trying to connect the PHP with Java with the PHPJAVABridge library,. but I am facing below error. Please help me ASAP. Please check below screenshot. [enter image description here][1] [1]: https://i.stack.imgur.com/xhYSU.png
0debug
int net_init_slirp(const NetClientOptions *opts, const char *name, NetClientState *peer, Error **errp) { struct slirp_config_str *config; char *vnet; int ret; const NetdevUserOptions *user; const char **dnssearch; assert(opts->kind == NET_CLIENT_OPTIONS_KIND_USER); user = opts->user; vnet = user->has_net ? g_strdup(user->net) : user->has_ip ? g_strdup_printf("%s/24", user->ip) : NULL; dnssearch = slirp_dnssearch(user->dnssearch); net_init_slirp_configs(user->hostfwd, SLIRP_CFG_HOSTFWD); net_init_slirp_configs(user->guestfwd, 0); ret = net_slirp_init(peer, "user", name, user->q_restrict, vnet, user->host, user->hostname, user->tftp, user->bootfile, user->dhcpstart, user->dns, user->smb, user->smbserver, dnssearch); while (slirp_configs) { config = slirp_configs; slirp_configs = config->next; g_free(config); } g_free(vnet); g_free(dnssearch); return ret; }
1threat
Is it possible to stream video from https:// (e.g. YouTube) into python with OpenCV? : <p><a href="http://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_gui/py_video_display/py_video_display.html" rel="noreferrer">This link</a> has a tidy little example of how to use python's OpenCV library, <code>cv2</code> to stream data from a camera into your python shell. I'm looking to do some experiments and would like to use the following YouTube video feed: <code>https://www.youtube.com/watch?v=oCUqsPLvYBQ</code>. </p> <p>I've tried adapting the example as follows: </p> <pre><code>import numpy as np import cv2 cap = cv2.VideoCapture('https://www.youtube.com/watch?v=oCUqsPLvYBQ') while(True): # Capture frame-by-frame ret, frame = cap.read() # Display the resulting frame cv2.imshow('frame',frame) if cv2.waitKey(1) &amp; 0xFF == ord('q'): break </code></pre> <p>Which produces the error: </p> <pre><code>WARNING: Couldn't read movie file https://www.youtube.com/watch?v=oCUqsPLvYBQ OpenCV Error: Assertion failed (size.width&gt;0 &amp;&amp; size.height&gt;0) in imshow, file /tmp/opencv20160107-29960-t5glvv/opencv-2.4.12/modules/highgui/src/window.cpp, line 261 </code></pre> <p>Is there a simple fix that would allow me to stream this video feed into my python shell via <code>cv2</code>? Not absolutely committed to <code>cv2</code>, either, if there are other libraries out there that will accomplish the same purpose. </p>
0debug
I need to loop through the email addresses in a table within a SQL Database and All an Email : I was wondering if someone could help me. I've got a simple Suppliers table that has the Email Addresses for my Suppliers. I need to loop through the email addresses 'SuppEmail' in the Suppliers table in the SQL Database 'SpecCars' and send them all the email below. I've been at it for a few days now, looking on-line and trying many different variations, but no matter what I do, it only sends one email to the first entry 'frontdesk@jacksauto.com.au' in the table and that's it. If you could help, that would be fantastic. It's an ASP.NET C# Solution. // This is the Suppliers Table, it just has two record in there: .................................................. use SpecCars Go CREATE table Suppliers( SuppId INT IDENTITY(1,1) PRIMARY KEY, SuppName NVARCHAR(60) NOT NULL, SuppAddress NVARCHAR(150) NOT NULL, SuppSuburb NVARCHAR(60) NOT NULL, SuppState NVARCHAR(30) NOT NULL, SuppPost NVARCHAR(10) NOT NULL, SuppPhone NVARCHAR(10) NOT NULL, SuppEmail NVARCHAR(100) NOT NULL, SuppCode NVARCHAR(10) NOT NULL ) Go Command(s) completed successfully. Insert into Suppliers (SuppName, SuppAddress, SuppSuburb, SuppState, SuppPost, SuppPhone, SuppEmail, SuppCode) values ('Jacks Auto', '2 Jill Street', 'Belgrade', 'VIC', '3299', '9555 4457', 'frontdesk@jacksauto.com.au', 'JACBLA') Insert into Suppliers (SuppName, SuppAddress, SuppSuburb, SuppState, SuppPost, SuppPhone, SuppEmail, SuppCode) values ('Ultimate Lights', '205 Browns Road', 'Tullamarine', 'VIC', '3011', '9877 2255', 'orders@ultimatlights.com.au', 'ULTTUL') (2 row(s) affected) .................................................. //This is the code snippet : SqlDataReader sqlData; SqlConnection connection = new SqlConnection("Data Source=.;Initial Catalog=SpecCars;Integrated Security=True"); connection.Open(); sqlData = new SqlCommand("Select SuppEmail From Suppliers", connection).ExecuteReader(); int count = sqlData.FieldCount; while (sqlData.Read()) { for (int i = 0; i < count; i++) { string emailnew = sqlData[i].ToString(); MailMessage mailMessage = new MailMessage(); mailMessage.From = new MailAddress("myemail.com"); mailMessage.To.Add("myemail.com"); mailMessage.To.Add(emailnew); //mailMessage.CC.Add(emailnew); mailMessage.Subject = "Assembly Line Stop"; mailMessage.Priority = MailPriority.High; mailMessage.Body = "Please be advised that the assembly line at Specialised Cars has STOPPED. You will be notified once the line has started again. Any Services between the LINE STOP and the LINE START will be carried out after 19:00 (7pm)."; mailMessage.IsBodyHtml = true; SmtpClient smtpClient = new SmtpClient("smtp-mail.myprovider.com", 587); smtpClient.EnableSsl = true; smtpClient.Credentials = new System.Net.NetworkCredential("myemail.com", "password"); smtpClient.Send(mailMessage); } } connection.Close(); ..................................................
0debug
document.getElementById('input').innerHTML = user_input;
1threat
React with Express Private Routes : <p>I've mainly been using server-side rendering solutions to pass data from the server to the client and render that in the browser.</p> <p>Some major benefits to this include being able to get data and pass it to the client without exposing a route that is public. So being able to keep that data hidden and only expose it when I want. I know other applications such as Facebook have data that is able to be received ONLY by their applications (iOS, Android, web applications) for example timeline data is not a public route and is only able to be received by their own applications.</p> <p>How can I achieve something like this using React? With server-side rendering I can lock down those functions/routes and only allow them to be called from the backend code and not expose them, I can also do things like check to make sure the user is logged in and such.</p> <p>How can I achieve this with React?</p>
0debug
Django Rest Framework 'RelatedManager' object has no attribute : <p>The original error is:</p> <pre><code>Got AttributeError when attempting to get a value for field `original` on serializer `ProductImageSerializer`. The serializer field might be named incorrectly and not match any attribute or key on the `RelatedManager` instance. Original exception text was: 'RelatedManager' object has no attribute 'original'. </code></pre> <p>This is my <code>models.py</code>:</p> <pre><code>class Product(models.Model): name = models.CharField(max_length=100, db_index=True) ean = models.CharField(max_length=13, db_index=True) ... class ProductImage(models.Model): product = models.ForeignKey(Product, null=True, related_name='images', on_delete=models.CASCADE, db_index=True) original = models.ImageField(upload_to=get_uuid_image) medium = models.ImageField(upload_to=get_uuid_image) small = models.ImageField(upload_to=get_uuid_image) </code></pre> <p>The serializers:</p> <pre><code>class ProductBasicSerializer(serializers.ModelSerializer): tags = TagSerializer(many=True) brand = BrandSerializer() images = ProductImageSerializer(required=False) class Meta: model = Product fields = ['tags', 'brand', "ean", "name", "quantity", "unit", "images"] class ProductImageSerializer(serializers.ModelSerializer): class Meta: model = ProductImage exclude = ("product",) </code></pre> <p>And in the view: </p> <pre><code>product = Product.objects.get(ean=ean) serializer = ProductBasicSerializer(product) </code></pre> <p>Why do I get the error <code>RelatedManager' object has no attribute 'original'</code> ? The reverse relationship ProductImage, with <code>related_name="images"</code> does have the attribute <code>original</code>.</p>
0debug
can't get second number between parenthesis using regex : <p>now I begin learning regex, and I have set of string in format like "(9/13)", and I need get second number. I try this regex: <code>/\(.*?[^\d]*(\d+?)\)/g</code>, in <a href="https://regex101.com/r/mFGYcA/2" rel="nofollow noreferrer">online regex</a> it works normally.</p> <p>But here:</p> <pre><code>var d = "(9/13)"; var v = /\(.*?[^\d]*(\d+?)\)/g; alert(d.match(v)); </code></pre> <p>it returns "(9/13)" , what am I doing wrong?</p>
0debug
When using a JMX server with ephemeral port, how to get the server port number? : <p>When launching a Java application with these options:</p> <pre><code>-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=0 -Dcom.sun.management.jmxremote.local.only=false </code></pre> <p>Java uses an ephemeral port, which is very useful to avoid collisions.</p> <p>Is it possible to get the actual port (or connection URL) programmatically from within the application ?</p>
0debug
static void default_end_frame(AVFilterLink *inlink) { AVFilterLink *outlink = NULL; if (inlink->dst->nb_outputs) outlink = inlink->dst->outputs[0]; if (outlink) { if (outlink->out_buf) { avfilter_unref_buffer(outlink->out_buf); outlink->out_buf = NULL; } ff_end_frame(outlink); } }
1threat
How to install KVM(kernal virtual machine) without any OS in a PC? : <p>Can we install KVM in a machine directly, with out any OS? if possible can you please suggest how to do this?</p>
0debug
main (void) { struct timeval t_m = {0, 0}; struct timezone t_z = {0, 0}; struct timeval t_m1 = {0, 0}; int i; if (gettimeofday (&t_m, &t_z) != 0) err ("gettimeofday"); for (i = 1; i < 10000; i++) if (gettimeofday (&t_m1, NULL) != 0) err ("gettimeofday 1"); else if (t_m1.tv_sec * 1000000 + t_m1.tv_usec != (t_m.tv_sec * 1000000 + t_m.tv_usec + i * 1000)) { fprintf (stderr, "t0 (%ld, %ld), i %d, t1 (%ld, %ld)\n", t_m.tv_sec, t_m.tv_usec, i, t_m1.tv_sec, t_m1.tv_usec); abort (); } if (time (NULL) != t_m1.tv_sec) { fprintf (stderr, "time != gettod\n"); abort (); } printf ("pass\n"); exit (0); }
1threat
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
1threat
How to import pre-downloaded MNIST dataset from a specific directory or folder? : <p>I have downloaded the MNIST dataset from LeCun site. What I want is to write the Python code in order to extract the gzip and read the dataset directly from the directory, meaning that I don't have to download or access to the MNIST site anymore. </p> <p><strong>Desire process:</strong> Access folder/directory --> extract gzip --> read dataset (one hot encoding)</p> <p>How to do it? Since almost all tutorials have to access to the either the LeCun or Tensoflow site to download and read the dataset. Thanks in advance!</p>
0debug
Java- How do I display an image in a table column from a local URL? : I need help in displaying an image to a table column. I have a programme which will ask input from the users (organisations) and one of them is to upload an image. Once they upload their image, the URL will be saved to a file according to the other details which they have filled in. This is part of the code for the model org (organisation) data: final static ObservableList<OrgData> data = FXCollections.observableArrayList(); public OrgData(String email, String pw, String name, String contact, String address, String type, String desc,String status,String url) { super(); this.email = email; this.pw = pw; this.name = name; this.contact = contact; this.address = address; this.type = type; this.desc = desc; this.status=status; this.url=url; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPw() { return pw; } public void setPw(String pw) { this.pw = pw; } public String getPw2() { return pw2; } public void setPw2(String pw2) { this.pw2 = pw2; } public String getName() { return name; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public void setName(String name) { this.name = name; } public String getContact() { return contact; } public void setContact(String contact) { this.contact = contact; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public void setType(String type) { this.type = type; } public String getType() { return type; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } public String toString(){ return email+","+pw+","+name+","+contact+","+address+","+type+","+desc+","+status+","+url; } This is part of the code for saving the data in a file: String Type = ""+type; System.out.println(Type); String Desc = desc.getText(); String url = imageURL; url = url.substring(6,url.length()); System.out.println(url); InputStream d = new FileInputStream(new File(url)); url=output(d); System.out.println(url); OrgData table = new OrgData(Email,Password,Name, Contact,Address,Type,Desc,null,url); OrgDataDAO dao = new OrgDataDAO(); dao.createOrg(table); } I'm able to view the other data by doing these lines of code as they will display strings in a table, but I do not want to display the URL but the image: //data in table OrgDataDAO dao=new OrgDataDAO(); data = dao.getAllOrg(); //List Of table column email.setCellValueFactory(new PropertyValueFactory<OrgData, String>("email")); Orgname.setCellValueFactory(new PropertyValueFactory<OrgData, String>("name")); contact.setCellValueFactory(new PropertyValueFactory<OrgData, String>("contact")); address.setCellValueFactory(new PropertyValueFactory<OrgData, String>("address")); category.setCellValueFactory(new PropertyValueFactory<OrgData, String>("type")); description.setCellValueFactory(new PropertyValueFactory<OrgData, String>("desc")); //displaying pic from url code here pic.setCellValueFactory(new PropertyValueFactory<OrgData, ImageView>("url")); status.setCellValueFactory( new PropertyValueFactory<>( "DUMMY" )); Note the line where it says pic.setCellValue.... line of code will just display the URL of the image from the data in the file, not the image itself, so what do I need to change to display the image in the table? The DUMMY can be ignored due to the fact that there will be radio buttons in that column. But the problem I have is regarding the image. Thank you in advance!
0debug
php pdo sql constraint violation : Good morning, i have a big problem with this sql error when i,m trying to insert a event in my database with this pdo: <hr/> PDO: `$subsquery1 = "SELECT cat_id FROM categories WHERE cat_name = ".$event_cat; $subsquery2 = "SELECT tournament_id FROM tournaments WHERE tournament_name = ".$event_tournament; $sqlx = "INSERT INTO events(event_team1, event_team2, event_cat, event_tournament, event_start_at, event_end_to, event_by) VALUES(:event_team1, :event_team2, :event_cat, :event_tournament, :event_start_at, :event_end_to, :event_by)"; // Prepare statement $statementx = $pdo->prepare($sqlx); // execute the query $resultx = $statementx->execute(array(':event_team1' => $event_team1, ':event_team2' => $event_team2, ':event_cat'=> $subsquery1, ':event_tournament'=> $subsquery2, ':event_start_at' => $event_start_at, ':event_end_to' => $event_end_to,':event_by'=>$event_by));` <hr/> SQL ERROR FOLLOW : <br/> `Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`datenbank`.`events`, CONSTRAINT `events_ibfk_1` FOREIGN KEY (`event_cat`) REFERENCES `categories` (`cat_id`) ON DELETE CASCADE ON UPDATE CASCADE)` -- Table structure for table `events` CREATE TABLE `events` ( `event_id` int(8) NOT NULL AUTO_INCREMENT PRIMARY KEY, `event_team1` varchar(255) NOT NULL, `event_team2` varchar(255) NOT NULL, `event_start_at` timestamp NOT NULL, `event_end_to` timestamp NOT NULL, `event_cat` int(8) NOT NULL, `event_by` int(8) NOT NULL, `event_tournament` int(8) NOT NULL, KEY `event_cat` (`event_cat`), KEY `event_by` (`event_by`), KEY `event_tournament` (`event_tournament`) )ENGINE=InnoDB DEFAULT CHARSET=latin1; -- Constraints for table `posts` ALTER TABLE `posts` ADD CONSTRAINT `posts_ibfk_1` FOREIGN KEY (`post_event`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `posts_ibfk_2` FOREIGN KEY (`post_by`) REFERENCES `users` (`id`) ON UPDATE CASCADE; -- Constraints for table `events` ALTER TABLE `events` ADD CONSTRAINT `events_ibfk_1` FOREIGN KEY (`event_cat`) REFERENCES `categories` (`cat_id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `events_ibfk_2` FOREIGN KEY (`event_by`) REFERENCES `users` (`id`) ON UPDATE CASCADE, ADD CONSTRAINT `events_ibfk_3` FOREIGN KEY (`event_tournament`) REFERENCES `tournaments` (`tournament_id`) ON DELETE CASCADE ON UPDATE CASCADE; Please could somebody helps by ...
0debug
Android Studio - Draw line on canvas and modify the position after it's been drawn : I need help with this thing I draw line on canvas and i need to be able to modify the position after it's been drawn. I search and try a lot of things, but no one seems that it works I want to select one of the ends of the line and dragging them in another position Can someone give me and advice?
0debug
static int asf_write_header(AVFormatContext *s) { ASFContext *asf = s->priv_data; s->packet_size = PACKET_SIZE; s->max_interleave_delta = 0; asf->nb_packets = 0; asf->index_ptr = av_malloc(sizeof(ASFIndex) * ASF_INDEX_BLOCK); asf->nb_index_memory_alloc = ASF_INDEX_BLOCK; asf->maximum_packet = 0; if (asf_write_header1(s, 0, DATA_HEADER_SIZE) < 0) { return -1; } avio_flush(s->pb); asf->packet_nb_payloads = 0; asf->packet_timestamp_start = -1; asf->packet_timestamp_end = -1; ffio_init_context(&asf->pb, asf->packet_buf, s->packet_size, 1, NULL, NULL, NULL, NULL); if (s->avoid_negative_ts < 0) s->avoid_negative_ts = 1; return 0; }
1threat
void helper_set_alt_mode (void) { env->saved_mode = env->ps & 0xC; env->ps = (env->ps & ~0xC) | (env->ipr[IPR_ALT_MODE] & 0xC); }
1threat
query malformed, no start_object after query name : <p>I am running this query against AWS Elasticsearch 5.1 and getting a malformed query error. Here is the body of the request. I am basically just checking if the field exists during the time range.</p> <pre><code>{ "query": { "bool": { "filter": { "bool": { "must": [ { "range": { "@timestamp": { "gt": "2017-03-21T15:37:08.595919Z", "lte": "2017-04-21T15:52:08.595919Z" } } }, { "query": [ { "query_string": { "query": "_exists_: $event.supplier" } } ] } ] } } } }, "sort": [ { "@timestamp": { "order": "asc" } } ] } </code></pre>
0debug
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. : Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzbtk.class when i run our android studio project these errors are com how solve it please help me
0debug
GitHub Error - "ssh: connect to host github.com port 22: Operation timed out fatal: Could not read from remote repository." : <p>I want to push a repo from my computer to GitHub. I set the remote origin</p> <pre><code>git remote add origin git@github.com:alicht/tweetanuber.git </code></pre> <p>and then after when I try pushing to GitHub</p> <pre><code>git push -u origin master </code></pre> <p>I'm greeted with this error:</p> <pre><code>ssh: connect to host github.com port 22: Operation timed out fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. </code></pre> <p>How can I resolve this issue and push the repo on my local computer to GitHub?</p>
0debug
How to set OnItemClickListener funtion on ListView using CustomAdapter : I have displayed the list of student from the database, field that are displayed are Student_Roll_no, Student_Name and Student_ID. Student_Roll_no and Student_Name are display using TextView and Student_ID id is display with checkbox. Now I want to set the code by which, when I click at the list the checkbox of that particular row should be checked but the listview is not responding to OnItemClickListener function, as there i have make a toast that doesn't appear when i click on the list. Sry for the bad english **activity_attendence.xml** <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_attendence" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.tejas.paras.bpibs.Attendence" android:orientation="vertical"> <LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/roll" android:layout_width="0dp" android:layout_height="wrap_content" android:paddingBottom="2dip" android:paddingTop="6dip" android:text="Roll" android:layout_weight=".1" android:textColor="#000000" /> <TextView android:id="@+id/name" android:layout_width="0dp" android:layout_height="wrap_content" android:paddingBottom="2dip" android:text="Name" android:layout_weight=".6" android:textColor="#000000" /> <TextView android:text="Present" android:layout_width="0dp" android:layout_height="wrap_content" android:id="@+id/textView26" android:layout_weight=".2" android:textColor="#000000" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:weightSum="1"> <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:background="#000000" android:layout_height="1dp" android:layout_marginBottom="5dp" android:layout_marginTop="5dp"></LinearLayout> <ListView android:layout_width="match_parent" android:layout_height="375dp" android:id="@+id/listview" android:layout_centerVertical="true" android:layout_centerHorizontal="true" android:layout_weight="1.10" /> <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:text="Save Attendence" android:layout_width="match_parent" android:background="@drawable/buttonlayout2" android:textColor="#FFFFFF" android:layout_height="wrap_content" android:id="@+id/button5" /> </LinearLayout> </LinearLayout> </LinearLayout> __Attendence.java__ package com.tejas.paras.bpibs; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.AdapterView; import android.widget.Button; import android.widget.ListView; import android.widget.Toast; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.util.ArrayList; import java.util.HashMap; public class Attendence extends AppCompatActivity{ String date, course, year,ID; String myJSON; private static final String TAG_RESULTS = "result"; String link; JSONArray peoples = null; BufferedReader bufferedReader; String result,data; ArrayList<HashMap<String, String>> personList; Button b5; ListView list,listView; private DataModel dataModel; private ArrayList<DataModel> dataModels; private static CustomAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_attendence); list=(ListView)findViewById(R.id.listview); b5=(Button)findViewById(R.id.button5); getData(); b5.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(Attendence.this,"1."+view, Toast.LENGTH_SHORT).show(); } }); list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> a, View v, int position, long id) { dataModel = dataModels.get(position); Toast.makeText(Attendence.this,"2.1",Toast.LENGTH_LONG).show(); ID=dataModel.getID(); Toast.makeText(Attendence.this,dataModel.getRoll(),Toast.LENGTH_LONG).show(); } }); } protected void showList() { dataModels= new ArrayList<>(); try { JSONObject jsonObj = new JSONObject(myJSON); peoples = jsonObj.getJSONArray(TAG_RESULTS); for (int i = 0; i < peoples.length(); i++) { JSONObject c = peoples.getJSONObject(i); dataModels.add(new DataModel(c.getString("name"),c.getString("id"), c.getString("roll"))); } adapter = new CustomAdapter(dataModels, getApplicationContext()); list.setAdapter(adapter); } catch (JSONException e) { e.printStackTrace(); } } public void getData() { class GetDataJSON extends AsyncTask<String, Void, String> { @Override protected String doInBackground(String... params) { try { link = "http://painnation.esy.es/attendence.php?date=18022017&course=MCA&year=3"; URL url = new URL(link); HttpURLConnection con = (HttpURLConnection) url.openConnection(); bufferedReader = new BufferedReader(new InputStreamReader(con.getInputStream())); StringBuilder sb = new StringBuilder(); String line = null; while ((line = bufferedReader.readLine()) != null) { sb.append(line + "\n"); } result = sb.toString(); } catch (Exception e) { // Oops } return result; } @Override protected void onPostExecute(String result) { myJSON = result; showList(); } } GetDataJSON g = new GetDataJSON(); g.execute(); } } __item_layout.xml__ <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="10dp" android:paddingLeft="10dp" android:paddingRight="10dp" > <LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight=".1"> <TextView android:id="@+id/roll" android:layout_width="0dp" android:layout_height="wrap_content" android:paddingBottom="2dip" android:paddingTop="6dip" android:textStyle="bold" android:text="Roll" android:layout_weight=".1" android:textColor="#000000" /> <TextView android:id="@+id/name" android:layout_width="0dp" android:layout_height="wrap_content" android:paddingBottom="2dip" android:textStyle="bold" android:text="Name" android:layout_weight=".6" android:textColor="#000000" /> <CheckBox android:layout_width="0dp" android:layout_height="wrap_content" android:id="@+id/id" android:layout_weight=".15" android:textColor="#000000" /> </LinearLayout> </LinearLayout> __CustomAdapter.java__ package com.tejas.paras.bpibs; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.CheckBox; import android.widget.TextView; import java.util.ArrayList; public class CustomAdapter extends ArrayAdapter<DataModel> implements View.OnClickListener{ private ArrayList<DataModel> dataSet; Context mContext; private static class ViewHolder { TextView name; TextView roll; CheckBox id; } public CustomAdapter(ArrayList<DataModel> data, Context context) { super(context, R.layout.item_layout, data); this.dataSet = data; this.mContext=context; } @Override public void onClick(View v) { int position=(Integer) v.getTag(); Object object= getItem(position); DataModel dataModel=(DataModel)object; } private int lastPosition = -1; @Override public View getView(int position, View convertView, ViewGroup parent) { DataModel dataModel = getItem(position); ViewHolder viewHolder; final View result; if (convertView == null) { viewHolder = new ViewHolder(); LayoutInflater inflater = LayoutInflater.from(getContext()); convertView = inflater.inflate(R.layout.item_layout, parent, false); viewHolder.name = (TextView) convertView.findViewById(R.id.name); viewHolder.roll = (TextView) convertView.findViewById(R.id.roll); viewHolder.id=(CheckBox) convertView.findViewById(R.id.id); result=convertView; convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); result=convertView; } lastPosition = position; viewHolder.name.setText(dataModel.getName()); viewHolder.roll.setText(dataModel.getRoll()); viewHolder.id.setText(dataModel.getID()); return convertView; } } __DataModel.java__ package com.tejas.paras.bpibs; public class DataModel { String roll; String name; String id; public DataModel(String name1, String id1, String roll1) { this.name=name1; this.id=id1; this.roll=roll1; } public String getName() { return name; } public String getID() { return id; } public String getRoll() { return roll; } } Attendence.php file and the database is hosted on a free hosting web server(Hostinger). you can check the DB output using the http://painnation.esy.es/attendence.php?date=18022017&course=MCA&year=3 [Output Screen][1] Data from server is fetch in json format.plz comment the code to do check the checkbox by clicking listview. __Thank You__ [1]: https://i.stack.imgur.com/IEX61.jpg
0debug
static int libquvi_probe(AVProbeData *p) { int score; quvi_t q; QUVIcode rc; rc = quvi_init(&q); if (rc != QUVI_OK) return AVERROR(ENOMEM); score = quvi_supported(q, (char *)p->filename) == QUVI_OK ? AVPROBE_SCORE_EXTENSION : 0; quvi_close(&q); return score; }
1threat
static int encode_q_branch(SnowContext *s, int level, int x, int y){ uint8_t p_buffer[1024]; uint8_t i_buffer[1024]; uint8_t p_state[sizeof(s->block_state)]; uint8_t i_state[sizeof(s->block_state)]; RangeCoder pc, ic; uint8_t *pbbak= s->c.bytestream; uint8_t *pbbak_start= s->c.bytestream_start; int score, score2, iscore, i_len, p_len, block_s, sum, base_bits; const int w= s->b_width << s->block_max_depth; const int h= s->b_height << s->block_max_depth; const int rem_depth= s->block_max_depth - level; const int index= (x + y*w) << rem_depth; const int block_w= 1<<(LOG2_MB_SIZE - level); int trx= (x+1)<<rem_depth; int try= (y+1)<<rem_depth; const BlockNode *left = x ? &s->block[index-1] : &null_block; const BlockNode *top = y ? &s->block[index-w] : &null_block; const BlockNode *right = trx<w ? &s->block[index+1] : &null_block; const BlockNode *bottom= try<h ? &s->block[index+w] : &null_block; const BlockNode *tl = y && x ? &s->block[index-w-1] : left; const BlockNode *tr = y && trx<w && ((x&1)==0 || level==0) ? &s->block[index-w+(1<<rem_depth)] : tl; int pl = left->color[0]; int pcb= left->color[1]; int pcr= left->color[2]; int pmx, pmy; int mx=0, my=0; int l,cr,cb; const int stride= s->current_picture->linesize[0]; const int uvstride= s->current_picture->linesize[1]; uint8_t *current_data[3]= { s->input_picture->data[0] + (x + y* stride)*block_w, s->input_picture->data[1] + ((x*block_w)>>s->chroma_h_shift) + ((y*uvstride*block_w)>>s->chroma_v_shift), s->input_picture->data[2] + ((x*block_w)>>s->chroma_h_shift) + ((y*uvstride*block_w)>>s->chroma_v_shift)}; int P[10][2]; int16_t last_mv[3][2]; int qpel= !!(s->avctx->flags & AV_CODEC_FLAG_QPEL); const int shift= 1+qpel; MotionEstContext *c= &s->m.me; int ref_context= av_log2(2*left->ref) + av_log2(2*top->ref); int mx_context= av_log2(2*FFABS(left->mx - top->mx)); int my_context= av_log2(2*FFABS(left->my - top->my)); int s_context= 2*left->level + 2*top->level + tl->level + tr->level; int ref, best_ref, ref_score, ref_mx, ref_my; av_assert0(sizeof(s->block_state) >= 256); if(s->keyframe){ set_blocks(s, level, x, y, pl, pcb, pcr, 0, 0, 0, BLOCK_INTRA); return 0; } P_LEFT[0]= left->mx; P_LEFT[1]= left->my; P_TOP [0]= top->mx; P_TOP [1]= top->my; P_TOPRIGHT[0]= tr->mx; P_TOPRIGHT[1]= tr->my; last_mv[0][0]= s->block[index].mx; last_mv[0][1]= s->block[index].my; last_mv[1][0]= right->mx; last_mv[1][1]= right->my; last_mv[2][0]= bottom->mx; last_mv[2][1]= bottom->my; s->m.mb_stride=2; s->m.mb_x= s->m.mb_y= 0; c->skip= 0; av_assert1(c-> stride == stride); av_assert1(c->uvstride == uvstride); c->penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_cmp); c->sub_penalty_factor= get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_sub_cmp); c->mb_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->mb_cmp); c->current_mv_penalty= c->mv_penalty[s->m.f_code=1] + MAX_MV; c->xmin = - x*block_w - 16+3; c->ymin = - y*block_w - 16+3; c->xmax = - (x+1)*block_w + (w<<(LOG2_MB_SIZE - s->block_max_depth)) + 16-3; c->ymax = - (y+1)*block_w + (h<<(LOG2_MB_SIZE - s->block_max_depth)) + 16-3; if(P_LEFT[0] > (c->xmax<<shift)) P_LEFT[0] = (c->xmax<<shift); if(P_LEFT[1] > (c->ymax<<shift)) P_LEFT[1] = (c->ymax<<shift); if(P_TOP[0] > (c->xmax<<shift)) P_TOP[0] = (c->xmax<<shift); if(P_TOP[1] > (c->ymax<<shift)) P_TOP[1] = (c->ymax<<shift); if(P_TOPRIGHT[0] < (c->xmin<<shift)) P_TOPRIGHT[0]= (c->xmin<<shift); if(P_TOPRIGHT[0] > (c->xmax<<shift)) P_TOPRIGHT[0]= (c->xmax<<shift); if(P_TOPRIGHT[1] > (c->ymax<<shift)) P_TOPRIGHT[1]= (c->ymax<<shift); P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]); P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]); if (!y) { c->pred_x= P_LEFT[0]; c->pred_y= P_LEFT[1]; } else { c->pred_x = P_MEDIAN[0]; c->pred_y = P_MEDIAN[1]; } score= INT_MAX; best_ref= 0; for(ref=0; ref<s->ref_frames; ref++){ init_ref(c, current_data, s->last_picture[ref]->data, NULL, block_w*x, block_w*y, 0); ref_score= ff_epzs_motion_search(&s->m, &ref_mx, &ref_my, P, 0, 0, last_mv, (1<<16)>>shift, level-LOG2_MB_SIZE+4, block_w); av_assert2(ref_mx >= c->xmin); av_assert2(ref_mx <= c->xmax); av_assert2(ref_my >= c->ymin); av_assert2(ref_my <= c->ymax); ref_score= c->sub_motion_search(&s->m, &ref_mx, &ref_my, ref_score, 0, 0, level-LOG2_MB_SIZE+4, block_w); ref_score= ff_get_mb_score(&s->m, ref_mx, ref_my, 0, 0, level-LOG2_MB_SIZE+4, block_w, 0); ref_score+= 2*av_log2(2*ref)*c->penalty_factor; if(s->ref_mvs[ref]){ s->ref_mvs[ref][index][0]= ref_mx; s->ref_mvs[ref][index][1]= ref_my; s->ref_scores[ref][index]= ref_score; } if(score > ref_score){ score= ref_score; best_ref= ref; mx= ref_mx; my= ref_my; } } base_bits= get_rac_count(&s->c) - 8*(s->c.bytestream - s->c.bytestream_start); pc= s->c; pc.bytestream_start= pc.bytestream= p_buffer; memcpy(p_state, s->block_state, sizeof(s->block_state)); if(level!=s->block_max_depth) put_rac(&pc, &p_state[4 + s_context], 1); put_rac(&pc, &p_state[1 + left->type + top->type], 0); if(s->ref_frames > 1) put_symbol(&pc, &p_state[128 + 1024 + 32*ref_context], best_ref, 0); pred_mv(s, &pmx, &pmy, best_ref, left, top, tr); put_symbol(&pc, &p_state[128 + 32*(mx_context + 16*!!best_ref)], mx - pmx, 1); put_symbol(&pc, &p_state[128 + 32*(my_context + 16*!!best_ref)], my - pmy, 1); p_len= pc.bytestream - pc.bytestream_start; score += (s->lambda2*(get_rac_count(&pc)-base_bits))>>FF_LAMBDA_SHIFT; block_s= block_w*block_w; sum = pix_sum(current_data[0], stride, block_w, block_w); l= (sum + block_s/2)/block_s; iscore = pix_norm1(current_data[0], stride, block_w) - 2*l*sum + l*l*block_s; if (s->nb_planes > 2) { block_s= block_w*block_w>>(s->chroma_h_shift + s->chroma_v_shift); sum = pix_sum(current_data[1], uvstride, block_w>>s->chroma_h_shift, block_w>>s->chroma_v_shift); cb= (sum + block_s/2)/block_s; sum = pix_sum(current_data[2], uvstride, block_w>>s->chroma_h_shift, block_w>>s->chroma_v_shift); cr= (sum + block_s/2)/block_s; }else cb = cr = 0; ic= s->c; ic.bytestream_start= ic.bytestream= i_buffer; memcpy(i_state, s->block_state, sizeof(s->block_state)); if(level!=s->block_max_depth) put_rac(&ic, &i_state[4 + s_context], 1); put_rac(&ic, &i_state[1 + left->type + top->type], 1); put_symbol(&ic, &i_state[32], l-pl , 1); if (s->nb_planes > 2) { put_symbol(&ic, &i_state[64], cb-pcb, 1); put_symbol(&ic, &i_state[96], cr-pcr, 1); } i_len= ic.bytestream - ic.bytestream_start; iscore += (s->lambda2*(get_rac_count(&ic)-base_bits))>>FF_LAMBDA_SHIFT; av_assert1(iscore < 255*255*256 + s->lambda2*10); av_assert1(iscore >= 0); av_assert1(l>=0 && l<=255); av_assert1(pl>=0 && pl<=255); if(level==0){ int varc= iscore >> 8; int vard= score >> 8; if (vard <= 64 || vard < varc) c->scene_change_score+= ff_sqrt(vard) - ff_sqrt(varc); else c->scene_change_score+= s->m.qscale; } if(level!=s->block_max_depth){ put_rac(&s->c, &s->block_state[4 + s_context], 0); score2 = encode_q_branch(s, level+1, 2*x+0, 2*y+0); score2+= encode_q_branch(s, level+1, 2*x+1, 2*y+0); score2+= encode_q_branch(s, level+1, 2*x+0, 2*y+1); score2+= encode_q_branch(s, level+1, 2*x+1, 2*y+1); score2+= s->lambda2>>FF_LAMBDA_SHIFT; if(score2 < score && score2 < iscore) return score2; } if(iscore < score){ pred_mv(s, &pmx, &pmy, 0, left, top, tr); memcpy(pbbak, i_buffer, i_len); s->c= ic; s->c.bytestream_start= pbbak_start; s->c.bytestream= pbbak + i_len; set_blocks(s, level, x, y, l, cb, cr, pmx, pmy, 0, BLOCK_INTRA); memcpy(s->block_state, i_state, sizeof(s->block_state)); return iscore; }else{ memcpy(pbbak, p_buffer, p_len); s->c= pc; s->c.bytestream_start= pbbak_start; s->c.bytestream= pbbak + p_len; set_blocks(s, level, x, y, pl, pcb, pcr, mx, my, best_ref, 0); memcpy(s->block_state, p_state, sizeof(s->block_state)); return score; } }
1threat
If- Else If statement in vbs scripts 123 : else if exist "K:\ICT project" (Set WshShell = CreateObject("WScript.Shell") WshShell.Run chr(34) & "K:\ICT project" & Chr(34), 0 Set WshShell = Nothing) else if exist "F:\ICT project" (Set WshShell = CreateObject("WScript.Shell") WshShell.Run chr(34) & "F:\ICT project" & Chr(34), 0 Set WshShell = Nothing) else if exist "E:\ICT project" (Set WshShell = CreateObject("WScript.Shell") WshShell.Run chr(34) & "E:\ICT project" & Chr(34), 0 Set WshShell = Nothing) else if exist "D:\ICT project" (Set WshShell = CreateObject("WScript.Shell") WshShell.Run chr(34) & "D:\ICT project" & Chr(34), 0 Set WshShell = Nothing) else if exist "C:\ICT project" (Set WshShell = CreateObject("WScript.Shell") WshShell.Run chr(34) & "C:\ICT project" & Chr(34), 0 Set WshShell = Nothing) what is wrong about this code??? and how well the if statement is used. please help meee how can this code be improved
0debug
def is_Two_Alter(s): for i in range (len( s) - 2) : if (s[i] != s[i + 2]) : return False if (s[0] == s[1]): return False return True
0debug
int qemu_pixman_get_type(int rshift, int gshift, int bshift) { int type = PIXMAN_TYPE_OTHER; if (rshift > gshift && gshift > bshift) { if (bshift == 0) { type = PIXMAN_TYPE_ARGB; } else { type = PIXMAN_TYPE_RGBA; } } else if (rshift < gshift && gshift < bshift) { if (rshift == 0) { type = PIXMAN_TYPE_ABGR; } else { type = PIXMAN_TYPE_BGRA; } } return type; }
1threat
static av_cold int bktr_init(const char *video_device, int width, int height, int format, int *video_fd, int *tuner_fd, int idev, double frequency) { struct meteor_geomet geo; int h_max; long ioctl_frequency; char *arg; int c; struct sigaction act = { 0 }, old; if (idev < 0 || idev > 4) { arg = getenv ("BKTR_DEV"); if (arg) idev = atoi (arg); if (idev < 0 || idev > 4) idev = 1; } if (format < 1 || format > 6) { arg = getenv ("BKTR_FORMAT"); if (arg) format = atoi (arg); if (format < 1 || format > 6) format = VIDEO_FORMAT; } if (frequency <= 0) { arg = getenv ("BKTR_FREQUENCY"); if (arg) frequency = atof (arg); if (frequency <= 0) frequency = 0.0; } sigemptyset(&act.sa_mask); act.sa_handler = catchsignal; sigaction(SIGUSR1, &act, &old); *tuner_fd = open("/dev/tuner0", O_RDONLY); if (*tuner_fd < 0) av_log(NULL, AV_LOG_ERROR, "Warning. Tuner not opened, continuing: %s\n", strerror(errno)); *video_fd = open(video_device, O_RDONLY); if (*video_fd < 0) { av_log(NULL, AV_LOG_ERROR, "%s: %s\n", video_device, strerror(errno)); return -1; } geo.rows = height; geo.columns = width; geo.frames = 1; geo.oformat = METEOR_GEO_YUV_422 | METEOR_GEO_YUV_12; switch (format) { case PAL: h_max = PAL_HEIGHT; c = BT848_IFORM_F_PALBDGHI; break; case PALN: h_max = PAL_HEIGHT; c = BT848_IFORM_F_PALN; break; case PALM: h_max = PAL_HEIGHT; c = BT848_IFORM_F_PALM; break; case SECAM: h_max = SECAM_HEIGHT; c = BT848_IFORM_F_SECAM; break; case NTSC: h_max = NTSC_HEIGHT; c = BT848_IFORM_F_NTSCM; break; case NTSCJ: h_max = NTSC_HEIGHT; c = BT848_IFORM_F_NTSCJ; break; default: h_max = PAL_HEIGHT; c = BT848_IFORM_F_PALBDGHI; break; } if (height <= h_max / 2) geo.oformat |= METEOR_GEO_EVEN_ONLY; if (ioctl(*video_fd, METEORSETGEO, &geo) < 0) { av_log(NULL, AV_LOG_ERROR, "METEORSETGEO: %s\n", strerror(errno)); return -1; } if (ioctl(*video_fd, BT848SFMT, &c) < 0) { av_log(NULL, AV_LOG_ERROR, "BT848SFMT: %s\n", strerror(errno)); return -1; } c = bktr_dev[idev]; if (ioctl(*video_fd, METEORSINPUT, &c) < 0) { av_log(NULL, AV_LOG_ERROR, "METEORSINPUT: %s\n", strerror(errno)); return -1; } video_buf_size = width * height * 12 / 8; video_buf = (uint8_t *)mmap((caddr_t)0, video_buf_size, PROT_READ, MAP_SHARED, *video_fd, (off_t)0); if (video_buf == MAP_FAILED) { av_log(NULL, AV_LOG_ERROR, "mmap: %s\n", strerror(errno)); return -1; } if (frequency != 0.0) { ioctl_frequency = (unsigned long)(frequency*16); if (ioctl(*tuner_fd, TVTUNER_SETFREQ, &ioctl_frequency) < 0) av_log(NULL, AV_LOG_ERROR, "TVTUNER_SETFREQ: %s\n", strerror(errno)); } c = AUDIO_UNMUTE; if (ioctl(*tuner_fd, BT848_SAUDIO, &c) < 0) av_log(NULL, AV_LOG_ERROR, "TVTUNER_SAUDIO: %s\n", strerror(errno)); c = METEOR_CAP_CONTINOUS; ioctl(*video_fd, METEORCAPTUR, &c); c = SIGUSR1; ioctl(*video_fd, METEORSSIGNAL, &c); return 0; }
1threat
static uint64_t omap_os_timer_read(void *opaque, target_phys_addr_t addr, unsigned size) { struct omap_32khz_timer_s *s = (struct omap_32khz_timer_s *) opaque; int offset = addr & OMAP_MPUI_REG_MASK; if (size != 4) { return omap_badwidth_read32(opaque, addr); } switch (offset) { case 0x00: return s->timer.reset_val; case 0x04: return omap_timer_read(&s->timer); case 0x08: return (s->timer.ar << 3) | (s->timer.it_ena << 2) | s->timer.st; default: break; } OMAP_BAD_REG(addr); return 0; }
1threat
RegEx: Extract Unknown # of Numbers of Unknown Length, With Separators, and Characters to Ignore : <p>I am looking to extract numbers in the format:</p> <blockquote> <p>[number]['/' or ' ' or '\' possible, ignore]:['/' or ' ' or '\' possible, ignore][number]['/' or ' ' or '\' possible, ignore]:...</p> </blockquote> <p>For example:</p> <blockquote> <p>"4852/: 5934: 439028/:\23"</p> </blockquote> <p>Would extract: ['4852', '5934', '439028', '23']</p>
0debug
static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) { CadenceGEMState *s; unsigned rxbufsize, bytes_to_copy; unsigned rxbuf_offset; uint8_t rxbuf[2048]; uint8_t *rxbuf_ptr; bool first_desc = true; int maf; s = qemu_get_nic_opaque(nc); maf = gem_mac_address_filter(s, buf); if (maf == GEM_RX_REJECT) { return -1; if (s->regs[GEM_NWCFG] & GEM_NWCFG_LERR_DISC) { unsigned type_len; type_len = buf[12] << 8 | buf[13]; if (type_len < 0x600) { if (size < type_len) { return -1; rxbuf_offset = (s->regs[GEM_NWCFG] & GEM_NWCFG_BUFF_OFST_M) >> GEM_NWCFG_BUFF_OFST_S; rxbufsize = ((s->regs[GEM_DMACFG] & GEM_DMACFG_RBUFSZ_M) >> GEM_DMACFG_RBUFSZ_S) * GEM_DMACFG_RBUFSZ_MUL; if (size < 60) { size = 60; if (s->regs[GEM_NWCFG] & GEM_NWCFG_STRIP_FCS) { rxbuf_ptr = (void *)buf; } else { unsigned crc_val; memcpy(rxbuf, buf, size); memset(rxbuf + size, 0, sizeof(rxbuf) - size); rxbuf_ptr = rxbuf; crc_val = cpu_to_le32(crc32(0, rxbuf, MAX(size, 60))); memcpy(rxbuf + size, &crc_val, sizeof(crc_val)); bytes_to_copy += 4; size += 4; DB_PRINT("config bufsize: %d packet size: %ld\n", rxbufsize, size); while (bytes_to_copy) { if (!gem_can_receive(nc)) { assert(!first_desc); return -1; DB_PRINT("copy %d bytes to 0x%x\n", MIN(bytes_to_copy, rxbufsize), rx_desc_get_buffer(s->rx_desc)); cpu_physical_memory_write(rx_desc_get_buffer(s->rx_desc) + rxbuf_offset, rxbuf_ptr, MIN(bytes_to_copy, rxbufsize)); rxbuf_ptr += MIN(bytes_to_copy, rxbufsize); bytes_to_copy -= MIN(bytes_to_copy, rxbufsize); if (first_desc) { rx_desc_set_sof(s->rx_desc); first_desc = false; if (bytes_to_copy == 0) { rx_desc_set_eof(s->rx_desc); rx_desc_set_length(s->rx_desc, size); rx_desc_set_ownership(s->rx_desc); switch (maf) { case GEM_RX_PROMISCUOUS_ACCEPT: break; case GEM_RX_BROADCAST_ACCEPT: rx_desc_set_broadcast(s->rx_desc); break; case GEM_RX_UNICAST_HASH_ACCEPT: rx_desc_set_unicast_hash(s->rx_desc); break; case GEM_RX_MULTICAST_HASH_ACCEPT: rx_desc_set_multicast_hash(s->rx_desc); break; case GEM_RX_REJECT: abort(); default: rx_desc_set_sar(s->rx_desc, maf); cpu_physical_memory_write(s->rx_desc_addr, (uint8_t *)s->rx_desc, sizeof(s->rx_desc)); if (rx_desc_get_wrap(s->rx_desc)) { DB_PRINT("wrapping RX descriptor list\n"); s->rx_desc_addr = s->regs[GEM_RXQBASE]; } else { DB_PRINT("incrementing RX descriptor list\n"); s->rx_desc_addr += 8; gem_get_rx_desc(s); gem_receive_updatestats(s, buf, size); s->regs[GEM_RXSTATUS] |= GEM_RXSTATUS_FRMRCVD; s->regs[GEM_ISR] |= GEM_INT_RXCMPL & ~(s->regs[GEM_IMR]); gem_update_int_status(s); return size;
1threat
How to use PyCharm with Google compute engine : <p>I have a compute engine instance running on Google cloud platform.</p> <p>I would like to use the Python interpreter of the compute engine as a remote interpreter with Pycharm. This means that I would be using Pycharm on my local machine and running computations remotely.</p> <p>Any clue on how to achieve this?</p>
0debug
How do i check if a string has a certain number of letters and digits? : <p>I need to create a function to check if the string I send as a parameter has the first 4 characters as a letter, and the last 3 are digits, and that it has exactly 7 characters. How would I code this function?</p>
0debug
C# enum excersice mycolor - print color and it's int (list index) : I am trying to solve this question , and i need your help. I use enumaration of the colors. the code below print each color's name. My question is how i add each color index number as well?? thank you foreach (string i in Enum.GetNames(typeof(MyColors))) { Console.WriteLine(i); } } public enum MyColors { White = 0, Black = 1, Orange = 2, Purpole = 4, } } }
0debug
Electron ES6 module import : <p>Electron 3.0.0-beta.1 Node 10.2.0 Chromium 66.0.3359.181</p> <p>The problem I'm having is importing a module. I created the following protocol:</p> <pre><code>protocol.registerFileProtocol('client', (request, callback) =&gt; { var url = request.url.substr(8); callback({path: path.join(__dirname, url)}); }); </code></pre> <p>The output of the protocol is the correct path</p> <pre><code>"/Users/adviner/Projects/Client/src/ClientsApp/app.js" </code></pre> <p>I have the following module app.js with the following code:</p> <pre><code>export function square() { return 'hello'; } </code></pre> <p>in my index.html I import the module like so:</p> <pre><code> &lt;script type="module" &gt; import square from 'client://app.js'; console.log(square()); &lt;/script&gt; </code></pre> <p>But I keep getting the error:</p> <p>app.js/:1 Failed to load module script: The server responded with a non-JavaScript MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec.</p> <p>I'm done searches but can't seem to find a solution. Can anyone suggest a way I can make this work?</p> <p>Thanks</p>
0debug
trying to write to python .txt file : <p>I am a new programmer, so be easy on me, I have watched a video on youtube, and understand most of it ( or so I thought). </p> <p>I get an error when I try to run </p> <pre><code>import logging import csv Date = input ('what date was it?') fish = input ('what type of fish did you catch?') fly = input ('what fly did you catch the fish on?') water = input ('what was the water conditions?') fileName = 'fish.txt' WRITE = 'w' # write rebuilds the file, so nothing is in the file! READ ='r' APPEND = 'a' ReadWrite = 'w+' file = open('fileName', 'a') file.write (Date + "\n") file.write (fish + "\n") file.write (fly + "\n") file.write (water + "\n") allFileContents = fileName.read() print (allFileContents) file.close() </code></pre> <p>does anything jump out at you that might be wrong? </p>
0debug
<function setDegreesAndMinutes at 0x10e7cf6e0> on python : when i run my code i got this answer: "<function setDegreesAndMinutes at 0x10e7cf6e0>" my code is below : def setDegreesAndMinutes(self, degrees,minutes): self.degrees = int(input()) self.minutes = float(input()) if(not(isinstance(degrees, int))): raise ValueError("degrees shoule be int") if(not(isinstance(minutes(int,float)))): raise ValueError("minutes shoule be int or float") x = degrees y = minutes return str(x)+'d'+str(y) returnValue = setDegreesAndMinutes print returnValue it will be great if anyone know what is happened , thanks!
0debug
how to get string from a struct in C? : <p>I was curious if anyone has gone about doing this before.</p> <p>I'm having an issue with getting a string from a struct. What I'm trying to do is get the string from the specific struct i'm working with, then put that string into fprintf("%s", whateverstring);</p> <pre><code>FILE* outfile = fopen("Z:\\NH\\instructions.txt","wb"); if ((dir = opendir ("Z:\\NH\\sqltesting\\")) != NULL) {// open directory and if it exists while ((ent = readdir (dir)) != NULL) { //while the directory isn't null printf("%s\n", ent-&gt;d_name); //I can do THIS okay fprintf("%s\n",ent-&gt;d_name); //but I can't do this fclose(outfile); } } closedir (dir); //else { // // perror (""); //print error and panic // return EXIT_FAILURE; //} } </code></pre> <p>am I taking the wrong approach here? I was thinking about in some way using something like <code>char[80] =ent.d_name;</code> however obviously that doesn't work. Is there some way I can get that string from the struct and throw it into fprintf? </p>
0debug