problem
stringlengths
26
131k
labels
class label
2 classes
static inline TCGv gen_ld16s(TCGv addr, int index) { TCGv tmp = new_tmp(); tcg_gen_qemu_ld16s(tmp, addr, index); return tmp; }
1threat
How can I make a hidden button menu with a scroll bar? : I want to have buttons hidden above my normal content in the scroll view that will appear when I swipe down. Currently I have these buttons in a stack view in the scroll view. I want the view to snap between two positions where the buttons are not visible and where they are, but also may need to scroll if the actual content is larger than the screen. I've tried content offset which works at first but then if it is scrolled and the content is smaller than the screen it will always show the buttons. Any ideas on how to do this? Thanks. [Image for clarification][1] [1]: https://i.stack.imgur.com/xtJcx.jpg
0debug
Get only dataValues from Sequelize ORM : <p>I'm using the sequelize ORM to fetch data from a PSQL DB. However, when I retrieve something, a whole bunch of data is given. The only data I want is inside 'dataValues'. Of course, I can use object.dataValues. But, is there any other good solutions?</p> <p>I'm using Sequelize 4.10</p>
0debug
Unuses Argument error R code : I have a Problem with the following code for a Sampling Importance Resampling Algorithm. It Returns "log=True: unused Argument" for the declaration of Theta. Hope u can help me! Thanks CODE: T = 1e5 theta <- runif(T,0,1, log=TRUE) log.p <- function(x) dbeta(x, 3000+711, 17000+2201-711) log.s <- function(x) dunif(x, 0, 1,) w <- function(t) log.p(t) / log.s(t) HA <- sum(w(theta)%*%theta)/T
0debug
Javascript unbind variables : <p>I have the following code that copy variable value then change its value.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var a = [{name: 'John Doe'}]; var b = a; document.write(b[0].name + '&lt;br /&gt;'); document.write(a[0].name + '&lt;br /&gt;&lt;br /&gt;'); b[0].name = 'Jane Doe'; document.write(b[0].name + '&lt;br /&gt;'); document.write(a[0].name + '&lt;br /&gt;');</code></pre> </div> </div> </p> <p>But somehow that also change first variable value</p> <p>How do I make variable A to keep its value?</p>
0debug
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
1threat
def multiples_of_num(m,n): multiples_of_num= list(range(n,(m+1)*n, n)) return list(multiples_of_num)
0debug
Autofac - SingleInstance HttpClient : <p>Have read in various places that HttpClient should be reused rather than a new instance every time.</p> <p><a href="https://aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/" rel="noreferrer">https://aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/</a></p> <p>I am using Autofac on a project.</p> <p>Would this be a good way of making a single instance of HttpClient available to to inject into services?</p> <pre><code>builder.Register(c =&gt; new HttpClient()).As&lt;HttpClient&gt;().SingleInstance(); </code></pre> <p>Seems to work :)</p>
0debug
void drive_hot_add(Monitor *mon, const QDict *qdict) { int dom, pci_bus; unsigned slot; int type, bus; PCIDevice *dev; DriveInfo *dinfo = NULL; const char *pci_addr = qdict_get_str(qdict, "pci_addr"); const char *opts = qdict_get_str(qdict, "opts"); BusState *scsibus; dinfo = add_init_drive(opts); if (!dinfo) goto err; if (dinfo->devaddr) { monitor_printf(mon, "Parameter addr not supported\n"); goto err; } type = dinfo->type; bus = drive_get_max_bus (type); switch (type) { case IF_SCSI: if (pci_read_devaddr(mon, pci_addr, &dom, &pci_bus, &slot)) { goto err; } dev = pci_find_device(pci_bus, slot, 0); if (!dev) { monitor_printf(mon, "no pci device with address %s\n", pci_addr); goto err; } scsibus = QLIST_FIRST(&dev->qdev.child_bus); scsi_bus_legacy_add_drive(DO_UPCAST(SCSIBus, qbus, scsibus), dinfo, dinfo->unit); monitor_printf(mon, "OK bus %d, unit %d\n", dinfo->bus, dinfo->unit); break; case IF_NONE: monitor_printf(mon, "OK\n"); break; default: monitor_printf(mon, "Can't hot-add drive to type %d\n", type); goto err; } return; err: if (dinfo) drive_uninit(dinfo); return; }
1threat
scikit-learn return value of LogisticRegression.predict_proba : <p>What exactly does the <code>LogisticRegression.predict_proba</code> function return?</p> <p>In my example I get a result like this:</p> <pre><code>[[ 4.65761066e-03 9.95342389e-01] [ 9.75851270e-01 2.41487300e-02] [ 9.99983374e-01 1.66258341e-05]] </code></pre> <p>From other calculations, using the sigmoid function, I know, that the second column are probabilities. The <a href="http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html#sklearn.linear_model.LogisticRegression.predict_proba" rel="noreferrer">documentation</a> says, that the first column are <code>n_samples</code>, but that can't be, because my samples are reviews, which are texts and not numbers. The documentation also says, that the second column are <code>n_classes</code>. That certainly can't be, since I only have two classes (namely <code>+1</code> and <code>-1</code>) and the function is supposed to be about calculating probabilities of samples really being of a class, but not the classes themselves.</p> <p>What is the first column really and why it is there?</p>
0debug
Reshaping data with R : <p>I have my data in the below table structure:</p> <pre> Person ID | Role | Role Count ----------------------------- 1 | A | 24 1 | B | 3 2 | A | 15 2 | B | 4 2 | C | 7 </pre> <p>I would like to reshape this so that there is one row for each Person ID, A column for each distinct role (e.g. A,B,C) and then the Role Count for each person as the values. Using the above data the output would be:</p> <pre> Person ID | Role A | Role B | Role C ------------------------------------- 1 | 24 | 3 | 0 2 | 16 | 4 | 7 </pre> <p>Coming from a Java background I would take an iterative approach to this:</p> <ol> <li>Find all distinct values for Role </li> <li>Create a new table with a column for PersonID and each of the distinct roles </li> <li>Iterate through the first table, get role counts for each Person ID and Role combination and insert results into new table.</li> </ol> <p>Is there another way of doing this in R without iterating through the first table? </p> <p>Thanks</p>
0debug
void qemu_system_debug_request(void) { debug_requested = 1; vm_stop(VMSTOP_DEBUG); }
1threat
AVIOContext *avio_alloc_context( unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t (*seek)(void *opaque, int64_t offset, int whence)) { AVIOContext *s = av_mallocz(sizeof(AVIOContext)); ffio_init_context(s, buffer, buffer_size, write_flag, opaque, read_packet, write_packet, seek); return s; }
1threat
static int qio_dns_resolver_lookup_sync_nop(QIODNSResolver *resolver, SocketAddressLegacy *addr, size_t *naddrs, SocketAddressLegacy ***addrs, Error **errp) { *naddrs = 1; *addrs = g_new0(SocketAddressLegacy *, 1); (*addrs)[0] = QAPI_CLONE(SocketAddressLegacy, addr); return 0; }
1threat
Extracting timeseries tables from string into dictionary : <p>I have a text file that contains several time series data that looks like this:</p> <pre><code>Elect Price (Jenkins 1989) 1960 6.64784 1961 6.95902 1962 6.8534 1963 6.95924 1964 6.77416 1965 6.96237 1966 6.94241 1967 6.50688 1968 5.72611 1969 5.45512 1970 5.2703 1971 5.75105 1972 5.26886 1973 5.06676 1975 6.14003 1976 5.44883 1977 6.49034 1978 7.17429 1979 7.87244 1980 9.20048 1981 7.35384 1982 6.44922 1983 5.44273 1984 4.3131 1985 5.27546 1986 4.99998 1987 5.78054 1988 5.65552 Hydro Electricity (Guyol 1969; Energy Information Administration 1995) 1958 5.74306e+009 1959 5.90702e+009 1960 6.40238e+009 1961 6.77396e+009 1962 7.12661e+009 1963 7.47073e+009 1964 7.72361e+009 1980 1.62e+010 1985 1.85e+010 1986 1.88e+010 1987 1.89e+010 1988 1.96e+010 1989 1.95e+010 1990 2.02e+010 1991 2.05e+010 1992 2.04e+010 1993 2.12e+010 Nuclear Electricity (Guyol 1969; Energy Information Administration 1995) 1958 4.43664e+006 1959 1.34129e+007 1960 2.56183e+007 1961 4.09594e+007 1962 6.09336e+007 1963 1.09025e+008 1964 1.59522e+008 1980 6.40598e+009 1985 1.33e+010 1986 1.42e+010 1987 1.55e+010 1988 1.68e+010 1989 1.73e+010 1990 1.77e+010 1991 1.86e+010 1992 1.88e+010 1993 1.95e+010 </code></pre> <p>I have it loaded up as a single string and I am wondering what the best way would be to convert it into a dictionary of the form:</p> <pre><code>{('Elect Price', '(Jenkins 1989)'): [(1960, 6.64784), (1961, 6.95902), (1962, 6.8534), ...], ...} </code></pre> <p>My first instinct is to go line by line through the string and check to see if a few different regular expressions match and go from there, but I'd also have to include logic to handle what to do after a variable name is matched, then the citation, and the data, etc.</p> <p>Is there a better way to do this? Possibly with some kind of template to extract the variable name, citation, and data as mentioned? I'm sure this is a fairly common task so I'm assuming there are more standard methods/tools for this.</p>
0debug
Why the return type of getchar() is int? : <p>I searched for the answer on Internet but I could not understand what is this 'EOF'? Please let me know from basic about what is getchar() and what are it's uses? Note that I am just a beginner of C language.</p>
0debug
static void *show_parts(void *arg) { char *device = arg; int nbd; nbd = open(device, O_RDWR); if (nbd != -1) { close(nbd); } return NULL; }
1threat
Property is missing in type error : <p>I am having an issue with working through a demo React project. Most of the issues stem from me trying to implement it in Typescript where they are using Javascript. This gist is my app.tsx file.</p> <p><a href="https://gist.github.com/jjuel/59eed01cccca0a7b4f486181f2a14c6c" rel="noreferrer">https://gist.github.com/jjuel/59eed01cccca0a7b4f486181f2a14c6c</a></p> <p>When I run this I get errors pertaining to the interface. </p> <blockquote> <p>ERROR in ./app/app.tsx (38,17): error TS2324: Property 'humans' is missing in type 'IntrinsicAttributes &amp; IntrinsicClassAttributes &amp; AppProps &amp; { children?: ReactElement |...'.</p> <p>ERROR in ./app/app.tsx (38,17): error TS2324: Property 'stores' is missing in type 'IntrinsicAttributes &amp; IntrinsicClassAttributes &amp; AppProps &amp; { children?: ReactElement |...'. webpack: bundle is now VALID.</p> </blockquote> <p>I have no idea what is going on with this. Does anyone know what my issue could be? Thanks!</p>
0debug
find files in AWS : <p>I update a company website which recently began hosting with AWS. I am used to accessing the files via ftp using Filezilla. I have been thru several tutorials and finally was able to get Filezilla connected with an instance. But the files I used to see are not there. Please can anyone help me? I'm not an expert I just can't wrap my head around AWS despite reading their tutorials and also watching other tutorials. I just want to see the files, be able to download or upload them as I wish. thanks</p>
0debug
How much jquery in angular app? : <p>I'm learning javascript and I'm at the point where I can't figure it out on my own, how much do I need to know about jquery to develop app with angular, ember or whatever framework i chose to, <strong>is jquery optional, something good to know but i can do all i wanted just by going with some popular framework</strong>? </p>
0debug
What does Gradle 'build' task include exactly : <p>I have searched on Gradle docs and on the stackoverflow and some other places but I can't find information about what is bundled in this task in depth, or I missed it, if so please point me to the direction.</p> <ul> <li>It comes from <code>java-base</code> plugin, right?</li> <li>Running <code>gradle -q tasks</code> doesn't say much about it.</li> </ul> <blockquote> <p>build - Assembles and tests this project.</p> </blockquote> <ul> <li><p>Running <code>gradle help --task build</code> shows detailed info, ok - but it show where the task is used, in which groups is included, type of a task, and paths.</p></li> <li><p>I have tried to track manually what does comes with it, and noticed, compile, test etc tasks.</p></li> </ul> <p>I would like to know what exactly comes from Gradle build task, what are the task dependencies.</p>
0debug
How to take column of dataframe in pandas : <p>now I have this dataframe:</p> <pre><code> A B C 0 m 1 b 1 n 4 a 2 p 3 c 3 o 4 d 4 k 6 e </code></pre> <p>so,How I can get <strong>n,p,k</strong> in column。as follow:</p> <pre><code> A B C 0 n 4 a 1 p 3 c 2 k 6 e </code></pre> <p>thanks</p>
0debug
haskell using list type function : <p>Hi I'm trying to use list types in haskell.</p> <p>I have the following types in my .hs file:</p> <pre><code>type Name = String type PhoneNumber = Int type Person = (Name, PhoneNumber) type PhoneBook = [Person] </code></pre> <p>I'm looking to add the function </p> <pre><code>add::Person -&gt; PhoneBook -&gt; PhoneBook add ........ </code></pre> <p>that adds an entry to the phone book at the beginning of the list. Testing it would be done through the terminal </p>
0debug
Init Array of vector.size() in c++ : <p>I try to compile some c++-Code from the internet (<a href="http://arma.sourceforge.net/shadows/" rel="nofollow">http://arma.sourceforge.net/shadows/</a>).</p> <p>When compiling the code I get an error for initializing arrays. Example (from the code-> GaussianMixtureModel.cpp Line:122):</p> <pre><code>void function() { int k = Vector.size(); uchar* Ptrs[k]; // Does somthing with the Ptrs } </code></pre> <p>I also tried to edit it to the following:</p> <pre><code>const int k = Vector.size(); </code></pre> <p>But it didn't work. I would appreciate any help!</p> <p>I'm using Visual Studio 2012.</p> <p>Thanks for your answers!</p>
0debug
How do I change the timezone of Selenium in Python : <p>I have been googling but there seems no adequate answers, I assume Selenium grabs it from my computer, but I should be able to feed it something else no?</p>
0debug
Notepad++ view hidden characters : <p>I have a string that has been giving some of my code fits of rage and its got "extra" characters in it that I only stumbled upon by using the arrow keys to go through it. I noticed that the cursor stayed in place in certain areas for an extra keystroke of the arrow key. Using View >Show Symbols > Show All Characters still didnt seem to indicate anything there. What kind of character could be there and is there a plugin for it?</p>
0debug
Andriod SQLite Warn : I have some strange warn with SQLite. <br>What does it mean ? 11-30 13:05:23.653 9964-9964/com.hikari.dev.servermonitor D/SQLiteDatabase: Open database java.lang.Throwable: stacktrace at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:815) at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:714) at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:578) at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:269) at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:223) at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:187) -> at com.hikari.dev.servermonitor.main.onClick(main.java:40) at android.view.View.performClick(View.java:5269) at android.view.View$PerformClick.run(View.java:21556) at android.os.Handler.handleCallback(Handler.java:815) at android.os.Handler.dispatchMessage(Handler.java:104) at android.os.Looper.loop(Looper.java:207) at android.app.ActivityThread.main(ActivityThread.java:5769) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679) database_helper.java (singleton) package com.hikari.dev.servermonitor; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class database_helper extends SQLiteOpenHelper { // Database public static final int DATABASE_VERSION = 1; public static final String DATABASE_NAME = "ServerMonitorDatabase"; public static final String TABLE_SERVERS = "servers"; //Servers public static final String SERVER_ID = "_id"; public static final String SERVER_NAME = "name"; public static final String SERVER_MONITORING_STATUS = "monitoring_status"; public static final String SERVER_IP = "ip"; public static final String SERVER_PORT = "port"; //Singleton private static database_helper instance; public static database_helper getInstance(Context context) { if(instance == null) instance = new database_helper(context.getApplicationContext()); return instance; } @Override public void onCreate(SQLiteDatabase sqLiteDatabase) { sqLiteDatabase.execSQL("create table " + TABLE_SERVERS + "(" + SERVER_ID + " integer primary key," + SERVER_NAME + " text," + SERVER_MONITORING_STATUS + " integer," + SERVER_IP + " text," + SERVER_PORT + " integer)"); } @Override public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) { sqLiteDatabase.execSQL("drop table if exists" + TABLE_SERVERS); onCreate(sqLiteDatabase); } private database_helper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } } main.java (40) SQLiteDatabase database = database_helper.getInstance(this).getReadableDatabase();
0debug
static int compute_bit_allocation(AC3EncodeContext *s, uint8_t bap[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], uint8_t encoded_exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], uint8_t exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS], int frame_bits) { int i, ch; int csnroffst, fsnroffst; uint8_t bap1[NB_BLOCKS][AC3_MAX_CHANNELS][N/2]; static int frame_bits_inc[8] = { 0, 0, 2, 2, 2, 4, 2, 4 }; s->sdecaycod = 2; s->fdecaycod = 1; s->sgaincod = 1; s->dbkneecod = 2; s->floorcod = 4; for(ch=0;ch<s->nb_all_channels;ch++) s->fgaincod[ch] = 4; s->bit_alloc.fscod = s->fscod; s->bit_alloc.halfratecod = s->halfratecod; s->bit_alloc.sdecay = sdecaytab[s->sdecaycod] >> s->halfratecod; s->bit_alloc.fdecay = fdecaytab[s->fdecaycod] >> s->halfratecod; s->bit_alloc.sgain = sgaintab[s->sgaincod]; s->bit_alloc.dbknee = dbkneetab[s->dbkneecod]; s->bit_alloc.floor = floortab[s->floorcod]; frame_bits += 65; frame_bits += frame_bits_inc[s->acmod]; for(i=0;i<NB_BLOCKS;i++) { frame_bits += s->nb_channels * 2 + 2; if (s->acmod == 2) frame_bits++; frame_bits += 2 * s->nb_channels; if (s->lfe) frame_bits++; for(ch=0;ch<s->nb_channels;ch++) { if (exp_strategy[i][ch] != EXP_REUSE) frame_bits += 6 + 2; } frame_bits++; frame_bits++; frame_bits += 2; } frame_bits++; frame_bits += 2*4 + 3 + 6 + s->nb_all_channels * (4 + 3); frame_bits += 2; frame_bits += 16; csnroffst = s->csnroffst; while (csnroffst >= 0 && bit_alloc(s, bap, encoded_exp, exp_strategy, frame_bits, csnroffst, 0) < 0) csnroffst -= SNR_INC1; if (csnroffst < 0) { av_log(NULL, AV_LOG_ERROR, "Yack, Error !!!\n"); return -1; } while ((csnroffst + SNR_INC1) <= 63 && bit_alloc(s, bap1, encoded_exp, exp_strategy, frame_bits, csnroffst + SNR_INC1, 0) >= 0) { csnroffst += SNR_INC1; memcpy(bap, bap1, sizeof(bap1)); } while ((csnroffst + 1) <= 63 && bit_alloc(s, bap1, encoded_exp, exp_strategy, frame_bits, csnroffst + 1, 0) >= 0) { csnroffst++; memcpy(bap, bap1, sizeof(bap1)); } fsnroffst = 0; while ((fsnroffst + SNR_INC1) <= 15 && bit_alloc(s, bap1, encoded_exp, exp_strategy, frame_bits, csnroffst, fsnroffst + SNR_INC1) >= 0) { fsnroffst += SNR_INC1; memcpy(bap, bap1, sizeof(bap1)); } while ((fsnroffst + 1) <= 15 && bit_alloc(s, bap1, encoded_exp, exp_strategy, frame_bits, csnroffst, fsnroffst + 1) >= 0) { fsnroffst++; memcpy(bap, bap1, sizeof(bap1)); } s->csnroffst = csnroffst; for(ch=0;ch<s->nb_all_channels;ch++) s->fsnroffst[ch] = fsnroffst; #if defined(DEBUG_BITALLOC) { int j; for(i=0;i<6;i++) { for(ch=0;ch<s->nb_all_channels;ch++) { printf("Block #%d Ch%d:\n", i, ch); printf("bap="); for(j=0;j<s->nb_coefs[ch];j++) { printf("%d ",bap[i][ch][j]); } printf("\n"); } } } #endif return 0; }
1threat
Unreachable Code detected c# beginner : <p>Hi I'm new to C# and could do with anybody's help on how to discover what the problem is here. I keep getting an error saying that unreachable code was detected under the line '_parcelService' at the bottom.</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ABC.Data; using ABC.Services; using ABC.Services.Service; namespace ABC.Controllers { public class AdminController : Controller { private ParcelService _parcelService; public AdminController() { _parcelService = new ParcelService(); } // GET: Admin public ActionResult Index() { return View(); } [HttpGet] public ActionResult AddParcel() { return View(); } [HttpPost] public ActionResult AddParcel(ParcelDetail parcel) { return View(); { _parcelService.AddParcel(parcel); return RedirectToAction("Parcels", new { TrackingID = parcel.TrackingID, controller = "Parcel" }); } } } } </code></pre>
0debug
AudioState *AUD_init (void) { size_t i; int done = 0; const char *drvname; AudioState *s = &glob_audio_state; LIST_INIT (&s->hw_head_out); LIST_INIT (&s->hw_head_in); LIST_INIT (&s->cap_head); atexit (audio_atexit); s->ts = qemu_new_timer (vm_clock, audio_timer, s); if (!s->ts) { dolog ("Could not create audio timer\n"); return NULL; } audio_process_options ("AUDIO", audio_options); s->nb_hw_voices_out = conf.fixed_out.nb_voices; s->nb_hw_voices_in = conf.fixed_in.nb_voices; if (s->nb_hw_voices_out <= 0) { dolog ("Bogus number of playback voices %d, setting to 1\n", s->nb_hw_voices_out); s->nb_hw_voices_out = 1; } if (s->nb_hw_voices_in <= 0) { dolog ("Bogus number of capture voices %d, setting to 0\n", s->nb_hw_voices_in); s->nb_hw_voices_in = 0; } { int def; drvname = audio_get_conf_str ("QEMU_AUDIO_DRV", NULL, &def); } if (drvname) { int found = 0; for (i = 0; i < ARRAY_SIZE (drvtab); i++) { if (!strcmp (drvname, drvtab[i]->name)) { done = !audio_driver_init (s, drvtab[i]); found = 1; break; } } if (!found) { dolog ("Unknown audio driver `%s'\n", drvname); dolog ("Run with -audio-help to list available drivers\n"); } } if (!done) { for (i = 0; !done && i < ARRAY_SIZE (drvtab); i++) { if (drvtab[i]->can_be_default) { done = !audio_driver_init (s, drvtab[i]); } } } if (!done) { done = !audio_driver_init (s, &no_audio_driver); if (!done) { dolog ("Could not initialize audio subsystem\n"); } else { dolog ("warning: Using timer based audio emulation\n"); } } if (done) { VMChangeStateEntry *e; if (conf.period.hertz <= 0) { if (conf.period.hertz < 0) { dolog ("warning: Timer period is negative - %d " "treating as zero\n", conf.period.hertz); } conf.period.ticks = 1; } else { conf.period.ticks = ticks_per_sec / conf.period.hertz; } e = qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s); if (!e) { dolog ("warning: Could not register change state handler\n" "(Audio can continue looping even after stopping the VM)\n"); } } else { qemu_del_timer (s->ts); return NULL; } LIST_INIT (&s->card_head); register_savevm ("audio", 0, 1, audio_save, audio_load, s); qemu_mod_timer (s->ts, qemu_get_clock (vm_clock) + conf.period.ticks); return s; }
1threat
How can i bulk rename file after a specify words : For example > 123_abc.mp4 > 456_def.mp4 I want to remove all after "_" so the result should be > 123.mp4 > 456.mp4 Is it possible to use cmd or batch,powershell to rename ?
0debug
static int audio_decode_frame(VideoState *is, double *pts_ptr) { AVPacket *pkt_temp = &is->audio_pkt_temp; AVPacket *pkt = &is->audio_pkt; AVCodecContext *dec = is->audio_st->codec; int len1, len2, data_size, resampled_data_size; int64_t dec_channel_layout; int got_frame; double pts; int new_packet = 0; int flush_complete = 0; int wanted_nb_samples; for (;;) { while (pkt_temp->size > 0 || (!pkt_temp->data && new_packet)) { if (!is->frame) { if (!(is->frame = avcodec_alloc_frame())) return AVERROR(ENOMEM); } else avcodec_get_frame_defaults(is->frame); if (is->paused) return -1; if (flush_complete) break; new_packet = 0; len1 = avcodec_decode_audio4(dec, is->frame, &got_frame, pkt_temp); if (len1 < 0) { pkt_temp->size = 0; break; } pkt_temp->data += len1; pkt_temp->size -= len1; if (!got_frame) { if (!pkt_temp->data && dec->codec->capabilities & CODEC_CAP_DELAY) flush_complete = 1; continue; } data_size = av_samples_get_buffer_size(NULL, dec->channels, is->frame->nb_samples, dec->sample_fmt, 1); dec_channel_layout = (dec->channel_layout && dec->channels == av_get_channel_layout_nb_channels(dec->channel_layout)) ? dec->channel_layout : av_get_default_channel_layout(dec->channels); wanted_nb_samples = synchronize_audio(is, is->frame->nb_samples); if (dec->sample_fmt != is->audio_src.fmt || dec_channel_layout != is->audio_src.channel_layout || dec->sample_rate != is->audio_src.freq || (wanted_nb_samples != is->frame->nb_samples && !is->swr_ctx)) { if (is->swr_ctx) swr_free(&is->swr_ctx); is->swr_ctx = swr_alloc_set_opts(NULL, is->audio_tgt.channel_layout, is->audio_tgt.fmt, is->audio_tgt.freq, dec_channel_layout, dec->sample_fmt, dec->sample_rate, 0, NULL); if (!is->swr_ctx || swr_init(is->swr_ctx) < 0) { fprintf(stderr, "Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels!\n", dec->sample_rate, av_get_sample_fmt_name(dec->sample_fmt), dec->channels, is->audio_tgt.freq, av_get_sample_fmt_name(is->audio_tgt.fmt), is->audio_tgt.channels); break; } is->audio_src.channel_layout = dec_channel_layout; is->audio_src.channels = dec->channels; is->audio_src.freq = dec->sample_rate; is->audio_src.fmt = dec->sample_fmt; } resampled_data_size = data_size; if (is->swr_ctx) { const uint8_t *in[] = { is->frame->data[0] }; uint8_t *out[] = {is->audio_buf2}; if (wanted_nb_samples != is->frame->nb_samples) { if (swr_set_compensation(is->swr_ctx, (wanted_nb_samples - is->frame->nb_samples) * is->audio_tgt.freq / dec->sample_rate, wanted_nb_samples * is->audio_tgt.freq / dec->sample_rate) < 0) { fprintf(stderr, "swr_set_compensation() failed\n"); break; } } len2 = swr_convert(is->swr_ctx, out, sizeof(is->audio_buf2) / is->audio_tgt.channels / av_get_bytes_per_sample(is->audio_tgt.fmt), in, is->frame->nb_samples); if (len2 < 0) { fprintf(stderr, "swr_convert() failed\n"); break; } if (len2 == sizeof(is->audio_buf2) / is->audio_tgt.channels / av_get_bytes_per_sample(is->audio_tgt.fmt)) { fprintf(stderr, "warning: audio buffer is probably too small\n"); swr_init(is->swr_ctx); } is->audio_buf = is->audio_buf2; resampled_data_size = len2 * is->audio_tgt.channels * av_get_bytes_per_sample(is->audio_tgt.fmt); } else { is->audio_buf = is->frame->data[0]; } pts = is->audio_clock; *pts_ptr = pts; is->audio_clock += (double)data_size / (dec->channels * dec->sample_rate * av_get_bytes_per_sample(dec->sample_fmt)); #ifdef DEBUG { static double last_clock; printf("audio: delay=%0.3f clock=%0.3f pts=%0.3f\n", is->audio_clock - last_clock, is->audio_clock, pts); last_clock = is->audio_clock; } #endif return resampled_data_size; } if (pkt->data) av_free_packet(pkt); memset(pkt_temp, 0, sizeof(*pkt_temp)); if (is->paused || is->audioq.abort_request) { return -1; } if ((new_packet = packet_queue_get(&is->audioq, pkt, 1)) < 0) return -1; if (pkt->data == flush_pkt.data) { avcodec_flush_buffers(dec); flush_complete = 0; } *pkt_temp = *pkt; if (pkt->pts != AV_NOPTS_VALUE) { is->audio_clock = av_q2d(is->audio_st->time_base)*pkt->pts; } } }
1threat
void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int endy, int status){ const int start_i= clip(startx + starty * s->mb_width , 0, s->mb_num-1); const int end_i = clip(endx + endy * s->mb_width , 0, s->mb_num); const int start_xy= s->mb_index2xy[start_i]; const int end_xy = s->mb_index2xy[end_i]; int mask= -1; if(!s->error_resilience) return; mask &= ~VP_START; if(status & (AC_ERROR|AC_END)){ mask &= ~(AC_ERROR|AC_END); s->error_count -= end_i - start_i + 1; if(status & (DC_ERROR|DC_END)){ mask &= ~(DC_ERROR|DC_END); s->error_count -= end_i - start_i + 1; if(status & (MV_ERROR|MV_END)){ mask &= ~(MV_ERROR|MV_END); s->error_count -= end_i - start_i + 1; if(status & (AC_ERROR|DC_ERROR|MV_ERROR)) s->error_count= INT_MAX; if(mask == ~0x7F){ memset(&s->error_status_table[start_xy], 0, (end_xy - start_xy) * sizeof(uint8_t)); }else{ int i; for(i=start_xy; i<end_xy; i++){ s->error_status_table[ i ] &= mask; if(end_i == s->mb_num) s->error_count= INT_MAX; else{ s->error_status_table[end_xy] &= mask; s->error_status_table[end_xy] |= status; s->error_status_table[start_xy] |= VP_START; if(start_xy > 0 && s->avctx->thread_count <= 1 && s->avctx->skip_top*s->mb_width < start_i){ int prev_status= s->error_status_table[ s->mb_index2xy[start_i - 1] ]; prev_status &= ~ VP_START; if(prev_status != (MV_END|DC_END|AC_END)) s->error_count= INT_MAX;
1threat
Accessing multiple controllers with same request mapping : <p>Please find my HomeController and DemoController</p> <pre><code>class HomeController{ @RequestMapping(value="index") public void home(){ } } class DemoController{ @RequestMapping(value="index") public void demo(){ } } </code></pre> <p>when I try to send a request to index, which one will get executed? I wanted to know how can we have same request mapping value for multiple controllers</p>
0debug
Python K-Means Z-Transfrom : i want to use the k-means to cluster my results, but I have a lot of question. <http://scikit-learn.org/stable/modules/generated/sklearn.cluster.KMeans.html#sklearn.cluster.KMeans> My input data looks like this: `ID ABC XYZ UVW MSE 10 A X U 102000 12 B Y V 9000` Do I transform my data set in z-tranfromation? Because I have numbers and character... When i get result of Kmeans, should i run it often to crosschecking my results? I want to know which ID is in which cluster. How i get this infromation out of software? Thx in Advance.
0debug
static void stream_seek(VideoState *is, int64_t pos, int rel) { is->seek_pos = pos; is->seek_req = 1; is->seek_flags = rel < 0 ? AVSEEK_FLAG_BACKWARD : 0; }
1threat
Detect when user accepts to download a file : <p>I want to redirect the user to a different webpage after they click a hyperlink which allows them to download a file. However since they need to make a choice in the open/save file dialog, I don't want to redirect them until they accept the download.</p> <p>How can I detect that they performed this action?</p>
0debug
how to parse this in uiimageview this data : `enter code here` photos = ( { height = 2988; "html_attributions" = ( "<a href=\"https://maps.google.com/maps/contrib/109461257917544660371/photos\">Marie-Claude Brousseau</a>" ); "photo_reference" = "CoQBdwAAAD1yAyXPTuN2ZyRD4VZGAqVTT3ZCWSLe_RHSLx_ea-GLe0TsaRSpqIsHhvTj82GljPJG5y-Lrk6809jI5KzvcUjXroCcaAlEkgDLhQma5xsvA0vF4DwdoEZ0wWUZxXHs01BxedzegpQSgB4zVnzbUaAZaN_D5dEr0UOp4awIExe2EhAISA1lOL6VARBNLg9a1r1tGhQf3RgXpVfnPBtYPH6RY5pqmJE0mQ"; width = 5312; } );
0debug
How to make a loading animation in Console Application written in JavaScript or NodeJs? : <p>How to make a loading animation in Console Application written in JavaScript or NodeJs?</p> <p>Example animation or other animation.</p> <pre><code>1. -- 2. \ 3. | 4. / 5. -- </code></pre>
0debug
pandas drop row based on index vs ix : <p>I'm trying to drop pandas dataframe row based on its index (not location).</p> <p>The data frame looks like </p> <pre><code> DO 129518 a developer and 20066 responsible for 571 responsible for 85629 responsible for 5956 by helping them </code></pre> <p>(FYI: "DO" is a column name)</p> <p>I want to delete the row where its index is 571 so I did:</p> <pre><code>df=df.drop(df.index[571]) </code></pre> <p>then I check df.ix[571]</p> <p>then what the hell it's still there!</p> <p>So I thought "ok, maybe index and ix are different!"</p> <pre><code>In [539]: df.index[571] 17002 </code></pre> <p>My question is</p> <p>1) What is index? (compared to ix)</p> <p>2) How do I delete the index row 571 using ix?</p>
0debug
Issue working with comparison operator : <p>Console logging <code>this.byPassViewState</code> returns <code>["01"]</code></p> <p>if i do <code>this.byPassViewState === ['01']</code> it returns <code>false</code></p> <p><code>typeof(this.byPassViewState)</code> retuns <code>object</code></p> <p>My question is why <code>this.byPassViewState</code> returns false ? it suppose to be <code>true</code> right ? please tell me what i'm doing wrong here</p> <p><a href="https://i.stack.imgur.com/YpWyl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YpWyl.png" alt="enter image description here"></a></p>
0debug
Android studio Emulator ( device unauthorized) : <p>I know that on a normal device I have to authorize the debugging process, but Authorizing it on an emulator is my first time.</p> <p>I just installed my first emulator on my home pc to do some work stuff, and this poped up.</p> <p>Any idea what is the cause or is it normal for android o api 26 google play SDK?</p> <p>PS: I am using windows version at home.</p>
0debug
static av_cold int pcm_dvd_decode_init(AVCodecContext *avctx) { PCMDVDContext *s = avctx->priv_data; s->last_header = -1; if (!(s->extra_samples = av_malloc(8 * 3 * 4))) return AVERROR(ENOMEM); s->extra_sample_count = 0; return 0; }
1threat
list with 2 elements, a list and an int, want to relate every list item with that int : Good evening everyone and happy new year, My issue is that i have a list of lists in which every element of the first list is composed of a second list and an integer. What i want to do is to relate that single integer with every element in the list, thus making the elements of the first list be lists of 2 elements the code i haven't got a clue on how to do this. Could i ask for some help?[This is the code i'm using to test this][1] [1]: https://i.stack.imgur.com/v0hot.png
0debug
static inline void RENAME(yuv2yuvX)(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, int dstW, int chrDstW) { #if COMPILE_TEMPLATE_MMX if(!(c->flags & SWS_BITEXACT)) { if (c->flags & SWS_ACCURATE_RND) { if (uDest) { YSCALEYUV2YV12X_ACCURATE( "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW) YSCALEYUV2YV12X_ACCURATE(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW) } if (CONFIG_SWSCALE_ALPHA && aDest) { YSCALEYUV2YV12X_ACCURATE( "0", ALP_MMX_FILTER_OFFSET, aDest, dstW) } YSCALEYUV2YV12X_ACCURATE("0", LUM_MMX_FILTER_OFFSET, dest, dstW) } else { if (uDest) { YSCALEYUV2YV12X( "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW) YSCALEYUV2YV12X(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW) } if (CONFIG_SWSCALE_ALPHA && aDest) { YSCALEYUV2YV12X( "0", ALP_MMX_FILTER_OFFSET, aDest, dstW) } YSCALEYUV2YV12X("0", LUM_MMX_FILTER_OFFSET, dest, dstW) } return; } #endif #if COMPILE_TEMPLATE_ALTIVEC yuv2yuvX_altivec_real(lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, dest, uDest, vDest, dstW, chrDstW); #else yuv2yuvXinC(lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, alpSrc, dest, uDest, vDest, aDest, dstW, chrDstW); #endif }
1threat
document.getElementById('input').innerHTML = user_input;
1threat
void helper_rdmsr(void) { uint64_t val; helper_svm_check_intercept_param(SVM_EXIT_MSR, 0); switch((uint32_t)ECX) { case MSR_IA32_SYSENTER_CS: val = env->sysenter_cs; case MSR_IA32_SYSENTER_ESP: val = env->sysenter_esp; case MSR_IA32_SYSENTER_EIP: val = env->sysenter_eip; case MSR_IA32_APICBASE: val = cpu_get_apic_base(env); case MSR_EFER: val = env->efer; case MSR_STAR: val = env->star; case MSR_PAT: val = env->pat; case MSR_VM_HSAVE_PA: val = env->vm_hsave; case MSR_IA32_PERF_STATUS: val = 1000ULL; val |= (((uint64_t)4ULL) << 40); #ifdef TARGET_X86_64 case MSR_LSTAR: val = env->lstar; case MSR_CSTAR: val = env->cstar; case MSR_FMASK: val = env->fmask; case MSR_FSBASE: val = env->segs[R_FS].base; case MSR_GSBASE: val = env->segs[R_GS].base; case MSR_KERNELGSBASE: val = env->kernelgsbase; #endif #ifdef USE_KQEMU case MSR_QPI_COMMBASE: if (env->kqemu_enabled) { val = kqemu_comm_base; } else { val = 0; } #endif default: val = 0; } EAX = (uint32_t)(val); EDX = (uint32_t)(val >> 32); }
1threat
I receive an error in the Unity console. I like to know what is means and how to solve it? : I tried to get the player ship game object to move to the next scene if all enemies are killed and won the game. I receive an error in the Unity console says: Assets\Scripts\GameController.cs(57,25): error CS0122: 'SceneLoader.LoadNextScene()' is inaccessible due to its protection level. Currently, I can only go to the next scene when I change the value in the of this line: SceneManager.LoadScene(1); to (2) in the scene Loader.cs I added code to the game controller this here: the public void WinGame() method any feedback to what this error s means and how I can fix it is appreciated. :) using UnityEngine; using UnityEngine.SceneManagement; public class SceneLoader : MonoBehaviour { [SerializeField] float levelLoadDelay = 2f; private int currentSceneIndex = -1; private void Awake() { currentSceneIndex = SceneManager.GetActiveScene().buildIndex; } private void Start() { if (currentSceneIndex == 0) { Invoke("LoadFirstScene", 2f); } else { Invoke("LoadNextScene", 2f); } } private void LoadNextScene() { int currentSceneIndex = SceneManager.GetActiveScene().buildIndex; int nextSceneIndex = currentSceneIndex + 1; SceneManager.LoadScene(nextSceneIndex); } public void LoadFirstScene() { SceneManager.LoadScene(1); } } using UnityEngine; using UnityEngine.Playables; using UnityEngine.UI; public class GameController : MonoBehaviour { public Text scoreText; public Text restartText; public Text gameOverText; [SerializeField] private Text outcome; [SerializeField] private PlayableDirector masterTimelinePlayableDirector; [SerializeField] private GameObject playerShip; private bool winGame = false; private bool gameOver = false; private int score; private int enemiesLeft = 0; private SceneLoader sceneLoader; public bool allEnemiesKilled; public float enemiesInScene = 10.0f; public float enemiesKilled; void Start() { sceneLoader = FindObjectOfType<SceneLoader>(); enemiesLeft = GameObject.FindObjectsOfType<Enemy>().Length; restartText.text = ""; gameOverText.text = ""; outcome.text = ""; score = 0; UpdateScore(); } void Update() { if (gameOver) { if (Input.GetKeyDown(KeyCode.R)) { sceneLoader.LoadFirstScene(); } } if (PlayerHealth.cur_health <= 0) { GameOver(); } } public void WinGame() { if(winGame) { sceneLoader.LoadNextScene(); } } public void DecreaseEnemyCount() { enemiesLeft--; } public void AddScore(int newScoreValue) { score += newScoreValue; UpdateScore(); } void UpdateScore() { scoreText.text = "Score: " + score; } public void GameOver() { gameOver = true; gameOverText.text = "Game Over!"; if (enemiesLeft > 0) { outcome.text = "You Lose"; } else { outcome.text = "You Win"; } restartText.text = "Press 'R' for Restart"; masterTimelinePlayableDirector.Stop(); playerShip.SetActive(false); } }
0debug
how big does an integer have to be that you need the big integer class to use a math function : <p>how big does an integer have to be that you need the big integer class to use a math function. Is there a specific rule that needs to be followed</p>
0debug
update all phone numbers to 10 characters : I have a table which have phone numbers filed.In this many records of phones numbers. Some are 10 characters ,While some are less than 10 and some are greater than 10. Now i want to select the records then update all the records to 10 characters. If phone number is less then 10 add leading 0 to make it 10. While if greater than 10 then remover last digits to make 10
0debug
Emit an event when a specific piece of state changes in vuex store : <p>I have a vuex store with the following state:</p> <pre><code>state: { authed: false ,id: false } </code></pre> <p>Inside a component I want to watch for changes to the <code>authed</code> state and send an AJAX call to the server. It needs to be done in various components.</p> <p>I tried using <code>store.watch()</code>, but that fires when either <code>id</code> or <code>authed</code> changes. I also noticed, it's different from <code>vm.$watch</code> in that you can't specify a property. When i tried to do this:</p> <pre><code>store.watch('authed',function(newValue,oldValue){ //some code }); </code></pre> <p>I got this error:</p> <p><code>[vuex] store.watch only accepts a function.</code></p> <p>Any help is appreciated!</p>
0debug
How do I set headers to all responses in Koa.js? : <p>In Express.js I used to have this kind of code:</p> <pre><code>app.use((req, res, next) =&gt; { res.header('Access-Control-Allow-Origin', '*'); res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); res.header('Access-Control-Allow-Methods', 'POST, GET, PUT, DELETE, OPTIONS'); next(); }); </code></pre> <p>How do I do the same thing with Koa.js? I need to preset these several http headers for each server response.</p>
0debug
static int parse_ffconfig(const char *filename) { FILE *f; char line[1024]; char cmd[64]; char arg[1024]; const char *p; int val, errors, line_num; FFStream **last_stream, *stream, *redirect; FFStream **last_feed, *feed, *s; AVCodecContext audio_enc, video_enc; enum CodecID audio_id, video_id; f = fopen(filename, "r"); if (!f) { perror(filename); return -1; } errors = 0; line_num = 0; first_stream = NULL; last_stream = &first_stream; first_feed = NULL; last_feed = &first_feed; stream = NULL; feed = NULL; redirect = NULL; audio_id = CODEC_ID_NONE; video_id = CODEC_ID_NONE; for(;;) { if (fgets(line, sizeof(line), f) == NULL) break; line_num++; p = line; while (isspace(*p)) p++; if (*p == '\0' || *p == '#') continue; get_arg(cmd, sizeof(cmd), &p); if (!strcasecmp(cmd, "Port")) { get_arg(arg, sizeof(arg), &p); val = atoi(arg); if (val < 1 || val > 65536) { fprintf(stderr, "%s:%d: Invalid port: %s\n", filename, line_num, arg); errors++; } my_http_addr.sin_port = htons(val); } else if (!strcasecmp(cmd, "BindAddress")) { get_arg(arg, sizeof(arg), &p); if (resolve_host(&my_http_addr.sin_addr, arg) != 0) { fprintf(stderr, "%s:%d: Invalid host/IP address: %s\n", filename, line_num, arg); errors++; } } else if (!strcasecmp(cmd, "NoDaemon")) { ffserver_daemon = 0; } else if (!strcasecmp(cmd, "RTSPPort")) { get_arg(arg, sizeof(arg), &p); val = atoi(arg); if (val < 1 || val > 65536) { fprintf(stderr, "%s:%d: Invalid port: %s\n", filename, line_num, arg); errors++; } my_rtsp_addr.sin_port = htons(atoi(arg)); } else if (!strcasecmp(cmd, "RTSPBindAddress")) { get_arg(arg, sizeof(arg), &p); if (resolve_host(&my_rtsp_addr.sin_addr, arg) != 0) { fprintf(stderr, "%s:%d: Invalid host/IP address: %s\n", filename, line_num, arg); errors++; } } else if (!strcasecmp(cmd, "MaxHTTPConnections")) { get_arg(arg, sizeof(arg), &p); val = atoi(arg); if (val < 1 || val > 65536) { fprintf(stderr, "%s:%d: Invalid MaxHTTPConnections: %s\n", filename, line_num, arg); errors++; } nb_max_http_connections = val; } else if (!strcasecmp(cmd, "MaxClients")) { get_arg(arg, sizeof(arg), &p); val = atoi(arg); if (val < 1 || val > nb_max_http_connections) { fprintf(stderr, "%s:%d: Invalid MaxClients: %s\n", filename, line_num, arg); errors++; } else { nb_max_connections = val; } } else if (!strcasecmp(cmd, "MaxBandwidth")) { int64_t llval; get_arg(arg, sizeof(arg), &p); llval = atoll(arg); if (llval < 10 || llval > 10000000) { fprintf(stderr, "%s:%d: Invalid MaxBandwidth: %s\n", filename, line_num, arg); errors++; } else max_bandwidth = llval; } else if (!strcasecmp(cmd, "CustomLog")) { if (!ffserver_debug) get_arg(logfilename, sizeof(logfilename), &p); } else if (!strcasecmp(cmd, "<Feed")) { char *q; if (stream || feed) { fprintf(stderr, "%s:%d: Already in a tag\n", filename, line_num); } else { feed = av_mallocz(sizeof(FFStream)); get_arg(feed->filename, sizeof(feed->filename), &p); q = strrchr(feed->filename, '>'); if (*q) *q = '\0'; for (s = first_feed; s; s = s->next) { if (!strcmp(feed->filename, s->filename)) { fprintf(stderr, "%s:%d: Feed '%s' already registered\n", filename, line_num, s->filename); errors++; } } feed->fmt = guess_format("ffm", NULL, NULL); snprintf(feed->feed_filename, sizeof(feed->feed_filename), "/tmp/%s.ffm", feed->filename); feed->feed_max_size = 5 * 1024 * 1024; feed->is_feed = 1; feed->feed = feed; *last_stream = feed; last_stream = &feed->next; *last_feed = feed; last_feed = &feed->next_feed; } } else if (!strcasecmp(cmd, "Launch")) { if (feed) { int i; feed->child_argv = av_mallocz(64 * sizeof(char *)); for (i = 0; i < 62; i++) { get_arg(arg, sizeof(arg), &p); if (!arg[0]) break; feed->child_argv[i] = av_strdup(arg); } feed->child_argv[i] = av_malloc(30 + strlen(feed->filename)); snprintf(feed->child_argv[i], 30+strlen(feed->filename), "http: (my_http_addr.sin_addr.s_addr == INADDR_ANY) ? "127.0.0.1" : inet_ntoa(my_http_addr.sin_addr), ntohs(my_http_addr.sin_port), feed->filename); } } else if (!strcasecmp(cmd, "ReadOnlyFile")) { if (feed) { get_arg(feed->feed_filename, sizeof(feed->feed_filename), &p); feed->readonly = 1; } else if (stream) { get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p); } } else if (!strcasecmp(cmd, "File")) { if (feed) { get_arg(feed->feed_filename, sizeof(feed->feed_filename), &p); } else if (stream) get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p); } else if (!strcasecmp(cmd, "Truncate")) { if (feed) { get_arg(arg, sizeof(arg), &p); feed->truncate = strtod(arg, NULL); } } else if (!strcasecmp(cmd, "FileMaxSize")) { if (feed) { char *p1; double fsize; get_arg(arg, sizeof(arg), &p); p1 = arg; fsize = strtod(p1, &p1); switch(toupper(*p1)) { case 'K': fsize *= 1024; break; case 'M': fsize *= 1024 * 1024; break; case 'G': fsize *= 1024 * 1024 * 1024; break; } feed->feed_max_size = (int64_t)fsize; if (feed->feed_max_size < FFM_PACKET_SIZE*4) { fprintf(stderr, "%s:%d: Feed max file size is too small, " "must be at least %d\n", filename, line_num, FFM_PACKET_SIZE*4); errors++; } } } else if (!strcasecmp(cmd, "</Feed>")) { if (!feed) { fprintf(stderr, "%s:%d: No corresponding <Feed> for </Feed>\n", filename, line_num); errors++; } feed = NULL; } else if (!strcasecmp(cmd, "<Stream")) { char *q; if (stream || feed) { fprintf(stderr, "%s:%d: Already in a tag\n", filename, line_num); } else { FFStream *s; const AVClass *class; stream = av_mallocz(sizeof(FFStream)); get_arg(stream->filename, sizeof(stream->filename), &p); q = strrchr(stream->filename, '>'); if (*q) *q = '\0'; for (s = first_stream; s; s = s->next) { if (!strcmp(stream->filename, s->filename)) { fprintf(stderr, "%s:%d: Stream '%s' already registered\n", filename, line_num, s->filename); errors++; } } stream->fmt = guess_stream_format(NULL, stream->filename, NULL); avcodec_get_context_defaults(&video_enc); class = video_enc.av_class; memset(&audio_enc, 0, sizeof(AVCodecContext)); memset(&video_enc, 0, sizeof(AVCodecContext)); audio_enc.av_class = class; video_enc.av_class = class; audio_id = CODEC_ID_NONE; video_id = CODEC_ID_NONE; if (stream->fmt) { audio_id = stream->fmt->audio_codec; video_id = stream->fmt->video_codec; } *last_stream = stream; last_stream = &stream->next; } } else if (!strcasecmp(cmd, "Feed")) { get_arg(arg, sizeof(arg), &p); if (stream) { FFStream *sfeed; sfeed = first_feed; while (sfeed != NULL) { if (!strcmp(sfeed->filename, arg)) break; sfeed = sfeed->next_feed; } if (!sfeed) fprintf(stderr, "%s:%d: feed '%s' not defined\n", filename, line_num, arg); else stream->feed = sfeed; } } else if (!strcasecmp(cmd, "Format")) { get_arg(arg, sizeof(arg), &p); if (stream) { if (!strcmp(arg, "status")) { stream->stream_type = STREAM_TYPE_STATUS; stream->fmt = NULL; } else { stream->stream_type = STREAM_TYPE_LIVE; if (!strcmp(arg, "jpeg")) strcpy(arg, "mjpeg"); stream->fmt = guess_stream_format(arg, NULL, NULL); if (!stream->fmt) { fprintf(stderr, "%s:%d: Unknown Format: %s\n", filename, line_num, arg); errors++; } } if (stream->fmt) { audio_id = stream->fmt->audio_codec; video_id = stream->fmt->video_codec; } } } else if (!strcasecmp(cmd, "InputFormat")) { get_arg(arg, sizeof(arg), &p); if (stream) { stream->ifmt = av_find_input_format(arg); if (!stream->ifmt) { fprintf(stderr, "%s:%d: Unknown input format: %s\n", filename, line_num, arg); } } } else if (!strcasecmp(cmd, "FaviconURL")) { if (stream && stream->stream_type == STREAM_TYPE_STATUS) { get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p); } else { fprintf(stderr, "%s:%d: FaviconURL only permitted for status streams\n", filename, line_num); errors++; } } else if (!strcasecmp(cmd, "Author")) { if (stream) get_arg(stream->author, sizeof(stream->author), &p); } else if (!strcasecmp(cmd, "Comment")) { if (stream) get_arg(stream->comment, sizeof(stream->comment), &p); } else if (!strcasecmp(cmd, "Copyright")) { if (stream) get_arg(stream->copyright, sizeof(stream->copyright), &p); } else if (!strcasecmp(cmd, "Title")) { if (stream) get_arg(stream->title, sizeof(stream->title), &p); } else if (!strcasecmp(cmd, "Preroll")) { get_arg(arg, sizeof(arg), &p); if (stream) stream->prebuffer = atof(arg) * 1000; } else if (!strcasecmp(cmd, "StartSendOnKey")) { if (stream) stream->send_on_key = 1; } else if (!strcasecmp(cmd, "AudioCodec")) { get_arg(arg, sizeof(arg), &p); audio_id = opt_audio_codec(arg); if (audio_id == CODEC_ID_NONE) { fprintf(stderr, "%s:%d: Unknown AudioCodec: %s\n", filename, line_num, arg); errors++; } } else if (!strcasecmp(cmd, "VideoCodec")) { get_arg(arg, sizeof(arg), &p); video_id = opt_video_codec(arg); if (video_id == CODEC_ID_NONE) { fprintf(stderr, "%s:%d: Unknown VideoCodec: %s\n", filename, line_num, arg); errors++; } } else if (!strcasecmp(cmd, "MaxTime")) { get_arg(arg, sizeof(arg), &p); if (stream) stream->max_time = atof(arg) * 1000; } else if (!strcasecmp(cmd, "AudioBitRate")) { get_arg(arg, sizeof(arg), &p); if (stream) audio_enc.bit_rate = atoi(arg) * 1000; } else if (!strcasecmp(cmd, "AudioChannels")) { get_arg(arg, sizeof(arg), &p); if (stream) audio_enc.channels = atoi(arg); } else if (!strcasecmp(cmd, "AudioSampleRate")) { get_arg(arg, sizeof(arg), &p); if (stream) audio_enc.sample_rate = atoi(arg); } else if (!strcasecmp(cmd, "AudioQuality")) { get_arg(arg, sizeof(arg), &p); if (stream) { } } else if (!strcasecmp(cmd, "VideoBitRateRange")) { if (stream) { int minrate, maxrate; get_arg(arg, sizeof(arg), &p); if (sscanf(arg, "%d-%d", &minrate, &maxrate) == 2) { video_enc.rc_min_rate = minrate * 1000; video_enc.rc_max_rate = maxrate * 1000; } else { fprintf(stderr, "%s:%d: Incorrect format for VideoBitRateRange -- should be <min>-<max>: %s\n", filename, line_num, arg); errors++; } } } else if (!strcasecmp(cmd, "Debug")) { if (stream) { get_arg(arg, sizeof(arg), &p); video_enc.debug = strtol(arg,0,0); } } else if (!strcasecmp(cmd, "Strict")) { if (stream) { get_arg(arg, sizeof(arg), &p); video_enc.strict_std_compliance = atoi(arg); } } else if (!strcasecmp(cmd, "VideoBufferSize")) { if (stream) { get_arg(arg, sizeof(arg), &p); video_enc.rc_buffer_size = atoi(arg) * 8*1024; } } else if (!strcasecmp(cmd, "VideoBitRateTolerance")) { if (stream) { get_arg(arg, sizeof(arg), &p); video_enc.bit_rate_tolerance = atoi(arg) * 1000; } } else if (!strcasecmp(cmd, "VideoBitRate")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.bit_rate = atoi(arg) * 1000; } } else if (!strcasecmp(cmd, "VideoSize")) { get_arg(arg, sizeof(arg), &p); if (stream) { av_parse_video_frame_size(&video_enc.width, &video_enc.height, arg); if ((video_enc.width % 16) != 0 || (video_enc.height % 16) != 0) { fprintf(stderr, "%s:%d: Image size must be a multiple of 16\n", filename, line_num); errors++; } } } else if (!strcasecmp(cmd, "VideoFrameRate")) { get_arg(arg, sizeof(arg), &p); if (stream) { AVRational frame_rate; if (av_parse_video_frame_rate(&frame_rate, arg) < 0) { fprintf(stderr, "Incorrect frame rate\n"); errors++; } else { video_enc.time_base.num = frame_rate.den; video_enc.time_base.den = frame_rate.num; } } } else if (!strcasecmp(cmd, "VideoGopSize")) { get_arg(arg, sizeof(arg), &p); if (stream) video_enc.gop_size = atoi(arg); } else if (!strcasecmp(cmd, "VideoIntraOnly")) { if (stream) video_enc.gop_size = 1; } else if (!strcasecmp(cmd, "VideoHighQuality")) { if (stream) video_enc.mb_decision = FF_MB_DECISION_BITS; } else if (!strcasecmp(cmd, "Video4MotionVector")) { if (stream) { video_enc.mb_decision = FF_MB_DECISION_BITS; video_enc.flags |= CODEC_FLAG_4MV; } } else if (!strcasecmp(cmd, "AVOptionVideo") || !strcasecmp(cmd, "AVOptionAudio")) { char arg2[1024]; AVCodecContext *avctx; int type; get_arg(arg, sizeof(arg), &p); get_arg(arg2, sizeof(arg2), &p); if (!strcasecmp(cmd, "AVOptionVideo")) { avctx = &video_enc; type = AV_OPT_FLAG_VIDEO_PARAM; } else { avctx = &audio_enc; type = AV_OPT_FLAG_AUDIO_PARAM; } if (ffserver_opt_default(arg, arg2, avctx, type|AV_OPT_FLAG_ENCODING_PARAM)) { fprintf(stderr, "AVOption error: %s %s\n", arg, arg2); errors++; } } else if (!strcasecmp(cmd, "VideoTag")) { get_arg(arg, sizeof(arg), &p); if ((strlen(arg) == 4) && stream) video_enc.codec_tag = AV_RL32(arg); } else if (!strcasecmp(cmd, "BitExact")) { if (stream) video_enc.flags |= CODEC_FLAG_BITEXACT; } else if (!strcasecmp(cmd, "DctFastint")) { if (stream) video_enc.dct_algo = FF_DCT_FASTINT; } else if (!strcasecmp(cmd, "IdctSimple")) { if (stream) video_enc.idct_algo = FF_IDCT_SIMPLE; } else if (!strcasecmp(cmd, "Qscale")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.flags |= CODEC_FLAG_QSCALE; video_enc.global_quality = FF_QP2LAMBDA * atoi(arg); } } else if (!strcasecmp(cmd, "VideoQDiff")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.max_qdiff = atoi(arg); if (video_enc.max_qdiff < 1 || video_enc.max_qdiff > 31) { fprintf(stderr, "%s:%d: VideoQDiff out of range\n", filename, line_num); errors++; } } } else if (!strcasecmp(cmd, "VideoQMax")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.qmax = atoi(arg); if (video_enc.qmax < 1 || video_enc.qmax > 31) { fprintf(stderr, "%s:%d: VideoQMax out of range\n", filename, line_num); errors++; } } } else if (!strcasecmp(cmd, "VideoQMin")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.qmin = atoi(arg); if (video_enc.qmin < 1 || video_enc.qmin > 31) { fprintf(stderr, "%s:%d: VideoQMin out of range\n", filename, line_num); errors++; } } } else if (!strcasecmp(cmd, "LumaElim")) { get_arg(arg, sizeof(arg), &p); if (stream) video_enc.luma_elim_threshold = atoi(arg); } else if (!strcasecmp(cmd, "ChromaElim")) { get_arg(arg, sizeof(arg), &p); if (stream) video_enc.chroma_elim_threshold = atoi(arg); } else if (!strcasecmp(cmd, "LumiMask")) { get_arg(arg, sizeof(arg), &p); if (stream) video_enc.lumi_masking = atof(arg); } else if (!strcasecmp(cmd, "DarkMask")) { get_arg(arg, sizeof(arg), &p); if (stream) video_enc.dark_masking = atof(arg); } else if (!strcasecmp(cmd, "NoVideo")) { video_id = CODEC_ID_NONE; } else if (!strcasecmp(cmd, "NoAudio")) { audio_id = CODEC_ID_NONE; } else if (!strcasecmp(cmd, "ACL")) { IPAddressACL acl; get_arg(arg, sizeof(arg), &p); if (strcasecmp(arg, "allow") == 0) acl.action = IP_ALLOW; else if (strcasecmp(arg, "deny") == 0) acl.action = IP_DENY; else { fprintf(stderr, "%s:%d: ACL action '%s' is not ALLOW or DENY\n", filename, line_num, arg); errors++; } get_arg(arg, sizeof(arg), &p); if (resolve_host(&acl.first, arg) != 0) { fprintf(stderr, "%s:%d: ACL refers to invalid host or ip address '%s'\n", filename, line_num, arg); errors++; } else acl.last = acl.first; get_arg(arg, sizeof(arg), &p); if (arg[0]) { if (resolve_host(&acl.last, arg) != 0) { fprintf(stderr, "%s:%d: ACL refers to invalid host or ip address '%s'\n", filename, line_num, arg); errors++; } } if (!errors) { IPAddressACL *nacl = av_mallocz(sizeof(*nacl)); IPAddressACL **naclp = 0; acl.next = 0; *nacl = acl; if (stream) naclp = &stream->acl; else if (feed) naclp = &feed->acl; else { fprintf(stderr, "%s:%d: ACL found not in <stream> or <feed>\n", filename, line_num); errors++; } if (naclp) { while (*naclp) naclp = &(*naclp)->next; *naclp = nacl; } } } else if (!strcasecmp(cmd, "RTSPOption")) { get_arg(arg, sizeof(arg), &p); if (stream) { av_freep(&stream->rtsp_option); stream->rtsp_option = av_strdup(arg); } } else if (!strcasecmp(cmd, "MulticastAddress")) { get_arg(arg, sizeof(arg), &p); if (stream) { if (resolve_host(&stream->multicast_ip, arg) != 0) { fprintf(stderr, "%s:%d: Invalid host/IP address: %s\n", filename, line_num, arg); errors++; } stream->is_multicast = 1; stream->loop = 1; } } else if (!strcasecmp(cmd, "MulticastPort")) { get_arg(arg, sizeof(arg), &p); if (stream) stream->multicast_port = atoi(arg); } else if (!strcasecmp(cmd, "MulticastTTL")) { get_arg(arg, sizeof(arg), &p); if (stream) stream->multicast_ttl = atoi(arg); } else if (!strcasecmp(cmd, "NoLoop")) { if (stream) stream->loop = 0; } else if (!strcasecmp(cmd, "</Stream>")) { if (!stream) { fprintf(stderr, "%s:%d: No corresponding <Stream> for </Stream>\n", filename, line_num); errors++; } else { if (stream->feed && stream->fmt && strcmp(stream->fmt->name, "ffm") != 0) { if (audio_id != CODEC_ID_NONE) { audio_enc.codec_type = CODEC_TYPE_AUDIO; audio_enc.codec_id = audio_id; add_codec(stream, &audio_enc); } if (video_id != CODEC_ID_NONE) { video_enc.codec_type = CODEC_TYPE_VIDEO; video_enc.codec_id = video_id; add_codec(stream, &video_enc); } } stream = NULL; } } else if (!strcasecmp(cmd, "<Redirect")) { char *q; if (stream || feed || redirect) { fprintf(stderr, "%s:%d: Already in a tag\n", filename, line_num); errors++; } else { redirect = av_mallocz(sizeof(FFStream)); *last_stream = redirect; last_stream = &redirect->next; get_arg(redirect->filename, sizeof(redirect->filename), &p); q = strrchr(redirect->filename, '>'); if (*q) *q = '\0'; redirect->stream_type = STREAM_TYPE_REDIRECT; } } else if (!strcasecmp(cmd, "URL")) { if (redirect) get_arg(redirect->feed_filename, sizeof(redirect->feed_filename), &p); } else if (!strcasecmp(cmd, "</Redirect>")) { if (!redirect) { fprintf(stderr, "%s:%d: No corresponding <Redirect> for </Redirect>\n", filename, line_num); errors++; } else { if (!redirect->feed_filename[0]) { fprintf(stderr, "%s:%d: No URL found for <Redirect>\n", filename, line_num); errors++; } redirect = NULL; } } else if (!strcasecmp(cmd, "LoadModule")) { get_arg(arg, sizeof(arg), &p); #if HAVE_DLOPEN load_module(arg); #else fprintf(stderr, "%s:%d: Module support not compiled into this version: '%s'\n", filename, line_num, arg); errors++; #endif } else { fprintf(stderr, "%s:%d: Incorrect keyword: '%s'\n", filename, line_num, cmd); } } fclose(f); if (errors) return -1; else return 0; }
1threat
static float pvq_band_cost(CeltPVQ *pvq, CeltFrame *f, OpusRangeCoder *rc, int band, float *bits, float lambda) { int i, b = 0; uint32_t cm[2] = { (1 << f->blocks) - 1, (1 << f->blocks) - 1 }; const int band_size = ff_celt_freq_range[band] << f->size; float buf[176 * 2], lowband_scratch[176], norm1[176], norm2[176]; float dist, cost, err_x = 0.0f, err_y = 0.0f; float *X = buf; float *X_orig = f->block[0].coeffs + (ff_celt_freq_bands[band] << f->size); float *Y = (f->channels == 2) ? &buf[176] : NULL; float *Y_orig = f->block[1].coeffs + (ff_celt_freq_bands[band] << f->size); OPUS_RC_CHECKPOINT_SPAWN(rc); memcpy(X, X_orig, band_size*sizeof(float)); if (Y) memcpy(Y, Y_orig, band_size*sizeof(float)); f->remaining2 = ((f->framebits << 3) - f->anticollapse_needed) - opus_rc_tell_frac(rc) - 1; if (band <= f->coded_bands - 1) { int curr_balance = f->remaining / FFMIN(3, f->coded_bands - band); b = av_clip_uintp2(FFMIN(f->remaining2 + 1, f->pulses[band] + curr_balance), 14); } if (f->dual_stereo) { pvq->encode_band(pvq, f, rc, band, X, NULL, band_size, b / 2, f->blocks, NULL, f->size, norm1, 0, 1.0f, lowband_scratch, cm[0]); pvq->encode_band(pvq, f, rc, band, Y, NULL, band_size, b / 2, f->blocks, NULL, f->size, norm2, 0, 1.0f, lowband_scratch, cm[1]); } else { pvq->encode_band(pvq, f, rc, band, X, Y, band_size, b, f->blocks, NULL, f->size, norm1, 0, 1.0f, lowband_scratch, cm[0] | cm[1]); } for (i = 0; i < band_size; i++) { err_x += (X[i] - X_orig[i])*(X[i] - X_orig[i]); err_y += (Y[i] - Y_orig[i])*(Y[i] - Y_orig[i]); } dist = sqrtf(err_x) + sqrtf(err_y); cost = OPUS_RC_CHECKPOINT_BITS(rc)/8.0f; *bits += cost; OPUS_RC_CHECKPOINT_ROLLBACK(rc); return lambda*dist*cost; }
1threat
static inline void gen_intermediate_code_internal(CPUARMState *env, TranslationBlock *tb, int search_pc) { DisasContext dc1, *dc = &dc1; CPUBreakpoint *bp; uint16_t *gen_opc_end; int j, lj; target_ulong pc_start; uint32_t next_page_start; int num_insns; int max_insns; pc_start = tb->pc; dc->tb = tb; gen_opc_end = gen_opc_buf + OPC_MAX_SIZE; dc->is_jmp = DISAS_NEXT; dc->pc = pc_start; dc->singlestep_enabled = env->singlestep_enabled; dc->condjmp = 0; dc->thumb = ARM_TBFLAG_THUMB(tb->flags); dc->condexec_mask = (ARM_TBFLAG_CONDEXEC(tb->flags) & 0xf) << 1; dc->condexec_cond = ARM_TBFLAG_CONDEXEC(tb->flags) >> 4; #if !defined(CONFIG_USER_ONLY) dc->user = (ARM_TBFLAG_PRIV(tb->flags) == 0); #endif dc->vfp_enabled = ARM_TBFLAG_VFPEN(tb->flags); dc->vec_len = ARM_TBFLAG_VECLEN(tb->flags); dc->vec_stride = ARM_TBFLAG_VECSTRIDE(tb->flags); cpu_F0s = tcg_temp_new_i32(); cpu_F1s = tcg_temp_new_i32(); cpu_F0d = tcg_temp_new_i64(); cpu_F1d = tcg_temp_new_i64(); cpu_V0 = cpu_F0d; cpu_V1 = cpu_F1d; cpu_M0 = tcg_temp_new_i64(); next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; lj = -1; num_insns = 0; max_insns = tb->cflags & CF_COUNT_MASK; if (max_insns == 0) max_insns = CF_COUNT_MASK; gen_icount_start(); tcg_clear_temp_count(); if (dc->condexec_mask || dc->condexec_cond) { TCGv tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); store_cpu_field(tmp, condexec_bits); } do { #ifdef CONFIG_USER_ONLY if (dc->pc >= 0xffff0000) { gen_exception(EXCP_KERNEL_TRAP); dc->is_jmp = DISAS_UPDATE; break; } #else if (dc->pc >= 0xfffffff0 && IS_M(env)) { gen_exception(EXCP_EXCEPTION_EXIT); dc->is_jmp = DISAS_UPDATE; break; } #endif if (unlikely(!QTAILQ_EMPTY(&env->breakpoints))) { QTAILQ_FOREACH(bp, &env->breakpoints, entry) { if (bp->pc == dc->pc) { gen_exception_insn(dc, 0, EXCP_DEBUG); dc->pc += 2; goto done_generating; break; } } } if (search_pc) { j = gen_opc_ptr - gen_opc_buf; if (lj < j) { lj++; while (lj < j) gen_opc_instr_start[lj++] = 0; } gen_opc_pc[lj] = dc->pc; gen_opc_condexec_bits[lj] = (dc->condexec_cond << 4) | (dc->condexec_mask >> 1); gen_opc_instr_start[lj] = 1; gen_opc_icount[lj] = num_insns; } if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) gen_io_start(); if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) { tcg_gen_debug_insn_start(dc->pc); } if (dc->thumb) { disas_thumb_insn(env, dc); if (dc->condexec_mask) { dc->condexec_cond = (dc->condexec_cond & 0xe) | ((dc->condexec_mask >> 4) & 1); dc->condexec_mask = (dc->condexec_mask << 1) & 0x1f; if (dc->condexec_mask == 0) { dc->condexec_cond = 0; } } } else { disas_arm_insn(env, dc); } if (dc->condjmp && !dc->is_jmp) { gen_set_label(dc->condlabel); dc->condjmp = 0; } if (tcg_check_temp_count()) { fprintf(stderr, "TCG temporary leak before %08x\n", dc->pc); } num_insns ++; } while (!dc->is_jmp && gen_opc_ptr < gen_opc_end && !env->singlestep_enabled && !singlestep && dc->pc < next_page_start && num_insns < max_insns); if (tb->cflags & CF_LAST_IO) { if (dc->condjmp) { cpu_abort(env, "IO on conditional branch instruction"); } gen_io_end(); } if (unlikely(env->singlestep_enabled)) { if (dc->condjmp) { gen_set_condexec(dc); if (dc->is_jmp == DISAS_SWI) { gen_exception(EXCP_SWI); } else { gen_exception(EXCP_DEBUG); } gen_set_label(dc->condlabel); } if (dc->condjmp || !dc->is_jmp) { gen_set_pc_im(dc->pc); dc->condjmp = 0; } gen_set_condexec(dc); if (dc->is_jmp == DISAS_SWI && !dc->condjmp) { gen_exception(EXCP_SWI); } else { gen_exception(EXCP_DEBUG); } } else { gen_set_condexec(dc); switch(dc->is_jmp) { case DISAS_NEXT: gen_goto_tb(dc, 1, dc->pc); break; default: case DISAS_JUMP: case DISAS_UPDATE: tcg_gen_exit_tb(0); break; case DISAS_TB_JUMP: break; case DISAS_WFI: gen_helper_wfi(); break; case DISAS_SWI: gen_exception(EXCP_SWI); break; } if (dc->condjmp) { gen_set_label(dc->condlabel); gen_set_condexec(dc); gen_goto_tb(dc, 1, dc->pc); dc->condjmp = 0; } } done_generating: gen_icount_end(tb, num_insns); *gen_opc_ptr = INDEX_op_end; #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("----------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(pc_start, dc->pc - pc_start, dc->thumb); qemu_log("\n"); } #endif if (search_pc) { j = gen_opc_ptr - gen_opc_buf; lj++; while (lj <= j) gen_opc_instr_start[lj++] = 0; } else { tb->size = dc->pc - pc_start; tb->icount = num_insns; } }
1threat
Cannot Find Symbol Error When Using Parameters : <p>I am creating a version of jeopardy in Java and I just inputted the answer methods to their respective question methods and I get the "cannot find symbol" error in regards to my parameters. Can anyone help?</p> <pre><code> public static void questions400opt1 () { Random rndm = new Random(); int randomQGenerator = 1 + rndm.nextInt(5); if(randomQGenerator == 1) { System.out.println(""); System.out.println("QUESTION: chris pratt voices this character in the lego movie"); answer400opt1q1(total, total2, total3); } else if(randomQGenerator == 2) { System.out.println(""); System.out.println("QUESTION: anna and elsa are the main characters of this blockbuster film"); answer400opt1q2(total, total2, total3); } The actual answer400opt1q1 method looks like (snippet): public static void answer400opt1q1 (int total, int total2, int total3) { Scanner word = new Scanner(System.in); Scanner num = new Scanner(System.in); System.out.print("ANSWER:"); String answer = word.nextLine(); System.out.print("player, enter your buzzing number: "); int playerNumber = num.nextInt(); if(playerNumber == 1) { if(answer.equalsIgnoreCase("emmett")) { total =+ 400; System.out.println(""); System.out.println("correct!"); } else if(!(answer.equalsIgnoreCase("emmett"))) { total =- 400; System.out.println(""); System.out.println("incorrect answer!"); } } </code></pre>
0debug
Converting 2D Image into 3D Using three.js and Other Tools : <p>I have an image of a data visualization that I want to make into 3D. I was wondering how I would be able to convert this image into 3D using three.js and other possible tools. I have no idea what to do.</p> <p>I heard that there is something called WebGL Javascript API so maybe I can use that but I don't know how to begin and whether or not it can be used in this situation. I also read somewhere that you cannot make a 3D image from a 2D one without some information about the 3rd dimension. This missing information can come from a second photo, an AI software, or a 3D digital model.</p> <p>I also read that I can make a 3D model of the image in Blender and then import it into three.js.</p> <p>Does anyone know how I can do this? </p> <p><strong>I want to try to do the coding in JS fiddle if it's possible unless other software/tools are needed outside of JS fiddle. I see that you can import the three.js library there.</strong></p> <p>The current visualization I have made is </p> <p><a href="https://i.stack.imgur.com/EA2wo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EA2wo.png" alt=""></a></p> <p>My code for this visualization if you need it is:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$(function() { var dataEx = [ ['1 Visit', 352000], ['2 Visits', 88000], ['3+ Visits', 42000] ], len = dataEx.length, sum = 0, minHeight = 0.05, data = []; //specify your percent of prior visit value manually here: var perc = [100, 25, 48]; for (var i = 0; i &lt; len; i++) { sum += dataEx[i][1]; } for (var i = 0; i &lt; len; i++) { var t = dataEx[i], r = t[1] / sum; data[i] = { name: t[0], y: (r &gt; minHeight ? t[1] : sum * minHeight), percent: perc[i], // &lt;----- this here is manual input //percent: Math.round(r * 100), &lt;--- this here is mathematical label: t[1] } } console.log(dataEx, data) $('#container').highcharts({ chart: { type: 'funnel', marginRight: 100, events: { load: function() { var chart = this; Highcharts.each(chart.series[0].data, function(p, i) { var bBox = p.dataLabel.getBBox() p.dataLabel.attr({ x: (chart.plotWidth - chart.plotLeft) / 2, 'text-anchor': 'middle', y: p.labelPos.y - (bBox.height / 2) }) }) }, redraw: function() { var chart = this; Highcharts.each(chart.series[0].data, function(p, i) { p.dataLabel.attr({ x: (chart.plotWidth - chart.plotLeft) / 2, 'text-anchor': 'middle', y: p.labelPos.y - (bBox.height / 2) }) }) } }, }, //Manually changing the default colors of each category of series colors: ['#FF5733', '#FFA533', '#1FC009'], title: { text: 'New Guest Return Funnel', x: -45 }, credits: { enabled: false }, tooltip: { //enabled: false formatter: function() { return '&lt;b&gt;' + this.key + '&lt;/b&gt;&lt;br/&gt;Percent of Prior Visit: '+ this.point.percent + '%&lt;br/&gt;Guests: ' + Highcharts.numberFormat(this.point.label, 0); } }, plotOptions: { series: { allowPointSelect: true, borderWidth: 12, animation: { duration: 400 }, dataLabels: { enabled: true, connectorWidth: 0, distance: 0, formatter: function() { var point = this.point; console.log(point); return '&lt;b&gt;' + point.name + '&lt;/b&gt; (' + Highcharts.numberFormat(point.label, 0) + ')&lt;br/&gt;' + point.percent + '%'; }, minSize: '10%', color: 'black', softConnector: true }, neckWidth: '30%', neckHeight: '0%', width: '50%', height: '110%' //old options are as follows: //neckWidth: '50%', //neckHeight: '50%', //-- Other available options //height: '200' // width: pixels or percent } }, legend: { enabled: false }, series: [{ name: 'Unique users', data: data }] }); });</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script src="http://code.highcharts.com/highcharts.js"&gt;&lt;/script&gt; &lt;script src="http://code.highcharts.com/modules/funnel.js"&gt;&lt;/script&gt; &lt;script src="http://code.highcharts.com/modules/exporting.js"&gt;&lt;/script&gt; &lt;div id="container" style="width: 500px; height: 400px; margin: 0 auto"&gt;&lt;/div&gt;</code></pre> </div> </div> </p>
0debug
Convert column counts into data frame with new columns : <p>I have a dataset of baseball play-by-play data. Here's a simplified example:</p> <pre><code>team &lt;- c('A','A','A','A','A','A','A', 'B','B','B','B','B','B','B', 'C','C','C','C','C','C','C') event &lt;- c("OUT","WALK","OUT","OUT","HR","WALK","OUT", "WALK","OUT","HR","WALK","OUT","OUT","WALK", "HR","HR","WALK","WALK","HR","OUT","WALK") df &lt;- data.frame(team, event) df team event 1 A OUT 2 A WALK 3 A OUT 4 A OUT 5 A HR 6 A WALK 7 A OUT 8 B WALK 9 B OUT 10 B HR 11 B WALK 12 B OUT 13 B OUT 14 B WALK 15 C HR 16 C HR 17 C WALK 18 C WALK 19 C HR 20 C OUT 21 C WALK </code></pre> <p>I would like to create a new data frame that shows the number of times each event occurred for each team, with each event represented by a new column, like this:</p> <pre><code> team OUT WALK HR 1 A 4 2 1 2 B 3 3 1 3 C 1 3 3 </code></pre> <p>I think there must be a way to do this using <code>dplyr</code>, but I haven't been able to figure it out.</p>
0debug
How do I retrieve the contents of a Quill text editor : <p>I am using the quill text editor in a javascript app and I need to retrieve the contents of the text editor as a string with the HTML included but the docs are a little sparse on this subject.</p>
0debug
static void FUNCC(pred8x8l_horizontal)(uint8_t *_src, int has_topleft, int has_topright, int _stride) { pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); PREDICT_8x8_LOAD_LEFT; #define ROW(y) ((pixel4*)(src+y*stride))[0] =\ ((pixel4*)(src+y*stride))[1] = PIXEL_SPLAT_X4(l##y) ROW(0); ROW(1); ROW(2); ROW(3); ROW(4); ROW(5); ROW(6); ROW(7); #undef ROW }
1threat
static int read_dcs(AVCodecContext *avctx, GetBitContext *gb, Bundle *b, int start_bits, int has_sign) { int i, j, len, len2, bsize, sign, v, v2; int16_t *dst = (int16_t*)b->cur_dec; CHECK_READ_VAL(gb, b, len); v = get_bits(gb, start_bits - has_sign); if (v && has_sign) { sign = -get_bits1(gb); v = (v ^ sign) - sign; } *dst++ = v; len--; for (i = 0; i < len; i += 8) { len2 = FFMIN(len - i, 8); bsize = get_bits(gb, 4); if (bsize) { for (j = 0; j < len2; j++) { v2 = get_bits(gb, bsize); if (v2) { sign = -get_bits1(gb); v2 = (v2 ^ sign) - sign; } v += v2; *dst++ = v; if (v < -32768 || v > 32767) { av_log(avctx, AV_LOG_ERROR, "DC value went out of bounds: %d\n", v); return -1; } } } else { for (j = 0; j < len2; j++) *dst++ = v; } } b->cur_dec = (uint8_t*)dst; return 0; }
1threat
static int thread_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs) { ThreadContext *c = ctx->graph->internal->thread; int dummy_ret; if (nb_jobs <= 0) return 0; pthread_mutex_lock(&c->current_job_lock); c->current_job = c->nb_threads; c->nb_jobs = nb_jobs; c->ctx = ctx; c->arg = arg; c->func = func; if (ret) { c->rets = ret; c->nb_rets = nb_jobs; } else { c->rets = &dummy_ret; c->nb_rets = 1; } c->current_execute++; pthread_cond_broadcast(&c->current_job_cond); slice_thread_park_workers(c); return 0; }
1threat
jQuery - Full Screen Horizontal number picker : <p>I am trying to create a horizontally scrolling number picker, I am open to using most technologies but am thinking that jQuery is going to be the most likely candidate.</p> <p><a href="https://i.stack.imgur.com/U93qO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/U93qO.jpg" alt="enter image description here"></a></p> <p>I am trying to achieve something like this...</p> <p>Anyone done anything similar or can point me in the right direction of a solution?</p>
0debug
Uncaught Error: Cannot assign to a reference or > variable! > at _AstToIrVisitor.visitPropertyWrite : <p>I was following an example from angular.io website of creating a form in angular with an input but I am stuck at an error:</p> <blockquote> <p>compiler.js:26390 Uncaught Error: Cannot assign to a reference or variable! at _AstToIrVisitor.visitPropertyWrite (webpack-internal:///./node_modules/@angular/compiler/esm5/compiler.js:26611:23) at PropertyWrite.visit (webpack-internal:///./node_modules/@angular/compiler/esm5/compiler.js:4900:24) at convertActionBinding (webpack-internal:///./node_modules/@angular/compiler/esm5/compiler.js:26035:45) at eval (webpack-internal:///./node_modules/@angular/compiler/esm5/compiler.js:28635:22) at Array.forEach () at ViewBuilder._createElementHandleEventFn (webpack-internal:///./node_modules/@angular/compiler/esm5/compiler.js:28631:18) at nodes.(anonymous function) (webpack-internal:///./node_modules/@angular/compiler/esm5/compiler.js:28050:27) at eval (webpack-internal:///./node_modules/@angular/compiler/esm5/compiler.js:28576:22) at Array.map () at ViewBuilder._createNodeExpressions (webpack-internal:///./node_modules/@angular/compiler/esm5/compiler.js:28575:56)</p> </blockquote> <p>The only change I made was renaming the "name" to "username". </p> <p>dashboard.component.ts</p> <pre><code>import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-dashboard', templateUrl: './dashboard.component.html', styleUrls: ['./dashboard.component.css'] }) export class DashboardComponent implements OnInit { username: string; submitted = false; constructor() { } ngOnInit() { } onSubmit() { this.submitted = true; } } </code></pre> <p>dashboard.component.html</p> <pre><code>&lt;div class="row justify-content-md-center"&gt; &lt;div class="col col-lg-12"&gt; &lt;form (ngSubmit)="onSubmit()" #usernameForm="ngForm" &gt; &lt;div class="form-group"&gt; &lt;label for="username"&gt;Name&lt;/label&gt; &lt;input type="text" class="form-control" id="name" required [(ngModel)]="username" name="name" #username="ngModel"&gt; &lt;div [hidden]="username.valid || username.pristine" class="alert alert-danger"&gt; Name is required &lt;/div&gt; &lt;/div&gt; &lt;button type="submit" class="btn btn-success"&gt;Submit&lt;/button&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>What's wrong in the above code?</p>
0debug
Get maxAbs from array c# : <p>Why i can't get the element from my array 'vec' which have the max abs value in absolute form? Where's the error?</p> <pre><code>return vec.Select(Math.Abs).Max(); </code></pre>
0debug
Want to add image to my programe : The class I have show you it had call by another class that class extend JPanel, And this class use for create Rectangle and have property when it collision with another. And I want to know how to add image to the Rectangle ,If the graphics2D can't add the image I want to change it to label or something it work. pls guide me import java.awt.*; import java.awt.image.BufferedImage; public class Entity{ private int x; private int y; private int size; private BufferedImage image; public Entity(int x){ this.size = x; } public int getX() { return x; } public int getY() { return y; } public void setX(int x) { this.x = x; } public void setY(int y) { this.y = y; } public void setPosition(int x, int y){ this.x = x; this.y = y; } public Rectangle getBound(){ return new Rectangle(x ,y,size, size); } public boolean isCollid(Entity e){ if (e == this) return false; return getBound().intersects(e.getBound()); } public void render(Graphics2D g2d){ g2d.fillRect(x, y, size, size); } }
0debug
How to verify if a date has expired/passed? : <p>I have a column of dates in the format dd mmm'yy (ex: 26 Jun'17).These dates have to be checked if they are expired using Ruby.How can i do that?</p> <p>Thanks!</p>
0debug
'git pull' command work from terminal but not with php shell_exec() via git repository hook : <p>I have create a webhook in my github repository which post on the hook url on my live server to run pull command for update my repo files on the server. </p> <p>The problem is the hook file which i have created is in the /var/www/site/web/hookfile.php (the post request is going there. i am getting the body response also)</p> <p>and my repo files are in /var/www/git-repo/</p> <p>its not updating the git-repo when i push anything to my github repository. I run this command using terminal and its working.</p> <pre><code>cd /var/www/git-repo &amp;&amp; git pull </code></pre> <p>But through my php file its not working</p> <pre><code>shell_exec('cd /var/www/git-repo &amp;&amp; git pull') </code></pre>
0debug
Jest unexpected token import from node_modules component; babel failing to run? : <p>I'm trying to figure out how to get Jest to work in my environment, and I'm running into an issue where this project has a bunch of custom components in a subdirectory within node_modules. </p> <p>I'm getting this error:</p> <pre><code> FAIL src/mantle/tools/searchindexer/apps/DataMover/js/components/__test__/GenericJobsTable.test.jsx ● Test suite failed to run /Users/rob/repos/mesa/ui/node_modules/iggy-common/components/IggyTable.jsx:1 ({"Object.":function(module,exports,require,__dirname,__filename,global,jest){import React, {PropTypes} from "react"; ^^^^^^ SyntaxError: Unexpected token import at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/ScriptTransformer.js:289:17) at Object. (src/mantle/tools/searchindexer/apps/DataMover/js/components/JobsTable/GenericJobsTable.jsx:7:18) at Object. (src/mantle/tools/searchindexer/apps/DataMover/js/components/__test__/GenericJobsTable.test.jsx:5:25) Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0 total Time: 2.4s Ran all test suites matching "GenericJobsTable". </code></pre> <p>I'm running <code>jest ^20.0.3</code> and <code>babel-jest ^20.0.3</code> on NodeJS 7.7.1. </p> <p>In my package.json, this is the jest config section I have:</p> <pre><code> "jest": { "verbose": true, "transform": { "^.+\\.jsx$": "babel-jest" }, "moduleFileExtensions": [ "js", "jsx" ], "moduleDirectories": [ "node_modules" ] } </code></pre> <p>I have my root <code>.babelrc</code> defined as:</p> <pre><code> { "presets": ["es2015", "react"] } </code></pre> <p>If I run <code>jest --debug</code> I see this:</p> <pre><code> { "config": { "automock": false, "browser": false, "cache": false, "cacheDirectory": "/var/folders/wz/hd_hp8zn6gq7p6816w1hwx640000gn/T/jest_dx", "clearMocks": false, "coveragePathIgnorePatterns": [ "/node_modules/" ], "globals": {}, "haste": { "providesModuleNodeModules": [] }, "moduleDirectories": [ "node_modules" ], "moduleFileExtensions": [ "js", "jsx" ], "moduleNameMapper": {}, "modulePathIgnorePatterns": [], "name": "898fa528b40c10619090191345fdb241", "resetMocks": false, "resetModules": false, "rootDir": "/Users/rob/repos/mesa/ui", "roots": [ "/Users/rob/repos/mesa/ui" ], "setupFiles": [ "/Users/rob/repos/mesa/ui/node_modules/regenerator-runtime/runtime.js" ], "snapshotSerializers": [], "testEnvironment": "jest-environment-jsdom", "testMatch": [ "**/__tests__/**/*.js?(x)", "**/?(*.)(spec|test).js?(x)" ], "testPathIgnorePatterns": [ "/node_modules/" ], "testRegex": "", "testRunner": "/Users/rob/repos/mesa/ui/node_modules/jest-jasmine2/build/index.js", "testURL": "about:blank", "timers": "real", "transform": [ [ "^.+\\.jsx$", "/Users/rob/repos/mesa/ui/node_modules/babel-jest/build/index.js" ] ], "transformIgnorePatterns": [ "/node_modules/" ] }, "framework": "jasmine2", "globalConfig": { "bail": false, "coverageReporters": [ "json", "text", "lcov", "clover" ], "expand": false, "mapCoverage": false, "noStackTrace": false, "notify": false, "projects": [ "/Users/rob/repos/mesa/ui" ], "rootDir": "/Users/rob/repos/mesa/ui", "testPathPattern": "", "testResultsProcessor": null, "updateSnapshot": "new", "useStderr": false, "verbose": true, "watch": false, "watchman": true }, "version": "20.0.3" } </code></pre> <p>Any idea what I might have misconfigured here?</p>
0debug
Python scrabble score from file : I got a list of points for each letter: SCRABBLES_SCORES = [(1, "E A O I N R T L S U"), (2, "D G"), (3, "B C M P"), (4, "F H V W Y"), (5, "K"), (8, "J X"), (10, "Q Z")] And in file I have to find word with the highest score I have a problem, because I don't know how to examine new line. I tried this, but its never ending loop: max = 0 help = 0 file = open("dictionary.txt", "r") for line in file: for l in line: while(l != '\n'): help += LETTER_SCORES.get(l) if(help > max): max = help else: continue help = 0 print(max) Does anybody know what Im doing wrong?
0debug
Sound cloud API not working : <p>I am on developing an application for my Sound Cloud channel. Now API is unavailable. I got a Client_ID key from Shoutem <a href="https://school.shoutem.com/lectures/build-react-native-music-app-tutorial-part1/" rel="nofollow noreferrer">https://school.shoutem.com/lectures/build-react-native-music-app-tutorial-part1/</a> but also it doesn't work.</p> <p>This is the client id <code>2t9loNQH90kzJcsFCODdigxfp325aq4z</code></p>
0debug
Mysterious character output in C : I had come across this code in K & R: int scanline (char str [], int lim) /* Line will be read in 'str []', while lim is the maximum characters to be read */ { int c, len, j; /* 'len' will have the length of the read string */ j = 0; /* Initializing 'j' */ for (len = 0; (c = getchar ()) != EOF && c != '\n'; ++len) /* Reading a character one by one, till the user enters '\n', and checking for failure of 'getchar' */ { if (len < (lim -2)) /* Checking that string entered has not gone beyond it's boundaries. '-2' for '\n' and '\0' */ { str [j] = c; /* Copying read character into 'string [j]' */ ++ j; /* Incrementing 'j' by 1 */ } } if (c == '\n') /* Checking if user has finished inputting the line */ { str [j] = c; /* Copying newline into string */ ++j; ++ len; } return len; /* Returning number of characters read */ } In the K & R, it is known as `getline`, but I made changes, added comments, and thus defined it as `scanline`. To test this, I made a demo program: #include <mocl/cancel.h> int main (int argc, char **argv) { int len; char str [50]; len = scanline (str, 50); printf ("len = %d\n str = %s\n", len, str); return 0; } The required headers and the function was in my own library, `cancel.h`. Then when I compiled my program, it was successful. Although, when I ran the executable, I got unexpected output (I cannot type it as I get a character which when I copy, it just gets pasted as 'm'): [![enter image description here][1]][1] The mysterious character is [![enter image description here][2]][2] which when I copy, gets copied as the letter `m`. Also, when I run my program with different inputs, I get different mysterious outputs: [![enter image description here][3]][3] In another case, I get perfect output, just that a blank line is printed: [![enter image description here][4]][4] I had also come across [this](http://stackoverflow.com/questions/35651800/what-is-this-mysterious-output-in-c) question, in which the user gets the same symbol. ------------ **_What have I done till now?_** I searched a lot, and I could not find any clue about [![enter image description here][5]][5] this character, but if you see carefully, in the second image, I get more characters when I enter "hi this is ashish". One of them is the slash, and one is [![enter image description here][6]][6]. But I get another character [![enter image description here][7]][7]. I got [this](https://rosettacode.org/wiki/Strip_control_codes_and_extended_characters_from_a_string#C) link which was showed how to reproduce it, and explained it, although I could not understand. When you run the code given there, you get a lot of characters, and one of them is [![enter image description here][8]][8]. Although, even the author of that article could not copy it, and has not posted it. So here's the output: [![enter image description here][9]][9] That was the actual output, as that's not clear, here's a cut out version: [![enter image description here][10]][10] So basically I got to know that both the characters [![enter image description here][11]][11] and [![enter image description here][12]][12] are extended characters from a string. At that point, I actually figured out what was causing the problem in `scanline`. The lines if (c == '\n') /* Checking if user has finished inputting the line */ { str [j] = c; /* Copying newline into string */ ++j; ++ len; } were causing the problems as you were copying a newline into the string. It worked, but I'm not sure why, as doing that was just a guess. I searched but still could not find the reason. --------------- **_My Questions_** - How does removing those lines make the program work properly? - What are the characters [![enter image description here][13]][13] and [![enter image description here][14]][14]? What are they supposed to do and how did they appear over here? - Are there any more characters like this? - Why can't those characters be copied? - Is it Undefined Behavior? **NOTE:** I know this questions lengthy, but I'll make sure and offer a bounty once that "question eligible for bounty in 2 days" gets over. [1]: http://i.stack.imgur.com/gJzPb.png [2]: http://i.stack.imgur.com/IWP35.png [3]: http://i.stack.imgur.com/UKqpI.png [4]: http://i.stack.imgur.com/8EKne.png [5]: http://i.stack.imgur.com/EbMX9.png [6]: http://i.stack.imgur.com/h0yCq.png [7]: http://i.stack.imgur.com/qu9oW.png [8]: http://i.stack.imgur.com/8XL0F.png [9]: http://i.stack.imgur.com/SxxxQ.png [10]: http://i.stack.imgur.com/dW876.png [11]: http://i.stack.imgur.com/RfafD.png [12]: http://i.stack.imgur.com/W5Wam.png [13]: http://i.stack.imgur.com/MVrgF.png [14]: http://i.stack.imgur.com/ecu9R.png
0debug
WordPress CPT With Ability to Login and Register : <p>We're responsible for a WordPress plugin which, as part of it's functionality, has a Custom Post Type called 'Applicant'. These are applicants looking to purchase property so against a post you can record things like their contact details, and search requirements.</p> <p>Now... it's come to light that we need to enable these applicants to be able to login and perform various actions such as save properties to a 'Favourites' list, or edit their own requirements.</p> <p>If we were building the plugin from scratch I would've just done them as users, however this is a plugin used by hundreds of people so we don't have that luxury and must keep it as a CPT.</p> <p>My question is... how can I/should I keep it a CPT whilst allowing these people to login and register.</p> <p>My two initial thoughts are:</p> <ol> <li>For every custom post you have a WordPress user and keep the two synced (i.e. if the user is deleted, the custom post gets deleted at the same time). That way you could use the built-in log in and security functionality provided by WordPress, but you have this nightmare of trying to keep the two in sync.</li> </ol> <p>or</p> <ol start="2"> <li>We build our own custom 'login' and 'register' functionality. We store the email address and password against the custom post and use that to validate them. Then also perform our own session management etc.</li> </ol> <p>or</p> <ol start="3"> <li>The final option is we do infact scrap the CPT altogether and just use 'users'. Then write some kind of migration script to move the CPT's over to users.</li> </ol> <p>Hope that makes sense. Any thoughts/ideas most welcome.</p>
0debug
Remove - from number : <p>I need to remove Hyphen from numbers and I cant find the function that does this. I know I have used it before Somewhere but I cant remember.</p> <p>+123-567-896 </p> <p>need +123-567896 like this</p>
0debug
Does using heap memory (malloc/new) create a non-deterministic program? : <p>I started developing software for real-time systems a few months ago in C for space applications, and also for microcontrollers with C++. There's a rule of thumb in such systems that <strong>one should never create heap objects</strong> (so no malloc/new), because it makes the program <strong>non-deterministic</strong>. I wasn't able to verify the correctness of this statement when people tell me that. So, <strong><em>Is this a correct statement?</em></strong></p> <p>The confusion for me is that as far as I know, determinism means that running a program twice will lead to the exact, same execution path. From my understanding this is an issue with multithreaded systems, since running the same program multiple times could have different threads running in different order every time.</p>
0debug
def binomial_coeff(n, k): C = [[0 for j in range(k + 1)] for i in range(n + 1)] for i in range(0, n + 1): for j in range(0, min(i, k) + 1): if (j == 0 or j == i): C[i][j] = 1 else: C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) return C[n][k] def lobb_num(n, m): return (((2 * m + 1) * binomial_coeff(2 * n, m + n)) / (m + n + 1))
0debug
Objactive C - Filter array with pradicare, dont understand the format : So i have an NMMutableArray wich I try to filter using searchBar with no success, Insted of posting all my code I created a project just to understand how it works and evrything I find online didnt help me understand this fully here is my code: - (void)viewDidLoad { [super viewDidLoad]; NSMutableArray<Model*>* firstArry = [[NSMutableArray alloc] init]; NSArray<Model*>* secondArry = [[NSMutableArray alloc] init]; Model* p1 = [[Model alloc] init]; p1.name = @"bob"; p1.lastName = @"bdas"; [firstArry addObject:p1]; Model* p2 = [[Model alloc] init]; p2.name = @"juny"; p2.lastName = @"his"; [firstArry addObject:p2]; Model* p3 = [[Model alloc] init]; p3.name = @"junay"; p3.lastName = @"firs"; [firstArry addObject:p3]; Model* p4 = [[Model alloc] init]; p4.name = @"bobov"; p4.lastName = @"daskal"; [firstArry addObject:p4]; Model* p5 = [[Model alloc] init]; p5.name = @"dima"; p5.lastName = @"bonder"; [firstArry addObject:p5]; for (Model* name in firstArry){ NSLog(@"%@",name.name); } NSString* filterWord = @"bo"; NSPredicate* predicate = [NSPredicate predicateWithFormat:@"keywords.name CONTAINS[cd] %@",filterWord]; secondArry = [firstArry filteredArrayUsingPredicate:predicate]; if(secondArry.count > 0){ for (Model* name in firstArry){ NSLog(@"%@",name.name); } } else { NSLog(@"second arry is empty"); } } I want to Filter the firstArry with the given filterWord and get a new array with the object wich they name property contains it, how to do it and how dose it work ?
0debug
Feching user's current location tips : <p>I was asked to create a web app that uses user current location to determine a distance to a given place. I have never faced this kind of problem so i'm looking for some guideline, efficient technologies/libraries that allow to implement such mechanism also some pro tips from someone with experiance would be really appreciated. I often develop my apps with Ruby on Rails/Django but i can adapt to other technologies if beneficial. I did research and found some geo libs but i'm really looking for some guidance from someone with experiance casue i want to do it right. Thanks in advance</p>
0debug
How to submit form when have input type="submit" inner form using javascript? : <p>How to submit form when have input type="submit" inner form using javascript ?</p> <p>i want to submit form using javascript (have input type="submit" inner form ).</p> <p>i tried to use this code </p> <pre><code>&lt;form action="" method="post" name="test_fn"&gt; &lt;input type="text" name="input1" value="ON"&gt; &lt;input type="submit" name="submit" value="ON"&gt; &lt;/form&gt; &lt;script type="text/javascript"&gt; setTimeout(function(){test_fn.submit();}, 0); &lt;/script&gt; </code></pre> <p>but not work. how can i do that ? for submit form using javascript (have input type="submit" inner form )</p> <p>thank</p>
0debug
How to get list of all Databases and its respective users list in single query : I have searched online and found few queries where I can list users of current database but I want to return all databases and its respective users list in single query. I am using SQL SERVER 2017. How to do that.
0debug
void timer_del(QEMUTimer *ts) { QEMUTimerList *timer_list = ts->timer_list; qemu_mutex_lock(&timer_list->active_timers_lock); timer_del_locked(timer_list, ts); qemu_mutex_unlock(&timer_list->active_timers_lock); }
1threat
How to use Butterknife plugin in Android Studio? : <p>I am currently working in a project where Butterknife plugin is being used, i noticed something like @BindView(R.id.something). How do we use butterknife plugin in an app?</p>
0debug
static void usb_msd_password_cb(void *opaque, int err) { MSDState *s = opaque; if (!err) err = usb_device_attach(&s->dev); if (err) qdev_unplug(&s->dev.qdev, NULL); }
1threat
I'm having trouble turning this program from an if-else-if statement into a switch statement. Any help would be appreciated : I'm having trouble turning this program from an if-else-if statement into a switch statement. Any help would be appreciated. public void tick() { if (s.word == 0) return; short t = this.sc.word; short d = this.get_opcode(); short i = this.get_indirect_bit(); if (t == 0 || t == 1) this.instruction_fetch(t); if (t == 2) this.instruction_decode(); if (t == 3 && d != 7) this.operand_fetch(i); if (t > 3 && d != 7) this.execute_mri(d, t); if (t == 3 && d == 7) { this.execute_rri((short) (this.ir.word & 0xFFF)); } }
0debug
Why doesn't Python return an error for string assignment using replace in a for loop? : <p>In the following example, I would have expected an error saying that string assignment is not possible because strings are immutable. Instead, the loop returns the original string.</p> <pre><code>a = "AECD" for i in a: if i == "E": a.replace(i, "B") print(a) </code></pre> <p>Is replace not essentially trying to do the same thing as a[1] = "B"? Does this have to do with creating a new object with assignment versus modifying an existing one with replace?</p>
0debug
What is the maximum scrape_interval in Prometheus : <p>I used Prometheus to measure business metrics like:</p> <pre><code># HELP items_waiting_total Total number of items in a queue # TYPE items_waiting_total gauge items_waiting_total 149 </code></pre> <p>I would like to keep this data for very long term (5 years retention) and I don't need high frequency in scrape_interval. So I set up <code>scrape_interval: "900s"</code>.</p> <p>When I check the graph in Prometheus with 60s resolution, it shows that flapping, but it is not true.</p> <p><a href="https://i.stack.imgur.com/QjOWh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/QjOWh.png" alt="enter image description here"></a></p> <p>The question is, what is the maximum (recommended) scrape_interval in Prometheus?</p>
0debug
alert('Hello ' + user_input);
1threat
If statement isn't working for simple JavaScript toggle : <p>In the <code>resize()</code> function we check if the <code>body</code> element has the class <code>switch</code>. If it contains <code>switch</code> then we remove it when <code>resize</code> is fired. If it doesn't have the <code>switch</code> class then we add it when the function is fired. </p> <p>However in the snippet below when the button is clicked it doesn't work as a toggle. It gets clicked only once and it's original state cannot be restored.</p> <p>Why doesn't this simple JavaScript work and what are some ways to fix this?</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function resize() { var body = document.querySelector( 'body' ); if( body.classList.contains( 'switch' ) ){ body.classList.remove( 'shrink' ); } else { body.classList.add( 'shrink' ); } } var switcher = document.getElementById( 'switch' ); switcher.addEventListener( 'click', resize );</code></pre> <pre class="snippet-code-css lang-css prettyprint-override"><code>p { text-align: center; margin-bottom: 1rem; transition-property: color; transition-duration: 1.5s; } .bar { width: 22.5rem; height: 10rem; background-color: #555; border-radius: 5rem; position: relative; transition-property: background-color; transition-duration: 1.5s; } .knob { width: 12rem; height: 12rem; background-color: #000; border-radius: 10rem; position: absolute; top: 50%; right: 0; transform: translateY( -50% ); transition-property: right, background-color; transition-duration: 1s, 1.5s; } :checked ~ label p { color: #888 } :checked ~ label .bar { background-color: #888 } :checked ~ label .knob { background-color: #777; right: 10.5rem } .shrink { transform: scale( 0.8 ) }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;head&gt; &lt;style&gt; * { margin: 0 } html { font-size: 10px } html, body, main { height: 100% } body { transition-property: transform; transition-duration: 1s; } main { font-family: arial; font-size: 6rem; display: flex; text-transform: capitalize; } input { display: none } label, p { user-select: none; cursor: pointer; margin: auto; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;main&gt; &lt;input type="checkbox" id="checkbox"&gt; &lt;label for="checkbox" id="switch"&gt; &lt;p&gt;switch&lt;/p&gt; &lt;div class="bar"&gt; &lt;div class="knob"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/label&gt; &lt;/main&gt; &lt;/body&gt;</code></pre> </div> </div> </p>
0debug
Why is Python re.sub capture not zero indexed? : <p>When capturing <code>Boiler</code> and <code>1</code> shown below, they are then referenced as \1 and \2. This took me a while to figure out why this was not working as I expected the capture group to be zero indexed. Why is the capture group not zero indexed unlike nearly everything in Python?</p> <pre><code>string = "BoilerRoom_Boiler_Booster_On" re.sub('(Boiler)_(\d)', r'\1-\2', string) Out[21]: 'BoilerRoom_Boiler-1_Booster_On' </code></pre>
0debug
static int qcow2_create2(const char *filename, int64_t total_size, const char *backing_file, const char *backing_format, int flags, size_t cluster_size, int prealloc, QEMUOptionParameter *options, int version, Error **errp) { int cluster_bits; cluster_bits = ffs(cluster_size) - 1; if (cluster_bits < MIN_CLUSTER_BITS || cluster_bits > MAX_CLUSTER_BITS || (1 << cluster_bits) != cluster_size) { error_setg(errp, "Cluster size must be a power of two between %d and " "%dk", 1 << MIN_CLUSTER_BITS, 1 << (MAX_CLUSTER_BITS - 10)); return -EINVAL; } BlockDriverState* bs; QCowHeader *header; uint8_t* refcount_table; Error *local_err = NULL; int ret; ret = bdrv_create_file(filename, options, &local_err); if (ret < 0) { error_propagate(errp, local_err); return ret; } bs = NULL; ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL, NULL, &local_err); if (ret < 0) { error_propagate(errp, local_err); return ret; } QEMU_BUILD_BUG_ON((1 << MIN_CLUSTER_BITS) < sizeof(*header)); header = g_malloc0(cluster_size); *header = (QCowHeader) { .magic = cpu_to_be32(QCOW_MAGIC), .version = cpu_to_be32(version), .cluster_bits = cpu_to_be32(cluster_bits), .size = cpu_to_be64(0), .l1_table_offset = cpu_to_be64(0), .l1_size = cpu_to_be32(0), .refcount_table_offset = cpu_to_be64(cluster_size), .refcount_table_clusters = cpu_to_be32(1), .refcount_order = cpu_to_be32(3 + REFCOUNT_SHIFT), .header_length = cpu_to_be32(sizeof(*header)), }; if (flags & BLOCK_FLAG_ENCRYPT) { header->crypt_method = cpu_to_be32(QCOW_CRYPT_AES); } else { header->crypt_method = cpu_to_be32(QCOW_CRYPT_NONE); } if (flags & BLOCK_FLAG_LAZY_REFCOUNTS) { header->compatible_features |= cpu_to_be64(QCOW2_COMPAT_LAZY_REFCOUNTS); } ret = bdrv_pwrite(bs, 0, header, cluster_size); g_free(header); if (ret < 0) { error_setg_errno(errp, -ret, "Could not write qcow2 header"); goto out; } refcount_table = g_malloc0(cluster_size); ret = bdrv_pwrite(bs, cluster_size, refcount_table, cluster_size); g_free(refcount_table); if (ret < 0) { error_setg_errno(errp, -ret, "Could not write refcount table"); goto out; } bdrv_unref(bs); bs = NULL; BlockDriver* drv = bdrv_find_format("qcow2"); assert(drv != NULL); ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH, drv, &local_err); if (ret < 0) { error_propagate(errp, local_err); goto out; } ret = qcow2_alloc_clusters(bs, 2 * cluster_size); if (ret < 0) { error_setg_errno(errp, -ret, "Could not allocate clusters for qcow2 " "header and refcount table"); goto out; } else if (ret != 0) { error_report("Huh, first cluster in empty image is already in use?"); abort(); } ret = bdrv_truncate(bs, total_size * BDRV_SECTOR_SIZE); if (ret < 0) { error_setg_errno(errp, -ret, "Could not resize image"); goto out; } if (backing_file) { ret = bdrv_change_backing_file(bs, backing_file, backing_format); if (ret < 0) { error_setg_errno(errp, -ret, "Could not assign backing file '%s' " "with format '%s'", backing_file, backing_format); goto out; } } if (prealloc) { BDRVQcowState *s = bs->opaque; qemu_co_mutex_lock(&s->lock); ret = preallocate(bs); qemu_co_mutex_unlock(&s->lock); if (ret < 0) { error_setg_errno(errp, -ret, "Could not preallocate metadata"); goto out; } } bdrv_unref(bs); bs = NULL; ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_BACKING, drv, &local_err); if (local_err) { error_propagate(errp, local_err); goto out; } ret = 0; out: if (bs) { bdrv_unref(bs); } return ret; }
1threat
How do i generate a random number that only shows up Once? : <p>I'm trying to generate up to 5 numbers between 0-4 and doesn't re generate the same number more than once. The program will stop after three attempts, therefore the random numbers generated should read 4,3,2 and not 4,3,4(For example).</p> <p>I've created an array with 5 string elements in it. at least 3 of the strings in the array will be displayed on a label when the button is clicked 3 times. After the button is clicked 3 times, the app will come to an end. However, the issue is that some of the strings in the array keeps repeating itself each time the button is clicked. I found a method that prevents the number from repeating (1,3,1) instead of (1,1,3) for eg. But in my case i do not want a number to be generated once it was already generated. For eg. (1,3,4) instead of (1,3,1) where the (1) is re-generated.</p> <pre><code>var fruits: [String] = ["Apple", "Mango", "Cherry", "Strawberry", "Blueberry", "Banana"] // fruits to be displayed in the label func randomizeNum() -&gt; UInt32 { var randomNumber = arc4random_uniform(UInt32(fruits.count)) while previousNumber == randomNumber { randomNumber = arc4random_uniform(UInt32(fruits.count)) } displayLbl.text = fruits[Int(randomNumber)] previousNumber = randomNumber print("the random num is \(randomNumber)") // This prints for example 5, 1, 5. Need it to print only numbers that's not yet displayed with 3 attempts. return randomNumber } </code></pre> <p>I expect the output of this function to generate a random number like 0,4,1 but it generates 5,1,5 or 0,4,0 where the (0) is re-generated again.</p>
0debug
Python random matrix : How to solve the problem to create a matrix with random numbers (user input)? I also how a problem with this: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 23: ordinal not in range(128) Thank you in advance! array = list() i = int(input("How many row: ")) j = int(input("How many column: ")) for x in range(i): if i <= 0 or i>10: print("Failure!") break elif j <= 0 or j>10: print("Failure!") break else: for y in range(j): num = raw_input("Value: ") array.append(int(num)) a = np.reshape((i,j)) print a
0debug
How can I use Rails 5.2 credentials in capistrano's deploy.rb file? : <p>I've just updated my Rails app to 5.2, and configured it to use the new <code>config/credentials.yml.enc</code> file.</p> <p>When I try to deploy, I get this error:</p> <pre><code>NameError: uninitialized constant Rails /Users/me/Documents/project/config/deploy.rb:27:in `&lt;top (required)&gt;' </code></pre> <p>That's pointing to this line in my <code>config/deploy.rb</code> file:</p> <pre><code>set :rollbar_token, Rails.application.credentials[:rollbar_token] </code></pre> <p>So it appears that while capistrano is running, it doesn't have access to <code>Rails.application.credentials</code>.</p> <p>How are you all handling this? I've got some ideas...</p> <ul> <li>Set this one variable as an <code>ENV</code> variable <ul> <li>I don't love how this separates/customizes this one setting</li> </ul></li> <li>Somehow make it so capistrano has access to <code>Rails.application.credentials</code> <ul> <li>I don't know if this is a good idea or if there are other things I need to be aware of if I go this route</li> </ul></li> <li>Remove deploy tracking in rollbar <ul> <li>🤷‍♂️</li> </ul></li> </ul>
0debug
How to update a label with the current date in XCode? : I have two labels(label1 , label2) . In label 1 want the day and in label 2 I want the month followed by the date. Example : Thursday Jun 30 Please Help!
0debug
int ff_get_qtpalette(int codec_id, AVIOContext *pb, uint32_t *palette) { int tmp, bit_depth, color_table_id, greyscale, i; avio_seek(pb, 82, SEEK_CUR); tmp = avio_rb16(pb); bit_depth = tmp & 0x1F; greyscale = tmp & 0x20; color_table_id = avio_rb16(pb); if (greyscale && codec_id == AV_CODEC_ID_CINEPAK) return 0; if ((bit_depth == 1 || bit_depth == 2 || bit_depth == 4 || bit_depth == 8)) { int color_count, color_start, color_end; uint32_t a, r, g, b; if (greyscale && bit_depth > 1 && color_table_id) { int color_index, color_dec; color_count = 1 << bit_depth; color_index = 255; color_dec = 256 / (color_count - 1); for (i = 0; i < color_count; i++) { r = g = b = color_index; palette[i] = (0xFFU << 24) | (r << 16) | (g << 8) | (b); color_index -= color_dec; if (color_index < 0) color_index = 0; } } else if (color_table_id) { const uint8_t *color_table; color_count = 1 << bit_depth; if (bit_depth == 1) color_table = ff_qt_default_palette_2; else if (bit_depth == 2) color_table = ff_qt_default_palette_4; else if (bit_depth == 4) color_table = ff_qt_default_palette_16; else color_table = ff_qt_default_palette_256; for (i = 0; i < color_count; i++) { r = color_table[i * 3 + 0]; g = color_table[i * 3 + 1]; b = color_table[i * 3 + 2]; palette[i] = (0xFFU << 24) | (r << 16) | (g << 8) | (b); } } else { color_start = avio_rb32(pb); avio_rb16(pb); color_end = avio_rb16(pb); if ((color_start <= 255) && (color_end <= 255)) { for (i = color_start; i <= color_end; i++) { a = avio_r8(pb); avio_r8(pb); r = avio_r8(pb); avio_r8(pb); g = avio_r8(pb); avio_r8(pb); b = avio_r8(pb); avio_r8(pb); palette[i] = (a << 24 ) | (r << 16) | (g << 8) | (b); } } } return 1; } return 0; }
1threat
Differences between using Lambda Expresions and without using it? : Could someone explain my the differences between methods using lambda expresions and without using it ? On the example : Function<Double, Double> function; public void methodCounting() { this.function = x -> x = x + 2; } public void methodCounting(double x) { x = x + 2; return x; } What do we gain ?
0debug
System Overflow Exception : i´m new here, i hope you can help me, and sorry for my bad english :D I tried to save the MaximumApplicationAddress from SystemInfo into an uint. But i got an error (System Overflow Exception). I tried alot and also googled alot, but nothing helps. If i convert or if i use an decimal, nothing helped. Here is my source, hope you can help me and find the error :) [Source][1] I also maked an Screenshot from the error. [Screenshot][2] Hope you can help me [1]: https://pastebin.com/nzR7g9UD [2]: https://i.stack.imgur.com/9qkoU.png
0debug
int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, enum AVPixelFormat pix_fmt, int width, int height) { int i; if (pix_fmt != AV_PIX_FMT_YUV420P && pix_fmt != AV_PIX_FMT_YUVJ420P && pix_fmt != AV_PIX_FMT_YUV422P && pix_fmt != AV_PIX_FMT_YUVJ422P && pix_fmt != AV_PIX_FMT_YUV444P && pix_fmt != AV_PIX_FMT_YUV411P && pix_fmt != AV_PIX_FMT_GRAY8) return -1; if ((width & 3) != 0 || (height & 3) != 0) return -1; for(i=0;i<3;i++) { if (i == 1) { switch(pix_fmt) { case AV_PIX_FMT_YUVJ420P: case AV_PIX_FMT_YUV420P: width >>= 1; height >>= 1; break; case AV_PIX_FMT_YUV422P: case AV_PIX_FMT_YUVJ422P: width >>= 1; break; case AV_PIX_FMT_YUV411P: width >>= 2; break; default: break; } if (pix_fmt == AV_PIX_FMT_GRAY8) { break; } } if (src == dst) { deinterlace_bottom_field_inplace(dst->data[i], dst->linesize[i], width, height); } else { deinterlace_bottom_field(dst->data[i],dst->linesize[i], src->data[i], src->linesize[i], width, height); } } emms_c(); return 0; }
1threat
How to merge two dataframes in Spark Hadoop? : I am trying to join two dataframes. data: DataFrame[_1: bigint, _2: vector] cluster: DataFrame[cluster: bigint] result = data.join(broadcast(cluster)) The strange thing is, that all the executors are failing on the joining step. I have no idea what I could do. The data file is 2.8 gb on HDFS and the cluster data only 5 mb. The files are read using Parquet.
0debug
How can i return multiple values from a function seperatly : i'm a newb, please help! So the issue is quite simple, I need to return multiple values from a function, can anyone suggest how I do it? Code below: <?php abstract class Products { protected $name; protected $price; public function __construct($name, $price) { $this->name = $name; $this->price = $price; } public function getName() { return $this->name; } public function getPrice() { return $this->price; } } // A new class extension class Furniture extends Products { protected $width; protected $height; protected $length; public function getSize() { // return $this->width; // return $this->height; // return $this->length; // return array($this->width, $this->height, $this->length); } } So as far as I understand, when I return something, it will stop the function, so I understand why I cant just do return 3 times. Attempt to return an array didn't work with an error "Notice: Array to string conversion". Could anyone please let me know how I can return all 3 of those?
0debug