problem
stringlengths
26
131k
labels
class label
2 classes
static void test_bh_flush(void) { BHTestData data = { .n = 0 }; data.bh = aio_bh_new(ctx, bh_test_cb, &data); qemu_bh_schedule(data.bh); g_assert_cmpint(data.n, ==, 0); wait_for_aio(); g_assert_cmpint(data.n, ==, 1); g_assert(!aio_poll(ctx, false)); g_assert_cmpint(data.n, ==, 1); qemu_bh_delete(data.bh); }
1threat
Visual Studio Can't Target .NET Framework 4.8 : <p>I'm having some issues creating a project that targets .NET Framework 4.8. I am using Visual Studio 2019, upgraded to version 16.2.5. I have also installed the <a href="https://dotnet.microsoft.com/download/dotnet-framework/net48" rel="noreferrer">.NET Framework 4.8 Developer Pack</a>. From the Visual Studio Installer, I don't see any option for enabling 4.8 development tools <a href="https://stackoverflow.com/questions/43316307/cant-choose-net-4-7">similar to 4.7</a>.</p>
0debug
Sum value in dictionary key python : I have a python dictionary like the one below: {'Jason': {'A': 200, 'B': 'NaN', 'C': 34, 'D': 'NaN', 'E': True}, 'John': {'A': 250, 'B': '34', 'C':98, 'D': 59, 'E': False}, 'Steve': {'A': 230, 'B': '45', 'C':'NaN', 'D': 67, 'E': False}, 'Louis': {'A': 220, 'B': '37', 'C':'NaN', 'D': 'Nan', 'E': True}, .... } I want to count the number of `'NaN'` in each value, and return that count with the number of `'NaN'` that have the value `'E': True`. So I would like to create a dictionary like this: {'A': {'NaN': 0, 'E': 0}, 'B': {'NaN': 1, 'E': 1}, 'C': {'NaN': 2, 'E': 1}, 'D': {'NaN': 2, 'E': 2}} Thanks for the help!
0debug
static void mov_read_chapters(AVFormatContext *s) { MOVContext *mov = s->priv_data; AVStream *st = NULL; MOVStreamContext *sc; int64_t cur_pos; int i; for (i = 0; i < s->nb_streams; i++) if (s->streams[i]->id == mov->chapter_track) { st = s->streams[i]; break; } if (!st) { av_log(s, AV_LOG_ERROR, "Referenced QT chapter track not found\n"); return; } st->discard = AVDISCARD_ALL; sc = st->priv_data; cur_pos = avio_tell(sc->pb); for (i = 0; i < st->nb_index_entries; i++) { AVIndexEntry *sample = &st->index_entries[i]; int64_t end = i+1 < st->nb_index_entries ? st->index_entries[i+1].timestamp : st->duration; uint8_t *title; uint16_t ch; int len, title_len; if (end < sample->timestamp) { av_log(s, AV_LOG_WARNING, "ignoring stream duration which is shorter than chapters\n"); end = AV_NOPTS_VALUE; } if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { av_log(s, AV_LOG_ERROR, "Chapter %d not found in file\n", i); goto finish; } len = avio_rb16(sc->pb); if (len > sample->size-2) continue; title_len = 2*len + 1; if (!(title = av_mallocz(title_len))) goto finish; if (!len) { title[0] = 0; } else { ch = avio_rb16(sc->pb); if (ch == 0xfeff) avio_get_str16be(sc->pb, len, title, title_len); else if (ch == 0xfffe) avio_get_str16le(sc->pb, len, title, title_len); else { AV_WB16(title, ch); if (len == 1 || len == 2) title[len] = 0; else avio_get_str(sc->pb, INT_MAX, title + 2, len - 1); } } avpriv_new_chapter(s, i, st->time_base, sample->timestamp, end, title); av_freep(&title); } finish: avio_seek(sc->pb, cur_pos, SEEK_SET); }
1threat
Perl get Value of a Hash in a Hash : i have a hash in perl and i dont know what its content looks like. When i print out its keys and values (check attached hash loop picture) i get for values what looks like a string that contains another hash for each value (check output of hash loop picture). How can i print out the keys and values for these hashes? [output of hash loop][1] [hash loop][2] [1]: https://i.stack.imgur.com/jAeG4.png [2]: https://i.stack.imgur.com/erYFe.png
0debug
Chrome console - breakpoint over whole file : <p>is there any option to set something like "breakpoint" on a file in chrome console (kindof shortcut to set breakpoint on every line of code in the file)?</p> <p>Would be extremely useful when trying to understand 3rd party scripts that you know are executed but have no idea which part of code and from where is executed when.</p> <p>My current example use case: I downloaded a script (form validation) which does not work as expected. The fastest way to solve the problem would be to pause execution anytime JS runtime enters this file and start exploring it from there.</p>
0debug
How to fix spacemacs importmagic and/or epc not found? : <p>I use spacemacs config to open a python file.</p> <p>emacs: 25.3.1<br> spacemacs: 0.300.0<br> platform: osx</p> <p>I add python layer in <code>dotspacemacs-configuration-layers</code>, besides I use miniconda to control my python envs with <code>(setenv "WORKON_HOME" "~/miniconda3/envs")</code> in <code>dotspacemacs/user-init</code>.</p> <p>Then I run into this problem(copy from <em>Messages</em>) when I open a python file:</p> <pre><code>Importmagic and/or epc not found. importmagic.el will not be working. </code></pre> <p>Tried to solve this situation from discussion at <a href="https://github.com/syl20bnr/spacemacs/issues/10145" rel="noreferrer">spacemacs#10145</a> by add </p> <pre><code>(require 'pyvenv) (pyvenv-activate DIRECTORY) </code></pre> <p>into my <code>dotspacemacs/user-config</code> but with no lucky.</p> <p>Hope someone could give me some advice, thank you!</p>
0debug
How can i check my android device having a internet connection in android? : <p>Explanation: I am trying to connect my device which has internet connection.I added a permission in manifiest both network state and internet.I check correctly my device is connected with specific network.e.g. WIFI.</p> <p>How can i check this wifi connection share the internet.</p> <p>Here is my class which has two method for internet connection checking and network connection checking.</p> <pre><code>package comman; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.util.Log; import java.net.URL; import java.io.IOException; import java.net.HttpURLConnection; public class ConnectionDetector { private Context _context; public ConnectionDetector(Context context) { this._context = context; } public boolean isConnectingToInternet() { if (networkConnectivity()) { try { HttpURLConnection urlc = (HttpURLConnection) (new URL( "http://www.google.com").openConnection()); urlc.setRequestProperty("User-Agent", "Test"); urlc.setRequestProperty("Connection", "close"); urlc.setConnectTimeout(3000); urlc.setReadTimeout(4000); urlc.connect(); // networkcode2 = urlc.getResponseCode(); return (urlc.getResponseCode() == 200); } catch (IOException e) { return (false); } } else return false; } private boolean networkConnectivity() { ConnectivityManager cm = (ConnectivityManager) _context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = cm.getActiveNetworkInfo(); if (networkInfo != null &amp;&amp; networkInfo.isConnected()) { return true; } return false; } } </code></pre> <p>Here is the code where i am trying to check whether device having internet connection or not?</p> <pre><code>ConnectionDetector cd=new ConnectionDetector(getContext()); if (cd.isConnectingToInternet()) { new TabJson().execute(); } else{ dialog_popup(); } </code></pre> <p>Here, is an exception </p> <pre><code>FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.angelnx.cricvilla.cricvilla/com.angelnx.cricvilla.cricvilla.MainActivity}: android.os.NetworkOnMainThreadException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135) at android.app.ActivityThread.access$700(ActivityThread.java:143) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1241) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4950) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771) at dalvik.system.NativeStart.main(Native Method) Caused by: android.os.NetworkOnMainThreadException at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1118) at java.net.InetAddress.lookupHostByName(InetAddress.java:385) at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236) at java.net.InetAddress.getAllByName(InetAddress.java:214) at libcore.net.http.HttpConnection.&lt;init&gt;(HttpConnection.java:70) at libcore.net.http.HttpConnection.&lt;init&gt;(HttpConnection.java:50) at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:340) at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87) at libcore.net.http.HttpConnection.connect(HttpConnection.java:128) at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:315) at libcore.net.http.HttpEngine.connect(HttpEngine.java:310) at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:289) at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:239) at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80) at comman.ConnectionDetector.isConnectingToInternet(ConnectionDetector.java:29) at com.angelnx.cricvilla.cricvilla.HomeFragment.onCreateView(HomeFragment.java:130) at android.support.v4.app.Fragment.performCreateView(Fragment.java:1962) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1248) at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1613) at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:330) at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:547) at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1178) at android.app.Activity.performStart(Activity.java:5187) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2083) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)  at android.app.ActivityThread.access$700(ActivityThread.java:143)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1241)  at android.os.Handler.dispatchMessage(Handler.java:99)  at android.os.Looper.loop(Looper.java:137)  at android.app.ActivityThread.main(ActivityThread.java:4950)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:511)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)  at dalvik.system.NativeStart.main(Native Method) </code></pre> <p>how can i solve this problem??? Please help me to solve out this problem.</p>
0debug
static void vnc_write_u8(VncState *vs, uint8_t value) { vnc_write(vs, (char *)&value, 1); }
1threat
How to log exceptions using logger.net in asp.net : How to log exceptions in asp.net using logger.net. I searching in google for example regarding logger.net.but i don't find any proper solution.It only store log details not exceptions.
0debug
static int decode_block(MJpegDecodeContext *s, int16_t *block, int component, int dc_index, int ac_index, uint16_t *quant_matrix) { int code, i, j, level, val; val = mjpeg_decode_dc(s, dc_index); if (val == 0xfffff) { av_log(s->avctx, AV_LOG_ERROR, "error dc\n"); return AVERROR_INVALIDDATA; } val = val * quant_matrix[0] + s->last_dc[component]; val = FFMIN(val, 32767); s->last_dc[component] = val; block[0] = val; i = 0; {OPEN_READER(re, &s->gb); do { UPDATE_CACHE(re, &s->gb); GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2); i += ((unsigned)code) >> 4; code &= 0xf; if (code) { if (code > MIN_CACHE_BITS - 16) UPDATE_CACHE(re, &s->gb); { int cache = GET_CACHE(re, &s->gb); int sign = (~cache) >> 31; level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign; } LAST_SKIP_BITS(re, &s->gb, code); if (i > 63) { av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i); return AVERROR_INVALIDDATA; } j = s->scantable.permutated[i]; block[j] = level * quant_matrix[i]; } } while (i < 63); CLOSE_READER(re, &s->gb);} return 0; }
1threat
Why does git diff-index HEAD result change for touched files after git diff or git status? : <p>If I <code>touch</code> a file tracked in a git repo, and run <code>git diff-index HEAD</code>, it will print output with <code>M</code> indicating the file has been modified. For example,</p> <pre><code>$ touch foo $ git diff-index HEAD :100644 100644 257cc5642cb1a054f08cc83f2d943e56fd3ebe99 0000000000000000000000000000000000000000 M foo </code></pre> <p>I am unsure if this makes sense or not, but that is not the question. The question is, why does the output change (to no diff) if I run <code>git diff HEAD</code> or <code>git status</code>?</p> <pre><code>$ touch foo $ git diff-index HEAD :100644 100644 257cc5642cb1a054f08cc83f2d943e56fd3ebe99 0000000000000000000000000000000000000000 M foo $ git diff # no output $ git diff-index HEAD # no output </code></pre> <p>I would expect the result, whatever it is, to stay the same across commands that are not supposed to change anything.</p>
0debug
uint32_t ldl_le_phys(target_phys_addr_t addr) { return ldl_phys_internal(addr, DEVICE_LITTLE_ENDIAN); }
1threat
Compare Time returned in string format by converting it to 24 hour format in javascript : <p>I am making an ajax call and getting a JSON response. In the response I am getting time in following format:</p> <pre><code>12:00 pm //typeof of this is String. </code></pre> <p>I need to compare this time with the other times returned and find the earliest time.</p> <p>What would be the best way of doing this? I was thinking of converting it to 24 Hour format in int and then directly compare, but how can we convert this to 24 hour format in the best way?</p>
0debug
AVFoundation Import Warnings after XCODE 8 upgrade : <p>Obj C project; just updated to Xcode 8 and iOS/10. App seems to work fine, however, getting warnings --</p> <p>"Missing submodule 'AVFoundation.AVSpeechSynthesis'" "Missing submodule 'AVFoundation.AVAudioSession'"</p> <p>These messages appear on the #import statements for AVAudioSession &amp; AVSpeechSynthesis.</p> <p>Does anyone know what's going on with this?</p> <p>TIA</p>
0debug
static void openpic_tmr_write(void *opaque, hwaddr addr, uint64_t val, unsigned len) { OpenPICState *opp = opaque; int idx; DPRINTF("%s: addr %08x <= %08x\n", __func__, addr, val); if (addr & 0xF) return; idx = (addr >> 6) & 0x3; addr = addr & 0x30; if (addr == 0x0) { opp->tifr = val; return; } switch (addr & 0x30) { case 0x00: break; case 0x10: if ((opp->timers[idx].ticc & TICC_TOG) != 0 && (val & TIBC_CI) == 0 && (opp->timers[idx].tibc & TIBC_CI) != 0) { opp->timers[idx].ticc &= ~TICC_TOG; } opp->timers[idx].tibc = val; break; case 0x20: write_IRQreg_ipvp(opp, opp->irq_tim0 + idx, val); break; case 0x30: write_IRQreg_ide(opp, opp->irq_tim0 + idx, val); break; } }
1threat
static void fdt_add_cpu_nodes(const VirtBoardInfo *vbi) { int cpu; int addr_cells = 1; for (cpu = 0; cpu < vbi->smp_cpus; cpu++) { ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(cpu)); if (armcpu->mp_affinity & ARM_AFF3_MASK) { addr_cells = 2; break; } } qemu_fdt_add_subnode(vbi->fdt, "/cpus"); qemu_fdt_setprop_cell(vbi->fdt, "/cpus", "#address-cells", addr_cells); qemu_fdt_setprop_cell(vbi->fdt, "/cpus", "#size-cells", 0x0); for (cpu = vbi->smp_cpus - 1; cpu >= 0; cpu--) { char *nodename = g_strdup_printf("/cpus/cpu@%d", cpu); ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(cpu)); qemu_fdt_add_subnode(vbi->fdt, nodename); qemu_fdt_setprop_string(vbi->fdt, nodename, "device_type", "cpu"); qemu_fdt_setprop_string(vbi->fdt, nodename, "compatible", armcpu->dtb_compatible); if (vbi->smp_cpus > 1) { qemu_fdt_setprop_string(vbi->fdt, nodename, "enable-method", "psci"); } if (addr_cells == 2) { qemu_fdt_setprop_u64(vbi->fdt, nodename, "reg", armcpu->mp_affinity); } else { qemu_fdt_setprop_cell(vbi->fdt, nodename, "reg", armcpu->mp_affinity); } g_free(nodename); } }
1threat
*ngIf for html attribute in Angular2 : <pre><code>&lt;ion-navbar hideBackButton &gt; &lt;ion-title&gt; &lt;/ion-title&gt; ... ... </code></pre> <p>I want <code>hideBackButton</code> to be there conditionally and I don't want to repeat the whole ion-navbar element with *ngIf. Is it possible to to apply *ngIf for hideBackButton attribute? </p>
0debug
static void cmd_args_init(CmdArgs *cmd_args) { cmd_args->name = qstring_new(); cmd_args->type = cmd_args->flag = cmd_args->optional = 0; }
1threat
I want to solution for my given code.kindly help me : `$string="cat, dog, pig, hello";` required output (dynamically) `$string1= cat;` `$string2= dog;` `$string3= pig;` `$string4= hello;` after use of comma in string, word become a new substring.`
0debug
Displaying Data from (.txt) in ListView C# : <p>Actually I don't know what to call this but still I will try my best to explain my problem.</p> <p>I have a text file saved on my desktop C:\users\Dell\partition.txt. It has data as follows </p> <pre> Number Start End Size File system Name Flags 1 524kB 3670kB 3146kB proinfo 2 3670kB 8913kB 5243kB nvram 3 8913kB 19.4MB 10.5MB ext4 protect1 4 19.4MB 29.9MB 10.5MB ext4 protect2 5 29.9MB 30.4MB 524kB lk 6 30.4MB 30.9MB 524kB para 7 30.9MB 47.7MB 16.8MB boot 8 47.7MB 64.5MB 16.8MB recovery 9 64.5MB 72.9MB 8389kB logo 10 72.9MB 73.9MB 1049kB yl_params </pre> <p>I want to display this on ListView in C# Winforms to get some output like this </p> <p><a href="https://i.stack.imgur.com/VlfSv.png" rel="nofollow noreferrer">Image1</a></p> <p>I have seen some Softwares doing it but didn't find their sources. So is there any way to do it in C# Winforms.</p> <p>Thanks in Advance,</p>
0debug
How can i generate the minified CSS from SCSS i am using WEB PACK and Laravel 5.5.2 : How can I generate the minified CSS files from SCSS file I am using Web Pack Is there any command which did that??. it's like when I compiled my SCSS it should generate the minified CSS
0debug
I was trying to write a program and it seems totally fine but i cannot find the reason why it doesn't work, any help would be thankful : <p>I have created a program which acts as a quiz. It is nowhere near done but I am working on it.</p> <p>The code is below:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;iostream&gt; int optionOne(int choice, int plonkPoints); int optionTwo(int choice, int plonkPoints); int optionThree(int choice, int plonkPoints); int optionFour(int choice, int plonkPoints); int optionFive(int choice, int plonkPoints); int optionOnev2(int choice, int plonkPoints); int plonkPoints = 0; void main() { char fName[30]; char sName[30]; char rightFname[30] = "Thomas"; char rightSname[30] = "Sloane"; char rightFname2[30] = "Ryan"; char rightSname2[30] = "Gleeson"; int result; printf("This is the Plonker test, it will determine where you are on the scale of Plonkerhood. \nGood luck and don't mess up you twat.\nTo answer yes type 1, to answer no type 0 \n"); printf("\nFirst what is your first name?: "); scanf_s("%s", fName, sizeof fName); printf("What is your surname?: "); scanf_s("%s", sName, sizeof sName); int res1 = strcmp(fName, rightFname); int res2 = strcmp(sName, rightSname); int res3 = strcmp(fName, rightFname2); int res4 = strcmp(sName, rightSname2); if (res1 == 0 &amp;&amp; res2 == 0) plonkPoints = 528; if (res3 == 0 &amp;&amp; res4 == 0) plonkPoints = 528; int choice; printf("\nQuestion 1: Are you a plonker?: "); scanf_s("%d", &amp;choice); if (choice == 0) plonkPoints = plonkPoints + 1; if (choice == 1) plonkPoints = plonkPoints + 0; printf("points: %d\n", plonkPoints); while (choice != 0 &amp;&amp; choice != 1) { printf("That's not a valid answer!\n"); printf("\nQuestion 1: Are you a plonker: "); scanf_s("%d", &amp;choice); if (choice == 0) plonkPoints = plonkPoints + 1; if (choice == 1) plonkPoints = plonkPoints + 0; } printf("\nQuestion 2: What does ORTCEMF stand for?\n"); printf("1. Only Retards Take Canned Eggs Mother Fucker\n"); printf("2.\n"); printf("3.\n"); printf("4.\n"); printf("5.\n"); printf("Enter your answer: "); scanf_s("%d", &amp;choice); optionOnev2(choice, plonkPoints); printf("points = %d", plonkPoints); } int optionOne(int choice, int plonkPoints) { switch (choice) { case 1: plonkPoints = plonkPoints + 5; break; case 2: plonkPoints = plonkPoints + 1; break; case 3: plonkPoints = plonkPoints + 4; break; case 4: plonkPoints = plonkPoints + 2; break; case 5: plonkPoints = plonkPoints + 3; break; } return plonkPoints; printf("Plonkpints : %d", plonkPoints); } int optionTwo(int choice, int plonkPoints) { switch (choice) { case 1: plonkPoints = plonkPoints + 1; break; case 2: plonkPoints = plonkPoints + 5; break; case 3: plonkPoints = plonkPoints + 2; break; case 4: plonkPoints = plonkPoints + 4; break; case 5: plonkPoints = plonkPoints + 3; break; } return plonkPoints; } int optionThree(int choice, int plonkPoints) { switch (choice) { case 1: plonkPoints = plonkPoints + 2; break; case 2: plonkPoints = plonkPoints + 4; break; case 3: plonkPoints = plonkPoints + 5; break; case 4: plonkPoints = plonkPoints + 1; break; case 5: plonkPoints = plonkPoints + 3; break; } return plonkPoints; } int optionFour(int choice, int plonkPoints) { switch (choice) { case 1: plonkPoints = plonkPoints + 3; break; case 2: plonkPoints = plonkPoints + 4; break; case 3: plonkPoints = plonkPoints + 2; break; case 4: plonkPoints = plonkPoints + 5; break; case 5: plonkPoints = plonkPoints + 1; break; } return plonkPoints; } int optionFive(int choice, int plonkPoints) { switch (choice) { case 1: plonkPoints = plonkPoints + 4; break; case 2: plonkPoints = plonkPoints + 1; break; case 3: plonkPoints = plonkPoints + 2; break; case 4: plonkPoints = plonkPoints + 3; break; case 5: plonkPoints = plonkPoints + 5; break; } return plonkPoints; } </code></pre> <p>I have created five functions. These functions will be used for questions that have 5 options and each option gives you a different amount of points. For example question 2 of the quiz gives 5 points for option one because it is the correct option. I have defined each function and declared them before the main function which seems to be working well. For each of the functions I want the variable choice (the option number which the user chooses) to be the input into the function. It will then work and give the variable "plonkPoints" as the output. In this case when I choose the first option of question two I should then have an extra five points. I even put in a printf to check. For some reason no points are added to the variable "plonkPoints".</p> <p>I originally had the variable "plonkPoints" as a local variable but then made it a global variable but that did not seem to help.</p> <p>Any help would be greatly appreciated. Thank you all.</p>
0debug
How to insert null into an SQL string : <p>In C# code, I have a string that has been concatenated together to build an SQL insert statement, and that is then passed into a stored procedure and run. The problem is that I have a field in the concatenated string, call it Salary, that is a numeric in the database. However, as it's being built in the C# code, its obviously a string. There's an error in the SP when it comes time to insert, <code>Error converting data type varchar to numeric</code>. The big insert string that is created is run in the SP all at once, so I can't check individual values in the SP. And I can't make Salary = the string null, because that just inserts the string "null" rather than a null value.</p>
0debug
static void save_display_set(DVBSubContext *ctx) { DVBSubRegion *region; DVBSubRegionDisplay *display; DVBSubCLUT *clut; uint32_t *clut_table; int x_pos, y_pos, width, height; int x, y, y_off, x_off; uint32_t *pbuf; char filename[32]; static int fileno_index = 0; x_pos = -1; y_pos = -1; width = 0; height = 0; for (display = ctx->display_list; display; display = display->next) { region = get_region(ctx, display->region_id); if (x_pos == -1) { x_pos = display->x_pos; y_pos = display->y_pos; width = region->width; height = region->height; } else { if (display->x_pos < x_pos) { width += (x_pos - display->x_pos); x_pos = display->x_pos; } if (display->y_pos < y_pos) { height += (y_pos - display->y_pos); y_pos = display->y_pos; } if (display->x_pos + region->width > x_pos + width) { width = display->x_pos + region->width - x_pos; } if (display->y_pos + region->height > y_pos + height) { height = display->y_pos + region->height - y_pos; } } } if (x_pos >= 0) { pbuf = av_malloc(width * height * 4); for (display = ctx->display_list; display; display = display->next) { region = get_region(ctx, display->region_id); x_off = display->x_pos - x_pos; y_off = display->y_pos - y_pos; clut = get_clut(ctx, region->clut); if (!clut) clut = &default_clut; switch (region->depth) { case 2: clut_table = clut->clut4; break; case 8: clut_table = clut->clut256; break; case 4: default: clut_table = clut->clut16; break; } for (y = 0; y < region->height; y++) { for (x = 0; x < region->width; x++) { pbuf[((y + y_off) * width) + x_off + x] = clut_table[region->pbuf[y * region->width + x]]; } } } snprintf(filename, sizeof(filename), "dvbs.%d", fileno_index); png_save2(filename, pbuf, width, height); av_freep(&pbuf); } fileno_index++; }
1threat
void visit_type_uint8(Visitor *v, uint8_t *obj, const char *name, Error **errp) { int64_t value; if (v->type_uint8) { v->type_uint8(v, obj, name, errp); } else { value = *obj; v->type_int64(v, &value, name, errp); if (value < 0 || value > UINT8_MAX) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null", "uint8_t"); return; } *obj = value; } }
1threat
how to align menu items horizontally : <p>How to create menu items aligned horizontally in the first row like google chrome </p> <p><a href="https://i.stack.imgur.com/aLaig.png" rel="noreferrer"><img src="https://i.stack.imgur.com/aLaig.png" alt="enter image description here"></a></p> <p>I created the first item with a menu child but by this way i got a row that send me to the other menu, So how to do that using menu file ? i don't want to use Dialog</p> <p>Here is my menu file : </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"&gt; &lt;group android:id="@+id/toolbar_menu" android:visible="true"&gt; &lt;item android:id="@+id/item_tabs" android:icon="@drawable/ic_tabs_24dp" android:title="@null" app:showAsAction="always"/&gt; &lt;item android:id="@+id/icon_row_menu_id" android:title="@null" android:visible="true"&gt; &lt;menu&gt; &lt;item android:id="@+id/item_back" android:icon="@drawable/ic_arrow_back_24dp" android:title="@string/go_back" /&gt; &lt;item android:id="@+id/item_forward" android:icon="@drawable/ic_arrow_forward_24dp" android:title="@string/go_forward" /&gt; &lt;item android:id="@+id/item_bookmark_page" android:icon="@drawable/ic_star_border_24dp" android:title="@string/bookmark_this_page" /&gt; &lt;item android:id="@+id/item_download_page" android:icon="@drawable/ic_download_24dp" android:title="@string/download_page" /&gt; &lt;item android:id="@+id/item_info" android:icon="@drawable/ic_info_outline_24dp" android:title="@string/view_site_information" /&gt; &lt;/menu&gt; &lt;/item&gt; &lt;item android:id="@+id/item_new_tab" android:title="@string/new_tab" /&gt; &lt;item android:id="@+id/item_new_incognito_tab" android:title="@string/new_incognito_tab" /&gt; &lt;item android:id="@+id/item_bookmarks" android:title="@string/bookmarks" /&gt; &lt;item android:id="@+id/item_history" android:title="@string/history" /&gt; &lt;item android:id="@+id/item_downloads" android:title="@string/download" /&gt; &lt;item android:id="@+id/item_settings" android:title="@string/settings" /&gt; &lt;/group&gt; &lt;/menu&gt; </code></pre> <p>And here how i use it :</p> <pre><code>@Override public boolean onCreateOptionsMenu(Menu menu) { mainMenu = menu; MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_menu, menu); return true; } </code></pre>
0debug
PXA2xxLCDState *pxa2xx_lcdc_init(MemoryRegion *sysmem, target_phys_addr_t base, qemu_irq irq) { PXA2xxLCDState *s; s = (PXA2xxLCDState *) g_malloc0(sizeof(PXA2xxLCDState)); s->invalidated = 1; s->irq = irq; s->sysmem = sysmem; pxa2xx_lcdc_orientation(s, graphic_rotate); memory_region_init_io(&s->iomem, &pxa2xx_lcdc_ops, s, "pxa2xx-lcd-controller", 0x00100000); memory_region_add_subregion(sysmem, base, &s->iomem); s->ds = graphic_console_init(pxa2xx_update_display, pxa2xx_invalidate_display, pxa2xx_screen_dump, NULL, s); switch (ds_get_bits_per_pixel(s->ds)) { case 0: s->dest_width = 0; break; case 8: s->line_fn[0] = pxa2xx_draw_fn_8; s->line_fn[1] = pxa2xx_draw_fn_8t; s->dest_width = 1; break; case 15: s->line_fn[0] = pxa2xx_draw_fn_15; s->line_fn[1] = pxa2xx_draw_fn_15t; s->dest_width = 2; break; case 16: s->line_fn[0] = pxa2xx_draw_fn_16; s->line_fn[1] = pxa2xx_draw_fn_16t; s->dest_width = 2; break; case 24: s->line_fn[0] = pxa2xx_draw_fn_24; s->line_fn[1] = pxa2xx_draw_fn_24t; s->dest_width = 3; break; case 32: s->line_fn[0] = pxa2xx_draw_fn_32; s->line_fn[1] = pxa2xx_draw_fn_32t; s->dest_width = 4; break; default: fprintf(stderr, "%s: Bad color depth\n", __FUNCTION__); exit(1); } vmstate_register(NULL, 0, &vmstate_pxa2xx_lcdc, s); return s; }
1threat
AWS Cognito Error: 'identityPoolId' failed to satisfy constraint : <p>I am new Cognito. I am trying to implement AWS Cognito using Lambda. This is the <a href="https://java.awsblog.com/blog/author/Dhruv+Thukral" rel="noreferrer">tutorial</a> I am following. </p> <pre><code>AmazonCognitoIdentityClient client = new AmazonCognitoIdentityClient(); GetOpenIdTokenForDeveloperIdentityRequest tokenRequest = new GetOpenIdTokenForDeveloperIdentityRequest(); tokenRequest.setIdentityPoolId("us-east-1_XXXXXXX"); </code></pre> <p>This is the pool Id that I am using in the setIdentityPoolId</p> <p><a href="https://i.stack.imgur.com/D8tjS.png" rel="noreferrer"><img src="https://i.stack.imgur.com/D8tjS.png" alt="enter image description here"></a></p> <p>This is the JUnit test</p> <pre><code>public class AuthenticateUser implements RequestHandler&lt;Object, Object&gt; { @Override public Object handleRequest(Object input, Context context) { AuthenticateUserResponse authenticateUserResponse = new AuthenticateUserResponse(); @SuppressWarnings("unchecked") LinkedHashMap inputHashMap = (LinkedHashMap)input; User user = authenticateUser(inputHashMap); return null; } public User authenticateUser(LinkedHashMap input){ User user = null; String userName = (String) input.get("userName"); String passwordHash = (String) input.get("passwordHash"); try { AmazonDynamoDBClient client = new AmazonDynamoDBClient(); client.setRegion(Region.getRegion(Regions.US_EAST_1)); DynamoDBMapper mapper = new DynamoDBMapper(client); user = mapper.load(User.class, userName); if(user != null){ System.out.println("user found"); if(user.getPasswordHash().equals(passwordHash)){ System.out.println("user password matched"); String openIdToken = getOpenIdToken(user.getUserId()); user.setOpenIdToken(openIdToken); return user; } else { System.out.println("password unmatched"); } } else { System.out.println("user not found"); } } catch (Exception e) { System.out.println("Error: " + e.toString()); } return user; } </code></pre> <p>This is the output</p> <pre><code>user found user password matched </code></pre> <p>But I am getting the following error and hence, the <code>return user</code> statement is failing</p> <pre><code>1 validation error detected: Value 'us-east-1_XXXXXX' at 'identityPoolId' failed to satisfy constraint: Member must satisfy regular expression pattern: [\w-]+:[0-9a-f-]+ (Service: AmazonCognitoIdentity; Status Code: 400; Error Code: ValidationException; </code></pre>
0debug
how to select data from the excel using a new interval : I currently has a set of data in a excel sheet that look something like that Distance 1.0 1.3 1.4 1.5 1.8 2.0 2.5 I would like to select this set of data base on a new interval of 0.5m which will show like that: Distance 1.0 1.5 2.0 2.5 This new arranged data will be place in a new excel sheet.Is there any way to do in a office excel 2003 environment?
0debug
static void trigger_access_exception(CPUS390XState *env, uint32_t type, uint32_t ilen, uint64_t tec) { S390CPU *cpu = s390_env_get_cpu(env); if (kvm_enabled()) { kvm_s390_access_exception(cpu, type, tec); } else { CPUState *cs = CPU(cpu); stq_phys(cs->as, env->psa + offsetof(LowCore, trans_exc_code), tec); trigger_pgm_exception(env, type, ilen); } }
1threat
Working with Logical And and multiple return values Ruby : I'm trying to check multiple conditions in a function. So i have written following code def validate value,message = check_length(name) && is_valid(id) end check_length and is_valid returns 2 values. so i store these values in value and message. Now if check_length returns value as false, it shouldn't evaluate second method is_valid. Ideally with logical and, if first condition fails, it doesn't execute other method. But for above code even if check_length returns value as false, it evaluates is_valid and value is overridden by return value of is_valid. How can we break if first condition value is false and return from validate function?
0debug
When i create unity project, it does not show 3d objects : [enter image description here][1] [1]: https://i.stack.imgur.com/sGbHM.png Please Help Me!
0debug
static av_cold int mpc8_decode_init(AVCodecContext * avctx) { int i; MPCContext *c = avctx->priv_data; GetBitContext gb; static int vlc_initialized = 0; int channels; static VLC_TYPE band_table[542][2]; static VLC_TYPE q1_table[520][2]; static VLC_TYPE q9up_table[524][2]; static VLC_TYPE scfi0_table[1 << MPC8_SCFI0_BITS][2]; static VLC_TYPE scfi1_table[1 << MPC8_SCFI1_BITS][2]; static VLC_TYPE dscf0_table[560][2]; static VLC_TYPE dscf1_table[598][2]; static VLC_TYPE q3_0_table[512][2]; static VLC_TYPE q3_1_table[516][2]; static VLC_TYPE codes_table[5708][2]; if(avctx->extradata_size < 2){ av_log(avctx, AV_LOG_ERROR, "Too small extradata size (%i)!\n", avctx->extradata_size); return -1; } memset(c->oldDSCF, 0, sizeof(c->oldDSCF)); av_lfg_init(&c->rnd, 0xDEADBEEF); ff_dsputil_init(&c->dsp, avctx); ff_mpadsp_init(&c->mpadsp); ff_mpc_init(); init_get_bits(&gb, avctx->extradata, 16); skip_bits(&gb, 3); c->maxbands = get_bits(&gb, 5) + 1; if (c->maxbands >= BANDS) { av_log(avctx,AV_LOG_ERROR, "maxbands %d too high\n", c->maxbands); return AVERROR_INVALIDDATA; } channels = get_bits(&gb, 4) + 1; if (channels > 2) { av_log_missing_feature(avctx, "Multichannel MPC SV8", 1); return -1; } c->MSS = get_bits1(&gb); c->frames = 1 << (get_bits(&gb, 3) * 2); avctx->sample_fmt = AV_SAMPLE_FMT_S16; avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; if(vlc_initialized) return 0; av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n"); band_vlc.table = band_table; band_vlc.table_allocated = 542; init_vlc(&band_vlc, MPC8_BANDS_BITS, MPC8_BANDS_SIZE, mpc8_bands_bits, 1, 1, mpc8_bands_codes, 1, 1, INIT_VLC_USE_NEW_STATIC); q1_vlc.table = q1_table; q1_vlc.table_allocated = 520; init_vlc(&q1_vlc, MPC8_Q1_BITS, MPC8_Q1_SIZE, mpc8_q1_bits, 1, 1, mpc8_q1_codes, 1, 1, INIT_VLC_USE_NEW_STATIC); q9up_vlc.table = q9up_table; q9up_vlc.table_allocated = 524; init_vlc(&q9up_vlc, MPC8_Q9UP_BITS, MPC8_Q9UP_SIZE, mpc8_q9up_bits, 1, 1, mpc8_q9up_codes, 1, 1, INIT_VLC_USE_NEW_STATIC); scfi_vlc[0].table = scfi0_table; scfi_vlc[0].table_allocated = 1 << MPC8_SCFI0_BITS; init_vlc(&scfi_vlc[0], MPC8_SCFI0_BITS, MPC8_SCFI0_SIZE, mpc8_scfi0_bits, 1, 1, mpc8_scfi0_codes, 1, 1, INIT_VLC_USE_NEW_STATIC); scfi_vlc[1].table = scfi1_table; scfi_vlc[1].table_allocated = 1 << MPC8_SCFI1_BITS; init_vlc(&scfi_vlc[1], MPC8_SCFI1_BITS, MPC8_SCFI1_SIZE, mpc8_scfi1_bits, 1, 1, mpc8_scfi1_codes, 1, 1, INIT_VLC_USE_NEW_STATIC); dscf_vlc[0].table = dscf0_table; dscf_vlc[0].table_allocated = 560; init_vlc(&dscf_vlc[0], MPC8_DSCF0_BITS, MPC8_DSCF0_SIZE, mpc8_dscf0_bits, 1, 1, mpc8_dscf0_codes, 1, 1, INIT_VLC_USE_NEW_STATIC); dscf_vlc[1].table = dscf1_table; dscf_vlc[1].table_allocated = 598; init_vlc(&dscf_vlc[1], MPC8_DSCF1_BITS, MPC8_DSCF1_SIZE, mpc8_dscf1_bits, 1, 1, mpc8_dscf1_codes, 1, 1, INIT_VLC_USE_NEW_STATIC); q3_vlc[0].table = q3_0_table; q3_vlc[0].table_allocated = 512; ff_init_vlc_sparse(&q3_vlc[0], MPC8_Q3_BITS, MPC8_Q3_SIZE, mpc8_q3_bits, 1, 1, mpc8_q3_codes, 1, 1, mpc8_q3_syms, 1, 1, INIT_VLC_USE_NEW_STATIC); q3_vlc[1].table = q3_1_table; q3_vlc[1].table_allocated = 516; ff_init_vlc_sparse(&q3_vlc[1], MPC8_Q4_BITS, MPC8_Q4_SIZE, mpc8_q4_bits, 1, 1, mpc8_q4_codes, 1, 1, mpc8_q4_syms, 1, 1, INIT_VLC_USE_NEW_STATIC); for(i = 0; i < 2; i++){ res_vlc[i].table = &codes_table[vlc_offsets[0+i]]; res_vlc[i].table_allocated = vlc_offsets[1+i] - vlc_offsets[0+i]; init_vlc(&res_vlc[i], MPC8_RES_BITS, MPC8_RES_SIZE, &mpc8_res_bits[i], 1, 1, &mpc8_res_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); q2_vlc[i].table = &codes_table[vlc_offsets[2+i]]; q2_vlc[i].table_allocated = vlc_offsets[3+i] - vlc_offsets[2+i]; init_vlc(&q2_vlc[i], MPC8_Q2_BITS, MPC8_Q2_SIZE, &mpc8_q2_bits[i], 1, 1, &mpc8_q2_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); quant_vlc[0][i].table = &codes_table[vlc_offsets[4+i]]; quant_vlc[0][i].table_allocated = vlc_offsets[5+i] - vlc_offsets[4+i]; init_vlc(&quant_vlc[0][i], MPC8_Q5_BITS, MPC8_Q5_SIZE, &mpc8_q5_bits[i], 1, 1, &mpc8_q5_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); quant_vlc[1][i].table = &codes_table[vlc_offsets[6+i]]; quant_vlc[1][i].table_allocated = vlc_offsets[7+i] - vlc_offsets[6+i]; init_vlc(&quant_vlc[1][i], MPC8_Q6_BITS, MPC8_Q6_SIZE, &mpc8_q6_bits[i], 1, 1, &mpc8_q6_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); quant_vlc[2][i].table = &codes_table[vlc_offsets[8+i]]; quant_vlc[2][i].table_allocated = vlc_offsets[9+i] - vlc_offsets[8+i]; init_vlc(&quant_vlc[2][i], MPC8_Q7_BITS, MPC8_Q7_SIZE, &mpc8_q7_bits[i], 1, 1, &mpc8_q7_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); quant_vlc[3][i].table = &codes_table[vlc_offsets[10+i]]; quant_vlc[3][i].table_allocated = vlc_offsets[11+i] - vlc_offsets[10+i]; init_vlc(&quant_vlc[3][i], MPC8_Q8_BITS, MPC8_Q8_SIZE, &mpc8_q8_bits[i], 1, 1, &mpc8_q8_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); } vlc_initialized = 1; avcodec_get_frame_defaults(&c->frame); avctx->coded_frame = &c->frame; return 0; }
1threat
Program Not Working As Expected : I am writing a program that allows the user to type in a "stop word" (https://en.wikipedia.org/wiki/Stop_words) and returns which language that stop word is contained within. The program is crashing, I almost said inexplicably, but I am no expert at C so I'm sure there is an explanation. I'm here because I cannot figure it out. I hate to post my entire code, but I really don't know where my problem lies, and I want to supply you with replicable code. Here is my code followed by an example stop word file. #StopWords.c #include <stdio.h> #include <stdlib.h> #include <dirent.h> #include <stddef.h> #include <string.h> typedef struct { char languageName[60]; //FILE fp; char stopwords[2000][60]; int wordcount; } LangData; typedef struct { int languageCount; LangData languages[]; } AllData; AllData *LoadData(char *); int main(int argc, char **argv) { AllData *Data; Data = LoadData(argv[1]); char word[60]; //Get word input from user printf("Enter a word to search: "); fgets(word, 60, stdin); //Search for word and print which languages it is found in. int i = 0; int k = 0; int found = -1; while(i < Data->languageCount) { while(k < Data->languages[i].wordcount) { if(strcmp(word, Data->languages[i].stopwords[k]) == 0) { found = 0; printf("Word found in %s", Data->languages[i].languageName); k++; } } i++; } if(found == -1) printf("Word not found"); return 0; } AllData *LoadData(char *path) { //Initialize data structures and open path directory int langCount = 0; DIR *d; struct dirent *ep; d = opendir(path); //Checks whether directory was able to be opened. if(!d) { perror("Invalid Directory"); exit(-1); } // // Only executed if directory is valid. // v v v v v v v v v v v v v v v v v v //Count the number of language files in the directory while(readdir(d)) langCount++; //Account for "." and ".." //langCount = langCount + 1; langCount = langCount - 2; //Allocate space in AllData for languageCount AllData *data = malloc(offsetof(AllData, languages) + sizeof(LangData)*langCount); data->languageCount = langCount; int i = 0; int k = 0; //Initialize Word Counts to zero for all languages for(i = 0; i < langCount; i++) { data->languages[i].wordcount = 0; } //Reset the directory in preparation for reading names rewinddir(d); //Get name of language for each file i = 0; while((ep = readdir(d)) != NULL) { if (!strcmp(ep->d_name, ".") || !strcmp(ep->d_name, "..")) { //Filtering "." and ".." } else { int size = strlen(ep->d_name); strcpy(data->languages[i].languageName, ep->d_name); data->languages[i].languageName[size - 4] = '\0'; i++; } } //Reset the directory in preparation for reading data rewinddir(d); //Copy all words into respective arrays. char word[60]; i = 0; k = 0; int j = 0; while((ep = readdir(d)) != NULL) { if (!strcmp(ep->d_name, ".") || !strcmp(ep->d_name, "..")) { //Filtering "." and ".." } else { FILE *entry; char fullpath[100]; memset(fullpath, 0, sizeof fullpath); strcpy(fullpath, path); strcat(fullpath, "\\"); strcat(fullpath, ep->d_name); entry = fopen(fullpath, "r"); while(fgets(word, 60, entry) != NULL) { j = 0; while(word[j] != '\0') { data->languages[i].stopwords[k][j] = word[j]; j++; } k++; data->languages[i].wordcount++; } i++; fclose(entry); } memset(ep, 0, sizeof *ep); } return data; } #english.txt consider seven without know very via you'll can't that doesn't getting hereafter whereas somewhat keeps soon their better awfully non ever but it's got within hello above came seems appreciate nd particularly especially useful when never need be here yourselves alone we're down able whose going perhaps didn't really want twice there yours used against gotten ltd wonder concerning actually only were anything hadn't thru sometimes various first it overall between onto won't best about indicates gets over saying ought according hence let serious everywhere there's nine mean has ex a than c's necessary following around tends still if yes these uses secondly t's am changes up each available otherwise seen nobody seeming outside apart cause off thereafter could hereby new specify get fifth sent toward during sorry another i'll hopefully should anyhow keep for welcome aren't etc thanks vs insofar whole happens whereupon isn't seem relatively near despite plus meanwhile they'll look eg greetings whereafter i'm self selves almost un did inner oh after four five follows com nearly some say like later further being somehow beforehand you think his ones aside forth its however novel rather name does again both nothing what right formerly accordingly allows theres please thats will towards sub they're well thereby possible entirely a's had among probably c'mon quite th let's regarding clearly beside until besides at might less the causes where's doing howbeit contains respectively and thereupon somewhere ain't same wouldn't haven't took whence others namely any before certainly willing although else unlikely use those throughout she so along merely we'd using no where everybody once usually asking not therein least it'd someone anyway under you're maybe particular because out downwards looks rd saw appropriate theirs definitely furthermore whenever qv you've wherever next knows gone instead who's do somebody comes shouldn't wants more as inasmuch seriously come an known are nevertheless inward thoroughly anybody amongst far either something considering described them most moreover last regardless regards us sup per herein seeing already they your while course thank by tell here's becoming having he mainly help okay our other unfortunately often behind everything nor ours don't see obviously whither himself reasonably take wasn't thanx therefore now enough across would taken two then or which placed they've one specifying former it'll have sometime believe with sure shall such that's they'd from every co how was ok on liked truly exactly seemed given been indicated try gives latter unless corresponding likely anywhere weren't thorough cant except anyone currently second go everyone third can too beyond my anyways specified we've tries wish hasn't noone sensible thus became said elsewhere to brief we since herself him whom needs i've would much ask you'd goes who inc hardly cannot done this thence whereby viz neither myself presumably themselves immediate whoever uucp value whatever appear old latterly itself lately also even together few ourselves went yourself six provides just of hereupon nowhere hi contain many followed her wherein he's become unto though indicate may is allow in none becomes upon afterwards et i what's normally mostly zero we'll example edu several always through que three all way associated containing indeed whether i'd couldn't why trying own lest below ignored yet kept hither re little looking eight me must ie consequently hers away certain tried says different into When I run the program (I am using Windows, sue me) this is the command I would type: StopWords C:\Users\Name\Desktop\Stop_Words_Directory The parameter is simply a path to the directory in which the language files (e.g. english.txt) are located. I apologize again for the mountain of code, but I am lost here and would be extremely grateful if someone can help.
0debug
static void nvram_writew (void *opaque, target_phys_addr_t addr, uint32_t value) { M48t59State *NVRAM = opaque; m48t59_write(NVRAM, addr, (value >> 8) & 0xff); m48t59_write(NVRAM, addr + 1, value & 0xff); }
1threat
How do I write an inline multiline powershell script in an Azure Pipelines PowerShell task? : <p>The yaml schema for a <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/powershell?view=azure-devops" rel="noreferrer">Powershell task</a> allows you to select targetType: 'inline' and define a script in the script: input.</p> <p>But what is the correct format for writing a script with more than one line?</p> <p>The docs don't specify how, and using a pipe on line one (like is specified for the Command Line task) does not work.</p>
0debug
XML code in TextView to make an android learning app : I am developing an android app for beginners to Learn Android I have developed most of it but now it is not allowing me to paste XML code in text view(that code i want to be visible in TextView). I did not got much help but i tried to use resources>value>string and tried pasting the code in text field. How can i fix it
0debug
Mute ActiveStorage Logs : <p>ActiveStorage floods my dev logs so i'm drowning in requests for images on a page. Is there a way to mute active storage or atleast reduce the log entries so that I can use my logs again?</p> <p>For example, for each of the images on a page that are accessed via ActiveStorage, I get one of these: </p> <pre><code>2018-09-03 11:07:42.181697 I [75455:70130232359340 log_subscriber.rb:12] (2.365ms) ActiveStorage::DiskController -- Completed #show -- { :controller =&gt; "ActiveStorage::DiskController", :action =&gt; "show", :params =&gt; { "content_type" =&gt; "image/jpeg", "disposition" =&gt; "inline; filename=\"faded-flip.jpg\"; filename*=UTF-8''faded-flip.jpg", "encoded_key" =&gt; "eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJbk4yWVhKcFlXNTBjeTh6TnpRMVlqSmtZaTB3WlRCakxUUTVaRFV0WW1Ga01DMWxNRFl4TWpFd09Ua3dOMkl2TkdRME1qQTBNR1EzTjJaaE5UZ3pOVFU1WXpSbVpqaGlOVFpoWVdVd01ESmhabVJqWW1GaE5HTmxPRFV3WXpneU1UUmhPVEpsWlRVNVl6bGlPRGs0WVFZNkJrVlUiLCJleHAiOiIyMDE4LTA5LTAzVDEwOjEyOjMyLjUwN1oiLCJwdXIiOiJibG9iX2tleSJ9fQ==--b9eed7f4cf3d71fcb697429188e1a1a74ba88bec", "filename" =&gt; "faded-flip" }, :format =&gt; "JPEG", :method =&gt; "GET", :path =&gt; "/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJbk4yWVhKcFlXNTBjeTh6TnpRMVlqSmtZaTB3WlRCakxUUTVaRFV0WW1Ga01DMWxNRFl4TWpFd09Ua3dOMkl2TkdRME1qQTBNR1EzTjJaaE5UZ3pOVFU1WXpSbVpqaGlOVFpoWVdVd01ESmhabVJqWW1GaE5HTmxPRFV3WXpneU1UUmhPVEpsWlRVNVl6bGlPRGs0WVFZNkJrVlUiLCJleHAiOiIyMDE4LTA5LTAzVDEwOjEyOjMyLjUwN1oiLCJwdXIiOiJibG9iX2tleSJ9fQ==--b9eed7f4cf3d71fcb697429188e1a1a74ba88bec/faded-flip.jpg", :status =&gt; 200, :view_runtime =&gt; 0.69, :db_runtime =&gt; 0.0, :status_message =&gt; "OK" } 127.0.0.1 - - [03/Sep/2018:11:07:41 BST] "GET /rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJbk4yWVhKcFlXNTBjeTh6TnpRMVlqSmtZaTB3WlRCakxUUTVaRFV0WW1Ga01DMWxNRFl4TWpFd09Ua3dOMkl2TkdRME1qQTBNR1EzTjJaaE5UZ3pOVFU1WXpSbVpqaGlOVFpoWVdVd01ESmhabVJqWW1GaE5HTmxPRFV3WXpneU1UUmhPVEpsWlRVNVl6bGlPRGs0WVFZNkJrVlUiLCJleHAiOiIyMDE4LTA5LTAzVDEwOjEyOjMyLjUwN1oiLCJwdXIiOiJibG9iX2tleSJ9fQ==--b9eed7f4cf3d71fcb697429188e1a1a74ba88bec/faded-flip.jpg?content_type=image%2Fjpeg&amp;disposition=inline%3B+filename%3D%22faded-flip.jpg%22%3B+filename%2A%3DUTF-8%27%27faded-flip.jpg HTTP/1.1" 200 21345 http://localhost:3000/users/password/new -&gt; /rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJbk4yWVhKcFlXNTBjeTh6TnpRMVlqSmtZaTB3WlRCakxUUTVaRFV0WW1Ga01DMWxNRFl4TWpFd09Ua3dOMkl2TkdRME1qQTBNR1EzTjJaaE5UZ3pOVFU1WXpSbVpqaGlOVFpoWVdVd01ESmhabVJqWW1GaE5HTmxPRFV3WXpneU1UUmhPVEpsWlRVNVl6bGlPRGs0WVFZNkJrVlUiLCJleHAiOiIyMDE4LTA5LTAzVDEwOjEyOjMyLjUwN1oiLCJwdXIiOiJibG9iX2tleSJ9fQ==--b9eed7f4cf3d71fcb697429188e1a1a74ba88bec/faded-flip.jpg?content_type=image%2Fjpeg&amp;disposition=inline%3B+filename%3D%22faded-flip.jpg%22%3B+filename%2A%3DUTF-8%27%27faded-flip.jpg 2018-09-03 11:07:42.234412 D [75455:70130203086520 log_subscriber.rb:8] ActiveStorage::DiskController -- Processing #show 2018-09-03 11:07:42.239153 I [75455:70130203086520 log_subscriber.rb:96] Rails -- FlatDisk Storage (0.1ms) Downloaded file from key: variants/ef6bca1d-bfd1-485e-b7cd-88a0e1e95404/4d42040d77fa583559c4ff8b56aae002afdcbaa4ce850c8214a92ee59c9b898a </code></pre> <p>Any help would be greatly appreciated. :)</p>
0debug
static int tx_consume(Rocker *r, DescInfo *info) { PCIDevice *dev = PCI_DEVICE(r); char *buf = desc_get_buf(info, true); RockerTlv *tlv_frag; RockerTlv *tlvs[ROCKER_TLV_TX_MAX + 1]; struct iovec iov[ROCKER_TX_FRAGS_MAX] = { { 0, }, }; uint32_t pport; uint32_t port; uint16_t tx_offload = ROCKER_TX_OFFLOAD_NONE; uint16_t tx_l3_csum_off = 0; uint16_t tx_tso_mss = 0; uint16_t tx_tso_hdr_len = 0; int iovcnt = 0; int err = ROCKER_OK; int rem; int i; if (!buf) { return -ROCKER_ENXIO; } rocker_tlv_parse(tlvs, ROCKER_TLV_TX_MAX, buf, desc_tlv_size(info)); if (!tlvs[ROCKER_TLV_TX_FRAGS]) { return -ROCKER_EINVAL; } pport = rocker_get_pport_by_tx_ring(r, desc_get_ring(info)); if (!fp_port_from_pport(pport, &port)) { return -ROCKER_EINVAL; } if (tlvs[ROCKER_TLV_TX_OFFLOAD]) { tx_offload = rocker_tlv_get_u8(tlvs[ROCKER_TLV_TX_OFFLOAD]); } switch (tx_offload) { case ROCKER_TX_OFFLOAD_L3_CSUM: if (!tlvs[ROCKER_TLV_TX_L3_CSUM_OFF]) { return -ROCKER_EINVAL; } break; case ROCKER_TX_OFFLOAD_TSO: if (!tlvs[ROCKER_TLV_TX_TSO_MSS] || !tlvs[ROCKER_TLV_TX_TSO_HDR_LEN]) { return -ROCKER_EINVAL; } break; } if (tlvs[ROCKER_TLV_TX_L3_CSUM_OFF]) { tx_l3_csum_off = rocker_tlv_get_le16(tlvs[ROCKER_TLV_TX_L3_CSUM_OFF]); } if (tlvs[ROCKER_TLV_TX_TSO_MSS]) { tx_tso_mss = rocker_tlv_get_le16(tlvs[ROCKER_TLV_TX_TSO_MSS]); } if (tlvs[ROCKER_TLV_TX_TSO_HDR_LEN]) { tx_tso_hdr_len = rocker_tlv_get_le16(tlvs[ROCKER_TLV_TX_TSO_HDR_LEN]); } rocker_tlv_for_each_nested(tlv_frag, tlvs[ROCKER_TLV_TX_FRAGS], rem) { hwaddr frag_addr; uint16_t frag_len; if (rocker_tlv_type(tlv_frag) != ROCKER_TLV_TX_FRAG) { err = -ROCKER_EINVAL; goto err_bad_attr; } rocker_tlv_parse_nested(tlvs, ROCKER_TLV_TX_FRAG_ATTR_MAX, tlv_frag); if (!tlvs[ROCKER_TLV_TX_FRAG_ATTR_ADDR] || !tlvs[ROCKER_TLV_TX_FRAG_ATTR_LEN]) { err = -ROCKER_EINVAL; goto err_bad_attr; } frag_addr = rocker_tlv_get_le64(tlvs[ROCKER_TLV_TX_FRAG_ATTR_ADDR]); frag_len = rocker_tlv_get_le16(tlvs[ROCKER_TLV_TX_FRAG_ATTR_LEN]); iov[iovcnt].iov_len = frag_len; iov[iovcnt].iov_base = g_malloc(frag_len); if (!iov[iovcnt].iov_base) { err = -ROCKER_ENOMEM; goto err_no_mem; } if (pci_dma_read(dev, frag_addr, iov[iovcnt].iov_base, iov[iovcnt].iov_len)) { err = -ROCKER_ENXIO; goto err_bad_io; } if (++iovcnt > ROCKER_TX_FRAGS_MAX) { goto err_too_many_frags; } } if (iovcnt) { tx_l3_csum_off += tx_tso_mss = tx_tso_hdr_len = 0; } err = fp_port_eg(r->fp_port[port], iov, iovcnt); err_too_many_frags: err_bad_io: err_no_mem: err_bad_attr: for (i = 0; i < ROCKER_TX_FRAGS_MAX; i++) { g_free(iov[i].iov_base); } return err; }
1threat
In c++ if header is included why I got 'does not a name of type' error? : <p>I have <code>data.h</code>:</p> <pre><code>#ifndef DATA_H_INCLUDED #define DATA_H_INCLUDED #include &lt;vector&gt; #include &lt;string&gt; #include &lt;iostream&gt; using namespace std; class student{ public: string id; int points [6] = {0,0,0,0,0,0}; }; #endif // DATA_H_INCLUDED </code></pre> <p>And I have <code>enor.h</code>:</p> <pre><code>#ifndef ENOR_H_INCLUDED #define ENOR_H_INCLUDED #include &lt;fstream&gt; #include &lt;vector&gt; #include &lt;string&gt; #include &lt;iostream&gt; #include "data.h" using namespace std; enum status{norm,abnorm}; class enor{ public: /*some voids*/ Student Current() const { return elem; } student elem; private: /*some voids*/ }; #endif // ENOR_H_INCLUDED </code></pre> <p>And I got <code>'Student' does not a name a type</code>, but why? I tried also if the <code>Student</code> calss is in <code>enor.h</code>, but also this error. how can I resolve this, and why is this?</p>
0debug
void bdrv_swap(BlockDriverState *bs_new, BlockDriverState *bs_old) { BlockDriverState tmp; if (bs_new->node_name[0] != '\0') { QTAILQ_REMOVE(&graph_bdrv_states, bs_new, node_list); } if (bs_old->node_name[0] != '\0') { QTAILQ_REMOVE(&graph_bdrv_states, bs_old, node_list); } assert(bs_new->device_name[0] == '\0'); assert(QLIST_EMPTY(&bs_new->dirty_bitmaps)); assert(bs_new->job == NULL); assert(bs_new->dev == NULL); assert(bdrv_op_blocker_is_empty(bs_new)); assert(bs_new->io_limits_enabled == false); assert(!throttle_have_timer(&bs_new->throttle_state)); tmp = *bs_new; *bs_new = *bs_old; *bs_old = tmp; bdrv_move_feature_fields(&tmp, bs_old); bdrv_move_feature_fields(bs_old, bs_new); bdrv_move_feature_fields(bs_new, &tmp); assert(bs_new->device_name[0] == '\0'); assert(bs_new->dev == NULL); assert(bs_new->job == NULL); assert(bdrv_op_blocker_is_empty(bs_new)); assert(bs_new->io_limits_enabled == false); assert(!throttle_have_timer(&bs_new->throttle_state)); if (bs_new->node_name[0] != '\0') { QTAILQ_INSERT_TAIL(&graph_bdrv_states, bs_new, node_list); } if (bs_old->node_name[0] != '\0') { QTAILQ_INSERT_TAIL(&graph_bdrv_states, bs_old, node_list); } bdrv_rebind(bs_new); bdrv_rebind(bs_old); }
1threat
static int mpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_output, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; Mpeg1Context *s = avctx->priv_data; AVFrame *picture = data; MpegEncContext *s2 = &s->mpeg_enc_ctx; av_dlog(avctx, "fill_buffer\n"); if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == SEQ_END_CODE)) { if (s2->low_delay == 0 && s2->next_picture_ptr) { *picture = s2->next_picture_ptr->f; s2->next_picture_ptr = NULL; *got_output = 1; } return buf_size; } if (s2->flags & CODEC_FLAG_TRUNCATED) { int next = ff_mpeg1_find_frame_end(&s2->parse_context, buf, buf_size, NULL); if (ff_combine_frame(&s2->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0) return buf_size; } if (s->mpeg_enc_ctx_allocated == 0 && avctx->codec_tag == AV_RL32("VCR2")) vcr2_init_sequence(avctx); s->slice_count = 0; if (avctx->extradata && !avctx->frame_number) { int ret = decode_chunks(avctx, picture, got_output, avctx->extradata, avctx->extradata_size); if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) return ret; } return decode_chunks(avctx, picture, got_output, buf, buf_size); }
1threat
flutter evaluate if var is integer or string : <p>i need to evaluate what type is a variable to make some switch,there are any way to evaluate a varible to get his type, like val() or something similar. i need to do something for integers and other for string.</p> <p>i alreaedy try to using a switch, like this,</p> <pre><code> switch (selector) { case int : print('value is a integer'); break; case String: print('value is a String'); break; </code></pre> <p>}</p> <p>but how i do this, if switch can allow compare mixed type of vars?</p> <p>thank you</p>
0debug
static int parse_inputs(const char **buf, AVFilterInOut **currInputs, AVFilterInOut **openLinks, AVClass *log_ctx) { int pad = 0; while(**buf == '[') { char *name = parse_link_name(buf, log_ctx); AVFilterInOut *match; if(!name) return -1; match = extract_inout(name, openLinks); if(match) { if(match->type != LinkTypeOut) { av_log(log_ctx, AV_LOG_ERROR, "Label \"%s\" appears twice as input!\n", match->name); return -1; } } else { match = av_mallocz(sizeof(AVFilterInOut)); match->name = name; match->type = LinkTypeIn; match->pad_idx = pad; } insert_inout(currInputs, match); *buf += consume_whitespace(*buf); pad++; } return pad; }
1threat
Sql query two first rows group by userId : <p>I have the data like this</p> <pre><code>deviceId | userId | Time 20 | 1 | 2-Jan-18 21 | 1 | 2-Jan-19 22 | 1 | 2-Jan-10 30 | 2 | 2-Jan-18 30 | 2 | 2-Jan-19 </code></pre> <p>I would like to query 2 first devices that the user uses and also the time (group by userId)</p> <pre><code>userId|firstDeviceId|firstDeviceTime|secondDeviceId|secondDeviceTime 1 |20 | 2-Jan-18 | 21 | 2-Jan-19 2 |30 | 2-Jan-18 | 30 | 2-Jan-19 </code></pre> <p>Could you guys show me the way to do it? Thanks</p>
0debug
¿How to declare and initialize multiple variables (with different names) within a for loop? (WITHOUT using arrays)) : I'm trying to perform the job that an array is supposed to do, but without actually using one. I was wondering if this was possible, and if it is, how? I have to initialize different variables, for example: int value1 = 0; int value2 = 0; int value3 = 0; int valueN = 0; I want to receive a value from the user that determinate what is the for loop going to last. Example: User --> 4 Then I can declare 4 variables and work with them. for(i = 1; i <= 4; i++){ Console.Write("Insert a number: "); int value(i) = int.Parse(Console.ReadLine()); } I expect to have 4 variables called equally, but with the only one difference that each one has a different number added at the end of the name. //value1 = 0; //value2 = 0; //value3 = 0; //valuen = 0;
0debug
How to use UMD in browser without any additional dependencies : <p>Suppose I have an UMD module like this (saved in <em>'js/mymodule.js'</em>):</p> <pre><code>(function (global, factory) { typeof exports === 'object' &amp;&amp; typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' &amp;&amp; define.amd ? define(['exports'], factory) : (factory((global.mymodule = global.mymodule || {}))); }(this, function (exports) { 'use strict'; function myFunction() { console.log('hello world'); } })); </code></pre> <p>How can I use this module in an HTML file like this? (without requirejs, commonjs, systemjs, etc...)</p> <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Using MyModule&lt;/title&gt; &lt;script src="js/mymodule.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;script&gt; /* HOW TO USE myFunction from mymodule.js ??? */ &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Many thanks in advance for any help.</p>
0debug
unable to store one function value in variable : <p>im getting value from jquery ajax call but unable to save in global variable, which value i want to use in another function. i want to get assign dustValue in initialize function.</p> <p>javascript code</p> <pre><code>var dustValue; $.ajax({ type: "GET", url: "http://my url", dataType: "json", success: function (data) { dustValue = data.sensorsdata.PHValue; } }); var myCenter = new google.maps.LatLng(22.8046, 86.2029); function initialize() { var mapProp = { center: myCenter, zoom: 17, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("googleMap"), mapProp); var value = dustValue;//78.55 var dustbinstatus = ''; if (value &lt; 50) { dustbinstatus = 'img/dustbinempty.png'; } else if (value &gt; 50 &amp;&amp; value &lt; 90) { dustbinstatus = 'img/dustbinfull.png'; } else if (value &gt; 90) { dustbinstatus = '3.jpg'; } var marker = new google.maps.Marker({ position: myCenter, icon: v_icon }); marker.setMap(map); } google.maps.event.addDomListener(window, 'load', initialize); </code></pre> <p>body </p> <pre><code> &lt;div id="googleMap" style="width:1580px;height:780px;"&gt;&lt;/div&gt; </code></pre>
0debug
How can I retrieve related or upselling products in php shopify app? : <p>I am looking into these apis to develop my shopify app, they haven't mentioned about apis for getting upselling products. Can anyone help? <a href="https://github.com/cmcdonaldca/ohShopify.php" rel="nofollow noreferrer">https://github.com/cmcdonaldca/ohShopify.php</a> <a href="https://github.com/ShopifyExtras/PHP-Shopify-API-Wrapper" rel="nofollow noreferrer">https://github.com/ShopifyExtras/PHP-Shopify-API-Wrapper</a></p>
0debug
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
1threat
How do I convert 2018-04-10T04:00:00.000Z string to DateTime? : <p>I get a date from a JSON API which looks like this "2018-04-10T04:00:00.000Z". I want to convert it in order to obtain a Date or String object and get something like "01-04-2018" that its "dd-MM-YYYY". How can I do it?</p>
0debug
String Formatting in java to replace the array index with the pointed string element : <p>We have to replace as follows Alibaba site china comparison best-Replacement array {} is {4} online {3} shopping {} in {}-positional argument array</p> <p>Output must be Alibaba is best online comparison shopping site in China.Please help me in getting so</p>
0debug
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; TiffContext *const s = avctx->priv_data; AVFrame *picture = data; AVFrame *const p = &s->picture; const uint8_t *orig_buf = buf, *end_buf = buf + buf_size; unsigned off; int id, le, ret; int i, j, entries; int stride; unsigned soff, ssize; uint8_t *dst; if (end_buf - buf < 8) return AVERROR_INVALIDDATA; id = AV_RL16(buf); buf += 2; if (id == 0x4949) le = 1; else if (id == 0x4D4D) le = 0; else { av_log(avctx, AV_LOG_ERROR, "TIFF header not found\n"); return -1; } s->le = le; s->invert = 0; s->compr = TIFF_RAW; s->fill_order = 0; free_geotags(s); av_dict_free(&s->picture.metadata); if (tget_short(&buf, le) != 42) { av_log(avctx, AV_LOG_ERROR, "The answer to life, universe and everything is not correct!\n"); return -1; } s->stripsizes = s->stripdata = NULL; off = tget_long(&buf, le); if (off >= UINT_MAX - 14 || end_buf - orig_buf < off + 14) { av_log(avctx, AV_LOG_ERROR, "IFD offset is greater than image size\n"); return AVERROR_INVALIDDATA; } buf = orig_buf + off; entries = tget_short(&buf, le); for (i = 0; i < entries; i++) { if (tiff_decode_tag(s, orig_buf, buf, end_buf) < 0) return -1; buf += 12; } for (i = 0; i<s->geotag_count; i++) { const char *keyname = get_geokey_name(s->geotags[i].key); if (!keyname) { av_log(avctx, AV_LOG_WARNING, "Unknown or unsupported GeoTIFF key %d\n", s->geotags[i].key); continue; } if (get_geokey_type(s->geotags[i].key) != s->geotags[i].type) { av_log(avctx, AV_LOG_WARNING, "Type of GeoTIFF key %d is wrong\n", s->geotags[i].key); continue; } ret = av_dict_set(&s->picture.metadata, keyname, s->geotags[i].val, 0); if (ret<0) { av_log(avctx, AV_LOG_ERROR, "Writing metadata with key '%s' failed\n", keyname); return ret; } } if (!s->stripdata && !s->stripoff) { av_log(avctx, AV_LOG_ERROR, "Image data is missing\n"); return -1; } if ((ret = init_image(s)) < 0) return ret; if (s->strips == 1 && !s->stripsize) { av_log(avctx, AV_LOG_WARNING, "Image data size missing\n"); s->stripsize = buf_size - s->stripoff; } stride = p->linesize[0]; dst = p->data[0]; for (i = 0; i < s->height; i += s->rps) { if (s->stripsizes) { if (s->stripsizes >= end_buf) return AVERROR_INVALIDDATA; ssize = tget(&s->stripsizes, s->sstype, s->le); } else ssize = s->stripsize; if (s->stripdata) { if (s->stripdata >= end_buf) return AVERROR_INVALIDDATA; soff = tget(&s->stripdata, s->sot, s->le); } else soff = s->stripoff; if (soff > buf_size || ssize > buf_size - soff) { av_log(avctx, AV_LOG_ERROR, "Invalid strip size/offset\n"); return -1; } if (tiff_unpack_strip(s, dst, stride, orig_buf + soff, ssize, FFMIN(s->rps, s->height - i)) < 0) break; dst += s->rps * stride; } if (s->predictor == 2) { dst = p->data[0]; soff = s->bpp >> 3; ssize = s->width * soff; if (s->avctx->pix_fmt == PIX_FMT_RGB48LE || s->avctx->pix_fmt == PIX_FMT_RGBA64LE) { for (i = 0; i < s->height; i++) { for (j = soff; j < ssize; j += 2) AV_WL16(dst + j, AV_RL16(dst + j) + AV_RL16(dst + j - soff)); dst += stride; } } else if (s->avctx->pix_fmt == PIX_FMT_RGB48BE || s->avctx->pix_fmt == PIX_FMT_RGBA64BE) { for (i = 0; i < s->height; i++) { for (j = soff; j < ssize; j += 2) AV_WB16(dst + j, AV_RB16(dst + j) + AV_RB16(dst + j - soff)); dst += stride; } } else { for (i = 0; i < s->height; i++) { for (j = soff; j < ssize; j++) dst[j] += dst[j - soff]; dst += stride; } } } if (s->invert) { dst = s->picture.data[0]; for (i = 0; i < s->height; i++) { for (j = 0; j < s->picture.linesize[0]; j++) dst[j] = (s->avctx->pix_fmt == PIX_FMT_PAL8 ? (1<<s->bpp) - 1 : 255) - dst[j]; dst += s->picture.linesize[0]; } } *picture = s->picture; *data_size = sizeof(AVPicture); return buf_size; }
1threat
static int is_rndis(USBNetState *s) { return s->dev.config->bConfigurationValue == DEV_RNDIS_CONFIG_VALUE; }
1threat
c# foreach iteration but only within specified date : I want to get files iteratied thru a directory but only from last two months, so I got: ...directory di code here ... DateTime from_date = DateTime.Now.AddMonths(-2); DateTime to_date = Datetime.Now; ... foreach (var filename in di.EnumerateFiles("*.SS*").Where(filename.ToString()=>filename.ToString().LastWriteTime >= from_date && filename.ToString().LastWriteTime <= to_date)) { ...code here.. } Well, it doesn't like that foreach loop for some reason. Is there a correct way of doing this?
0debug
Regex for a specific string with exact digits : <p>I am trying to get a regex for the below two strings.</p> <p>Must start, end and contain only these many digits. </p> <p>SG2222222C</p> <p>And </p> <p>P22222222</p> <p>THANKS </p>
0debug
c# correct way to call GC.Collect : <p>I have an application that do complex processing and creates too many objects, I want to free up the memory after the processing is complete.</p> <p>I'm currently calling GC.collect in my application in a try catch block, and </p> <p>// this function in a static class</p> <pre><code>public static void Collect() { try { GC.Collect } catch(Exception) { // } } </code></pre> <p>Is this the correct way to call the Garbage collector? should I call it directly? what is best use practice?</p>
0debug
static int nbd_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVNBDState *s = bs->opaque; char *export = NULL; int result, sock; result = nbd_config(s, options, &export); if (result != 0) { return result; } sock = nbd_establish_connection(bs); if (sock < 0) { return sock; } result = nbd_client_session_init(&s->client, bs, sock, export); g_free(export); return result; }
1threat
Cordova build changes distributionUrl in gradle-wrapper.properties file : <p>I keep getting the following build exception when I run </p> <pre><code> cordova run android --verbose </code></pre> <ul> <li>What went wrong: A problem occurred evaluating root project 'android'. <blockquote> <p>Failed to apply plugin [id 'android'] Gradle version 2.10 is required. Current version is 2.2.1. If using the gradle wrapper, try editing the distributionUrl in C:\Users\Project\gradle\wrapper\gradle-wrapper.properties to gradle-2.10-all.zip</p> </blockquote></li> </ul> <p>The reason for this is the line being changed when I run the cordova build command from; </p> <pre><code>distributionUrl=http\://services.gradle.org/distributions/gradle-2.1.0-all.zip </code></pre> <p>to</p> <pre><code>distributionUrl=http\://services.gradle.org/distributions/gradle-2.2.1-all.zip </code></pre> <p>Any way to prevent this ?</p>
0debug
Angular 2 access parent routeparams from child component : <p>I've got this (main parent) component -</p> <pre><code>@RouteConfig([ { path: '/', name: 'ProjectList', component: ProjectListComponent, useAsDefault: true }, { path: '/new', name: 'ProjectNew', component: ProjectFormComponent }, { path: '/:id', name: 'ProjectDetail', component: ProjectDetailComponent }, { path: '/:id/issues/...', name: 'Issue', component: IssueMountComponent }, ]) class ProjectMountComponent { } </code></pre> <p>And then I've got the second mount component (child of main parent, parent of the next component)</p> <pre><code>@Component({ template: ` &lt;div&gt;&lt;router-outlet&gt;&lt;/router-outlet&gt;&lt;/div&gt; `, directives: [RouterLink, RouterOutlet] }) @RouteConfig([ { path: "/", name: "IssueList", component: IssueListComponent, useAsDefault: true }, ]) class IssueMountComponent { constructor(private _routeParams: RouteParams) { } } </code></pre> <p>Here I can access the routeParams (:id) without any problem. Now, here's the component where I need the value of <code>:id</code> from the uri. </p> <pre><code>@Component({ template: ` &lt;h3&gt;Issue List&lt;/h3&gt; &lt;ul&gt; &lt;issue-component *ngFor="#issue of issues" [issue]="issue"&gt;&lt;/issue-component&gt; &lt;/ul&gt; `, directives: [IssueComponent], providers: [IssueService] }) class IssueListComponent implements OnInit { issues: Issue[]; constructor(private _issueService: IssueService, private _routeParams: RouteParams) {} getIssues() { let id = this._routeParams.get('id'); console.log(this._routeParams); this._issueService.getIssues(id).then(issues =&gt; this.issues = issues); } ngOnInit() { this.getIssues(); } } </code></pre> <p>In this component, I cannot access the value of the <code>:id</code> route parameter. It's always null. What am I doing wrong?</p> <p>Here's the component hierarchy -</p> <p><strong>ProjectMountComponent -> IssueMountComponent -> IssueListComponent</strong></p>
0debug
def newman_prime(n): if n == 0 or n == 1: return 1 return 2 * newman_prime(n - 1) + newman_prime(n - 2)
0debug
Concantenate two string and convert to datetime pandas python : I am using latest version of pandas and python 3.5 I have a CSV file with two columns DATE and TIME both are string DATE: 07Jan2015 TIME: 0:00:00 I need to concatenate DATE and TIME and convert the result to datetime or timestamp but the DATE must be in following format DATE FORMAT: 01/07/2015 So the result should look like this: 01/07/2015 0:00:00 I am using pandas to import the CSV Your help is always appreciated Thanks
0debug
"fetch is not found globally and no fetcher passed" when using spacejam in meteor : <p>I'm writing unit tests to check my api. Before I merged my <code>git</code> <em>test</em> branch with my <em>dev</em> branch everything was fine, but then I started to get this <em>error</em>:</p> <pre><code>App running at: http://localhost:4096/ spacejam: meteor is ready spacejam: spawning phantomjs phantomjs: Running tests at http://localhost:4096/local using test-in-console phantomjs: Error: fetch is not found globally and no fetcher passed, to fix pass a fetch for your environment like https://www.npmjs.com/package/unfetch. For example: import fetch from 'unfetch'; import { createHttpLink } from 'apollo-link-http'; const link = createHttpLink({ uri: '/graphql', fetch: fetch }); </code></pre> <p>Here's a part of my <code>api.test.js</code> file:</p> <pre><code>describe('GraphQL API for users', () =&gt; { before(() =&gt; { StubCollections.add([Meteor.users]); StubCollections.stub(); }); after(() =&gt; { StubCollections.restore(); }); it('should do the work', () =&gt; { const x = 'hello'; expect(x).to.be.a('string'); }); }); </code></pre> <p>The funniest thing is that I don't even have <code>graphql</code> in my tests (although, I use it in my <code>meteor</code> package) Unfortunately, I didn't to find enough information (apart from <a href="https://www.apollographql.com/docs/link/links/http.html" rel="noreferrer">apollo-link-http docs</a> that has examples, but still puzzles me). I did try to use that example, but it didn't help and I still get the same error</p>
0debug
In angularjs Make http service in synchronous way using promises : When i hit the url on particular page of the application i want to check whether the page is allow to load or not using the api call, if it is allowed then allow to load that page else redirect to different page
0debug
static int get_video_private_data(struct VideoFile *vf, AVCodecContext *codec) { AVIOContext *io = NULL; uint16_t sps_size, pps_size; int err = AVERROR(EINVAL); if (codec->codec_id == AV_CODEC_ID_VC1) return get_private_data(vf, codec); avio_open_dyn_buf(&io); if (codec->extradata_size < 11 || codec->extradata[0] != 1) goto fail; sps_size = AV_RB16(&codec->extradata[6]); if (11 + sps_size > codec->extradata_size) goto fail; avio_wb32(io, 0x00000001); avio_write(io, &codec->extradata[8], sps_size); pps_size = AV_RB16(&codec->extradata[9 + sps_size]); if (11 + sps_size + pps_size > codec->extradata_size) goto fail; avio_wb32(io, 0x00000001); avio_write(io, &codec->extradata[11 + sps_size], pps_size); err = 0; fail: vf->codec_private_size = avio_close_dyn_buf(io, &vf->codec_private); return err; }
1threat
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
yuv2rgb_2_c_template(SwsContext *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, enum PixelFormat target, int hasAlpha) { const int16_t *buf0 = buf[0], *buf1 = buf[1], *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], *vbuf0 = vbuf[0], *vbuf1 = vbuf[1], *abuf0 = hasAlpha ? abuf[0] : NULL, *abuf1 = hasAlpha ? abuf[1] : NULL; int yalpha1 = 4095 - yalpha; int uvalpha1 = 4095 - uvalpha; int i; for (i = 0; i < (dstW >> 1); i++) { int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19; int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 19; int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19; int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19; int A1, A2; const void *r = c->table_rV[V], *g = (c->table_gU[U] + c->table_gV[V]), *b = c->table_bU[U]; if (hasAlpha) { A1 = (abuf0[i * 2 ] * yalpha1 + abuf1[i * 2 ] * yalpha) >> 19; A2 = (abuf0[i * 2 + 1] * yalpha1 + abuf1[i * 2 + 1] * yalpha) >> 19; } yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, r, g, b, y, target, hasAlpha); } }
1threat
How to make a for loop to start from anywhere and end it same position? : <p>I am having a array list of integer type , say 1,2,3,4,5,6,7,8,9.i need to reorder the list with the dynamic index values suppose if i pass the index value as 4 the array should be re ordered as 5,6,7,8,9,1,2,3,4 .....</p>
0debug
How to display a progress bar while loading single bundled javascript file by webpack? : <p>The question is concerning webpack. After packing almost everything into a single bundle.js which is loaded in index.html, the bundle.js file is about 2M and requires several seconds to load. </p> <p>I'd like to display a progress bar indicating loading progress while hiding all the content. Only enable user interaction and show the content after loading is done, exactly the one that Gmail is using. </p> <p>Is it possible to use webpack to do that? How? </p> <p>Thanks!</p>
0debug
Radiobutton not geting value : I want to get the value of my Radiobutton but it doesn't work! I searched for countless tutorials and none of them answer my question. It might be because of I'm trying to get a dictionary but can somebody please help!! This is my code: vars = [] playersg={"Bob":"1", "Jeff":"2", "John":"3", "Adam":"4"} def NextRound(): j = 0 playersg2 = [] while j < len(vars): playersg2 += vars[j].get() print(j) print(vars[j].get()) j += 1 print(playersg2) def match(): matchw = Tk() matchw.withdraw() draw = 0 vieww.withdraw() matchw.deiconify() matchw.title('Tournament Software') matchw.geometry("300x999900") matchw.configure(background="#1aff29") numPlayers = len(playersg) numDraws = numPlayers/2 matches=Label(matchw, text="Matches", font="none 50 bold", bg="#1aff29", fg="black").pack() while draw < numDraws: frame = Frame(matchw, bg="#1aff29") frame.pack() var = StringVar() R1=Radiobutton(frame, text=playersg[draw], bg="#00e60f" , font="none 10 bold", fg="black", command=NextRound, indicatoron = 0, value = playersg[draw], variable=var) R1.pack(side=LEFT, anchor=W) Label(frame, text = "vs", font = "none 10 bold", bg="#1aff29", fg="black").pack(side=LEFT, anchor=W) R2=Radiobutton(frame, text=playersg[numPlayers-draw-1] , bg="#00e60f", font="none 10 bold", fg="black", command=NextRound, indicatoron = 0, value = playersg[numPlayers-draw-1], variable=var) R2.pack(side=LEFT, anchor=W) draw += 1 print(var.get()) vars.append(var) There is no error but when I print(var[j].get()), it doesn't print anything.
0debug
Can white-space: pre-line be set of a specific height in CSS? : <p>Is there a way to set the space of white-space pre-line?</p> <p>I don't want line height which also affects the text of the paragraph, only of the pre-line line breaks height.</p> <p>Thank you</p>
0debug
Convert string into integers for addition of fractions on C++ : <p>I have a problem with converting this input: 1/2 + 3/4 for example. This input is given as string. How can I convert it into integers and do the addition with this fractions. Here is my code:</p> <pre><code>int main() { char input[30]; cin.getline(input, 30); char *tok; tok = strtok(input, "+ /"); while (tok != NULL) { cout &lt;&lt; tok &lt;&lt; endl; tok = strtok(NULL, "+ /"); } return 0; } </code></pre> <p>I splitted the string and extracted the numbers but they are still a chars, so how can i convert them into ints in that while loop?</p>
0debug
static inline void gen_evsel(DisasContext *ctx) { int l1 = gen_new_label(); int l2 = gen_new_label(); int l3 = gen_new_label(); int l4 = gen_new_label(); TCGv_i32 t0 = tcg_temp_local_new_i32(); tcg_gen_andi_i32(t0, cpu_crf[ctx->opcode & 0x07], 1 << 3); tcg_gen_brcondi_i32(TCG_COND_EQ, t0, 0, l1); tcg_gen_mov_tl(cpu_gprh[rD(ctx->opcode)], cpu_gprh[rA(ctx->opcode)]); tcg_gen_br(l2); gen_set_label(l1); tcg_gen_mov_tl(cpu_gprh[rD(ctx->opcode)], cpu_gprh[rB(ctx->opcode)]); gen_set_label(l2); tcg_gen_andi_i32(t0, cpu_crf[ctx->opcode & 0x07], 1 << 2); tcg_gen_brcondi_i32(TCG_COND_EQ, t0, 0, l3); tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); tcg_gen_br(l4); gen_set_label(l3); tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rB(ctx->opcode)]); gen_set_label(l4); tcg_temp_free_i32(t0); }
1threat
How can i scrape member emails from a private group on facebook without being added to the group : I want to scrape emails of the members of a particular group on facebook but I can't see them (the group is private) because I am not a member of the group and I would not accepted anytime soon.
0debug
void helper_ldl_data(uint64_t t0, uint64_t t1) { ldl_data(t1, t0); }
1threat
static void gd_grab_pointer(GtkDisplayState *s) { #if GTK_CHECK_VERSION(3, 0, 0) GdkDisplay *display = gtk_widget_get_display(s->drawing_area); GdkDeviceManager *mgr = gdk_display_get_device_manager(display); GList *devices = gdk_device_manager_list_devices(mgr, GDK_DEVICE_TYPE_MASTER); GList *tmp = devices; while (tmp) { GdkDevice *dev = tmp->data; if (gdk_device_get_source(dev) == GDK_SOURCE_MOUSE) { gdk_device_grab(dev, gtk_widget_get_window(s->drawing_area), GDK_OWNERSHIP_NONE, FALSE, GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_MOTION_MASK | GDK_SCROLL_MASK, s->null_cursor, GDK_CURRENT_TIME); } tmp = tmp->next; } g_list_free(devices); #else gdk_pointer_grab(gtk_widget_get_window(s->drawing_area), FALSE, GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_MOTION_MASK | GDK_SCROLL_MASK, NULL, s->null_cursor, GDK_CURRENT_TIME); #endif }
1threat
Can we define synchronized block inside a synchronized method? : <p>In java can we define synchronized block inside a synchronized method? If so please explain me with example</p>
0debug
sent email if ping failed on listview VB.net : I'm creating the Ping monitoring system using VB.net. I want the system to sent an email if some of device is down, and sent an email again if that device back to online. I try to create this script but it failed. Can u all help me to solve the problem. The email will always sent if the device ping is failed. I used Ping to monitor the devices, IP Address of the device already saved and will be loaded on lvi.SubItems(5).Text. Here is the script Private Sub Ping_LV() For Each lvi As ListViewItem In LV_Monitoring.Items Dim p As New Ping AddHandler p.PingCompleted, AddressOf p_PingCompleted p.SendAsync(lvi.SubItems(5).Text, lvi) Next End Sub Private Sub p_PingCompleted(ByVal sender As Object, ByVal e As System.Net.NetworkInformation.PingCompletedEventArgs) Dim p As Ping = DirectCast(sender, Ping) Dim lvi As ListViewItem = DirectCast(e.UserState, ListViewItem) If e.Reply.Status = IPStatus.Success Then Console.WriteLine("Ping Success") lvi.SubItems(6).Text = "UP" lvi.UseItemStyleForSubItems = False lvi.SubItems(6).ForeColor = Color.White lvi.SubItems(6).BackColor = Color.Green Else Console.WriteLine("Ping Failed") lvi.SubItems(6).Text = "DOWN" lvi.UseItemStyleForSubItems = False lvi.SubItems(6).ForeColor = Color.White lvi.SubItems(6).BackColor = Color.Red Sent_Email() End If RemoveHandler p.PingCompleted, AddressOf p_PingCompleted p.Dispose() LV_Monitoring.Refresh() End Sub
0debug
iscsi_aio_flush(BlockDriverState *bs, BlockDriverCompletionFunc *cb, void *opaque) { IscsiLun *iscsilun = bs->opaque; struct iscsi_context *iscsi = iscsilun->iscsi; IscsiAIOCB *acb; acb = qemu_aio_get(&iscsi_aiocb_info, bs, cb, opaque); acb->iscsilun = iscsilun; acb->canceled = 0; acb->bh = NULL; acb->status = -EINPROGRESS; acb->buf = NULL; acb->task = iscsi_synchronizecache10_task(iscsi, iscsilun->lun, 0, 0, 0, 0, iscsi_synccache10_cb, acb); if (acb->task == NULL) { error_report("iSCSI: Failed to send synchronizecache10 command. %s", iscsi_get_error(iscsi)); qemu_aio_release(acb); return NULL; } iscsi_set_events(iscsilun); return &acb->common; }
1threat
Replace no data by zeros in datadog graphs : <p>There does not seem to be a way to replace no data by zeros when using formulas in datadog. I've tried fill zero but it doesn't seem to work I would simply like my dd agent monitor to display 0 instead of no data when it is down</p>
0debug
how to compare a string to a an expression has lambda in it : I'm trying to compare a string to another string that has lambda symbol in it. if (CategoryType.ToUpper() == "E&D") when i compare these 2 strings it displays as E&amp;D. How can I do the comparison?
0debug
How do I access a variable that's defined within an imported file? : <p>My windows batch file:</p> <pre><code>python test.py pause </code></pre> <p>test.py:</p> <pre><code>import test_import print(greeting) </code></pre> <p>test_import.py:</p> <pre><code>greeting='hello world' </code></pre> <p>This isn't working. I'm getting an error message, saying 'greeting' is not defined. I'd like to show you the output, but I'm having trouble with that too.</p> <p>What do I need to change withint test_import.py, so the variable is accessible within the main module?</p>
0debug
How do I read content from a .txt file and then find the average of said content in java : I was tasked with reading a data.txt file using the scanner import. The data.txt file looks like this: ``` 1 2 3 4 5 6 7 8 9 Q ``` I need to read and find the average of these numbers, but stop when I get to something that is not an integer. This is the code that I have so far. ``` public static double fileAverage(String filename) throws FileNotFoundException { Scanner input = new Scanner(System.in); String i = input.nextLine(); while (i.hasNext); return fileAverage(i); // dummy return value. You must return the average here. } // end of method fileAverage ``` As you can see I did not get very far and I cannot figure this out. Thank you for your help.
0debug
MVC 5 application : Hello guys i need your help. I am having issue with these code. All i want to do is to apply link to each of the list item in the controller. When i click on a single link it takes me to a new page entirely, displaying the item id in the URL. Please find attached the code below. var customers = new List<Customer> { new Customer {Id = 1, Name = "John Smith"}, new Customer {Id = 2, Name = "Mary Williams"} }; var viewModel = new RandomMovieViewModel { customers = customers }; return View(viewModel); } public ActionResult Details(int id) { return View(); }
0debug
static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacket *pkt) { int got_picture, i; if (packet_queue_get(&is->videoq, pkt, 1) < 0) return -1; if (pkt->data == flush_pkt.data) { avcodec_flush_buffers(is->video_st->codec); SDL_LockMutex(is->pictq_mutex); for (i = 0; i < VIDEO_PICTURE_QUEUE_SIZE; i++) { is->pictq[i].skip = 1; } while (is->pictq_size && !is->videoq.abort_request) { SDL_CondWait(is->pictq_cond, is->pictq_mutex); } is->video_current_pos = -1; is->frame_last_pts = AV_NOPTS_VALUE; is->frame_last_duration = 0; is->frame_timer = (double)av_gettime() / 1000000.0; is->frame_last_dropped_pts = AV_NOPTS_VALUE; SDL_UnlockMutex(is->pictq_mutex); return 0; } avcodec_decode_video2(is->video_st->codec, frame, &got_picture, pkt); if (got_picture) { int ret = 1; if (decoder_reorder_pts == -1) { *pts = av_frame_get_best_effort_timestamp(frame); } else if (decoder_reorder_pts) { *pts = frame->pkt_pts; } else { *pts = frame->pkt_dts; } if (*pts == AV_NOPTS_VALUE) { *pts = 0; } if (((is->av_sync_type == AV_SYNC_AUDIO_MASTER && is->audio_st) || is->av_sync_type == AV_SYNC_EXTERNAL_CLOCK) && (framedrop>0 || (framedrop && is->audio_st))) { SDL_LockMutex(is->pictq_mutex); if (is->frame_last_pts != AV_NOPTS_VALUE && *pts) { double clockdiff = get_video_clock(is) - get_master_clock(is); double dpts = av_q2d(is->video_st->time_base) * *pts; double ptsdiff = dpts - is->frame_last_pts; if (fabs(clockdiff) < AV_NOSYNC_THRESHOLD && ptsdiff > 0 && ptsdiff < AV_NOSYNC_THRESHOLD && clockdiff + ptsdiff - is->frame_last_filter_delay < 0) { is->frame_last_dropped_pos = pkt->pos; is->frame_last_dropped_pts = dpts; is->frame_drops_early++; ret = 0; } } SDL_UnlockMutex(is->pictq_mutex); } return ret; } return 0; }
1threat
static int vorbis_parse_id_hdr(vorbis_context *vc){ GetBitContext *gb=&vc->gb; uint_fast8_t bl0, bl1; if ((get_bits(gb, 8)!='v') || (get_bits(gb, 8)!='o') || (get_bits(gb, 8)!='r') || (get_bits(gb, 8)!='b') || (get_bits(gb, 8)!='i') || (get_bits(gb, 8)!='s')) { av_log(vc->avccontext, AV_LOG_ERROR, " Vorbis id header packet corrupt (no vorbis signature). \n"); return 1; } vc->version=get_bits_long(gb, 32); vc->audio_channels=get_bits(gb, 8); vc->audio_samplerate=get_bits_long(gb, 32); vc->bitrate_maximum=get_bits_long(gb, 32); vc->bitrate_nominal=get_bits_long(gb, 32); vc->bitrate_minimum=get_bits_long(gb, 32); bl0=get_bits(gb, 4); bl1=get_bits(gb, 4); vc->blocksize[0]=(1<<bl0); vc->blocksize[1]=(1<<bl1); if (bl0>13 || bl0<6 || bl1>13 || bl1<6 || bl1<bl0) { av_log(vc->avccontext, AV_LOG_ERROR, " Vorbis id header packet corrupt (illegal blocksize). \n"); return 3; } if (vc->blocksize[1]/2 * vc->audio_channels * 2 > AVCODEC_MAX_AUDIO_FRAME_SIZE) { av_log(vc->avccontext, AV_LOG_ERROR, "Vorbis channel count makes " "output packets too large.\n"); return 4; } vc->win[0]=ff_vorbis_vwin[bl0-6]; vc->win[1]=ff_vorbis_vwin[bl1-6]; if(vc->exp_bias){ int i, j; for(j=0; j<2; j++){ float *win = av_malloc(vc->blocksize[j]/2 * sizeof(float)); for(i=0; i<vc->blocksize[j]/2; i++) win[i] = vc->win[j][i] * (1<<15); vc->win[j] = win; } } if ((get_bits1(gb)) == 0) { av_log(vc->avccontext, AV_LOG_ERROR, " Vorbis id header packet corrupt (framing flag not set). \n"); return 2; } vc->channel_residues=(float *)av_malloc((vc->blocksize[1]/2)*vc->audio_channels * sizeof(float)); vc->channel_floors=(float *)av_malloc((vc->blocksize[1]/2)*vc->audio_channels * sizeof(float)); vc->saved=(float *)av_malloc((vc->blocksize[1]/2)*vc->audio_channels * sizeof(float)); vc->ret=(float *)av_malloc((vc->blocksize[1]/2)*vc->audio_channels * sizeof(float)); vc->buf=(float *)av_malloc(vc->blocksize[1] * sizeof(float)); vc->buf_tmp=(float *)av_malloc(vc->blocksize[1] * sizeof(float)); vc->saved_start=0; ff_mdct_init(&vc->mdct[0], bl0, 1); ff_mdct_init(&vc->mdct[1], bl1, 1); AV_DEBUG(" vorbis version %d \n audio_channels %d \n audio_samplerate %d \n bitrate_max %d \n bitrate_nom %d \n bitrate_min %d \n blk_0 %d blk_1 %d \n ", vc->version, vc->audio_channels, vc->audio_samplerate, vc->bitrate_maximum, vc->bitrate_nominal, vc->bitrate_minimum, vc->blocksize[0], vc->blocksize[1]); return 0; }
1threat
yuv2rgb48_1_c_template(SwsContext *c, const int32_t *buf0, const int32_t *ubuf[2], const int32_t *vbuf[2], const int32_t *abuf0, uint16_t *dest, int dstW, int uvalpha, int y, enum PixelFormat target) { const int32_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], *vbuf0 = vbuf[0], *vbuf1 = vbuf[1]; int i; if (uvalpha < 2048) { for (i = 0; i < (dstW >> 1); i++) { int Y1 = (buf0[i * 2] ) >> 2; int Y2 = (buf0[i * 2 + 1]) >> 2; int U = (ubuf0[i] + (-128 << 11)) >> 2; int V = (vbuf0[i] + (-128 << 11)) >> 2; int R, G, B; Y1 -= c->yuv2rgb_y_offset; Y2 -= c->yuv2rgb_y_offset; Y1 *= c->yuv2rgb_y_coeff; Y2 *= c->yuv2rgb_y_coeff; Y1 += 1 << 13; Y2 += 1 << 13; R = V * c->yuv2rgb_v2r_coeff; G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; B = U * c->yuv2rgb_u2b_coeff; output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14); output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14); output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14); output_pixel(&dest[3], av_clip_uintp2(R_B + Y2, 30) >> 14); output_pixel(&dest[4], av_clip_uintp2( G + Y2, 30) >> 14); output_pixel(&dest[5], av_clip_uintp2(B_R + Y2, 30) >> 14); dest += 6; } } else { for (i = 0; i < (dstW >> 1); i++) { int Y1 = (buf0[i * 2] ) >> 2; int Y2 = (buf0[i * 2 + 1]) >> 2; int U = (ubuf0[i] + ubuf1[i] + (-128 << 11)) >> 3; int V = (vbuf0[i] + vbuf1[i] + (-128 << 11)) >> 3; int R, G, B; Y1 -= c->yuv2rgb_y_offset; Y2 -= c->yuv2rgb_y_offset; Y1 *= c->yuv2rgb_y_coeff; Y2 *= c->yuv2rgb_y_coeff; Y1 += 1 << 13; Y2 += 1 << 13; R = V * c->yuv2rgb_v2r_coeff; G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; B = U * c->yuv2rgb_u2b_coeff; output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14); output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14); output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14); output_pixel(&dest[3], av_clip_uintp2(R_B + Y2, 30) >> 14); output_pixel(&dest[4], av_clip_uintp2( G + Y2, 30) >> 14); output_pixel(&dest[5], av_clip_uintp2(B_R + Y2, 30) >> 14); dest += 6; } } }
1threat
How to add condition inractjs : I want to show tooltip if two conditions are true. <LikelihoodIndicatorRefi likelihood={ props.props.approvalChance_NewLoan } > {console.log(props.props.approvalChance_NewLoan === 'Less Likely' && props.props.approvalChance_Combined === 'Less Likely')} {(props.props.approvalChance_NewLoan === 'Less Likely' && props.props.approvalChance_Combined === 'Less Likely' && <SmartTooltip wrapperCssClass="option-detail-tooltip" ctaLabel="How do I increase my chances?"> <h3>Less Likely</h3> <p> Want to improve your chnace of getting this loan? &nbsp;Try increasing the time to pay it back over.Or you could try asking for less money. </p> </SmartTooltip>)} </LikelihoodIndicatorRefi> <LikelihoodIndicatorRefi likelihood={ props.props.approvalChance_NewLoan } > {console.log(props.props.approvalChance_NewLoan === 'Less Likely' && props.props.approvalChance_Combined === 'Less Likely')} {(props.props.approvalChance_NewLoan === 'Less Likely' && props.props.approvalChance_Combined === 'Less Likely' && <SmartTooltip wrapperCssClass="option-detail-tooltip" ctaLabel="How do I increase my chances?"> <h3>Less Likely</h3> <p> Want to improve your chnace of getting this loan? &nbsp;Try increasing the time to pay it back over.Or you could try asking for less money. </p> </SmartTooltip>)} </LikelihoodIndicatorRefi>
0debug
creating a movie database : <p>Hi is there anyway I can incorporate an entire movie database to an android application ? I am using java to code and I cannot figure out whether to use sql lite. But even if that is the case I don't know how to exactly I am supposed to code all that considering I need to classify the movies according to genres, year, duration, a trailer and plot.Thank you.</p>
0debug
I am new to programming and currently coding in VB.NET. I'm starting to grasp For Loops but 1 line of the following loop doesn't make sense to me? : Dim answer As Integer Dim startNumber As Integer answer = 0 For startNumber = 1 To 4 answer = answer + startNumber Next startNumber MessageBox.Show(answer) can someone explain the line that says " answer = answer + startNumber"
0debug
void h263_encode_mb(MpegEncContext * s, DCTELEM block[6][64], int motion_x, int motion_y) { int cbpc, cbpy, i, cbp, pred_x, pred_y; if (!s->mb_intra) { cbp = 0; for (i = 0; i < 6; i++) { if (s->block_last_index[i] >= 0) cbp |= 1 << (5 - i); } if ((cbp | motion_x | motion_y) == 0) { put_bits(&s->pb, 1, 1); return; } put_bits(&s->pb, 1, 0); cbpc = cbp & 3; put_bits(&s->pb, inter_MCBPC_bits[cbpc], inter_MCBPC_code[cbpc]); cbpy = cbp >> 2; cbpy ^= 0xf; put_bits(&s->pb, cbpy_tab[cbpy][1], cbpy_tab[cbpy][0]); h263_pred_motion(s, 0, &pred_x, &pred_y); if (!umvplus) { h263_encode_motion(s, motion_x - pred_x); h263_encode_motion(s, motion_y - pred_y); } else { h263p_encode_umotion(s, motion_x - pred_x); h263p_encode_umotion(s, motion_y - pred_y); if (((motion_x - pred_x) == 1) && ((motion_y - pred_y) == 1)) put_bits(&s->pb,1,1); } } else { cbp = 0; for (i = 0; i < 6; i++) { if (s->block_last_index[i] >= 1) cbp |= 1 << (5 - i); } cbpc = cbp & 3; if (s->pict_type == I_TYPE) { put_bits(&s->pb, intra_MCBPC_bits[cbpc], intra_MCBPC_code[cbpc]); } else { put_bits(&s->pb, 1, 0); put_bits(&s->pb, inter_MCBPC_bits[cbpc + 4], inter_MCBPC_code[cbpc + 4]); } if (s->h263_pred) { put_bits(&s->pb, 1, 0); } cbpy = cbp >> 2; put_bits(&s->pb, cbpy_tab[cbpy][1], cbpy_tab[cbpy][0]); } if (s->h263_pred) { for (i = 0; i < 6; i++) { mpeg4_encode_block(s, block[i], i); } } else { for (i = 0; i < 6; i++) { h263_encode_block(s, block[i], i); } } }
1threat
Iptables deny all proxy on firewall : <p>i've recently configured a server and after a bit i decided to deny everyone that use a proxy in my Ts3 server, i tried to search some iptables module but nothing, then i'm searching for something like a global proxy list, i'm asking if there's a method to deny all connection from a proxy to my server using iptables or some other program.</p>
0debug
void ff_avg_h264_qpel4_mc33_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_hv_qrt_and_aver_dst_4x4_msa(src + stride - 2, src - (stride * 2) + sizeof(uint8_t), stride, dst, stride); }
1threat
Google Code Archive to Github : <p>I want to migrate this project <a href="https://code.google.com/archive/p/majesticuo" rel="noreferrer">https://code.google.com/archive/p/majesticuo</a> to GitHub maintaining the history.</p> <p>When i try to use the 'Export to GitHub' button, it says 'The Google Code project export tool is no longer available</p> <p>The Google Code to GitHub exporter tool is no longer available. The source code for Google Code projects can now be found in the Google Code Archive.'</p> <p>What would be the best way to do it manually? I have no svn knowledge and know a little bit of git. Thanks so much! </p>
0debug
What lengths code in matlab? : So I am trying to understand what length is all about. Say we have vector A = [1,2,3,4,5,6,7,8] and when we code up length(A) it spits out 8 for the # of elements. How does the length command work. Ive been thinking its a for loop like A = [could be any size]; for i = A % takes each element of a i = i+1; adds 1 for each new element thus counting the elements end Please help my understanding
0debug
How to check whether text starts with uppercase : # TL;DR: Surely somebody has written, and packaged up, a utility which checks whether the first character in a piece of `Text` is uppercase! Surely something like that is usable with `Protolude` (or some other modern Prelude replacement). # The simple problem I need to find out whether some word starts with an uppercase character. # Warming up import Data.Char startsWithUppercase :: String -> Bool startsWithUppercase = isUpper . head this works ... λ startsWithUppercase "Yes" True λ startsWithUppercase "no" False except that `head` is a partial function λ startsWithUppercase "" *** Exception: Prelude.head: empty list # A safer version import Data.Char import Data.Maybe safeHead :: [a] -> Maybe a safeHead [] = Nothing safeHead (x:_) = Just x startsWithUppercase :: String -> Bool startsWithUppercase = (maybe False isUpper) . safeHead This seems to fix the problem: λ map startsWithUppercase $ words "Yes no" [True,False] λ startsWithUppercase "" False except that I want to use `Text` rather than `String` # Moving from `String` to `Text` Let's try a direct translation: {-# LANGUAGE OverloadedStrings #-} import Prelude hiding (head) import Data.Text import Data.Char import Data.Maybe safeHead :: Text -> Maybe Char safeHead "" = Nothing safeHead t = Just . head $ t startsWithUppercase :: Text -> Bool startsWithUppercase = (maybe False isUpper) . safeHead It seems to work ... yes, no, crash :: Text yes = "Yes" no = "no" crash = "" λ Prelude.map startsWithUppercase [yes, no, crash] [True,False,False] ... but I can't help wondering why Hoogle didn't come up with anything interesting in response to `Text -> Maybe Char`. Anyway, I'm sick and tired of these partial functions all over the place: I don't want these gaping holes in my static guarantees. I know, let's use one of these modern Prelude replacemens. `Protolude` looks good, and seems to have many proponents. # Moving to Protolude Protolude, among its many virtues, is supposed to address the two main issues I have addressed above: + Eradicate `String`, make `Text` available by default. + Eradicate partial functions, make safe ones available by default. It even imports `Data.Maybe` for me. Sounds great. Let's do it! There will be no need to write `safeHead`, because in `Protolude` `head` already is safe, and generic to boot: λ :t head head :: Foldable f => f a -> Maybe a Excellent! {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE NoImplicitPrelude #-} import Protolude import Data.Char startsWithUppercase :: Text -> Bool startsWithUppercase = (maybe False isUpper) . head Oh dear: Lib.hs 8 23 error [-Wdeferred-type-errors] • Couldn't match type ‘Text’ with ‘f0 Char’ Expected type: Text -> Bool Actual type: f0 Char -> Bool • In the expression: (maybe False isUpper) . head In an equation for ‘startsWithUppercase’: startsWithUppercase = (maybe False isUpper) . head (intero) `Protolude.head` is defined on `Foldable`s, which `Text` isn't. I guess I'll have to write my own `safeHead` for `Text` after all. Hmm, but for that I used `Text.head` and `Protolude` hides that away. After numerous further failed attempts to get this to work, I have to stand back and think: I'm trying to find whether the first character of a piece of `Text` is uppercase, in a modern Prelude. **Surely it can't take this much effort!!!1111!!!** What am I missing? What is the sane solution to this simple problem?
0debug
static int kvm_getput_regs(CPUState *env, int set) { struct kvm_regs regs; int ret = 0; if (!set) { ret = kvm_vcpu_ioctl(env, KVM_GET_REGS, &regs); if (ret < 0) return ret; } kvm_getput_reg(&regs.rax, &env->regs[R_EAX], set); kvm_getput_reg(&regs.rbx, &env->regs[R_EBX], set); kvm_getput_reg(&regs.rcx, &env->regs[R_ECX], set); kvm_getput_reg(&regs.rdx, &env->regs[R_EDX], set); kvm_getput_reg(&regs.rsi, &env->regs[R_ESI], set); kvm_getput_reg(&regs.rdi, &env->regs[R_EDI], set); kvm_getput_reg(&regs.rsp, &env->regs[R_ESP], set); kvm_getput_reg(&regs.rbp, &env->regs[R_EBP], set); #ifdef TARGET_X86_64 kvm_getput_reg(&regs.r8, &env->regs[8], set); kvm_getput_reg(&regs.r9, &env->regs[9], set); kvm_getput_reg(&regs.r10, &env->regs[10], set); kvm_getput_reg(&regs.r11, &env->regs[11], set); kvm_getput_reg(&regs.r12, &env->regs[12], set); kvm_getput_reg(&regs.r13, &env->regs[13], set); kvm_getput_reg(&regs.r14, &env->regs[14], set); kvm_getput_reg(&regs.r15, &env->regs[15], set); #endif kvm_getput_reg(&regs.rflags, &env->eflags, set); kvm_getput_reg(&regs.rip, &env->eip, set); if (set) ret = kvm_vcpu_ioctl(env, KVM_SET_REGS, &regs); return ret; }
1threat
React history.push() is updating url but not navigating to it in browser : <p>I've read many things about react-router v4 and the npm history library to this point, but none seems to be helping me. </p> <p>My code is functioning as expected up to the point when it should navigate and do a simple redirect when the url is changed using the history.push() method. The URL IS changing to the specified route, but not doing the redirect on the button push. Thanks in advance, still learning react-router... </p> <p>I would like for the button push to do a simple redirect without the {forceRefresh:true}, which then reloads the whole page. </p> <pre><code>import React from 'react'; import createBrowserHistory from 'history/createBrowserHistory'; const history = createBrowserHistory({forceRefresh:true}); export default class Link extends React.Component { onLogout() { history.push("/signup"); } render() { return( &lt;div&gt; &lt;h1&gt;Your Links&lt;/h1&gt; &lt;button onClick={this.onLogout.bind(this)}&gt;Log Out&lt;/button&gt; &lt;/div&gt; ) } } </code></pre>
0debug
It's possible ignore child dependency in Composer config? : <p>When I run composer install, it will install all my "require" and the "require" of the other package.</p> <p>My composer.json</p> <pre><code>{ "name": "my_app", "require": { "some/package": "0.0.0" } } </code></pre> <p>The "child" dependency</p> <pre><code>{ "name": "some/package", "require": { "zendframework/zend-mail": "2.4.*@dev", "soundasleep/html2text": "~0.2", "mpdf/mpdf": "6.0.0", "endroid/qrcode": "1.*@dev" } } </code></pre> <p>I know that it's possible ignore the php extensions, but what about these second require package?</p>
0debug