problem
stringlengths
26
131k
labels
class label
2 classes
javascript array find value base on id : <p>I have an array of json objects:</p> <pre><code>[ {id:0, name:'A'}, {id:1, name:'B'}...{id:n, name:'N'} ] </code></pre> <p>How do i get the value (name) base on a given id, without iterating the array? Perhaps using map or some filter method...</p>
0debug
tech stack required to understand git source code : I'm interested in understanding the git source code and maybe someday contribute to it. I understand git source code is build on 1) languages such as C, Shell, Perl, python, c++, tcl 2) technology such as http, https, ssh etc I was just wondering, is there anything else that are pre-requisite to understanding the git source code? Thanks in advance for any help!
0debug
Multi Language Wordpress Site : <p>I'm building a site for a client that requires several languages. They have all the text required for all the languages. But what's the best (correct) way to implement this? </p> <p>Thanks for your help!</p>
0debug
static int seqvideo_decode(SeqVideoContext *seq, const unsigned char *data, int data_size) { const unsigned char *data_end = data + data_size; GetBitContext gb; int flags, i, j, x, y, op; unsigned char c[3]; unsigned char *dst; uint32_t *palette; flags = *data++; if (flags & 1) { palette = (uint32_t *)seq->frame.data[1]; if (data_end - data < 256 * 3) return AVERROR_INVALIDDATA; for (i = 0; i < 256; i++) { for (j = 0; j < 3; j++, data++) c[j] = (*data << 2) | (*data >> 4); palette[i] = AV_RB24(c); } seq->frame.palette_has_changed = 1; } if (flags & 2) { if (data_end - data < 128) return AVERROR_INVALIDDATA; init_get_bits(&gb, data, 128 * 8); data += 128; for (y = 0; y < 128; y += 8) for (x = 0; x < 256; x += 8) { dst = &seq->frame.data[0][y * seq->frame.linesize[0] + x]; op = get_bits(&gb, 2); switch (op) { case 1: data = seq_decode_op1(seq, data, data_end, dst); break; case 2: data = seq_decode_op2(seq, data, data_end, dst); break; case 3: data = seq_decode_op3(seq, data, data_end, dst); break; } if (!data) return AVERROR_INVALIDDATA; } } return 0; }
1threat
static void hybrid4_8_12_cx(float (*in)[2], float (*out)[32][2], const float (*filter)[7][2], int N, int len) { int i, j, ssb; for (i = 0; i < len; i++, in++) { for (ssb = 0; ssb < N; ssb++) { float sum_re = filter[ssb][6][0] * in[6][0], sum_im = filter[ssb][6][0] * in[6][1]; for (j = 0; j < 6; j++) { float in0_re = in[j][0]; float in0_im = in[j][1]; float in1_re = in[12-j][0]; float in1_im = in[12-j][1]; sum_re += filter[ssb][j][0] * (in0_re + in1_re) - filter[ssb][j][1] * (in0_im - in1_im); sum_im += filter[ssb][j][0] * (in0_im + in1_im) + filter[ssb][j][1] * (in0_re - in1_re); } out[ssb][i][0] = sum_re; out[ssb][i][1] = sum_im; } } }
1threat
Download And Save File From URL in Swift : <p>I'm trying to...</p> <ul> <li><p>download a file (an MLModel) from a server</p></li> <li><p>save that file to the device </p></li> <li><p>re-launch the app</p></li> <li><p>use the URL (path) that the file was saved to, to access the downloaded file.. so I don't have to re-download it every time the app launches</p></li> </ul> <p>let download = URLSession.shared.downloadTask(with: url) { (urlOrNil, response, error) in</p> <pre><code> if let error = error { print("❌ There was an error in \(#function) \(error)") completion(nil) return } // the location the mlModel is saved at guard let fileURL = urlOrNil else {print("🔥❇️&gt;&gt;&gt;\(#file) \(#line)"); return } do { //compiles the model let compiledUrl = try MLModel.compileModel(at: fileURL) //turns the model into an MLModel let model = try MLModel(contentsOf: compiledUrl) print("newModel Complete 🍪") // find the app support directory let fileManager = FileManager.default // Finds a place to save the MLModel let appSupportDirectory = try! fileManager.url(for: .applicationSupportDirectory, in: .userDomainMask, appropriateFor: compiledUrl, create: true) // create a permanent URL in the app support directory let permanentUrl = appSupportDirectory.appendingPathComponent(compiledUrl.lastPathComponent) print("🎨\(permanentUrl)") // if the file exists, replace it. Otherwise, copy the file to the destination. if fileManager.fileExists(atPath: permanentUrl.absoluteString) { _ = try fileManager.replaceItemAt(permanentUrl, withItemAt: compiledUrl) } else { try fileManager.copyItem(at: compiledUrl, to: permanentUrl) } let newModel = try MLModel(contentsOf: permanentUrl) print("🎟", newModel) completion(newModel) }catch{ print("❌ There was an error in \(#function) \(error) : \(error.localizedDescription)") } }.resume() </code></pre> <p>From what I understand, this is saving my MLModel to the "permanentUrl". So I restart the app, I don't run downloadTask again (because the MLModel should be saved?), and I try to access the MLModel that I copied to the permanentURL with this code </p> <pre><code>let permanentUrl = URL(string:"file:///var/mobile/Containers/Data/Application/659B2FEE-4384-4BBE-97D1-B1575BF1EB3B/Library/Application%20Support/CFNetworkDownload_v3EpLD.mlmodelc") do { let model = try MLModel(contentsOf: permanentUrl!) print(model) }catch{ print("❌ There was an error in \(#function) \(error) : \(error.localizedDescription)") } </code></pre> <p>I get this Error</p> <blockquote> <p>file:///var/mobile/Containers/Data/Application/659B2FEE-4384-4BBE-97D1-B1575BF1EB3B/Library/Application 귑ీƢupport/CFNetworkDownload_v3EpLD.mlmodelc does not exist" UserInfo={NSLocalizedDescription=file:///var/mobile/Containers/Data/Application/659B2FEE-4384-4BBE-97D1-B1575BF1EB3B/Library/Application 귑ీƢupport/CFNetworkDownload_v3EpLD.mlmodelc does not exist} : file:///var/mobile/Containers/Data/Application/659B2FEE-4384-4BBE-97D1-B1575BF1EB3B/Library/Application 귑ీƢupport/CFNetworkDownload_v3EpLD.mlmodelc does not exist</p> </blockquote> <p>So I guess the MLModel wasn't saved? What am I missing here? I assume I saved the MLModel with downloadTask and I'm just not retrieving it the right way. How do I access the file that I had saved?</p>
0debug
Appropriate use of namespace in C++ : <p>Coming from a Java background, I've got used to creating an object and using it's methods in main class by referencing the object and it's method, for example:</p> <pre><code>object.objectMethod(); </code></pre> <p>Having different classes with identical-named methods wasn't an issue, but now I'm doing a project in Arduino which is pretty much C++. A <a href="https://www.arduino.cc/en/Hacking/LibraryTutorial" rel="nofollow noreferrer">tutorial</a> on using classes in Arduino suggests using class name and double colons in .cpp file before every single method. A bit of googling led me to believe that this is called a namespace. Further googling on namespaces in C++ yielded various options of use of namespaces, but none of them were like the one in the Arduino tutorial and that got me puzzled.</p> <p>My question: what is the appropriate use of namespaces and if using it as in linked tutorial is a good practice? </p>
0debug
Catch the values ​in the listbox respectively : <p>I need a code that when click on button1 every time the items in the listbox are entered into my textbox, respectively. And I do not know how to write the foreach loop for the listbox thank you</p>
0debug
I am getting a json array from webservice , but when i set the value to the textview i am getting only the last value : List<WeekDays> weekDaysList = place.getWeekDayList(); if(weekDaysList.size()>0) { for(int i = 0;i<weekDaysList.size();i++) { WeekDays days = weekDaysList.get(i); //String openhours += days.getDaystime(); //Log.d("WeekDaysView",days.getDaystime()); weekDays.setText(days.getDaystime()); } } Here is the logcat result: 11-23 17:24:55.553 32297-32297/com.softtoll.ncf D/WeekDaysView: Monday: 9:00 AM – 7:00 PM 11-23 17:24:55.553 32297-32297/com.softtoll.ncf D/WeekDaysView: Tuesday: 9:00 AM – 7:00 PM 11-23 17:24:55.553 32297-32297/com.softtoll.ncf D/WeekDaysView: Wednesday: 9:00 AM – 7:00 PM 11-23 17:24:55.553 32297-32297/com.softtoll.ncf D/WeekDaysView: Thursday: 9:00 AM – 7:00 PM 11-23 17:24:55.553 32297-32297/com.softtoll.ncf D/WeekDaysView: Friday: 9:00 AM – 7:00 PM 11-23 17:24:55.553 32297-32297/com.softtoll.ncf D/WeekDaysView: Saturday: 9:00 AM – 7:00 PM 11-23 17:24:55.553 32297-32297/com.softtoll.ncf D/WeekDaysView: Sunday: Closed
0debug
about GULP and application development : <p>Can we use GULP for developing UI and then server, web services connecting them to the UI ? like a complete cycle to implement a simple application or something..</p>
0debug
Access array member through two subscripts : <p>I have stored the members of a matrix into a 1D array. The problem now is that I need to access those members throught a 2 index notation like this:</p> <pre><code>int matrix[2][3] = {{ 1 , 2 , 3 },{ 4, 5 , 6 }}; // this is no longer available int x , y; //Stored matrix data on array[] int array[] = {1,2,3,4,5,6}; // only this member available cout &lt;&lt; "Insert the x index : "; cin&gt;&gt; x; cout &lt;&lt; "Insert the y index : "; cin&gt;&gt; y; </code></pre> <p>So, How can I print the matrix [1][1] member stored in on array[] ??</p>
0debug
How can I call Kotlin methods with reified generics from Java? : <p>I have the following method in Kotlin:</p> <pre><code>inline fun &lt;reified T&gt; foo() { } </code></pre> <p>If I try to call this from Java like this:</p> <pre><code>myObject.foo(); </code></pre> <p>OR like this:</p> <pre><code>myObject.&lt;SomeClass&gt;foo(); </code></pre> <p>I get the following error:</p> <blockquote> <p>java: foo() has private access in MyClass</p> </blockquote> <p>How can I call the <code>foo</code> method from Java?</p>
0debug
Python - Get user to input 10 numbers and then display only the prime numbers : <p>I need your help if possible. I am very new to Python, but I've got a good understanding in C#, java and now have started learning python as part of my learning program. I am stuck with one of my tasks to do and I can't get any help as no one that I know uses python.</p> <p>My task is : "Find the prime numbers from the given list of 10 numbers. User should input 10 numbers" Could anyone help me please? Thanks in advance</p>
0debug
static int dca_subframe_footer(DCAContext *s, int base_channel) { int in, out, aux_data_count, aux_data_end, reserved; uint32_t nsyncaux; if (!base_channel) { if (s->timestamp) skip_bits_long(&s->gb, 32); if (s->aux_data) { aux_data_count = get_bits(&s->gb, 6); skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31); aux_data_end = 8 * aux_data_count + get_bits_count(&s->gb); if ((nsyncaux = get_bits_long(&s->gb, 32)) != DCA_NSYNCAUX) { av_log(s->avctx, AV_LOG_ERROR, "nSYNCAUX mismatch %#"PRIx32"\n", nsyncaux); return AVERROR_INVALIDDATA; } if (get_bits1(&s->gb)) { avpriv_request_sample(s->avctx, "Auxiliary Decode Time Stamp Flag"); skip_bits(&s->gb, (-get_bits_count(&s->gb)) & 4); skip_bits_long(&s->gb, 44); } if ((s->core_downmix = get_bits1(&s->gb))) { int am = get_bits(&s->gb, 3); switch (am) { case 0: s->core_downmix_amode = DCA_MONO; break; case 1: s->core_downmix_amode = DCA_STEREO; break; case 2: s->core_downmix_amode = DCA_STEREO_TOTAL; break; case 3: s->core_downmix_amode = DCA_3F; break; case 4: s->core_downmix_amode = DCA_2F1R; break; case 5: s->core_downmix_amode = DCA_2F2R; break; case 6: s->core_downmix_amode = DCA_3F1R; break; default: av_log(s->avctx, AV_LOG_ERROR, "Invalid mode %d for embedded downmix coefficients\n", am); return AVERROR_INVALIDDATA; } for (out = 0; out < ff_dca_channels[s->core_downmix_amode]; out++) { for (in = 0; in < s->audio_header.prim_channels + !!s->lfe; in++) { uint16_t tmp = get_bits(&s->gb, 9); if ((tmp & 0xFF) > 241) { av_log(s->avctx, AV_LOG_ERROR, "Invalid downmix coefficient code %"PRIu16"\n", tmp); return AVERROR_INVALIDDATA; } s->core_downmix_codes[in][out] = tmp; } } } align_get_bits(&s->gb); skip_bits(&s->gb, 16); if ((reserved = (aux_data_end - get_bits_count(&s->gb))) < 0) { av_log(s->avctx, AV_LOG_ERROR, "Overread auxiliary data by %d bits\n", -reserved); return AVERROR_INVALIDDATA; } else if (reserved) { avpriv_request_sample(s->avctx, "Core auxiliary data reserved content"); skip_bits_long(&s->gb, reserved); } } if (s->crc_present && s->dynrange) get_bits(&s->gb, 16); } return 0; }
1threat
How evaluate a string? : <p>So basically what i have been struggling with is to evaluate sentence in EF Core.</p> <p>For example if i have: </p> <pre><code>string condition = "65 &lt; 100 AND 65 &gt; 50" </code></pre> <p>How can evaluate that?</p>
0debug
static inline void FUNC(idctSparseColAdd)(pixel *dest, int line_size, DCTELEM *col) { int a0, a1, a2, a3, b0, b1, b2, b3; INIT_CLIP; IDCT_COLS; dest[0] = CLIP(dest[0] + ((a0 + b0) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((a1 + b1) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((a2 + b2) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((a3 + b3) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((a3 - b3) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((a2 - b2) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((a1 - b1) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((a0 - b0) >> COL_SHIFT)); }
1threat
Multiple count down timers in RecyclerView flickering when scrolled : <p>I have implemented count down timer for each item of RecyclerView which is in a fragment activity. The count down timer shows the time remaining for expiry. The count down timer is working fine but when scrolled up it starts flickering. Searched a lot but did not got the good reference. Can any one help me?</p> <p>This is my RecyclerView adapter</p> <pre><code>public class MyOfferAdapter extends RecyclerView.Adapter&lt;MyOfferAdapter.FeedViewHolder&gt;{ private final Context mContext; private final LayoutInflater mLayoutInflater; private ArrayList&lt;Transactions&gt; mItems = new ArrayList&lt;&gt;(); private ImageLoader mImageLoader; private String imageURL; private View mView; private String mUserEmail; public MyOfferAdapter(Context context) { mContext = context; mLayoutInflater = LayoutInflater.from(context); VolleySingleton mVolley = VolleySingleton.getInstance(mContext); mImageLoader = mVolley.getImageLoader(); } public void addItems(ArrayList&lt;Transactions&gt; items,String userEmail) { int count = mItems.size(); mItems.addAll(items); mUserEmail = userEmail; notifyItemRangeChanged(count, items.size()); } @Override public FeedViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { mView = mLayoutInflater.inflate(R.layout.my_feed_item_layout, parent, false); return new FeedViewHolder(mView); } @Override public void onBindViewHolder(final FeedViewHolder holder, final int position) { holder.desc.setText(mItems.get(position).getDescription());//replace by title holder.scratchDes.setText(mItems.get(position).getScratchDescription()); long timer = mItems.get(position).getTimerExpiryTimeStamp(); Date today = new Date(); final long currentTime = today.getTime(); long expiryTime = timer - currentTime; new CountDownTimer(expiryTime, 500) { public void onTick(long millisUntilFinished) { long seconds = millisUntilFinished / 1000; long minutes = seconds / 60; long hours = minutes / 60; long days = hours / 24; String time = days+" "+"days" +" :" +hours % 24 + ":" + minutes % 60 + ":" + seconds % 60; holder.timerValueTimeStamp.setText(time); } public void onFinish() { holder.timerValueTimeStamp.setText("Time up!"); } }.start(); } @Override public int getItemCount() { return mItems.size(); } public static class FeedViewHolder extends RecyclerView.ViewHolder { TextView desc; TextView scratchDes; TextView timerValueTimeStamp; ImageView feedImage; CardView mCv; public FeedViewHolder(View itemView) { super(itemView); mCv = (CardView) itemView.findViewById(R.id.cv_fil); desc = (TextView) itemView.findViewById(R.id.desc_tv_fil); feedImage = (ImageView) itemView.findViewById(R.id.feed_iv_fil); scratchDes = (TextView) itemView.findViewById(R.id.tv_scratch_description); timerValueTimeStamp = (TextView) itemView.findViewById(R.id.tv_timer_value_time_stamp); } } </code></pre> <p>And this is my xml file used in adapter</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content"&gt; &lt;android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/cv_fil" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="@dimen/card_margin" android:layout_gravity="center" app:cardUseCompatPadding="true" app:cardElevation="4dp" android:elevation="6dp"&gt; &lt;RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;ImageView android:id="@+id/feed_iv_fil" android:layout_width="match_parent" android:layout_height="200dp" android:layout_alignParentTop="true" android:scaleType="fitXY" android:tint="@color/grey_tint_color" /&gt; &lt;TextView android:id="@+id/tv_scratch_description" style="@style/ListItemText" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:text="casul shoes" android:fontFamily="sans-serif-light" android:padding="10dp" /&gt; &lt;TextView android:id="@+id/tv_timer_value_time_stamp" style="@style/CardTitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" /&gt; &lt;TextView android:id="@+id/desc_tv_fil" style="@style/VendorNameText" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/feed_iv_fil" android:textColor="#3f3e3f" android:padding="10dp" /&gt; &lt;/RelativeLayout&gt; &lt;/android.support.v7.widget.CardView&gt; </code></pre> <p></p> <p>And this is screen shot of my RecyclerView <a href="https://i.stack.imgur.com/3ikcq.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/3ikcq.jpg" alt="enter image description here"></a></p>
0debug
static inline void RENAME(rgb24to15)(const uint8_t *src, uint8_t *dst, long src_size) { const uint8_t *s = src; const uint8_t *end; #if COMPILE_TEMPLATE_MMX const uint8_t *mm_end; #endif uint16_t *d = (uint16_t *)dst; end = s + src_size; #if COMPILE_TEMPLATE_MMX __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory"); __asm__ volatile( "movq %0, %%mm7 \n\t" "movq %1, %%mm6 \n\t" ::"m"(red_15mask),"m"(green_15mask)); mm_end = end - 15; while (s < mm_end) { __asm__ volatile( PREFETCH" 32%1 \n\t" "movd %1, %%mm0 \n\t" "movd 3%1, %%mm3 \n\t" "punpckldq 6%1, %%mm0 \n\t" "punpckldq 9%1, %%mm3 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "movq %%mm3, %%mm4 \n\t" "movq %%mm3, %%mm5 \n\t" "psllq $7, %%mm0 \n\t" "psllq $7, %%mm3 \n\t" "pand %%mm7, %%mm0 \n\t" "pand %%mm7, %%mm3 \n\t" "psrlq $6, %%mm1 \n\t" "psrlq $6, %%mm4 \n\t" "pand %%mm6, %%mm1 \n\t" "pand %%mm6, %%mm4 \n\t" "psrlq $19, %%mm2 \n\t" "psrlq $19, %%mm5 \n\t" "pand %2, %%mm2 \n\t" "pand %2, %%mm5 \n\t" "por %%mm1, %%mm0 \n\t" "por %%mm4, %%mm3 \n\t" "por %%mm2, %%mm0 \n\t" "por %%mm5, %%mm3 \n\t" "psllq $16, %%mm3 \n\t" "por %%mm3, %%mm0 \n\t" MOVNTQ" %%mm0, %0 \n\t" :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory"); d += 4; s += 12; } __asm__ volatile(SFENCE:::"memory"); __asm__ volatile(EMMS:::"memory"); #endif while (s < end) { const int r = *s++; const int g = *s++; const int b = *s++; *d++ = (b>>3) | ((g&0xF8)<<2) | ((r&0xF8)<<7); } }
1threat
import bisect def left_insertion(a, x): i = bisect.bisect_left(a, x) return i
0debug
saveAs is not defined when using JSzip : <p>I am getting an error when trying to do a simple jszip </p> <blockquote> <p>Uncaught (in promise) ReferenceError: saveAs is not defined</p> </blockquote> <p>Pretty sure I included all of the correct files so I am not sure what I am doing wrong, could someone please enlighten me?</p> <pre><code> &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset="UTF-8"&gt; &lt;title&gt;Download&lt;/title&gt; &lt;link rel="stylesheet" href="css/download.css"&gt; &lt;script type="text/javascript" src="jszip/dist/jszip.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="https://stuk.github.io/jszip-utils/dist/jszip-utils.js"&gt;&lt;/script&gt; &lt;script src='https://code.jquery.com/jquery-2.2.4.min.js'&gt;&lt;/script&gt; &lt;script src="js/download.js"&gt;&lt;/script&gt; &lt;link href="https://fonts.googleapis.com/css?family=Josefin+Sans" rel="stylesheet"&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="maindiv"&gt; &lt;header&gt; &lt;a href="index.html" class="company"&gt;Instasample&lt;/a&gt; &lt;a href="login" class="login"&gt;Login&lt;/a&gt; &lt;/header&gt; &lt;div class="soulection"&gt; &lt;button id="kick" onclick="download(this.id)" &gt;kick&lt;/button&gt; &lt;button id="snare" onclick="download(this.id)" &gt;snare&lt;/button&gt; &lt;button id="hat" onclick="download(this.id)" &gt;hat&lt;/button&gt; &lt;button id="open hat" onclick="download(this.id)" &gt;open hat&lt;/button&gt; &lt;button id="rim" onclick="download(this.id)" &gt;rim&lt;/button&gt; &lt;button id="perc" onclick="download(this.id)" &gt;perc&lt;/button&gt; &lt;button id="tom" onclick="download(this.id)" &gt;tom&lt;/button&gt; &lt;button id="clap" onclick="download(this.id)" &gt;clap&lt;/button&gt; &lt;button id="foley" onclick="download(this.id)" &gt;foley&lt;/button&gt; &lt;button id="ambient" onclick="download(this.id)" &gt;ambient&lt;/button&gt; &lt;button id="effects" onclick="download(this.id)" &gt;effects&lt;/button&gt; &lt;button id="vocal" onclick="download(this.id)" &gt;vocal&lt;/button&gt; &lt;button id="synth" onclick="download(this.id)" &gt;synth&lt;/button&gt; &lt;button id="808" onclick="download(this.id)" &gt;808&lt;/button&gt; &lt;button id="bass" onclick="download(this.id)" &gt;bass&lt;/button&gt; &lt;button id="sample" onclick="download(this.id)" &gt;sample&lt;/button&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;script type="text/javascript"&gt; (function () { var zip = new JSZip(); zip.file("Hello.txt", "Hello world\n"); function bindEvent(el, eventName, eventHandler) { if (el.addEventListener){ // standard way el.addEventListener(eventName, eventHandler, false); } else if (el.attachEvent){ // old IE el.attachEvent('on'+eventName, eventHandler); } } // Blob var blobLink = document.getElementById('kick'); if (JSZip.support.blob) { function downloadWithBlob() { zip.generateAsync({type:"blob"}).then(function (blob) { saveAs(blob, "hello.zip"); }, function (err) { blobLink.innerHTML += " " + err; }); return false; } bindEvent(blobLink, 'click', downloadWithBlob); } else { blobLink.innerHTML += " (not supported on this browser)"; } })(); &lt;/script&gt; &lt;footer&gt; &lt;a href="mailto:garvernr@mail.uc.edu?Subject=Hey%20Instasample" class="bottom"&gt;contact&lt;/a&gt; &lt;t class="bottomline"&gt;&amp;nbsp;|&amp;nbsp;&lt;/t&gt; &lt;a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=5LC9QK23C9M28" class="bottom2"&gt;donate&lt;/a&gt; &lt;t class="bottomline"&gt;&amp;nbsp;|&amp;nbsp;&lt;/t&gt; &lt;t class="bottom3"&gt;&amp;copy 2016&lt;/t&gt; &lt;/footer&gt; &lt;/html&gt; </code></pre>
0debug
static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, RMDemuxContext *rm, RMStream *vst, AVPacket *pkt, int len, int *pseq, int64_t *timestamp) { int hdr, seq, pic_num, len2, pos; int type; hdr = avio_r8(pb); len--; type = hdr >> 6; if(type != 3){ seq = avio_r8(pb); len--; } if(type != 1){ len2 = get_num(pb, &len); pos = get_num(pb, &len); pic_num = avio_r8(pb); len--; } if(len<0) return -1; rm->remaining_len = len; if(type&1){ if(type == 3){ len= len2; *timestamp = pos; } if(rm->remaining_len < len) return -1; rm->remaining_len -= len; if(av_new_packet(pkt, len + 9) < 0) return AVERROR(EIO); pkt->data[0] = 0; AV_WL32(pkt->data + 1, 1); AV_WL32(pkt->data + 5, 0); avio_read(pb, pkt->data + 9, len); return 0; } *pseq = seq; if((seq & 0x7F) == 1 || vst->curpic_num != pic_num){ vst->slices = ((hdr & 0x3F) << 1) + 1; vst->videobufsize = len2 + 8*vst->slices + 1; av_free_packet(&vst->pkt); if(av_new_packet(&vst->pkt, vst->videobufsize) < 0) return AVERROR(ENOMEM); vst->videobufpos = 8*vst->slices + 1; vst->cur_slice = 0; vst->curpic_num = pic_num; vst->pktpos = avio_tell(pb); } if(type == 2) len = FFMIN(len, pos); if(++vst->cur_slice > vst->slices) return 1; AV_WL32(vst->pkt.data - 7 + 8*vst->cur_slice, 1); AV_WL32(vst->pkt.data - 3 + 8*vst->cur_slice, vst->videobufpos - 8*vst->slices - 1); if(vst->videobufpos + len > vst->videobufsize) return 1; if (avio_read(pb, vst->pkt.data + vst->videobufpos, len) != len) return AVERROR(EIO); vst->videobufpos += len; rm->remaining_len-= len; if (type == 2 || vst->videobufpos == vst->videobufsize) { vst->pkt.data[0] = vst->cur_slice-1; *pkt= vst->pkt; vst->pkt.data= NULL; vst->pkt.size= 0; if(vst->slices != vst->cur_slice) memmove(pkt->data + 1 + 8*vst->cur_slice, pkt->data + 1 + 8*vst->slices, vst->videobufpos - 1 - 8*vst->slices); pkt->size = vst->videobufpos + 8*(vst->cur_slice - vst->slices); pkt->pts = AV_NOPTS_VALUE; pkt->pos = vst->pktpos; vst->slices = 0; return 0; } return 1; }
1threat
UIFeedback Haptic Engine called more times than was activated : <p>I am using the <code>UIFeedback Haptic Engine</code> with <strong>swift 2.3</strong> like:</p> <pre><code>let generator = UINotificationFeedbackGenerator() generator.notificationOccurred(.Warning) </code></pre> <p>and</p> <pre><code>let generator = UIImpactFeedbackGenerator(style: .Heavy) generator.impactOccurred() </code></pre> <p>Today I got a new kind of error like this, and couldn't find the problem. Do you have any idea?</p> <pre><code>UIFeedbackHapticEngine _deactivate] called more times than the feedback engine was activated </code></pre> <p>Details:</p> <pre><code>Fatal Exception: NSInternalInconsistencyException 0 CoreFoundation 0x1863e41c0 __exceptionPreprocess 1 libobjc.A.dylib 0x184e1c55c objc_exception_throw 2 CoreFoundation 0x1863e4094 +[NSException raise:format:] 3 Foundation 0x186e6e82c -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] 4 UIKit 0x18cc43fb8 -[_UIFeedbackEngine _deactivate] 5 UIKit 0x18cad781c -[UIFeedbackGenerator __deactivateWithStyle:] </code></pre>
0debug
iOS 11 simulator multitasking bar : <p>How to trigger the multitasking bar on iOS 11 simulator? I tried standard double </p> <blockquote> <p>Cmd + Shift + H</p> </blockquote> <p>on both iPhone 8 and iPhone X simulators, but it doesn't seem to be working anymore.</p> <p><strong>Edit:</strong> tried few more times and apparently it still works, but like one try in ten. Does anyone experience the same behavior? Is it a simulator bug? Any idea how to improve it?</p>
0debug
void target_disas(FILE *out, CPUState *cpu, target_ulong code, target_ulong size, int flags) { CPUClass *cc = CPU_GET_CLASS(cpu); target_ulong pc; int count; CPUDebug s; INIT_DISASSEMBLE_INFO(s.info, out, fprintf); s.cpu = cpu; s.info.read_memory_func = target_read_memory; s.info.read_memory_inner_func = NULL; s.info.buffer_vma = code; s.info.buffer_length = size; s.info.print_address_func = generic_print_address; #ifdef TARGET_WORDS_BIGENDIAN s.info.endian = BFD_ENDIAN_BIG; #else s.info.endian = BFD_ENDIAN_LITTLE; #endif if (cc->disas_set_info) { cc->disas_set_info(cpu, &s.info); } #if defined(TARGET_I386) if (flags == 2) { s.info.mach = bfd_mach_x86_64; } else if (flags == 1) { s.info.mach = bfd_mach_i386_i8086; } else { s.info.mach = bfd_mach_i386_i386; } s.info.print_insn = print_insn_i386; #elif defined(TARGET_PPC) if ((flags >> 16) & 1) { s.info.endian = BFD_ENDIAN_LITTLE; } if (flags & 0xFFFF) { s.info.mach = flags & 0xFFFF; } else { #ifdef TARGET_PPC64 s.info.mach = bfd_mach_ppc64; #else s.info.mach = bfd_mach_ppc; #endif } s.info.disassembler_options = (char *)"any"; s.info.print_insn = print_insn_ppc; #endif if (s.info.print_insn == NULL) { s.info.print_insn = print_insn_od_target; } for (pc = code; size > 0; pc += count, size -= count) { fprintf(out, "0x" TARGET_FMT_lx ": ", pc); count = s.info.print_insn(pc, &s.info); #if 0 { int i; uint8_t b; fprintf(out, " {"); for(i = 0; i < count; i++) { target_read_memory(pc + i, &b, 1, &s.info); fprintf(out, " %02x", b); } fprintf(out, " }"); } #endif fprintf(out, "\n"); if (count < 0) break; if (size < count) { fprintf(out, "Disassembler disagrees with translator over instruction " "decoding\n" "Please report this to qemu-devel@nongnu.org\n"); break; } } }
1threat
Mysql Connection to Local Area Network : <p>im am working on application with mysql server its working fine. but my program needs to be use in other computer Via Local Area Network i have no idea how to do it can you guys please help me? thanks in advance</p> <p>P.S sorry for my english</p>
0debug
static void access_with_adjusted_size(hwaddr addr, uint64_t *value, unsigned size, unsigned access_size_min, unsigned access_size_max, void (*access)(MemoryRegion *mr, hwaddr addr, uint64_t *value, unsigned size, unsigned shift, uint64_t mask), MemoryRegion *mr) { uint64_t access_mask; unsigned access_size; unsigned i; if (!access_size_min) { access_size_min = 1; } if (!access_size_max) { access_size_max = 4; } access_size = MAX(MIN(size, access_size_max), access_size_min); access_mask = -1ULL >> (64 - access_size * 8); for (i = 0; i < size; i += access_size) { #ifdef TARGET_WORDS_BIGENDIAN access(mr, addr + i, value, access_size, (size - access_size - i) * 8, access_mask); #else access(mr, addr + i, value, access_size, i * 8, access_mask); #endif } }
1threat
Azure CLI in Git Bash : <p>I am trying to use a bash (sh) script on windows to run a test deployment. I am running the script from the gitbash console so that I have a copy of bash, but doing so means that the azure clie is not available (i.e. azure command is not found). Does anyone know how I can get the Azure cli working in GitBash (I am assuming I just install it somewhere else) or should I change to a different way of using bash </p>
0debug
static int curl_open(BlockDriverState *bs, const char *filename, int flags) { BDRVCURLState *s = bs->opaque; CURLState *state = NULL; double d; #define RA_OPTSTR ":readahead=" char *file; char *ra; const char *ra_val; int parse_state = 0; static int inited = 0; file = strdup(filename); s->readahead_size = READ_AHEAD_SIZE; ra = file + strlen(file) - 1; while (ra >= file) { if (parse_state == 0) { if (*ra == ':') parse_state++; else break; } else if (parse_state == 1) { if (*ra > '9' || *ra < '0') { char *opt_start = ra - strlen(RA_OPTSTR) + 1; if (opt_start > file && strncmp(opt_start, RA_OPTSTR, strlen(RA_OPTSTR)) == 0) { ra_val = ra + 1; ra -= strlen(RA_OPTSTR) - 1; *ra = '\0'; s->readahead_size = atoi(ra_val); break; } else { break; } } } ra--; } if ((s->readahead_size & 0x1ff) != 0) { fprintf(stderr, "HTTP_READAHEAD_SIZE %zd is not a multiple of 512\n", s->readahead_size); goto out_noclean; } if (!inited) { curl_global_init(CURL_GLOBAL_ALL); inited = 1; } DPRINTF("CURL: Opening %s\n", file); s->url = file; state = curl_init_state(s); if (!state) goto out_noclean; curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1); curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION, (void *)curl_size_cb); if (curl_easy_perform(state->curl)) goto out; curl_easy_getinfo(state->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &d); curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION, (void *)curl_read_cb); curl_easy_setopt(state->curl, CURLOPT_NOBODY, 0); if (d) s->len = (size_t)d; else if(!s->len) goto out; DPRINTF("CURL: Size = %lld\n", (long long)s->len); curl_clean_state(state); curl_easy_cleanup(state->curl); state->curl = NULL; s->multi = curl_multi_init(); curl_multi_setopt( s->multi, CURLMOPT_SOCKETDATA, s); curl_multi_setopt( s->multi, CURLMOPT_SOCKETFUNCTION, curl_sock_cb ); curl_multi_do(s); return 0; out: fprintf(stderr, "CURL: Error opening file: %s\n", state->errmsg); curl_easy_cleanup(state->curl); state->curl = NULL; out_noclean: qemu_free(file); return -EINVAL; }
1threat
How to pause game in unity on steam overly : I am developing a game in unity for the steam platform. I want to know how to pause the game when steam overly is called. I tried several things but nothing worked.
0debug
static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts) { InputStream *ist = s->opaque; const enum AVPixelFormat *p; int ret; for (p = pix_fmts; *p != -1; p++) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p); const HWAccel *hwaccel; if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) break; hwaccel = get_hwaccel(*p, ist->hwaccel_id); if (!hwaccel || (ist->active_hwaccel_id && ist->active_hwaccel_id != hwaccel->id) || (ist->hwaccel_id != HWACCEL_AUTO && ist->hwaccel_id != hwaccel->id)) continue; ret = hwaccel->init(s); if (ret < 0) { if (ist->hwaccel_id == hwaccel->id) { av_log(NULL, AV_LOG_FATAL, "%s hwaccel requested for input stream #%d:%d, " "but cannot be initialized.\n", hwaccel->name, ist->file_index, ist->st->index); return AV_PIX_FMT_NONE; } continue; } if (ist->hw_frames_ctx) { s->hw_frames_ctx = av_buffer_ref(ist->hw_frames_ctx); if (!s->hw_frames_ctx) return AV_PIX_FMT_NONE; } ist->active_hwaccel_id = hwaccel->id; ist->hwaccel_pix_fmt = *p; break; } return *p; }
1threat
static void pcnet_common_init(PCNetState *d, NICInfo *nd) { d->poll_timer = qemu_new_timer(vm_clock, pcnet_poll_timer, d); d->nd = nd; if (nd && nd->vlan) { d->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, pcnet_receive, pcnet_can_receive, d); qemu_format_nic_info_str(d->vc, d->nd->macaddr); } else { d->vc = NULL; } pcnet_h_reset(d); register_savevm("pcnet", -1, 2, pcnet_save, pcnet_load, d); }
1threat
Remove the outer list of a double list : <p>Let's say i have a list that consist of:</p> <pre><code>[['a','b','c','d']] </code></pre> <p>Is there an easy way to remove the outer list so the output would be</p> <pre><code>['a','b','c','d'] </code></pre> <p>I figured something like pop, but that remove the element, and i just want to remove the outer list.</p> <p>I know i could iterate over the double list and append the elements to a new list, and the problem would be solved, but im not happy with that solution, i want a smoother one with cleaner code.</p>
0debug
Jpeg2000TgtNode *ff_j2k_tag_tree_init(int w, int h) { int pw = w, ph = h; Jpeg2000TgtNode *res, *t, *t2; int32_t tt_size; tt_size = tag_tree_size(w, h); t = res = av_mallocz(tt_size, sizeof(*t)); if (!res) return NULL; while (w > 1 || h > 1) { int i, j; pw = w; ph = h; w = (w + 1) >> 1; h = (h + 1) >> 1; t2 = t + pw * ph; for (i = 0; i < ph; i++) for (j = 0; j < pw; j++) t[i * pw + j].parent = &t2[(i >> 1) * w + (j >> 1)]; t = t2; } t[0].parent = NULL; return res; }
1threat
av_cold void ff_mpadsp_init(MPADSPContext *s) { DCTContext dct; ff_dct_init(&dct, 5, DCT_II); ff_init_mpadsp_tabs_float(); ff_init_mpadsp_tabs_fixed(); s->apply_window_float = ff_mpadsp_apply_window_float; s->apply_window_fixed = ff_mpadsp_apply_window_fixed; s->dct32_float = dct.dct32; s->dct32_fixed = ff_dct32_fixed; s->imdct36_blocks_float = ff_imdct36_blocks_float; s->imdct36_blocks_fixed = ff_imdct36_blocks_fixed; if (ARCH_AARCH64) ff_mpadsp_init_aarch64(s); if (ARCH_ARM) ff_mpadsp_init_arm(s); if (ARCH_PPC) ff_mpadsp_init_ppc(s); if (ARCH_X86) ff_mpadsp_init_x86(s); if (HAVE_MIPSFPU) ff_mpadsp_init_mipsfpu(s); if (HAVE_MIPSDSP) ff_mpadsp_init_mipsdsp(s); }
1threat
static void gen_arith_imm(DisasContext *ctx, uint32_t opc, int rt, int rs, int16_t imm) { target_ulong uimm = (target_long)imm; const char *opn = "imm arith"; if (rt == 0 && opc != OPC_ADDI && opc != OPC_DADDI) { MIPS_DEBUG("NOP"); return; } switch (opc) { case OPC_ADDI: { TCGv t0 = tcg_temp_local_new(); TCGv t1 = tcg_temp_new(); TCGv t2 = tcg_temp_new(); int l1 = gen_new_label(); gen_load_gpr(t1, rs); tcg_gen_addi_tl(t0, t1, uimm); tcg_gen_ext32s_tl(t0, t0); tcg_gen_xori_tl(t1, t1, ~uimm); tcg_gen_xori_tl(t2, t0, uimm); tcg_gen_and_tl(t1, t1, t2); tcg_temp_free(t2); tcg_gen_brcondi_tl(TCG_COND_GE, t1, 0, l1); tcg_temp_free(t1); generate_exception(ctx, EXCP_OVERFLOW); gen_set_label(l1); tcg_gen_ext32s_tl(t0, t0); gen_store_gpr(t0, rt); tcg_temp_free(t0); } opn = "addi"; break; case OPC_ADDIU: if (rs != 0) { tcg_gen_addi_tl(cpu_gpr[rt], cpu_gpr[rs], uimm); tcg_gen_ext32s_tl(cpu_gpr[rt], cpu_gpr[rt]); } else { tcg_gen_movi_tl(cpu_gpr[rt], uimm); } opn = "addiu"; break; #if defined(TARGET_MIPS64) case OPC_DADDI: { TCGv t0 = tcg_temp_local_new(); TCGv t1 = tcg_temp_new(); TCGv t2 = tcg_temp_new(); int l1 = gen_new_label(); gen_load_gpr(t1, rs); tcg_gen_addi_tl(t0, t1, uimm); tcg_gen_xori_tl(t1, t1, ~uimm); tcg_gen_xori_tl(t2, t0, uimm); tcg_gen_and_tl(t1, t1, t2); tcg_temp_free(t2); tcg_gen_brcondi_tl(TCG_COND_GE, t1, 0, l1); tcg_temp_free(t1); generate_exception(ctx, EXCP_OVERFLOW); gen_set_label(l1); gen_store_gpr(t0, rt); tcg_temp_free(t0); } opn = "daddi"; break; case OPC_DADDIU: if (rs != 0) { tcg_gen_addi_tl(cpu_gpr[rt], cpu_gpr[rs], uimm); } else { tcg_gen_movi_tl(cpu_gpr[rt], uimm); } opn = "daddiu"; break; #endif } (void)opn; MIPS_DEBUG("%s %s, %s, " TARGET_FMT_lx, opn, regnames[rt], regnames[rs], uimm); }
1threat
Something Goofy With This PHP target="_blank" : So I know this kind of question has been asked in here, but mine appears to be different from others: The code below shows that if there is a URL populate it and open it in a new tab, however, for some strange reason the link opens in a new tab (YAY!!) AND opens in the current tab (BOO!!). I can't figure out what I am missing. Any help is appreciated. And I just checked incognito so it doesn't appear to be a cookie issue either. <div class="box span4"> <?php if( $url1 != '' && $img1 != '' ): ?> <a href="<?php echo esc_url( $url1 ); ?>" target="_blank" class="box-link"> <center><img class="box-image" src="<?php echo esc_url( $img1 ); ?>"/></center> </a> <?php else: ?> <?php if( $img1 != '' ): ?> <a class="box-no-url"> <center><img class="box-image" src="<?php echo esc_url( $img1 ); ?>"/></center> </a> <?php endif; ?> <?php endif; ?> <p><?php echo wp_kses( $text1, array( 'br' => array(), 'em' => array(), 'strong' => array() ) ); ?></p> </div> Thanks again for any help. Have a great day. David
0debug
How do i make one button play a list of sounds randomly each time its being pressed Android Studio, java : I know how to make 1 button play 1 audio file but how do u make 1 button play multiple Sound files randomly?
0debug
static void usb_uas_task(UASDevice *uas, uas_ui *ui) { uint16_t tag = be16_to_cpu(ui->hdr.tag); uint64_t lun64 = be64_to_cpu(ui->task.lun); SCSIDevice *dev = usb_uas_get_dev(uas, lun64); int lun = usb_uas_get_lun(lun64); UASRequest *req; uint16_t task_tag; req = usb_uas_find_request(uas, be16_to_cpu(ui->hdr.tag)); if (req) { goto overlapped_tag; if (dev == NULL) { goto incorrect_lun; switch (ui->task.function) { case UAS_TMF_ABORT_TASK: task_tag = be16_to_cpu(ui->task.task_tag); trace_usb_uas_tmf_abort_task(uas->dev.addr, tag, task_tag); req = usb_uas_find_request(uas, task_tag); if (req && req->dev == dev) { scsi_req_cancel(req->req); usb_uas_queue_response(uas, tag, UAS_RC_TMF_COMPLETE, 0); break; case UAS_TMF_LOGICAL_UNIT_RESET: trace_usb_uas_tmf_logical_unit_reset(uas->dev.addr, tag, lun); qdev_reset_all(&dev->qdev); usb_uas_queue_response(uas, tag, UAS_RC_TMF_COMPLETE, 0); break; default: trace_usb_uas_tmf_unsupported(uas->dev.addr, tag, ui->task.function); usb_uas_queue_response(uas, tag, UAS_RC_TMF_NOT_SUPPORTED, 0); break; return; invalid_tag: usb_uas_queue_response(uas, tag, UAS_RC_INVALID_INFO_UNIT, 0); return; overlapped_tag: usb_uas_queue_response(uas, req->tag, UAS_RC_OVERLAPPED_TAG, 0); return; incorrect_lun: usb_uas_queue_response(uas, tag, UAS_RC_INCORRECT_LUN, 0);
1threat
Sorting tuple of tuple in a list : <pre><code>[(('A', 'B'), 1.0), (('A', 'C'), 1.0), (('B', 'C'), 1.0), (('B', 'D'), 1.0), (('D', 'E'), 1.0), (('D', 'F'), 1.0), (('E', 'F'), 5.0), (('F', 'G'), 5.0), (('D', 'G'), 1.0)] </code></pre> <p>I need to sort this list in descending order on the numbers if in case of a tie I have to sort in the ascending order of alphabets</p> <p>The final list should look something like this:</p> <pre><code>[(('E', 'F'), 5.0),(('F', 'G'), 5.0), (('A', 'B'), 1.0),(('A', 'C'), 1.0),(('B', 'C'), 1.0),(('B', 'D'), 1.0),(('D', 'E'), 1.0),(('D', 'F'), 1.0) (('D', 'G'), 1.0)] </code></pre>
0debug
const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len) { const AVOption *o = av_opt_find(obj, name, NULL, 0, 0); void *dst; uint8_t *bin; int len, i; if (!o || o->offset<=0) return NULL; if (o->type != FF_OPT_TYPE_STRING && (!buf || !buf_len)) return NULL; dst= ((uint8_t*)obj) + o->offset; if (o_out) *o_out= o; switch (o->type) { case FF_OPT_TYPE_FLAGS: snprintf(buf, buf_len, "0x%08X",*(int *)dst);break; case FF_OPT_TYPE_INT: snprintf(buf, buf_len, "%d" , *(int *)dst);break; case FF_OPT_TYPE_INT64: snprintf(buf, buf_len, "%"PRId64, *(int64_t*)dst);break; case FF_OPT_TYPE_FLOAT: snprintf(buf, buf_len, "%f" , *(float *)dst);break; case FF_OPT_TYPE_DOUBLE: snprintf(buf, buf_len, "%f" , *(double *)dst);break; case FF_OPT_TYPE_RATIONAL: snprintf(buf, buf_len, "%d/%d", ((AVRational*)dst)->num, ((AVRational*)dst)->den);break; case FF_OPT_TYPE_STRING: return *(void**)dst; case FF_OPT_TYPE_BINARY: len = *(int*)(((uint8_t *)dst) + sizeof(uint8_t *)); if (len >= (buf_len + 1)/2) return NULL; bin = *(uint8_t**)dst; for (i = 0; i < len; i++) snprintf(buf + i*2, 3, "%02X", bin[i]); break; default: return NULL; } return buf; }
1threat
How to clear complete cache in Varnish? : <p>I'm looking for a way to clear the cache for all domains and all URLs in Varnish.</p> <p>Currently, I would need to issue individual commands for each URLs, for example:</p> <pre><code>curl -X PURGE http://example.com/url1 curl -X PURGE http://example.com/url1 curl -X PURGE http://subdomain.example.com/ curl -X PURGE http://subdomain.example.com/url1 // etc. </code></pre> <p>While I'm looking for a way to do something like</p> <pre><code>curl -X PURGE http://example.com/* </code></pre> <p>And that would clear all URLs under example.com, but also all URLs in sub-domains of example.com, basically all the URLs managed by Varnish.</p> <p>Any idea how to achieve this?</p> <p>This is my current VCL file:</p> <pre><code>vcl 4.0; backend default { .host = "127.0.0.1"; .port = "8080"; } sub vcl_recv { # Command to clear the cache # curl -X PURGE http://example.com if (req.method == "PURGE") { return (purge); } } </code></pre>
0debug
static int nvdec_mpeg12_end_frame(AVCodecContext *avctx) { NVDECContext *ctx = avctx->internal->hwaccel_priv_data; int ret = ff_nvdec_end_frame(avctx); ctx->bitstream = NULL; return ret; }
1threat
void sparc64_get_context(CPUSPARCState *env) { abi_ulong ucp_addr; struct target_ucontext *ucp; target_mc_gregset_t *grp; target_mcontext_t *mcp; abi_ulong fp, i7, w_addr; int err; unsigned int i; target_sigset_t target_set; sigset_t set; ucp_addr = env->regwptr[UREG_I0]; if (!lock_user_struct(VERIFY_WRITE, ucp, ucp_addr, 0)) { goto do_sigsegv; } mcp = &ucp->tuc_mcontext; grp = &mcp->mc_gregs; env->pc = env->npc; env->npc += 4; err = 0; do_sigprocmask(0, NULL, &set); host_to_target_sigset_internal(&target_set, &set); if (TARGET_NSIG_WORDS == 1) { __put_user(target_set.sig[0], (abi_ulong *)&ucp->tuc_sigmask); } else { abi_ulong *src, *dst; src = target_set.sig; dst = ucp->tuc_sigmask.sig; for (i = 0; i < TARGET_NSIG_WORDS; i++, dst++, src++) { __put_user(*src, dst); } if (err) goto do_sigsegv; } __put_user(env->pc, &((*grp)[MC_PC])); __put_user(env->npc, &((*grp)[MC_NPC])); __put_user(env->y, &((*grp)[MC_Y])); __put_user(env->gregs[1], &((*grp)[MC_G1])); __put_user(env->gregs[2], &((*grp)[MC_G2])); __put_user(env->gregs[3], &((*grp)[MC_G3])); __put_user(env->gregs[4], &((*grp)[MC_G4])); __put_user(env->gregs[5], &((*grp)[MC_G5])); __put_user(env->gregs[6], &((*grp)[MC_G6])); __put_user(env->gregs[7], &((*grp)[MC_G7])); __put_user(env->regwptr[UREG_I0], &((*grp)[MC_O0])); __put_user(env->regwptr[UREG_I1], &((*grp)[MC_O1])); __put_user(env->regwptr[UREG_I2], &((*grp)[MC_O2])); __put_user(env->regwptr[UREG_I3], &((*grp)[MC_O3])); __put_user(env->regwptr[UREG_I4], &((*grp)[MC_O4])); __put_user(env->regwptr[UREG_I5], &((*grp)[MC_O5])); __put_user(env->regwptr[UREG_I6], &((*grp)[MC_O6])); __put_user(env->regwptr[UREG_I7], &((*grp)[MC_O7])); w_addr = TARGET_STACK_BIAS+env->regwptr[UREG_I6]; fp = i7 = 0; if (get_user(fp, w_addr + offsetof(struct target_reg_window, ins[6]), abi_ulong) != 0) { goto do_sigsegv; } if (get_user(i7, w_addr + offsetof(struct target_reg_window, ins[7]), abi_ulong) != 0) { goto do_sigsegv; } __put_user(fp, &(mcp->mc_fp)); __put_user(i7, &(mcp->mc_i7)); { uint32_t *dst = ucp->tuc_mcontext.mc_fpregs.mcfpu_fregs.sregs; for (i = 0; i < 64; i++, dst++) { if (i & 1) { __put_user(env->fpr[i/2].l.lower, dst); } else { __put_user(env->fpr[i/2].l.upper, dst); } } } __put_user(env->fsr, &(mcp->mc_fpregs.mcfpu_fsr)); __put_user(env->gsr, &(mcp->mc_fpregs.mcfpu_gsr)); __put_user(env->fprs, &(mcp->mc_fpregs.mcfpu_fprs)); if (err) goto do_sigsegv; unlock_user_struct(ucp, ucp_addr, 1); return; do_sigsegv: unlock_user_struct(ucp, ucp_addr, 1); force_sig(TARGET_SIGSEGV); }
1threat
Grant Android USB Permission Automatically without a popup in Xamarin : I was sent to the following stackoverflow topic to have this occur from Xamarin forums (thanks David Hunt!): http://stackoverflow.com/questions/13647547/android-usb-automatically-grant-permission This appears that I would have to be have this completed in Java with Android and then a Jar file will have to be created so this can be utilized in Xamarin correct?
0debug
Google App Engine multiple regions : <p>Is it possible for my GAE to be balanced accross regions? Like US and Europe.<br> <a href="https://cloud.google.com/about/locations/" rel="noreferrer">https://cloud.google.com/about/locations/</a><br> Reading the link above it says that it scales automatically within or accross multi-regional locations.<br> What does that mean? Do I have to enable automatic scaling across regions? If so, how do I do that?<br> And secondly, if it does handle automatic scaling across regions, the choice one makes for <code>App engine location</code> when creating a new project, is that irrelevant for a Google App Engine instance?</p>
0debug
static int vmd_probe(AVProbeData *p) { if (p->buf_size < 2) return 0; if (AV_RL16(&p->buf[0]) != VMD_HEADER_SIZE - 2) return 0; return AVPROBE_SCORE_MAX / 2; }
1threat
create_iovec(QEMUIOVector *qiov, char **argv, int nr_iov, int pattern) { size_t *sizes = calloc(nr_iov, sizeof(size_t)); size_t count = 0; void *buf = NULL; void *p; int i; for (i = 0; i < nr_iov; i++) { char *arg = argv[i]; int64_t len; len = cvtnum(arg); if (len < 0) { printf("non-numeric length argument -- %s\n", arg); goto fail; } if (len > INT_MAX) { printf("too large length argument -- %s\n", arg); goto fail; } if (len & 0x1ff) { printf("length argument %" PRId64 " is not sector aligned\n", len); goto fail; } sizes[i] = len; count += len; } qemu_iovec_init(qiov, nr_iov); buf = p = qemu_io_alloc(count, pattern); for (i = 0; i < nr_iov; i++) { qemu_iovec_add(qiov, p, sizes[i]); p += sizes[i]; } fail: free(sizes); return buf; }
1threat
Is O(N^2) nested for loop as O(N) while loop possible? : <p>Am I correct in saying that this code will execute in O(N) time? This is to iterate through a map&lt; int, vector&lt; int > >. </p> <pre><code> int counter = 0; unsigned int u = 0; unsigned int v = 0; bool notDone = true; while (notDone) { if (u &lt; map.size()) { if (v &lt; map.at(u).size()) { if (map.at(u)[v] == -1) { ++v; } else { ++counter; ++v; } } else { v = 0; ++u; } } else { notDone = false; } } </code></pre>
0debug
uint64_t ram_bytes_transferred(void) { return bytes_transferred; }
1threat
static int qcow_make_empty(BlockDriverState *bs) { BDRVQcowState *s = bs->opaque; uint32_t l1_length = s->l1_size * sizeof(uint64_t); int ret; memset(s->l1_table, 0, l1_length); if (bdrv_pwrite(bs->file, s->l1_table_offset, s->l1_table, l1_length) < 0) return -1; ret = bdrv_truncate(bs->file, s->l1_table_offset + l1_length); if (ret < 0) return ret; memset(s->l2_cache, 0, s->l2_size * L2_CACHE_SIZE * sizeof(uint64_t)); memset(s->l2_cache_offsets, 0, L2_CACHE_SIZE * sizeof(uint64_t)); memset(s->l2_cache_counts, 0, L2_CACHE_SIZE * sizeof(uint32_t)); return 0; }
1threat
top 5 values in a particular row of a dataframe in R : I have a dataframe with 165 coloumns where I have different values. data frame is like this: skill1 skill2 slkill3 skill4 ...... 1 1 0 54 20 2 0 23 9 2 I want to find top 3 values for a particular row. How to do that
0debug
static void init_excp_601 (CPUPPCState *env) { #if !defined(CONFIG_USER_ONLY) env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100; env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200; env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300; env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400; env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500; env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600; env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700; env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800; env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900; env->excp_vectors[POWERPC_EXCP_IO] = 0x00000A00; env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00; env->excp_vectors[POWERPC_EXCP_RUNM] = 0x00002000; env->excp_prefix = 0xFFF00000; env->hreset_vector = 0x00000100UL; #endif }
1threat
Selenium ChromeDriver does not recognize newly compiled Headless Chromium (Python) : <p>I am trying to use the new (2016) <strong>headless</strong> version of Chromium with Selenium/ChromeDriver (In the past, I used Firefox with xfvb but this promises to be much better). </p> <p>I have compiled a headless version of Chromium from sources (I did not find any pre-built binaries) based on the instructions I found <a href="https://docs.google.com/document/d/1a9cdsljKxCSreR2LDE3KErJhfyC0N9y5ju2UYZb8-J4/edit#" rel="noreferrer">here</a> and then I used the following code to launch it through Selenium:</p> <pre class="lang-python prettyprint-override"><code>from selenium import webdriver from selenium.webdriver.chrome.options import Options l_option = Options() l_option.add_argument('headless') l_option.add_argument('disable-notifications') l_option.binary_location = '/home/fi11222/Headless_Chromium/headless_shell' l_driver = webdriver.Chrome(chrome_options=l_option) </code></pre> <p>The same code works with the standard chromium (if I remove the <code>binary.location</code> option)</p> <p>As is, however, I get the following error:</p> <pre><code>selenium.common.exceptions.WebDriverException: Message: unknown error: unrecognized Chrome version: HeadlessChrome/59.0.3032.0 (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.4.0-53-generic x86_64) </code></pre> <p>Apparently, the headless chromium binary is compiled with a version ID that ChromeDriver does not recognize. Help !!</p> <p>Environment: </p> <ul> <li>Compilation: Ubuntu 16.04 server</li> <li>Selenium execution: Linux Mint 18.1</li> </ul>
0debug
Here i have written a C++ code which uses 2-dimension array and meant to perform rowsum but it is not giving proper output : <pre><code># include&lt;iostream&gt; using namespace std; int const rows=3; //rows are kept constant int const cols=3; //columns are kept constant void display(int arr[][cols],int rows,int cols); //function prototype int rowsum(int arr[][cols],int rows,int cols); //function prototype int main() { int z [rows][cols]; //2-D array declaration int r,c; for(r=0;r&lt;rows;r++) { for(c=0;c&lt;cols;c++) { cout&lt;&lt;"Enter elements of array["&lt;&lt;r&lt;&lt;"]["&lt;&lt;c&lt;&lt;"]:"; cin&gt;&gt;z[r][c]; } } display(z,rows,cols); //Function call rowsum(z,rows,cols); //Function call return 0; } void display(int arr[][cols],int rows,int cols) //function to display input { int r,c; for(r=0;r&lt;rows;r++) { for(c=0;c&lt;cols;c++) { cout&lt;&lt;"Elements of array["&lt;&lt;r&lt;&lt;"]["&lt;&lt;c&lt;&lt;"]="&lt;&lt;arr[r][c]&lt;&lt;endl; } } } int rowsum(int arr[][cols],int rows,int cols) //Function to perform rowsum { int c,sum=0,r=0; for(c=0;c&lt;cols;c++) { sum=sum+arr[r][c]; cout&lt;&lt;"the sum of rows is:"&lt;&lt;sum&lt;&lt;endl; } return sum; } </code></pre> <p>Above is a C++ code which is using 2-D array.It takes input from user and that input is displayed using a display function.After taking input i want to sum the rows ,for which i have written a function named rowsum but it not working properly .It does not gives desired output.</p>
0debug
Only input boxes of bootstrap : <p>I am currently building a site and I wanted to style my input boxes like bootstrap ones, however I don't want to use other features provided by bootstrap. Could someone recommend me how I could just export that feature and include in my CSS. There maybe some JavaScript too I believe.</p> <p>Thank you in advance.</p>
0debug
css pseudo selectors with material-ui : <p>I have seen in a lot of the material-ui code that they use pseudo selectors in their react styled components. I thought I would try to do it myself and I cannot get it to work. I'm not sure what I am doing wrong or if this is even possible. </p> <p>I am trying to make some css that will offset this element against the fixed header.</p> <pre><code>import React from 'react'; import { createStyles, WithStyles, withStyles, Typography } from '@material-ui/core'; import { TypographyProps } from '@material-ui/core/Typography'; import GithubSlugger from 'github-slugger'; import Link from './link'; const styles = () =&gt; createStyles({ h: { '&amp;::before': { content: 'some content', display: 'block', height: 60, marginTop: -60 } } }); interface Props extends WithStyles&lt;typeof styles&gt;, TypographyProps { children: string; } const AutolinkHeader = ({ classes, children, variant }: Props) =&gt; { // I have to call new slugger here otherwise on a re-render it will append a 1 const slug = new GithubSlugger().slug(children); return ( &lt;Link to={`#${slug}`}&gt; &lt;Typography classes={{ root: classes.h }} id={slug} variant={variant} children={children} /&gt; &lt;/Link&gt; ); }; export default withStyles(styles)(AutolinkHeader); </code></pre>
0debug
Getting maximum Key Values in Map : <p>How do I get maximum key values in a Map and let's say save it to a List?</p> <p>For example, is there is a Map: John, 30 Alexander, 10 Ivan, 20 Steven, 30</p> <p>The result must be a List: John, Steven</p>
0debug
Check how many times a character occurs in a word (VB) : <p>I have an array that contains characters converted from a word via <code>.ToCharArray</code> method. I would like to check how many times a letter occurred in this array (word). How can I do this?</p>
0debug
How to exit process in node.js? : I want to exit node process when all data will be processed (fetch data, http request with axios and update data). When I run my script by typing `node script.js` it never ends. Script below: Keyword.find({ images: { $eq: [] } }) .limit(8) .exec((err, keywords) => { keywords.forEach((keyword) => { console.log(keyword.body); axios.get('https://www.example.com/?q=' + encodeURIComponent(keyword.body)) .then(function (response) { const dom = new JSDOM(response.data); let items = dom.window.document.querySelectorAll('div.item'); let images = []; items.forEach(((item) => { let url = item.querySelector('a.thumb').href; let source = item.querySelector('a.tit').href; let description = item.querySelector('div.des').innerHTML; images.push({ url, source, description }); })); Keyword.findByIdAndUpdate({ _id: keyword._id }, { $set: { images } }, (err2, result2) => { if (err2) console.log(err2); console.log(result2); }); }) .catch(function (error) { console.log(error); }); }); });
0debug
int qio_channel_socket_listen_sync(QIOChannelSocket *ioc, SocketAddress *addr, Error **errp) { int fd; trace_qio_channel_socket_listen_sync(ioc, addr); fd = socket_listen(addr, errp); if (fd < 0) { trace_qio_channel_socket_listen_fail(ioc); return -1; } trace_qio_channel_socket_listen_complete(ioc, fd); if (qio_channel_socket_set_fd(ioc, fd, errp) < 0) { close(fd); return -1; } qio_channel_set_feature(QIO_CHANNEL(ioc), QIO_CHANNEL_FEATURE_LISTEN); return 0; }
1threat
static void core_region_del(MemoryListener *listener, MemoryRegionSection *section) { cpu_register_physical_memory_log(section, false); }
1threat
What's the difference between IClonable and partial classes : <p>What's the difference between using <code>System.IClonable</code> and <code>partial</code> classes? And if there is one difference, when should one be used over the other? Are there some best practices?</p>
0debug
How can I get the values of multiple inputs by numbered ids and insert them into MySQL : <p>I tried to create a multi insert form where you can insert as many tiles and related languages as you want by filling in a number. The display of the Titles and language works fine, but I'm not able to get the different values and insert them into db. My aim is it that every Title with its Lang gets a unique ID in the db.</p> <pre><code>&lt;form method="POST" action="" enctype="multipart/form-data"&gt; &lt;table&gt; &lt;tr&gt; &lt;th&gt;Title&lt;/th&gt; &lt;th&gt;Language&lt;/th&gt; &lt;/tr&gt; &lt;/table&gt; &lt;input id="count" type="number" placeholder="Number of Titles"&gt; &lt;input type="button" id="plus" value="+"&gt; &lt;input type="submit" id="save" name="save" value="Save"&gt; &lt;script type="text/javascript"&gt; $('#plus').on('click', function(){ var queryString = ""; var count = $('#count').val(); var i; for(i = 1; i &lt;= count; i++){ $('table').append('&lt;tr&gt;&lt;td&gt;&lt;input name="title" type="text" placeholder="Title" id="Title_'+i+'" autocomplete="off" class="title"&gt;&lt;/td&gt;&lt;td&gt;&lt;select name="lang" id="Lang_'+i+'"&gt;&lt;option value="0"&gt;Romaji&lt;/option&gt;&lt;option value="ja"&gt;Japanese&lt;/option&gt;&lt;option value="en"&gt;English&lt;/option&gt;&lt;option value="de"&gt;German&lt;/option&gt;&lt;option value="ru"&gt;Russian&lt;/option&gt;&lt;/select&gt;&lt;/td&gt;&lt;/tr&gt;'); } }); $('#save').on('click', function(){ var Title = $('#Title_'+i).val(); console.log(Title); queryString ='title='+Title+'&amp;lang='+Lang; jQuery.ajax({ url: "action/insert.php", data: queryString, type: "POST", success:function(data){ location.reload(); }, }); }); &lt;/script&gt; &lt;/form&gt; </code></pre> <p>I also tried to get the value of the inputs via Jquery and send them with Jquery Ajax to the PHP file but I only get the output "undefined" when I tried to show the values in console</p> <p>The insert.php</p> <pre><code>&lt;?php require "../config.php"; $title= $_POST['title']; $lang= $_POST["lang"]; $sql = "INSERT INTO MyGuests (title, lang) VALUES ('".$_POST['']."', '".$_POST['']."');"; $sql .= "INSERT INTO MyGuests (title, lang) VALUES ('".$_POST['']."', '".$_POST['']."');"; $sql .= "INSERT INTO MyGuests (title, lang) VALUES ('".$_POST['']."', '".$_POST['']."')"; ... mysqli_multi_query($conn, $sql); ?&gt; </code></pre>
0debug
Unexpected token operator «=», expected punc «,» : <p>i am getting the following error</p> <blockquote> <p>Parse error: Unexpected token operator «=», expected punc «,» Line 159, column 26</p> </blockquote> <p>This is my code</p> <pre><code> function fitBounds(type="all", shape=null) { var bounds = new google.maps.LatLngBounds(); if ( type == "all" ){ if ((circles.length &gt; 0) | (polygons.length &gt; 0)){ $.each(circles, function(index, circle){ bounds.union(circle.getBounds()); }); $.each(polygons, function(index, polygon){ polygon.getPath().getArray().forEach(function(latLng){ bounds.extend(latLng); }); }); } } else if ( (type == "single") &amp;&amp; (shape != null) ) { if (shape.type == google.maps.drawing.OverlayType.MARKER) { marker_index = markers.indexOf(shape); bounds.union(circles[marker_index].getBounds()); } else { shape.getPath().getArray().forEach(function(latLng){ bounds.extend(latLng); }); } } if (bounds.isEmpty() != true) { map.fitBounds(bounds); } } </code></pre>
0debug
How do I delete the last character in each line using vim : <p>I have a file:</p> <pre><code>12345a 123456b 1234567c 12345678d 123456789e </code></pre> <p>How do I delete the last character in each line.<br> And the file will be<br></p> <pre><code>12345 123456 1234567 12345678 123456789 </code></pre>
0debug
What is the easiest way to allow users of my Django site to search for posts that I've written on the site? : <p>I don't want to write a search algorithm and I suspect that there must be a library or script to do this. Are there any suggestions? Thank you very much.</p>
0debug
static void pxb_dev_exitfn(PCIDevice *pci_dev) { PXBDev *pxb = PXB_DEV(pci_dev); pxb_dev_list = g_list_remove(pxb_dev_list, pxb); }
1threat
Indy delphi 10.2 : using delphi 10.2 and getting a 400 bad request exception using Idhttp1.get call. This app was working as of 11/7/2019 and now it's not working. I can enter the http call string into any browser it it works correctly but not indy any more. my request string is accept text/html,*/* accept charset UTF-8 basicauthentication true contentType Text/xml UserAgent Mozilla/4.0 (compatible; MyApp)Mozilla/4.0 (compatible; MyApp)
0debug
static av_cold int xvid_encode_init(AVCodecContext *avctx) { int xerr, i, ret = -1; int xvid_flags = avctx->flags; struct xvid_context *x = avctx->priv_data; uint16_t *intra, *inter; int fd; xvid_plugin_single_t single = { 0 }; struct xvid_ff_pass1 rc2pass1 = { 0 }; xvid_plugin_2pass2_t rc2pass2 = { 0 }; xvid_plugin_lumimasking_t masking_l = { 0 }; xvid_plugin_lumimasking_t masking_v = { 0 }; xvid_plugin_ssim_t ssim = { 0 }; xvid_gbl_init_t xvid_gbl_init = { 0 }; xvid_enc_create_t xvid_enc_create = { 0 }; xvid_enc_plugin_t plugins[4]; x->twopassfd = -1; x->vop_flags = XVID_VOP_HALFPEL; if (xvid_flags & AV_CODEC_FLAG_4MV) x->vop_flags |= XVID_VOP_INTER4V; if (avctx->trellis) x->vop_flags |= XVID_VOP_TRELLISQUANT; if (xvid_flags & AV_CODEC_FLAG_AC_PRED) x->vop_flags |= XVID_VOP_HQACPRED; if (xvid_flags & AV_CODEC_FLAG_GRAY) x->vop_flags |= XVID_VOP_GREYSCALE; x->me_flags = 0; switch (x->me_quality) { case 6: case 5: x->me_flags |= XVID_ME_EXTSEARCH16 | XVID_ME_EXTSEARCH8; case 4: case 3: x->me_flags |= XVID_ME_ADVANCEDDIAMOND8 | XVID_ME_HALFPELREFINE8 | XVID_ME_CHROMA_PVOP | XVID_ME_CHROMA_BVOP; case 2: case 1: x->me_flags |= XVID_ME_ADVANCEDDIAMOND16 | XVID_ME_HALFPELREFINE16; #if FF_API_MOTION_EST FF_DISABLE_DEPRECATION_WARNINGS break; default: switch (avctx->me_method) { case ME_FULL: x->me_flags |= XVID_ME_EXTSEARCH16 | XVID_ME_EXTSEARCH8; case ME_EPZS: x->me_flags |= XVID_ME_ADVANCEDDIAMOND8 | XVID_ME_HALFPELREFINE8 | XVID_ME_CHROMA_PVOP | XVID_ME_CHROMA_BVOP; case ME_LOG: case ME_PHODS: case ME_X1: x->me_flags |= XVID_ME_ADVANCEDDIAMOND16 | XVID_ME_HALFPELREFINE16; case ME_ZERO: default: break; } FF_ENABLE_DEPRECATION_WARNINGS #endif } switch (avctx->mb_decision) { case 2: x->vop_flags |= XVID_VOP_MODEDECISION_RD; x->me_flags |= XVID_ME_HALFPELREFINE8_RD | XVID_ME_QUARTERPELREFINE8_RD | XVID_ME_EXTSEARCH_RD | XVID_ME_CHECKPREDICTION_RD; case 1: if (!(x->vop_flags & XVID_VOP_MODEDECISION_RD)) x->vop_flags |= XVID_VOP_FAST_MODEDECISION_RD; x->me_flags |= XVID_ME_HALFPELREFINE16_RD | XVID_ME_QUARTERPELREFINE16_RD; default: break; } #if FF_API_GMC if (avctx->flags & CODEC_FLAG_GMC) x->gmc = 1; #endif x->vol_flags = 0; if (x->gmc) { x->vol_flags |= XVID_VOL_GMC; x->me_flags |= XVID_ME_GME_REFINE; } if (xvid_flags & AV_CODEC_FLAG_QPEL) { x->vol_flags |= XVID_VOL_QUARTERPEL; x->me_flags |= XVID_ME_QUARTERPELREFINE16; if (x->vop_flags & XVID_VOP_INTER4V) x->me_flags |= XVID_ME_QUARTERPELREFINE8; } xvid_gbl_init.version = XVID_VERSION; xvid_gbl_init.debug = 0; xvid_gbl_init.cpu_flags = 0; xvid_global(NULL, XVID_GBL_INIT, &xvid_gbl_init, NULL); xvid_enc_create.version = XVID_VERSION; xvid_enc_create.width = x->xsize = avctx->width; xvid_enc_create.height = x->ysize = avctx->height; xvid_enc_create.zones = NULL; xvid_enc_create.num_zones = 0; xvid_enc_create.num_threads = avctx->thread_count; #if (XVID_VERSION <= 0x010303) && (XVID_VERSION >= 0x010300) if (avctx->height <= 16) { if (avctx->thread_count < 2) { xvid_enc_create.num_threads = 0; } else { av_log(avctx, AV_LOG_ERROR, "Too small height for threads > 1."); return AVERROR(EINVAL); } } #endif xvid_enc_create.plugins = plugins; xvid_enc_create.num_plugins = 0; x->twopassbuffer = NULL; x->old_twopassbuffer = NULL; x->twopassfile = NULL; if (xvid_flags & AV_CODEC_FLAG_PASS1) { rc2pass1.version = XVID_VERSION; rc2pass1.context = x; x->twopassbuffer = av_malloc(BUFFER_SIZE); x->old_twopassbuffer = av_malloc(BUFFER_SIZE); if (!x->twopassbuffer || !x->old_twopassbuffer) { av_log(avctx, AV_LOG_ERROR, "Xvid: Cannot allocate 2-pass log buffers\n"); return AVERROR(ENOMEM); } x->twopassbuffer[0] = x->old_twopassbuffer[0] = 0; plugins[xvid_enc_create.num_plugins].func = xvid_ff_2pass; plugins[xvid_enc_create.num_plugins].param = &rc2pass1; xvid_enc_create.num_plugins++; } else if (xvid_flags & AV_CODEC_FLAG_PASS2) { rc2pass2.version = XVID_VERSION; rc2pass2.bitrate = avctx->bit_rate; fd = avpriv_tempfile("xvidff.", &x->twopassfile, 0, avctx); if (fd < 0) { av_log(avctx, AV_LOG_ERROR, "Xvid: Cannot write 2-pass pipe\n"); return fd; } x->twopassfd = fd; if (!avctx->stats_in) { av_log(avctx, AV_LOG_ERROR, "Xvid: No 2-pass information loaded for second pass\n"); return AVERROR(EINVAL); } ret = write(fd, avctx->stats_in, strlen(avctx->stats_in)); if (ret == -1) ret = AVERROR(errno); else if (strlen(avctx->stats_in) > ret) { av_log(avctx, AV_LOG_ERROR, "Xvid: Cannot write to 2-pass pipe\n"); ret = AVERROR(EIO); } if (ret < 0) return ret; rc2pass2.filename = x->twopassfile; plugins[xvid_enc_create.num_plugins].func = xvid_plugin_2pass2; plugins[xvid_enc_create.num_plugins].param = &rc2pass2; xvid_enc_create.num_plugins++; } else if (!(xvid_flags & AV_CODEC_FLAG_QSCALE)) { single.version = XVID_VERSION; single.bitrate = avctx->bit_rate; plugins[xvid_enc_create.num_plugins].func = xvid_plugin_single; plugins[xvid_enc_create.num_plugins].param = &single; xvid_enc_create.num_plugins++; } if (avctx->lumi_masking != 0.0) x->lumi_aq = 1; if (x->lumi_aq) { masking_l.method = 0; plugins[xvid_enc_create.num_plugins].func = xvid_plugin_lumimasking; plugins[xvid_enc_create.num_plugins].param = avctx->lumi_masking ? NULL : &masking_l; xvid_enc_create.num_plugins++; } if (x->variance_aq) { masking_v.method = 1; plugins[xvid_enc_create.num_plugins].func = xvid_plugin_lumimasking; plugins[xvid_enc_create.num_plugins].param = &masking_v; xvid_enc_create.num_plugins++; } if (x->lumi_aq && x->variance_aq ) av_log(avctx, AV_LOG_INFO, "Both lumi_aq and variance_aq are enabled. The resulting quality" "will be the worse one of the two effects made by the AQ.\n"); if (x->ssim) { plugins[xvid_enc_create.num_plugins].func = xvid_plugin_ssim; ssim.b_printstat = x->ssim == 2; ssim.acc = x->ssim_acc; ssim.cpu_flags = xvid_gbl_init.cpu_flags; ssim.b_visualize = 0; plugins[xvid_enc_create.num_plugins].param = &ssim; xvid_enc_create.num_plugins++; } xvid_correct_framerate(avctx); xvid_enc_create.fincr = avctx->time_base.num; xvid_enc_create.fbase = avctx->time_base.den; if (avctx->gop_size > 0) xvid_enc_create.max_key_interval = avctx->gop_size; else xvid_enc_create.max_key_interval = 240; if (xvid_flags & AV_CODEC_FLAG_QSCALE) x->qscale = 1; else x->qscale = 0; xvid_enc_create.min_quant[0] = avctx->qmin; xvid_enc_create.min_quant[1] = avctx->qmin; xvid_enc_create.min_quant[2] = avctx->qmin; xvid_enc_create.max_quant[0] = avctx->qmax; xvid_enc_create.max_quant[1] = avctx->qmax; xvid_enc_create.max_quant[2] = avctx->qmax; x->intra_matrix = x->inter_matrix = NULL; #if FF_API_PRIVATE_OPT FF_DISABLE_DEPRECATION_WARNINGS if (avctx->mpeg_quant) x->mpeg_quant = avctx->mpeg_quant; FF_ENABLE_DEPRECATION_WARNINGS #endif if (x->mpeg_quant) x->vol_flags |= XVID_VOL_MPEGQUANT; if ((avctx->intra_matrix || avctx->inter_matrix)) { x->vol_flags |= XVID_VOL_MPEGQUANT; if (avctx->intra_matrix) { intra = avctx->intra_matrix; x->intra_matrix = av_malloc(sizeof(unsigned char) * 64); if (!x->intra_matrix) return AVERROR(ENOMEM); } else intra = NULL; if (avctx->inter_matrix) { inter = avctx->inter_matrix; x->inter_matrix = av_malloc(sizeof(unsigned char) * 64); if (!x->inter_matrix) return AVERROR(ENOMEM); } else inter = NULL; for (i = 0; i < 64; i++) { if (intra) x->intra_matrix[i] = (unsigned char) intra[i]; if (inter) x->inter_matrix[i] = (unsigned char) inter[i]; } } xvid_enc_create.frame_drop_ratio = 0; xvid_enc_create.global = 0; if (xvid_flags & AV_CODEC_FLAG_CLOSED_GOP) xvid_enc_create.global |= XVID_GLOBAL_CLOSED_GOP; avctx->extradata = NULL; avctx->extradata_size = 0; if (xvid_flags & AV_CODEC_FLAG_GLOBAL_HEADER) { x->quicktime_format = 1; avctx->codec_id = AV_CODEC_ID_MPEG4; } else { x->quicktime_format = 0; if (!avctx->codec_tag) avctx->codec_tag = AV_RL32("xvid"); } xvid_enc_create.max_bframes = avctx->max_b_frames; xvid_enc_create.bquant_offset = 100 * avctx->b_quant_offset; xvid_enc_create.bquant_ratio = 100 * avctx->b_quant_factor; if (avctx->max_b_frames > 0 && !x->quicktime_format) xvid_enc_create.global |= XVID_GLOBAL_PACKED; av_assert0(xvid_enc_create.num_plugins + (!!x->ssim) + (!!x->variance_aq) + (!!x->lumi_aq) <= FF_ARRAY_ELEMS(plugins)); if (x->quicktime_format) { AVFrame *picture; AVPacket packet; int size, got_packet, ret; av_init_packet(&packet); picture = av_frame_alloc(); if (!picture) return AVERROR(ENOMEM); xerr = xvid_encore(NULL, XVID_ENC_CREATE, &xvid_enc_create, NULL); if( xerr ) { av_frame_free(&picture); av_log(avctx, AV_LOG_ERROR, "Xvid: Could not create encoder reference\n"); return AVERROR_EXTERNAL; } x->encoder_handle = xvid_enc_create.handle; size = ((avctx->width + 1) & ~1) * ((avctx->height + 1) & ~1); picture->data[0] = av_malloc(size + size / 2); if (!picture->data[0]) { av_frame_free(&picture); return AVERROR(ENOMEM); } picture->data[1] = picture->data[0] + size; picture->data[2] = picture->data[1] + size / 4; memset(picture->data[0], 0, size); memset(picture->data[1], 128, size / 2); ret = xvid_encode_frame(avctx, &packet, picture, &got_packet); if (!ret && got_packet) av_packet_unref(&packet); av_free(picture->data[0]); av_frame_free(&picture); xvid_encore(x->encoder_handle, XVID_ENC_DESTROY, NULL, NULL); } xerr = xvid_encore(NULL, XVID_ENC_CREATE, &xvid_enc_create, NULL); if (xerr) { av_log(avctx, AV_LOG_ERROR, "Xvid: Could not create encoder reference\n"); return AVERROR_EXTERNAL; } x->encoder_handle = xvid_enc_create.handle; return 0; }
1threat
No Such table error(while the table is already exist)... in sqlite database android : <p>Android Monitor:</p> <pre><code> android.database.sqlite.SQLiteException: no such table: dates (code 1): , while compiling: SELECT dateId FROM dates </code></pre> <p>This is my dates table:</p> <pre><code> db.execSQL("CREATE TABLE "+Date_TABLE+"("+ KEY_DATE_ID+" INTEGER PRIMARY KEY, "+ KEY_DATE+" DATE);" ); </code></pre>
0debug
Python prints my class object memory address instead of values of my array : <p>I want to print each element registered in my "student_list" array. But Python prints the memory location of each of my values. I am totally new to OOP using python. Any help or comments are highly appreciated.</p> <pre><code>class Student(): def __init__(self, name, grade_level, subject, grade): self.name = name self.grade_level = grade_level self.subject = subject self.grade = grade @classmethod def student_input(cls): return cls( input("Name: "), input("Garde Level: "), input("Subject: "), int(input("Grade: ")), ) def student_info(self): print("************************") print("Name: " + self.name+"\n"+"Grade Level: "+self.grade_level + "\n"+"Subject: "+self.subject + "\n"+"Grade: "+str(self.grade)) print("************************") student_list = [] print("**********************") user1 = Student.student_input() student_list.append(user1) print("**********************") user2 = Student.student_input() student_list.append(user2) print("**********************") print(user1.student_info) for student in student_list: print(student) </code></pre> <h2>Output:</h2> <pre><code>PS C:\Users\D3L10\Documents\PythonML\iPythonProj&gt; python .\schoolSystem.py ********************** Name: Andy Garde Level: Freshman Subject: Physics Grade: 92 ********************** Name: James Garde Level: Sophmore Subject: Algebra Grade: 82 ********************** &lt;bound method Student.student_info of &lt;__main__.Student object at 0x00580610&gt;&gt; &lt;__main__.Student object at 0x00580610&gt; &lt;__main__.Student object at 0x00819DB0&gt; </code></pre>
0debug
Get url parameter and hashed value from an url in javascript : I have a url `http://local.evibe-dash.in/tickets/123?ref=avl-error#10610` I want to get ref=avl-error and 10610 in two variable for Example somthing like that var1 = 'avl-error'; var2 = 10610; How can I get it in javascript or jQuery
0debug
Add one hour to PHP variable with date : <p>The title says it all. I have a PHP variable that says: <code>07/05/2016</code>.</p> <p>I've tried <code>strtodate</code>, the <code>date</code> function, but nothing seems to be working. <strong>How can I now add one hour to this date?</strong></p>
0debug
When OutofMemory error occurs in Android? : I am parsing JSON String fetched from web.(Around 40,000 records in a single chunk). I call AsyncTask recursively(40k records retrieved in a single call) until i fetched all the records from server(Total records 2 lac). In first two calls app responds smooth and around 80k records fetched from server, but in third call OutOfMemory error occurs. I searched the web and got to know that this error occurs when heap size overflowed. String response = ""; try { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpEntity httpEntity = null; HttpResponse httpResponse = null; HttpPost httpPost = new HttpPost("http://URL"); httpPost.setEntity(new StringEntity(strings[0])); httpPost.setHeader("Content-Type", "application/json"); httpPost.setHeader("Accept", "application/json"); httpResponse = httpClient.execute(httpPost); httpEntity = httpResponse.getEntity(); response = EntityUtils.toString(httpEntity); Error occurs on the below line. response = EntityUtils.toString(httpEntity); My code works fine for first 2 calls, then why it throws OutOfMemory in next call? Why first two calls works fine with the same size of data? I know their are many questions regarding OutOfMemory error. But, I want to know that how android allocates the heap size? Does it depends on the free memory of device? Does the size of heap reduced by android when the size of app data increase or it remains same? Please ignore if you found this question worthless. :)
0debug
why an extra comma in the shape of a single index numpy array : <p>A numpy array a a = numpy.arange(12) </p> <p>has shape a.shape = (12,)</p> <p>Why do we need the comma? is shape (12) reserved for something else?</p>
0debug
How do i return a string of hex in C? : I have a cryptographic program in which i need to represent each character by its hex value and return all of these hex value as a char string. After multiple crypto functions i got a final decimal value of each char. Now at the end of a for cycle i need to put all of them in a string containing each character hex value separated by space. In short, i have decimal number, which i need to convert to hex and put them in a string for return. Thanks for responses. I tried sprintf but i obviously cant put it into char string because it can only hold one char per index.
0debug
working with data in java : I've been using a formula for some time to try to find value in spreads for sports betting and done this by basically creating my own spread and comparing to what bookies offer and would like to automate the process. I've written some code in java which will do the maths on the data i give it and i'm looking for a way to populate the input data either from a database or from an xml file i create but i'm quite new to programming. Say for example if i pick two teams to compare. for each team i need a list of the teams they played, how many points each team scored in total, how many points each team conceded in total and how many games each team played so i can run the maths on those figures and i have no idea where to start. could anyone help me or point me in the right direction? Thanks in advance
0debug
void json_end_object(QJSON *json) { qstring_append(json->str, " }"); json->omit_comma = false; }
1threat
static void perf_yield(void) { unsigned int i, maxcycles; double duration; maxcycles = 100000000; i = maxcycles; Coroutine *coroutine = qemu_coroutine_create(yield_loop); g_test_timer_start(); while (i > 0) { qemu_coroutine_enter(coroutine, &i); } duration = g_test_timer_elapsed(); g_test_message("Yield %u iterations: %f s\n", maxcycles, duration); }
1threat
Javascript or PHP Array search like SQL %seacrch% : <p>Hello i'm trying to search in a Array like SQL with the "Like %search%" statement Has anybody an idea? I need this.</p>
0debug
onClick() Methot can not find Exception : I get this error. > java.lang.IllegalStateException: Could not find method Clicked(View) in a parent or ancestor Context for android:onClick attribute defined on view class android.support.v7.widget.AppCompatButton with id 'button2' I'm using in my app a different java class. My Java Class https://pasteb in.com/gwdf1Zrf My XML https://pasteb in.com/b0SQUPvW I can get onClick() method on MainActivity but I want to get on " another.java "
0debug
Making Tabs with CSS and Javascript work : <p>I have tried to make the snippet work somewhat. I'm just starting out with this and I have only currently designed it for my phone. You can see the problem by clicking on projects and today.</p> <p>I have a div(<code>#data-container</code>) which consists of two divs(<code>.project, .today</code>) and I want those two divs to be side by side acting like tabs. So, that when I click on their respective button it swipes and shows the respective div. I've got it working but with 2 problems.</p> <p><strong>How they work</strong> - The <code>#data-container</code> has <code>white-space: nowrap</code>(child divs won't wrap and stay side by side and the sliding will work) and it's child div's(<code>.project and .today</code>) are set to <code>width: 100%</code> and <code>inline-block</code>. </p> <p><strong>Problems with this</strong></p> <ol> <li><p>The <code>data-container</code> needs to be able to scroll vertically and can wrap text around the currently selected div but <code>white-space: nowrap</code> makes the text overflow. I have tried <code>word-wrap: break-word</code>, it doesn't work. I can also make it work by setting the <code>display: hidden</code> but I want the divs to swipe.</p></li> <li><p>I don't understand why this problem is happening. When I set the <code>#data-container</code> to <code>overflow-y: scroll</code>, it makes the divs horizontally scroll able which breaks the whole system. </p></li> </ol> <p>I need a way to make the <code>data-container</code> only vertically scroll able and to wrap text.</p> <p><strong>Jade</strong></p> <pre><code>extends ./layout.jade block content #maindiv .sidebar #profile img(src= ' #{image} ', width=40, height=40) span #{name} ul li Home li +Project li +Task li Reminders li Statistics li Settings li Help li a(href='/logout') Log Out header span ☰ h1 LifeHub .container .navbar .navbar-inside-one.below h2 Projects .navbar-inside-two.above h2 Today #data-container .project p It's lonely here. You should add some projects. .today input#task(type='text', placeholder='+ Add a New Task', autocomplete='off') </code></pre> <p><strong>CSS</strong></p> <pre><code>.container { position: relative; } .below { z-index: 0; box-shadow: 0; background-color: white; color: black; } .above { z-index: 1; box-shadow: 2px 2px 2px 1px #b0b0b0; background-color: #26A69A; color: white; } #data-container { position: relative; height: 93%; overflow-y: scroll; white-space: nowrap; width: 100%; z-index: 0; } .navbar { text-align: center; font-size: 26px; height: 7%; min-height: 50px; } .navbar-inside-one, .navbar-inside-two { position: relative; display: inline-block; width: 50%; height: 100%; padding: 10px 10px 10px 10px; } .project, .today { display: inline-block; position: relative; width: 100%; word-wrap: break-all; font-size: 28px; line-height: 1.63em; } </code></pre> <p>Animating with Javascript</p> <pre><code> $('.navbar-inside-two').click(function() { $(".project, .today").animate({left: "-" + $("#data-container").width()}, 200); $(".navbar-inside-one").removeClass('below').addClass('above'); $(this).removeClass('above').addClass('below'); }); $('.navbar-inside-one').click(function() { $(".project, .today").animate({left: "0"}, 200); $(".navbar-inside-two").removeClass('below').addClass('above'); $(this).removeClass('above').addClass('below'); }); </code></pre> <p><div class="snippet" data-lang="js" data-hide="true"> <div class="snippet-code snippet-currently-hidden"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() { //Height function for container and sidebar (function() { $(".container, .sidebar").height($("#maindiv").height() - $('header').height()); $(".sidebar").css('top', 49); //TO BE MADE AGAIN })(); $('span').click(function() { var sidebar = $('.sidebar').css('left').replace(/([a-z])\w+/g, ''); if (sidebar &lt; 0) { $('.sidebar').animate({ 'left': '0px' }, 200); $('.container').animate({ 'left': '150px' }, 200) } else { $('.sidebar').animate({ 'left': '-150px' }, 200); $('.container').animate({ 'left': '0px' }, 200) } }); $('.navbar-inside-two').click(function() { $(".project, .today").animate({ left: "-" + $("#data-container").width() }, 200); $(".navbar-inside-one").removeClass('below').addClass('above'); $(this).removeClass('above').addClass('below'); }); $('.navbar-inside-one').click(function() { $(".project, .today").animate({ left: "0" }, 200); $(".navbar-inside-two").removeClass('below').addClass('above'); $(this).removeClass('above').addClass('below'); }); });</code></pre> <pre class="snippet-code-css lang-css prettyprint-override"><code>/* Messed up Css from multiple Sass files */ .font-head, .navbar, .sidebar { font-family: 'Poiret One', cursive; font-weight: 100; letter-spacing: 2.2px; } .font-para, input[type='text'] { font-family: 'Source Sans Pro', sans-serif; font-weight: 100; letter-spacing: 1.4px; } * { box-sizing: border-box; -webkit-font-smoothing: antialiased; font-family: 'Source Sans Pro', sans-serif; } html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; } /* HTML5 display-role reset for older browsers */ article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; } body { line-height: 1; } ol, ul { list-style: none; } a { text-decoration: none; color: white; } header { width: 100%; background-color: #1a70c5; padding: 10px; } span { box-sizing: border-box; position: relative; font-size: 28px; color: #F8F8F8; } h1 { font-family: 'Poiret One', cursive; letter-spacing: 2.2px; margin-left: 10px; color: white; font-size: 28px; display: inline-block; } .container { position: relative; } .below { z-index: 0; box-shadow: 0; background-color: white; color: black; } .above { z-index: 1; box-shadow: 2px 2px 2px 1px #b0b0b0; background-color: #26A69A; color: white; } #data-container { position: relative; height: 93%; overflow-y: scroll; white-space: nowrap; width: 100%; z-index: 0; } .navbar { text-align: center; font-size: 26px; height: 7%; min-height: 50px; } .navbar-inside-one, .navbar-inside-two { position: relative; display: inline-block; width: 46%; height: 100%; padding: 10px 10px 10px 10px; } .project, .today { display: inline-block; position: relative; width: 100%; word-wrap: break-all; font-size: 24px; line-height: 1.63em; padding: 20px } input[type='text'] { position: static; border: none; background: transparent; font-size: 16px; line-height: 16px; width: 100%; height: 30px; color: black; } input[type='text']:focus { outline: none; border: none; } ::-webkit-input-placeholder { color: #D9D9D9; } ::-webkit-scrollbar { display: none; } #maindiv { width: 400px; height: 550px; position: absolute; top: 30%; left: 50%; -webkit-transform: translateX(-50%) translateY(-30%); transform: translateX(-50%) translateY(-30%); overflow: hidden; } .sidebar { position: fixed; left: -155px; height: 100%; bottom: 0px; width: 150px; background: #333; } .sidebar ul { padding: 0px 5px; } .sidebar li { color: #F7F7F7; font-weight: 100; font-size: 22px; text-align: center; margin-top: 30px; } .sidebar li:first-child { margin-top: 10px; } #profile { height: 50px; width: 98%; margin-top: 10px; } #profile img { vertical-align: middle; border: 1px solid #333; border-radius: 100%; } #profile span { display: inline-block; padding: 5px 0px 0px 10px; color: white; font-size: 18px; } @media (max-width: 450px) { #maindiv { width: 100%; height: 100%; } }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="maindiv"&gt; &lt;div class="sidebar"&gt; &lt;div id="profile"&gt; &lt;img src="something.jpg" width="40" height="40" /&gt;&lt;span&gt;Derp&lt;/span&gt; &lt;/div&gt; &lt;ul&gt; &lt;li&gt;Home&lt;/li&gt; &lt;li&gt;+Project&lt;/li&gt; &lt;li&gt;+Task&lt;/li&gt; &lt;li&gt;Reminders&lt;/li&gt; &lt;li&gt;Statistics&lt;/li&gt; &lt;li&gt;Settings&lt;/li&gt; &lt;li&gt;Help&lt;/li&gt; &lt;li&gt;&lt;a href="/logout"&gt;Log Out&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;header&gt;&lt;span&gt;☰&lt;/span&gt; &lt;h1&gt;Derp Title&lt;/h1&gt; &lt;/header&gt; &lt;div class="container"&gt; &lt;div class="navbar"&gt; &lt;div class="navbar-inside-one below"&gt; &lt;h2&gt;Projects&lt;/h2&gt; &lt;/div&gt; &lt;div class="navbar-inside-two above"&gt; &lt;h2&gt;Today&lt;/h2&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="data-container"&gt; &lt;div class="project"&gt; &lt;p&gt;Stupid paragraph dosen't wrap when supposed to&lt;/p&gt; &lt;/div&gt; &lt;div class="today"&gt; &lt;input id="task" type="text" placeholder="+ Add a New Task" autocomplete="off" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;</code></pre> </div> </div> </p>
0debug
Sequelize JSON data type : <p>I have defined a model as </p> <pre><code>module.exports = function (sequelize, DataTypes) { const MyModel = sequelize.define('MyModel', { data: { type: DataTypes.JSON, ... }, ... }); return MyModel; }; </code></pre> <p>I query it using </p> <pre><code>MyModel.findAll().then(myModels =&gt; ...); </code></pre> <p>However, <code>data</code> field in the query result is a string, not a JSON object. How do I fix it?</p>
0debug
get-childitem for subfolder : Im noob - i know... IF someone can ask my rather simple question $subfldr = Get-childitem -Name -Directory *_* $pctrlst = Get-childitem -Name -Include *.jpg $subfldr | ForEach-Object { $pctrlst | out-file pctrlst.txt } Why does it 4uck1n a55h0l3 #bad script` returns result for parent directory only? I surfed at MS sites for 36 hour but i didnt find the answer... I have idea why its dont work properly... Because output of the first cmdlet doesnt became input of the second command... How to make this piece of 541t work properly? PS: I really feel myself like a dumb... Forest Dumb... Focused Forest Dumb... Ill be happy if you share a link to some references...
0debug
Laravel: Get URL from routes BY NAME : <p>I'm trying to do something a little different and I couldn't find any way to do it. Maybe my approach is wrong but either way I figured I might find some help here.</p> <p>I have a Laravel 5 project and you know how you can get the current route name by using:</p> <pre><code>\Request::route()-&gt;getName(); </code></pre> <p>So I'm actually looking to do the exact opposite. Maybe not the exact opposite but what I need is to retrieve my route URL based on the name that I gave to that route. Here is my dream scenario.</p> <p>my <b>routes.php:</b></p> <pre><code>Route::any('/hos', "HospitalController@index")-&gt;name("hospital"); </code></pre> <p>What I <strong>would like to do</strong> in my controller that I have no idea how to or even if is possible:</p> <pre><code>// I have no idea if this is possible but thats what I'm trying to accomplish $my_route_url = \Request::route()-&gt;getURLByName("hospital"); echo $my_route_url; // this would echo: "/hos" </code></pre> <p>I might be using the wrong approach here so maybe you guys can help me out and shine some light on the issue.</p> <p>Thanks!</p>
0debug
Amazon web services and tensorflow : <p>As someone who has a laptop with insufficient processing power, I am having a hard time trying to train my neural network models. So, I thought of Amazon Web Services as a solution. But I have a few questions. First of all, as far as I know, Amazon SageMaker supports TensorFlow. I could not understand if the service is free or not though. I have heard some people say that it is free for a specific time, others say that it is free unless you surpass a limit. I would be more than happy if someone could clarify or put forward other alternatives that would help me out.<br> Thanks a lot! </p>
0debug
Powershell set Header on beinning of every C-File : <p>I need a dynamic solution approach to this problem:</p> <p>In Powershell I need to create a script/CMDLET which sets a specific header (Text) on all C-Files.</p> <p>Thanks for your support.</p>
0debug
static void fdt_add_pmu_nodes(const VirtMachineState *vms) { CPUState *cpu; ARMCPU *armcpu; uint32_t irqflags = GIC_FDT_IRQ_FLAGS_LEVEL_HI; CPU_FOREACH(cpu) { armcpu = ARM_CPU(cpu); if (!arm_feature(&armcpu->env, ARM_FEATURE_PMU) || !kvm_arm_pmu_create(cpu, PPI(VIRTUAL_PMU_IRQ))) { return; } } if (vms->gic_version == 2) { irqflags = deposit32(irqflags, GIC_FDT_IRQ_PPI_CPU_START, GIC_FDT_IRQ_PPI_CPU_WIDTH, (1 << vms->smp_cpus) - 1); } armcpu = ARM_CPU(qemu_get_cpu(0)); qemu_fdt_add_subnode(vms->fdt, "/pmu"); if (arm_feature(&armcpu->env, ARM_FEATURE_V8)) { const char compat[] = "arm,armv8-pmuv3"; qemu_fdt_setprop(vms->fdt, "/pmu", "compatible", compat, sizeof(compat)); qemu_fdt_setprop_cells(vms->fdt, "/pmu", "interrupts", GIC_FDT_IRQ_TYPE_PPI, VIRTUAL_PMU_IRQ, irqflags); } }
1threat
why dependency injection pattern in unit test is best when compared to other patterns in c# mstest? : <p>I am new to unit testing and i need to use dependency injection pattern.</p>
0debug
Change element of another class in HTML : <p>I'm studying HTML, PHP, CSS, Javascript and MySQL and in a particular project I'm having a problem trying to change the property of a class using hover. Here is an example:</p> <p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false"> <div class="snippet-code snippet-currently-hidden"> <pre class="snippet-code-css lang-css prettyprint-override"><code>html { height: 100%; } body { height: 100%; margin: 0; overflow: hidden; background-color: blue; background-image: url("../images/background.png"); background-repeat: no-repeat; background-size: 100% 100%; } .rain { position: absolute; left: 0; width: 100%; height: 100%; z-index: 2; } .rain.back-row { display: none; z-index: 1; bottom: 60px; opacity: 0.5; } body.back-row-toggle .rain.back-row { display: block; } .drop { position: absolute; bottom: 100%; width: 15px; height: 120px; pointer-events: none; animation: drop 0.5s linear infinite; } @keyframes drop { 0% { transform: translateY(0vh); } 75% { transform: translateY(90vh); } 100% { transform: translateY(90vh); } } .stem { width: 1px; height: 60%; margin-left: 7px; background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.25)); animation: stem 0.5s linear infinite; } @keyframes stem { 0% { opacity: 1; } 65% { opacity: 1; } 75% { opacity: 0; } 100% { opacity: 0; } } .splat { width: 15px; height: 10px; border-top: 2px dotted rgba(255, 255, 255, 0.5); border-radius: 50%; opacity: 1; transform: scale(0); animation: splat 0.5s linear infinite; display: none; } body.splat-toggle .splat { display: block; } @keyframes splat { 0% { opacity: 1; transform: scale(0); } 80% { opacity: 1; transform: scale(0); } 90% { opacity: 0.5; transform: scale(1); } 100% { opacity: 0; transform: scale(1.5); } } .loginp { position: relative; top: 45%; margin: 0 auto; width: 6.25%; margin: 0 auto; } .login, .pwr { position: relative; z-index: 3; height: 25px; color: white; border: none; border-radius: 5px; background-color: rgba(255, 255, 255, 0.1); transition: 1s; } label.ll, label.lp { top: 23px; left: 5px; position: relative; color: #9eb2c8; z-index: 2; transition: 1s; } input.login:focus~label.ll { color: red; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://code.jquery.com/jquery-2.2.4.min.js"&gt;&lt;/script&gt; &lt;!DOCTYPE html&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt; &lt;title&gt;Tela de Login&lt;/title&gt; &lt;meta name="description" content=""&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt; &lt;/head&gt; &lt;body onload="makeItRain()" class="back-row-toggle splat-toggle"&gt; &lt;div class="rain front-row"&gt;&lt;/div&gt; &lt;div class="rain back-row"&gt;&lt;/div&gt; &lt;div class="loginp"&gt; &lt;label class="ll"&gt;Login&lt;/label&gt; &lt;input class="login" type="text" name="login" placeholder="" /&gt; &lt;label class="lp"&gt;Senha&lt;/label&gt; &lt;input class="pwr" type="password" name="senha" placeholder="" /&gt; &lt;div&gt; &lt;script&gt; var makeItRain = function() { $('.rain').empty(); var increment = 0; var drops = ""; var backDrops = ""; while (increment &lt; 100) { var randoHundo = (Math.floor(Math.random() * (98 - 1 + 1) + 1)); var randoFiver = (Math.floor(Math.random() * (5 - 2 + 1) + 2)); increment += randoFiver; drops += '&lt;div class="drop" style="left: ' + increment + '%; bottom: ' + (randoFiver + randoFiver - 1 + 100) + '%; animation-delay: 0.' + randoHundo + 's; animation-duration: 0.5' + randoHundo + 's;"&gt;&lt;div class="stem" style="animation-delay: 0.' + randoHundo + 's; animation-duration: 0.5' + randoHundo + 's;"&gt;&lt;/div&gt;&lt;div class="splat" style="animation-delay: 0.' + randoHundo + 's; animation-duration: 0.5' + randoHundo + 's;"&gt;&lt;/div&gt;&lt;/div&gt;'; backDrops += '&lt;div class="drop" style="right: ' + increment + '%; bottom: ' + (randoFiver + randoFiver - 1 + 100) + '%; animation-delay: 0.' + randoHundo + 's; animation-duration: 0.5' + randoHundo + 's;"&gt;&lt;div class="stem" style="animation-delay: 0.' + randoHundo + 's; animation-duration: 0.5' + randoHundo + 's;"&gt;&lt;/div&gt;&lt;div class="splat" style="animation-delay: 0.' + randoHundo + 's; animation-duration: 0.5' + randoHundo + 's;"&gt;&lt;/div&gt;&lt;/div&gt;'; } $('.rain.front-row').append(drops); $('.rain.back-row').append(backDrops); } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> </div> </div> </p> <p>The function on CSS </p> <p><code>input.login:focus ~ label.ll { color: red; }</code></p> <p>My goal is that when the user passes the mouse over the <code>&lt;input class="login"&gt;</code> something to happen with <code>&lt;label class="ll"&gt;</code> label but I can not make it happen, where am I going wrong?</p>
0debug
static int64_t nfs_client_open(NFSClient *client, QDict *options, int flags, int open_flags, Error **errp) { int ret = -EINVAL; QemuOpts *opts = NULL; Error *local_err = NULL; struct stat st; char *file = NULL, *strp = NULL; qemu_mutex_init(&client->mutex); opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { error_propagate(errp, local_err); ret = -EINVAL; goto fail; } client->path = g_strdup(qemu_opt_get(opts, "path")); if (!client->path) { ret = -EINVAL; error_setg(errp, "No path was specified"); goto fail; } strp = strrchr(client->path, '/'); if (strp == NULL) { error_setg(errp, "Invalid URL specified"); goto fail; } file = g_strdup(strp); *strp = 0; client->server = nfs_config(options, errp); if (!client->server) { ret = -EINVAL; goto fail; } client->context = nfs_init_context(); if (client->context == NULL) { error_setg(errp, "Failed to init NFS context"); goto fail; } if (qemu_opt_get(opts, "user")) { client->uid = qemu_opt_get_number(opts, "user", 0); nfs_set_uid(client->context, client->uid); } if (qemu_opt_get(opts, "group")) { client->gid = qemu_opt_get_number(opts, "group", 0); nfs_set_gid(client->context, client->gid); } if (qemu_opt_get(opts, "tcp-syn-count")) { client->tcp_syncnt = qemu_opt_get_number(opts, "tcp-syn-count", 0); nfs_set_tcp_syncnt(client->context, client->tcp_syncnt); } #ifdef LIBNFS_FEATURE_READAHEAD if (qemu_opt_get(opts, "readahead-size")) { if (open_flags & BDRV_O_NOCACHE) { error_setg(errp, "Cannot enable NFS readahead " "if cache.direct = on"); goto fail; } client->readahead = qemu_opt_get_number(opts, "readahead-size", 0); if (client->readahead > QEMU_NFS_MAX_READAHEAD_SIZE) { warn_report("Truncating NFS readahead size to %d", QEMU_NFS_MAX_READAHEAD_SIZE); client->readahead = QEMU_NFS_MAX_READAHEAD_SIZE; } nfs_set_readahead(client->context, client->readahead); #ifdef LIBNFS_FEATURE_PAGECACHE nfs_set_pagecache_ttl(client->context, 0); #endif client->cache_used = true; } #endif #ifdef LIBNFS_FEATURE_PAGECACHE if (qemu_opt_get(opts, "page-cache-size")) { if (open_flags & BDRV_O_NOCACHE) { error_setg(errp, "Cannot enable NFS pagecache " "if cache.direct = on"); goto fail; } client->pagecache = qemu_opt_get_number(opts, "page-cache-size", 0); if (client->pagecache > QEMU_NFS_MAX_PAGECACHE_SIZE) { warn_report("Truncating NFS pagecache size to %d pages", QEMU_NFS_MAX_PAGECACHE_SIZE); client->pagecache = QEMU_NFS_MAX_PAGECACHE_SIZE; } nfs_set_pagecache(client->context, client->pagecache); nfs_set_pagecache_ttl(client->context, 0); client->cache_used = true; } #endif #ifdef LIBNFS_FEATURE_DEBUG if (qemu_opt_get(opts, "debug")) { client->debug = qemu_opt_get_number(opts, "debug", 0); if (client->debug > QEMU_NFS_MAX_DEBUG_LEVEL) { warn_report("Limiting NFS debug level to %d", QEMU_NFS_MAX_DEBUG_LEVEL); client->debug = QEMU_NFS_MAX_DEBUG_LEVEL; } nfs_set_debug(client->context, client->debug); } #endif ret = nfs_mount(client->context, client->server->host, client->path); if (ret < 0) { error_setg(errp, "Failed to mount nfs share: %s", nfs_get_error(client->context)); goto fail; } if (flags & O_CREAT) { ret = nfs_creat(client->context, file, 0600, &client->fh); if (ret < 0) { error_setg(errp, "Failed to create file: %s", nfs_get_error(client->context)); goto fail; } } else { ret = nfs_open(client->context, file, flags, &client->fh); if (ret < 0) { error_setg(errp, "Failed to open file : %s", nfs_get_error(client->context)); goto fail; } } ret = nfs_fstat(client->context, client->fh, &st); if (ret < 0) { error_setg(errp, "Failed to fstat file: %s", nfs_get_error(client->context)); goto fail; } ret = DIV_ROUND_UP(st.st_size, BDRV_SECTOR_SIZE); client->st_blocks = st.st_blocks; client->has_zero_init = S_ISREG(st.st_mode); *strp = '/'; goto out; fail: nfs_client_close(client); out: qemu_opts_del(opts); g_free(file); return ret; }
1threat
static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, long srcWidth, long srcHeight, long srcStride, long dstStride) { long x,y; dst[0]= src[0]; for (x=0; x<srcWidth-1; x++) { dst[2*x+1]= (3*src[x] + src[x+1])>>2; dst[2*x+2]= ( src[x] + 3*src[x+1])>>2; } dst[2*srcWidth-1]= src[srcWidth-1]; dst+= dstStride; for (y=1; y<srcHeight; y++) { #if COMPILE_TEMPLATE_MMX2 || COMPILE_TEMPLATE_AMD3DNOW const x86_reg mmxSize= srcWidth&~15; __asm__ volatile( "mov %4, %%"REG_a" \n\t" "movq "MANGLE(mmx_ff)", %%mm0 \n\t" "movq (%0, %%"REG_a"), %%mm4 \n\t" "movq %%mm4, %%mm2 \n\t" "psllq $8, %%mm4 \n\t" "pand %%mm0, %%mm2 \n\t" "por %%mm2, %%mm4 \n\t" "movq (%1, %%"REG_a"), %%mm5 \n\t" "movq %%mm5, %%mm3 \n\t" "psllq $8, %%mm5 \n\t" "pand %%mm0, %%mm3 \n\t" "por %%mm3, %%mm5 \n\t" "1: \n\t" "movq (%0, %%"REG_a"), %%mm0 \n\t" "movq (%1, %%"REG_a"), %%mm1 \n\t" "movq 1(%0, %%"REG_a"), %%mm2 \n\t" "movq 1(%1, %%"REG_a"), %%mm3 \n\t" PAVGB" %%mm0, %%mm5 \n\t" PAVGB" %%mm0, %%mm3 \n\t" PAVGB" %%mm0, %%mm5 \n\t" PAVGB" %%mm0, %%mm3 \n\t" PAVGB" %%mm1, %%mm4 \n\t" PAVGB" %%mm1, %%mm2 \n\t" PAVGB" %%mm1, %%mm4 \n\t" PAVGB" %%mm1, %%mm2 \n\t" "movq %%mm5, %%mm7 \n\t" "movq %%mm4, %%mm6 \n\t" "punpcklbw %%mm3, %%mm5 \n\t" "punpckhbw %%mm3, %%mm7 \n\t" "punpcklbw %%mm2, %%mm4 \n\t" "punpckhbw %%mm2, %%mm6 \n\t" #if 1 MOVNTQ" %%mm5, (%2, %%"REG_a", 2) \n\t" MOVNTQ" %%mm7, 8(%2, %%"REG_a", 2) \n\t" MOVNTQ" %%mm4, (%3, %%"REG_a", 2) \n\t" MOVNTQ" %%mm6, 8(%3, %%"REG_a", 2) \n\t" #else "movq %%mm5, (%2, %%"REG_a", 2) \n\t" "movq %%mm7, 8(%2, %%"REG_a", 2) \n\t" "movq %%mm4, (%3, %%"REG_a", 2) \n\t" "movq %%mm6, 8(%3, %%"REG_a", 2) \n\t" #endif "add $8, %%"REG_a" \n\t" "movq -1(%0, %%"REG_a"), %%mm4 \n\t" "movq -1(%1, %%"REG_a"), %%mm5 \n\t" " js 1b \n\t" :: "r" (src + mmxSize ), "r" (src + srcStride + mmxSize ), "r" (dst + mmxSize*2), "r" (dst + dstStride + mmxSize*2), "g" (-mmxSize) : "%"REG_a ); #else const x86_reg mmxSize=1; dst[0 ]= (3*src[0] + src[srcStride])>>2; dst[dstStride]= ( src[0] + 3*src[srcStride])>>2; #endif for (x=mmxSize-1; x<srcWidth-1; x++) { dst[2*x +1]= (3*src[x+0] + src[x+srcStride+1])>>2; dst[2*x+dstStride+2]= ( src[x+0] + 3*src[x+srcStride+1])>>2; dst[2*x+dstStride+1]= ( src[x+1] + 3*src[x+srcStride ])>>2; dst[2*x +2]= (3*src[x+1] + src[x+srcStride ])>>2; } dst[srcWidth*2 -1 ]= (3*src[srcWidth-1] + src[srcWidth-1 + srcStride])>>2; dst[srcWidth*2 -1 + dstStride]= ( src[srcWidth-1] + 3*src[srcWidth-1 + srcStride])>>2; dst+=dstStride*2; src+=srcStride; } #if 1 dst[0]= src[0]; for (x=0; x<srcWidth-1; x++) { dst[2*x+1]= (3*src[x] + src[x+1])>>2; dst[2*x+2]= ( src[x] + 3*src[x+1])>>2; } dst[2*srcWidth-1]= src[srcWidth-1]; #else for (x=0; x<srcWidth; x++) { dst[2*x+0]= dst[2*x+1]= src[x]; } #endif #if COMPILE_TEMPLATE_MMX __asm__ volatile(EMMS" \n\t" SFENCE" \n\t" :::"memory"); #endif }
1threat
static char *get_content_url(xmlNodePtr *baseurl_nodes, int n_baseurl_nodes, char *rep_id_val, char *rep_bandwidth_val, char *val) { int i; char *text; char *url = NULL; char tmp_str[MAX_URL_SIZE]; char tmp_str_2[MAX_URL_SIZE]; memset(tmp_str, 0, sizeof(tmp_str)); for (i = 0; i < n_baseurl_nodes; ++i) { if (baseurl_nodes[i] && baseurl_nodes[i]->children && baseurl_nodes[i]->children->type == XML_TEXT_NODE) { text = xmlNodeGetContent(baseurl_nodes[i]->children); if (text) { memset(tmp_str, 0, sizeof(tmp_str)); memset(tmp_str_2, 0, sizeof(tmp_str_2)); ff_make_absolute_url(tmp_str_2, MAX_URL_SIZE, tmp_str, text); av_strlcpy(tmp_str, tmp_str_2, sizeof(tmp_str)); xmlFree(text); } } } if (val) av_strlcat(tmp_str, (const char*)val, sizeof(tmp_str)); if (rep_id_val) { url = av_strireplace(tmp_str, "$RepresentationID$", (const char*)rep_id_val); if (!url) { return NULL; } av_strlcpy(tmp_str, url, sizeof(tmp_str)); av_free(url); } if (rep_bandwidth_val && tmp_str[0] != '\0') { url = av_strireplace(tmp_str, "$Bandwidth$", (const char*)rep_bandwidth_val); if (!url) { return NULL; } } return url; }
1threat
Multipart/form-data file upload in asp.net core web api : <p>How to do Multipart-form-data file upload in asp.net core web api? Is it possible to POST both JSON and the image at the same time in a single POST?</p>
0debug
Issues with my website copyright footer : <p>Not really code related but website related which in a different view is programming. The copyright footer on a website has to be of current year, right!?! </p>
0debug
can someone help me why this bitcount code does not work? : I'm now doing the bit.c lab, and I make the function bitCount, I think it's perfect but it cannot pass the test. I don't know why. please help! int bitCount(int x) { unsigned int a = 0x01010101; int b; int result = 0; result += a&x; result += a&(x>>1); result += a&(x>>2); result += a&(x>>3); result += a&(x>>4); result += a&(x>>5); result += a&(x>>6); result += a&(x>>7); b = result + result >> 8; b = b + result >> 16; b = b + result >> 24; return b&0xff; }
0debug
static void bdrv_co_complete(BlockAIOCBCoroutine *acb) { if (!acb->need_bh) { acb->common.cb(acb->common.opaque, acb->req.error); qemu_aio_unref(acb); } }
1threat
static int v9fs_synth_link(FsContext *fs_ctx, V9fsPath *oldpath, V9fsPath *newpath, const char *buf) { errno = EPERM; return -1; }
1threat
Typescript Return Type: void : <p>In Typescript (using in an Angular project) for a method that returns nothing (void), which of the below is best practice?</p> <pre><code>onSelect(someNumber: number): void { } </code></pre> <p>OR</p> <pre><code>onSelect(someNumber: number) { } </code></pre> <p>I've seen it both ways in different examples and wasn't sure if it is better to add the return type as void or leave it blank?</p>
0debug
PHP Subtracting two number gives wrong values : <p>My PHP code:</p> <pre><code>$a = 25,787; $b = 5,661; $c = $b - $a; </code></pre> <p>Expect answer is -20126. Gives output: 0,20,126.</p>
0debug