problem
stringlengths
26
131k
labels
class label
2 classes
I want to execute a print after else one time in java (without using break) : A code to simulate the hashing > A code to simulate the hashing > I am new to Java so my question is very simple, how to stop many iterations and print Not found once without using break <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> > The main class - main public class hash { public static void main(String[] args) { contact [] table = new contact [88]; //Create an object of contact class int tablesize = 88; int Out= calc_hash( "NAME",tablesize); table [Out] = new contact() ; table [Out].Name = "AHMED" ; table [Out].phone =23445677; System.out.println(Out); > My question is here for (int i = 0; i < 36 ; i++) { if(table[i] !=null ) { if (table [i].Name != null) { System.out.println(i); System.out.println(table [i].Name); System.out.println(table [i].phone);} } else { System.out.println("Not found"); } // Here "Not found" is printed with every iteration } > Hash function } public static int calc_hash( String key , int table_size) { int i, l = key.length(); int hash = 0; for (i = 0; i < l ; i++) { hash += Character.getNumericValue(key.charAt(i)); hash += (hash << 10); hash ^= (hash >> 6); } hash += (hash << 3); hash ^= (hash >> 11); hash += (hash << 15); if ( hash > 0) return hash % table_size; else return -hash % table_size; } } <!-- end snippet -->
0debug
Spring core. Default @Bean destroy method : <p>I have my own bean:</p> <pre><code>@Bean public MyBean myBean(){... </code></pre> <p>following spring documentation to release its own resources I should specify <code>destroyMethod</code>. I've not found any default destroy methods called by spring in case if <code>destroyMethod</code> is not specified directly.</p> <p>I used</p> <pre><code>@Bean(destroyMethod = "close") public MyBean myBean(){... </code></pre> <p>but think about possibility to do not specify destroy method directly if it has value by default.</p> <hr> <p>Does spring try something by default like <code>destroy</code>, <code>close</code>, <code>release</code>? If spring tries some methods by default to release resources - which ones?</p>
0debug
static int vnc_display_listen_addr(VncDisplay *vd, SocketAddress *addr, const char *name, QIOChannelSocket ***lsock, guint **lsock_tag, size_t *nlsock, Error **errp) { *nlsock = 1; *lsock = g_new0(QIOChannelSocket *, 1); *lsock_tag = g_new0(guint, 1); (*lsock)[0] = qio_channel_socket_new(); qio_channel_set_name(QIO_CHANNEL((*lsock)[0]), name); if (qio_channel_socket_listen_sync((*lsock)[0], addr, errp) < 0) { return -1; } (*lsock_tag)[0] = qio_channel_add_watch( QIO_CHANNEL((*lsock)[0]), G_IO_IN, vnc_listen_io, vd, NULL); return 0; }
1threat
How to create flavor in openatack using python code : Can anyone please tell me how to create flavor I have a code for list out the flavor but first I need how to create a flavor using python?
0debug
Calculation of ever rising value : <p>I will like to be able to make a calculation in php using a number of experience points (XP) as base to return a level value. I want it to be increasingly more difficult for each level to rise. Like this:</p> <pre><code>0-49 XP = Level 1 50-104 XP = Level 2 105-164 XP = Level 3 165-229 XP = Level 4 etc. </code></pre> <p>To reach level 2 50 XP is needed. To reach level 3 a further 55 XP is needed. To reach level 4 a further 60 XP is needed and so forth.</p> <p>Even more I would like to be able to display the amount of XP needed to reach the next threshold.</p> <p>I have no idea what to search for to solve my challenge. I hope you can help.</p> <p>Thank you in advance.</p>
0debug
Simply description restrict keyword : <ul> <li>I'm a junior C programmer.I don't understand the <strong><em>restrict</em></strong> keyword.Can you simply explain?Thanks for help.</li> </ul>
0debug
How do you run and compare two sorting algorithms and see which one finishes first? : <p>Is parallel processing going to be necessary?</p>
0debug
Angular 4 scheduled form autosave : <p>I'm trying to implement form data autosave in Angular 4. It should work like this:<br></p> <ul> <li>User changes some data in the form -> some save request to DB is invoked. Let's assume some timer is started here for 2s. </li> <li>During 2s from previous save request all changes will not invoke any requests (to reduce DB load), but will trigger another save request then 2s timer will expire. </li> <li>If no timer is started at the moment then save request should be invoked immediately.</li> </ul> <p>I suppose that <code>Observable</code>, <code>Subject</code> and <code>Scheduler</code> from RxJS will help me, but I am completely new to it. Could you suggest the best approach for achieving above functionality please? </p>
0debug
Why is this c program NOT causing a segmentation fault with alphanumeric values? : In its simplest form the program is int main(){ int x; scanf("%d",x); } when we give this program any numeric value as input it fails by producing a segfault signal which is what we should expect. But if we instead give it any alphanumeric value it DOES NOT fails !!! what is going on in the scanf that produces this behavior ? This is the backtrace from gdb when running it with a numeric value (gdb) bt #0 0x00000034e7456ed0 in _IO_vfscanf_internal () from /lib64/libc.so.6 #1 0x00000034e74646cd in __isoc99_scanf () from /lib64/libc.so.6 #2 0x0000000000400553 in main () So why is it NOT failing for any alphanumeric value like 'a' or 'dfgb'?
0debug
alert('Hello ' + user_input);
1threat
When should you use an empty array in a web application? : <p>I'm learning Ruby and several tutorials introduce empty arrays and pushing values in them.</p> <p>I googled "When are empty arrays used?" and there seems to be no web pages that talk about practical empty array usage.</p> <p>My assumption is that empty arrays are used when arrays elements are unknown and external input provides the array elements. But I cannot think of any examples...</p>
0debug
dice number showing with c# on unity 3d : I wrote a code to show the number of the dice on the screen but that did not happen when I pressed the button only the number 0 is showing . [enter image description here][1] [1]: https://i.stack.imgur.com/IF6QM.png this is Dice script : ` using System.Collections; using System.Collections.Generic; using UnityEngine; public class Dice: MonoBehaviour { static Rigidbody rb; public static Vector3 diceVelocity; // Use this for initialization void Start () { rb = GetComponent<Rigidbody>(); } // Update is called once per frame void Update () { diceVelocity = rb.velocity; if (Input.GetKey("left")) { DiceNumberText.diceNumber = 0; float dirX = Random.Range(0, 500); float dirY = Random.Range(0, 500); float dirZ = Random.Range(0, 500); transform.position = new Vector3(0, 2, 0); transform.rotation = Quaternion.identity; rb.AddForce(transform.up * 500); rb.AddTorque(dirX, dirY, dirZ); } } }` and my DiceNumberscript: `public class DiceNumberText : MonoBehaviour { Text text; public static int diceNumber; // Use this for initialization private void Start () { text = GetComponent< Text>(); } // Update is called once per frame void Update () { text.text = diceNumber.ToString(); } } `
0debug
Lambda Issue, or corss validation : I am doing double cross validation with LASSO, however when I plot the results I am getting lambda of 0 - 150000 which is unrealistic in my case, not sure what is wrong I am doing, can someone point me in the right direction. Thanks in advance! calcium = read.csv("calciumgood.csv", header=TRUE) dim(calcium) n = dim(calcium)[1] calcium = na.omit(calcium) names(calcium) library(glmnet) # use LASSO model from package glmnet lambdalist = exp((-1200:1200)/100) # defines models to consider fulldata.in = calcium x.in = model.matrix(CAMMOL~. - CAMLEVEL - AGE,data=fulldata.in) y.in = fulldata.in[,2] k.in = 10 n.in = dim(fulldata.in)[1] groups.in = c(rep(1:k.in,floor(n.in/k.in)),1:(n.in%%k.in)) set.seed(8) cvgroups.in = sample(groups.in,n.in) #orders randomly, with seed (8) #LASSO cross-validation cvLASSOglm.in = cv.glmnet(x.in, y.in, lambda=lambdalist, alpha = 1, nfolds=k.in, foldid=cvgroups.in) plot(cvLASSOglm.in$lambda,cvLASSOglm.in$cvm,type="l",lwd=2,col="red",xlab="lambda",ylab="CV(10)") whichlowestcvLASSO.in = order(cvLASSOglm.in$cvm)[1]; min(cvLASSOglm.in$cvm) bestlambdaLASSO = (cvLASSOglm.in$lambda)[whichlowestcvLASSO.in]; bestlambdaLASSO abline(v=bestlambdaLASSO) bestlambdaLASSO # this is the lambda for the best LASSO model LASSOfit.in = glmnet(x.in, y.in, alpha = 1,lambda=lambdalist) # fit the model across possible lambda LASSObestcoef = coef(LASSOfit.in, s = bestlambdaLASSO); LASSObestcoef # coefficients for the best model fit
0debug
NGINX configuration for Rails 5 ActionCable with puma : <p>I am using Jelastic for my development environment (not yet in production). My application is running with Unicorn but I discovered websockets with ActionCable and integrated it in my application.</p> <p>Everything is working fine in local, but when deploying to my Jelastic environment (with the default NGINX/Unicorn configuration), I am getting this message in my javascript console and I see nothing in my access log</p> <pre><code>WebSocket connection to 'ws://dev.myapp.com:8080/' failed: WebSocket is closed before the connection is established. </code></pre> <p>I used to have on my local environment and I solved it by adding the needed ActionCable.server.config.allowed_request_origins in my config file. So I double-checked my development config for this and it is ok.</p> <p>That's why I was wondering if there is something specific for NGINX config, else than what is explained on ActionCable git page </p> <pre><code>bundle exec puma -p 28080 cable/config.ru </code></pre> <p>For my application, I followed everything from <a href="https://github.com/rails/rails/tree/master/actioncable">enter link description here</a> but nothing's mentioned about NGINX configuration</p> <p>I know that websocket with ActionCable is quite new but I hope someone would be able to give me a lead on that</p> <p>Many thanks</p>
0debug
static void qdm2_decode_fft_packets (QDM2Context *q) { int i, j, min, max, value, type, unknown_flag; GetBitContext gb; if (q->sub_packet_list_B[0].packet == NULL) return; q->fft_coefs_index = 0; for (i=0; i < 5; i++) q->fft_coefs_min_index[i] = -1; for (i = 0, max = 256; i < q->sub_packets_B; i++) { QDM2SubPacket *packet; for (j = 0, min = 0, packet = NULL; j < q->sub_packets_B; j++) { value = q->sub_packet_list_B[j].packet->type; if (value > min && value < max) { min = value; packet = q->sub_packet_list_B[j].packet; } } max = min; if (i == 0 && (packet->type < 16 || packet->type >= 48 || fft_subpackets[packet->type - 16])) return; init_get_bits (&gb, packet->data, packet->size*8); if (packet->type >= 32 && packet->type < 48 && !fft_subpackets[packet->type - 16]) unknown_flag = 1; else unknown_flag = 0; type = packet->type; if ((type >= 17 && type < 24) || (type >= 33 && type < 40)) { int duration = q->sub_sampling + 5 - (type & 15); if (duration >= 0 && duration < 4) qdm2_fft_decode_tones(q, duration, &gb, unknown_flag); } else if (type == 31) { for (i=0; i < 4; i++) qdm2_fft_decode_tones(q, i, &gb, unknown_flag); } else if (type == 46) { for (i=0; i < 6; i++) q->fft_level_exp[i] = get_bits(&gb, 6); for (i=0; i < 4; i++) qdm2_fft_decode_tones(q, i, &gb, unknown_flag); } } for (i = 0, j = -1; i < 5; i++) if (q->fft_coefs_min_index[i] >= 0) { if (j >= 0) q->fft_coefs_max_index[j] = q->fft_coefs_min_index[i]; j = i; } if (j >= 0) q->fft_coefs_max_index[j] = q->fft_coefs_index; }
1threat
static int svq1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; SVQ1Context *s = avctx->priv_data; AVFrame *cur = s->cur; uint8_t *current; int result, i, x, y, width, height; svq1_pmv *pmv; if (cur->data[0]) avctx->release_buffer(avctx, cur); init_get_bits(&s->gb, buf, buf_size * 8); s->frame_code = get_bits(&s->gb, 22); if ((s->frame_code & ~0x70) || !(s->frame_code & 0x60)) return AVERROR_INVALIDDATA; if (s->frame_code != 0x20) { uint32_t *src = (uint32_t *)(buf + 4); if (buf_size < 36) return AVERROR_INVALIDDATA; for (i = 0; i < 4; i++) src[i] = ((src[i] << 16) | (src[i] >> 16)) ^ src[7 - i]; } result = svq1_decode_frame_header(avctx, cur); if (result != 0) { av_dlog(avctx, "Error in svq1_decode_frame_header %i\n", result); return result; } avcodec_set_dimensions(avctx, s->width, s->height); if ((avctx->skip_frame >= AVDISCARD_NONREF && s->nonref) || (avctx->skip_frame >= AVDISCARD_NONKEY && cur->pict_type != AV_PICTURE_TYPE_I) || avctx->skip_frame >= AVDISCARD_ALL) return buf_size; result = ff_get_buffer(avctx, cur); if (result < 0) return result; pmv = av_malloc((FFALIGN(s->width, 16) / 8 + 3) * sizeof(*pmv)); if (!pmv) return AVERROR(ENOMEM); for (i = 0; i < 3; i++) { int linesize = cur->linesize[i]; if (i == 0) { width = FFALIGN(s->width, 16); height = FFALIGN(s->height, 16); } else { if (avctx->flags & CODEC_FLAG_GRAY) break; width = FFALIGN(s->width / 4, 16); height = FFALIGN(s->height / 4, 16); } current = cur->data[i]; if (cur->pict_type == AV_PICTURE_TYPE_I) { for (y = 0; y < height; y += 16) { for (x = 0; x < width; x += 16) { result = svq1_decode_block_intra(&s->gb, &current[x], linesize); if (result) { av_log(avctx, AV_LOG_ERROR, "Error in svq1_decode_block %i (keyframe)\n", result); goto err; } } current += 16 * linesize; } } else { uint8_t *previous = s->prev->data[i]; if (!previous) { av_log(avctx, AV_LOG_ERROR, "Missing reference frame.\n"); result = AVERROR_INVALIDDATA; goto err; } memset(pmv, 0, ((width / 8) + 3) * sizeof(svq1_pmv)); for (y = 0; y < height; y += 16) { for (x = 0; x < width; x += 16) { result = svq1_decode_delta_block(avctx, &s->dsp, &s->gb, &current[x], previous, linesize, pmv, x, y); if (result) { av_dlog(avctx, "Error in svq1_decode_delta_block %i\n", result); goto err; } } pmv[0].x = pmv[0].y = 0; current += 16 * linesize; } } } *(AVFrame*)data = *cur; cur->qscale_table = NULL; if (!s->nonref) FFSWAP(AVFrame*, s->cur, s->prev); *got_frame = 1; result = buf_size; err: av_free(pmv); return result; }
1threat
What is curl and how to use it with nodejs? : <p>I Can not understand the purpose and use case of curl. what it is meant to be doing?</p> <p>There is this command that i saw in a tutorial and i don't know how it is working </p> <pre><code>curl -d 'hello' http://localhost:8080 </code></pre> <p>we are passing the hello string to the server as a request and can't we do that in browser, if we can , can you please explain how to write the same thing in the browser</p>
0debug
In Dart, syntactically nice way to cast dynamic to given type or return null? : <p>I have a <code>dynamic x</code> and I would like to assign <code>x</code> to <code>T s</code> if <code>x is T</code>, and otherwise assign <code>null</code> to <code>s</code>. Specifically, I would like to avoid having to type <code>x</code> twice, and to avoid creating a temporary. (For example, I don't want to have to write <code>String s = map['key'] is String ? map['key'] : null;</code> over and over, because I will have many such expressions.) I don't want there to be any possibility of a runtime error.</p> <p>The following works:</p> <pre><code>class Cast&lt;T&gt; { T f(x) { if (x is T) { return x; } else { return null; } } } // ... dynamic x = something(); String s = Cast&lt;String&gt;().f(x); </code></pre> <p>Is there a syntactically nicer way to do this?</p>
0debug
Assembly.Load .NET Core : <p>I have an assembly that was dynamically generated using <code>AssemblyBuilder.DefineDynamicAssembly</code>, yet when i try to load it, i get the following error:</p> <blockquote> <p>System.IO.FileNotFoundException: 'Could not load file or assembly 'test, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.'</p> </blockquote> <p>This is the full code to reproduce:</p> <pre><code>var name = new AssemblyName("test"); var assembly = AssemblyBuilder.DefineDynamicAssembly(name, AssemblyBuilderAccess.Run); var assembly2 = Assembly.Load(name); </code></pre> <p>I am using .NET Core 2.0, 2.1 and 2.2.</p> <p>Can somebody please explain why this happens and any possible solutions?</p>
0debug
void hbitmap_iter_init(HBitmapIter *hbi, const HBitmap *hb, uint64_t first) { unsigned i, bit; uint64_t pos; hbi->hb = hb; pos = first >> hb->granularity; hbi->pos = pos >> BITS_PER_LEVEL; hbi->granularity = hb->granularity; for (i = HBITMAP_LEVELS; i-- > 0; ) { bit = pos & (BITS_PER_LONG - 1); pos >>= BITS_PER_LEVEL; hbi->cur[i] = hb->levels[i][pos] & ~((1UL << bit) - 1); if (i != HBITMAP_LEVELS - 1) { hbi->cur[i] &= ~(1UL << bit); } } }
1threat
static int expand_rle_row(SgiState *s, uint8_t *out_buf, uint8_t *out_end, int pixelstride) { unsigned char pixel, count; unsigned char *orig = out_buf; while (1) { if (bytestream2_get_bytes_left(&s->g) < 1) return AVERROR_INVALIDDATA; pixel = bytestream2_get_byteu(&s->g); if (!(count = (pixel & 0x7f))) { return (out_buf - orig) / pixelstride; } if(out_buf + pixelstride * count >= out_end) return -1; if (pixel & 0x80) { while (count--) { *out_buf = bytestream2_get_byte(&s->g); out_buf += pixelstride; } } else { pixel = bytestream2_get_byte(&s->g); while (count--) { *out_buf = pixel; out_buf += pixelstride; } } } }
1threat
static void i440fx_pcihost_get_pci_hole_start(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { I440FXState *s = I440FX_PCI_HOST_BRIDGE(obj); uint32_t value = s->pci_hole.begin; visit_type_uint32(v, name, &value, errp); }
1threat
Javascript Password : I need the password to fulfil these requirements 1. Password must contain at least 8 word characters 2. Must have at least 1 numeric (i.e. digit) 3) 3. At least 2 uppercase characters but not in one consecutive sequence It doesn't seems to work with this var pos = myPass.value.search(/^([\w.-]{8,})(?=.*\d)((.*?[A-Z]){2,})$/); No.3 is the hardest. help much appreciated
0debug
Rxjs: Observable.combineLatest vs Observable.forkJoin : <p>Just wonder what is differences between <code>Observable.combineLatest</code> and <code>Observable.forkJoin</code>? As far as I can see, the only difference is <code>forkJoin</code> expects the Observables to be completed, while <code>combineLatest</code> return the latest values.</p>
0debug
php or html, css and js : <p>I am programming a school website where I want an easy system for teachers, where they could post news, informations, etc. I also want a timetable there. Which language is best suited for these needs? </p> <p>Thanks Adam</p>
0debug
Download file from a href link, how? : <p>I have a a tag with href inside. When link is clicked a wanna download a file from my server. How can I do this. Here is my tag</p> <pre><code>" &lt;a href=\""+ downloadPDF("xxx","xxx") +"\"&gt; </code></pre> <p>downloadPDF is a method which starts the download, but how to make the href link call this method?</p>
0debug
How to load a data using ajax-php with parameters : <p>i got a link that performs a javascript function onclick</p> <pre><code>&lt;input type='hidden' id='name'&gt; &lt;a href='#' onclick='getUsers(1)'&gt;Click here&lt;/a&gt; function getUsers(id){ $('#name').val(id); } </code></pre> <p>whenever i click the link i want to pass the '1' to be the value of the hidden input type.</p> <p>after that i want to perform an ajax to use the value of the hidden input type for my mysql query.</p> <p>would that be possible?</p> <p>Thank you</p>
0debug
static void test_dispatch_cmd_io(void) { QDict *req = qdict_new(); QDict *args = qdict_new(); QDict *args3 = qdict_new(); QDict *ud1a = qdict_new(); QDict *ud1b = qdict_new(); QDict *ret, *ret_dict, *ret_dict_dict, *ret_dict_dict_userdef; QDict *ret_dict_dict2, *ret_dict_dict2_userdef; QInt *ret3; qdict_put_obj(ud1a, "integer", QOBJECT(qint_from_int(42))); qdict_put_obj(ud1a, "string", QOBJECT(qstring_from_str("hello"))); qdict_put_obj(ud1b, "integer", QOBJECT(qint_from_int(422))); qdict_put_obj(ud1b, "string", QOBJECT(qstring_from_str("hello2"))); qdict_put_obj(args, "ud1a", QOBJECT(ud1a)); qdict_put_obj(args, "ud1b", QOBJECT(ud1b)); qdict_put_obj(req, "arguments", QOBJECT(args)); qdict_put_obj(req, "execute", QOBJECT(qstring_from_str("user_def_cmd2"))); ret = qobject_to_qdict(test_qmp_dispatch(req)); assert(!strcmp(qdict_get_str(ret, "string"), "blah1")); ret_dict = qdict_get_qdict(ret, "dict"); assert(!strcmp(qdict_get_str(ret_dict, "string"), "blah2")); ret_dict_dict = qdict_get_qdict(ret_dict, "dict"); ret_dict_dict_userdef = qdict_get_qdict(ret_dict_dict, "userdef"); assert(qdict_get_int(ret_dict_dict_userdef, "integer") == 42); assert(!strcmp(qdict_get_str(ret_dict_dict_userdef, "string"), "hello")); assert(!strcmp(qdict_get_str(ret_dict_dict, "string"), "blah3")); ret_dict_dict2 = qdict_get_qdict(ret_dict, "dict2"); ret_dict_dict2_userdef = qdict_get_qdict(ret_dict_dict2, "userdef"); assert(qdict_get_int(ret_dict_dict2_userdef, "integer") == 422); assert(!strcmp(qdict_get_str(ret_dict_dict2_userdef, "string"), "hello2")); assert(!strcmp(qdict_get_str(ret_dict_dict2, "string"), "blah4")); QDECREF(ret); qdict_put(args3, "a", qint_from_int(66)); qdict_put(req, "arguments", args3); qdict_put(req, "execute", qstring_from_str("user_def_cmd3")); ret3 = qobject_to_qint(test_qmp_dispatch(req)); assert(qint_get_int(ret3) == 66); QDECREF(ret3); QDECREF(req); }
1threat
I don't know what is wrong : I have no clue what is wrong. I would really appreciate if you could help me. I am trying to get input from the textbox, but it will not work. I also, am having trouble getting my variables to work between functions. If anyone could help, that would be great! <html> <head> <title>Project Quiz</title> <script language="JavaScript"> var first_name = document.getElementById('first'); var last_name = document.getElementById('first'); function firstNameClick () { window.document.f.note.value = "Enter first name, then last name."; window.document.f.note.size = 25; } function firstNameLeave () { window.document.f.note.size = 10; window.document.f.note.value = ""; first_name = document.getElementById('first'); if ((first_name != "") && (last_name != "")) { window.document.f.firstDisplay.value=(first_name); window.document.f.firstDisplay.value=(last_name); } else { window.document.f.firstDisplay.value=""; } } function lastName () { last_name = document.getElementById('last'); if ((first_name != "") && (last_name != "")) { window.document.f.lastDisplay.value=(last_name); window.document.f.firstDisplay.value=(first_name); } else { window.document.f.lastDisplay.value=""; } } </script> </head> <body> <form name="f"> <font>First Name</font> </br> <input type="text" id="first" name="first" size=35 onClick="firstNameClick();" onBlur="firstNameLeave();"> </br> </br> <font>Last Name</font> </br> <input type="text" id="last" name="last" size=35 onBlur="lastName();"> </br> </br> <font>Note</font> </br> <input type="text" name="note" size=10 value="" readonly> </br> </br> <font>Display</font> </br> <input type="text" name="firstDisplay" size=25 value="" readonly> </br> <input type="text" name="lastDisplay" size=25 value="" readonly> </form> </body> </html>
0debug
how to use if command to ignore the institution which did not appear and execute the rest command : I use STATA. I have a question regarding how to use loop commond to execute this task. My task is I have mutliple institutions which school_code indicates their ID. And I knew that the ID is in range of 1 to 10000. They appear in the variable of "school_code". But, as mentioned, they did not appear occuasionally. Therefore, I need a condition commond, "if" for example, to help me to ignore those institution did not appear in the given year automatically. Thank you for your advice.
0debug
void tb_invalidate_phys_addr(target_phys_addr_t addr) { ram_addr_t ram_addr; MemoryRegionSection *section; section = phys_page_find(addr >> TARGET_PAGE_BITS); if (!(memory_region_is_ram(section->mr) || (section->mr->rom_device && section->mr->readable))) { return; } ram_addr = (memory_region_get_ram_addr(section->mr) & TARGET_PAGE_MASK) + memory_region_section_addr(section, addr); tb_invalidate_phys_page_range(ram_addr, ram_addr + 1, 0); }
1threat
PKCS#1 and PKCS#8 format for RSA private key : <p>Can some one help me understand how an RSA key literally is stored in these formats? I would like to know the difference between the PKCS formats vs Encodings(DER, PEM). From what I understand PEM is more human readable. Is PEM/DER for keys/certs similar to UTF-8/16 for characters? What is the significance of DER/PEM? Sorry too many questions but fed up googling and getting vague answers. Thanks.</p>
0debug
how do you write a function which doesn't hang when u read from a channel and u are pushing to another channel : consider a function like this func (sc *saramaConsumer) ConsumeClaim(sess sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error { for msg := range claim.Messages() { sc.messages <- msg //this would hang the call if no one is reading from sc.messages and u can never exit consume cliam } }
0debug
Running Job On Airflow Based On Webrequest : <p>I wanted to know if airflow tasks can be executed upon getting a request over HTTP. I am not interested in the scheduling part of Airflow. I just want to use it as a substitute for Celery.</p> <p>So an example operation would be something like this.</p> <ol> <li>User submits a form requesting for some report.</li> <li>Backend receives the request and sends the user a notification that the request has been received.</li> <li>The backend then schedules a job using Airflow to run immediately.</li> <li>Airflow then executes a series of tasks associated with a DAG. For example, pull data from redshift first, pull data from MySQL, make some operations on the two result sets, combine them and then upload the results to Amazon S3, send an email.</li> </ol> <p>From whatever I read online, you can run airflow jobs by executing <code>airflow ...</code> on the command line. I was wondering if there is a python api which can execute the same thing.</p> <p>Thanks.</p>
0debug
How to remove fields from a TypeScript interface via extension : <p>Let's say there's an interface that I don't have control over:</p> <pre><code>interface Original { name: string; size: number; link: SomeType; } </code></pre> <p>I want to extend this interface, but actually <em>remove</em> <code>link</code> so I end up with a new interface that is effectively:</p> <pre><code>interface OriginalLite { name: string; size: number; } </code></pre> <p>How can I do this?</p>
0debug
void qcow2_free_any_clusters(BlockDriverState *bs, uint64_t l2_entry, int nb_clusters, enum qcow2_discard_type type) { BDRVQcow2State *s = bs->opaque; switch (qcow2_get_cluster_type(l2_entry)) { case QCOW2_CLUSTER_COMPRESSED: { int nb_csectors; nb_csectors = ((l2_entry >> s->csize_shift) & s->csize_mask) + 1; qcow2_free_clusters(bs, (l2_entry & s->cluster_offset_mask) & ~511, nb_csectors * 512, type); } break; case QCOW2_CLUSTER_NORMAL: case QCOW2_CLUSTER_ZERO: if (l2_entry & L2E_OFFSET_MASK) { if (offset_into_cluster(s, l2_entry & L2E_OFFSET_MASK)) { qcow2_signal_corruption(bs, false, -1, -1, "Cannot free unaligned cluster %#llx", l2_entry & L2E_OFFSET_MASK); } else { qcow2_free_clusters(bs, l2_entry & L2E_OFFSET_MASK, nb_clusters << s->cluster_bits, type); } } break; case QCOW2_CLUSTER_UNALLOCATED: break; default: abort(); } }
1threat
How to watch for file changes "dotnet watch" with Visual Studio ASP.NET Core : <p>I am using Visual Studio with ASP.NET Core and run the web site using just F5 or Ctrl+F5 (not using command line directly). I would like to use the "dotnet watch" functionality to make sure all changes are picked up on the fly to avoid starting the server again. It seems that with command line you would use "dotnet watch run" for this, but Visual Studio uses launchSettings.json and does it behind the scenes if I understand it correctly. </p> <p>How can I wire up "dotnet watch" there?</p>
0debug
Page loading ASP.NET : How to make a page load like facebook ?? i made a div with an image[tool image] on left side and its description [textbox] on right. There are many images on database ,how can I show other images in the same format..?? I tried it by creating 10 rows with 10 images and 10 textbox it is working but page load became slow.Don't know how to handle other images.. Now i am using multiple pages with 5 image and text box,is there any better option ? Help me to learn..I am a beginner !!
0debug
Why my web-scraping code is not working? : I want to web-scraping the arrivals airplanes from a website with Python 2.7, and export it to excel, but something is wrong with my code: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> import urllib2 import unicodecsv as csv import os import sys import io import time import datetime import pandas as pd from bs4 import BeautifulSoup filename=r'output.csv' resultcsv=open(filename,"wb") output=csv.writer(resultcsv, delimiter=';',quotechar = '"', quoting=csv.QUOTE_NONNUMERIC, encoding='latin-1') url = "https://www.flightradar24.com/data/airports/bud/arrivals" page = urllib2.urlopen(url).read() soup = BeautifulSoup(page) data = soup.find('div', { "class" : "row cnt-schedule-table"}) print data <!-- end snippet --> I need this "row cnt-schedule table". What am i wrong?
0debug
static void vnc_client_error(VncState *vs) { vnc_client_io_error(vs, -1, EINVAL); }
1threat
Is there a way to use a macro to insert a comment in whichever cell I've selected and automatically deletes the username? : <p>The point of this is that I have a column of cells in which I'd like to put a comment in each cell (which I move up and down with sort). However I'm a bit too lazy to go through hundreds of cells and each time having to delete the username when I insert a blank comment for future use. So I thought it'd be easier, if I could select a cell and just press a shortcut key instead.</p>
0debug
static int restore_sigcontext(CPUAlphaState *env, struct target_sigcontext *sc) { uint64_t fpcr; int i, err = 0; __get_user(env->pc, &sc->sc_pc); for (i = 0; i < 31; ++i) { __get_user(env->ir[i], &sc->sc_regs[i]); } for (i = 0; i < 31; ++i) { __get_user(env->fir[i], &sc->sc_fpregs[i]); } __get_user(fpcr, &sc->sc_fpcr); cpu_alpha_store_fpcr(env, fpcr); return err; }
1threat
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, PreallocMode prealloc, QemuOpts *opts, int version, int refcount_order, const char *encryptfmt, Error **errp) { int cluster_bits; QDict *options; cluster_bits = ctz32(cluster_size); 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; } BlockBackend *blk; QCowHeader *header; uint64_t* refcount_table; Error *local_err = NULL; int ret; if (prealloc == PREALLOC_MODE_FULL || prealloc == PREALLOC_MODE_FALLOC) { int64_t prealloc_size = qcow2_calc_prealloc_size(total_size, cluster_size, refcount_order); qemu_opt_set_number(opts, BLOCK_OPT_SIZE, prealloc_size, &error_abort); qemu_opt_set(opts, BLOCK_OPT_PREALLOC, PreallocMode_lookup[prealloc], &error_abort); } ret = bdrv_create_file(filename, opts, &local_err); if (ret < 0) { error_propagate(errp, local_err); return ret; } blk = blk_new_open(filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_RESIZE | BDRV_O_PROTOCOL, &local_err); if (blk == NULL) { error_propagate(errp, local_err); return -EIO; } blk_set_allow_write_beyond_eof(blk, true); 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(refcount_order), .header_length = cpu_to_be32(sizeof(*header)), }; 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 = blk_pwrite(blk, 0, header, cluster_size, 0); g_free(header); if (ret < 0) { error_setg_errno(errp, -ret, "Could not write qcow2 header"); goto out; } refcount_table = g_malloc0(2 * cluster_size); refcount_table[0] = cpu_to_be64(2 * cluster_size); ret = blk_pwrite(blk, cluster_size, refcount_table, 2 * cluster_size, 0); g_free(refcount_table); if (ret < 0) { error_setg_errno(errp, -ret, "Could not write refcount table"); goto out; } blk_unref(blk); blk = NULL; options = qdict_new(); qdict_put_str(options, "driver", "qcow2"); blk = blk_new_open(filename, NULL, options, BDRV_O_RDWR | BDRV_O_RESIZE | BDRV_O_NO_FLUSH, &local_err); if (blk == NULL) { error_propagate(errp, local_err); ret = -EIO; goto out; } ret = qcow2_alloc_clusters(blk_bs(blk), 3 * 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 = qcow2_update_header(blk_bs(blk)); if (ret < 0) { error_setg_errno(errp, -ret, "Could not update qcow2 header"); goto out; } ret = blk_truncate(blk, total_size, errp); if (ret < 0) { error_prepend(errp, "Could not resize image: "); goto out; } if (backing_file) { ret = bdrv_change_backing_file(blk_bs(blk), 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 (encryptfmt) { ret = qcow2_set_up_encryption(blk_bs(blk), encryptfmt, opts, errp); if (ret < 0) { goto out; } } if (prealloc != PREALLOC_MODE_OFF) { BDRVQcow2State *s = blk_bs(blk)->opaque; qemu_co_mutex_lock(&s->lock); ret = preallocate(blk_bs(blk)); qemu_co_mutex_unlock(&s->lock); if (ret < 0) { error_setg_errno(errp, -ret, "Could not preallocate metadata"); goto out; } } blk_unref(blk); blk = NULL; options = qdict_new(); qdict_put_str(options, "driver", "qcow2"); blk = blk_new_open(filename, NULL, options, BDRV_O_RDWR | BDRV_O_NO_BACKING | BDRV_O_NO_IO, &local_err); if (blk == NULL) { error_propagate(errp, local_err); ret = -EIO; goto out; } ret = 0; out: if (blk) { blk_unref(blk); } return ret; }
1threat
I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, qemu_irq sci_irq, qemu_irq smi_irq, int kvm_enabled, FWCfgState *fw_cfg, DeviceState **piix4_pm) { DeviceState *dev; PIIX4PMState *s; dev = DEVICE(pci_create(bus, devfn, TYPE_PIIX4_PM)); qdev_prop_set_uint32(dev, "smb_io_base", smb_io_base); if (piix4_pm) { *piix4_pm = dev; } s = PIIX4_PM(dev); s->irq = sci_irq; s->smi_irq = smi_irq; s->kvm_enabled = kvm_enabled; if (xen_enabled()) { s->use_acpi_pci_hotplug = false; } qdev_init_nofail(dev); if (fw_cfg) { uint8_t suspend[6] = {128, 0, 0, 129, 128, 128}; suspend[3] = 1 | ((!s->disable_s3) << 7); suspend[4] = s->s4_val | ((!s->disable_s4) << 7); fw_cfg_add_file(fw_cfg, "etc/system-states", g_memdup(suspend, 6), 6); } return s->smb.smbus; }
1threat
How to use @ComponentScan together with test-specific ContextConfigurations in SpringJunit4TestRunner? : <p>I am testing a Spring Boot application. I have several test classes, each of which needs a different set of mocked or otherwise customized beans.</p> <p>Here is a sketch of the setup:</p> <p>src/main/java:</p> <pre><code>package com.example.myapp; @SpringBootApplication @ComponentScan( basePackageClasses = { MyApplication.class, ImportantConfigurationFromSomeLibrary.class, ImportantConfigurationFromAnotherLibrary.class}) @EnableFeignClients @EnableHystrix public class MyApplication { public static void main(String[] args) { SpringApplication.run(MyApplication.class, args); } } package com.example.myapp.feature1; @Component public class Component1 { @Autowired ServiceClient serviceClient; @Autowired SpringDataJpaRepository dbRepository; @Autowired ThingFromSomeLibrary importantThingIDontWantToExplicitlyConstructInTests; // methods I want to test... } </code></pre> <p>src/test/java:</p> <pre><code>package com.example.myapp; @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = MyApplication.class) @WebAppConfiguration @ActiveProfiles("test") public class Component1TestWithFakeCommunication { @Autowired Component1 component1; // &lt;-- the thing we're testing. wants the above mock implementations of beans wired into it. @Autowired ServiceClient mockedServiceClient; @Configuration static class ContextConfiguration { @Bean @Primary public ServiceClient mockedServiceClient() { return mock(ServiceClient.class); } } @Before public void setup() { reset(mockedServiceClient); } @Test public void shouldBehaveACertainWay() { // customize mock, call component methods, assert results... } } package com.example.myapp; @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = MyApplication.class) @WebAppConfiguration @ActiveProfiles("test") public class Component1TestWithRealCommunication { @Autowired Component1 component1; // &lt;-- the thing we're testing. wants the real implementations in this test. @Autowired ServiceClient mockedServiceClient; @Before public void setup() { reset(mockedServiceClient); } @Test public void shouldBehaveACertainWay() { // call component methods, assert results... } } </code></pre> <p>The problem with the above setup is that the component scan configured in MyApplication picks up Component1TestWithFakeCommunication.ContextConfiguration, so I get a mock ServiceClient even in Component1TestWithRealCommunication where I want the real ServiceClient implementation.</p> <p>Although I could use @Autowired constructors and build up the components myself in both tests, there is a sufficient amount of stuff with complicated setup that I would rather have Spring TestContext set up for me (for example, Spring Data JPA repositories, components from libraries outside the app that pull beans from the Spring context, etc.). Nesting a Spring configuration inside the test that can locally override certain bean definitions within the Spring context feels like it should be a clean way to do this; the only downfall is that these nested configurations end up affecting all Spring TestContext tests that base their configuration on MyApplication (which component scans the app package).</p> <p>How do I modify my setup so I still get a "mostly real" Spring context for my tests with just a few locally overridden beans in each test class?</p>
0debug
uint32_t HELPER(stfle)(CPUS390XState *env, uint64_t addr) { uint64_t words[MAX_STFL_WORDS]; unsigned count_m1 = env->regs[0] & 0xff; unsigned max_m1 = do_stfle(env, words); unsigned i; for (i = 0; i <= count_m1; ++i) { cpu_stq_data(env, addr + 8 * i, words[i]); } env->regs[0] = deposit64(env->regs[0], 0, 8, max_m1); return (count_m1 >= max_m1 ? 0 : 3); }
1threat
static int vhdx_allocate_block(BlockDriverState *bs, BDRVVHDXState *s, uint64_t *new_offset) { *new_offset = bdrv_getlength(bs->file->bs); *new_offset = ROUND_UP(*new_offset, 1024 * 1024); return bdrv_truncate(bs->file, *new_offset + s->block_size, PREALLOC_MODE_OFF, NULL); }
1threat
static int decode_frame(WmallDecodeCtx *s) { GetBitContext* gb = &s->gb; int more_frames = 0; int len = 0; int i; if (s->num_channels * s->samples_per_frame > s->samples_end - s->samples) { av_log(s->avctx, AV_LOG_ERROR, "not enough space for the output samples\n"); s->packet_loss = 1; return 0; } if (s->len_prefix) len = get_bits(gb, s->log2_frame_size); if (decode_tilehdr(s)) { s->packet_loss = 1; return 0; } if (s->dynamic_range_compression) { s->drc_gain = get_bits(gb, 8); } if (get_bits1(gb)) { int skip; if (get_bits1(gb)) { skip = get_bits(gb, av_log2(s->samples_per_frame * 2)); dprintf(s->avctx, "start skip: %i\n", skip); } if (get_bits1(gb)) { skip = get_bits(gb, av_log2(s->samples_per_frame * 2)); dprintf(s->avctx, "end skip: %i\n", skip); } } s->parsed_all_subframes = 0; for (i = 0; i < s->num_channels; i++) { s->channel[i].decoded_samples = 0; s->channel[i].cur_subframe = 0; s->channel[i].reuse_sf = 0; } while (!s->parsed_all_subframes) { if (decode_subframe(s) < 0) { s->packet_loss = 1; return 0; } } dprintf(s->avctx, "Frame done\n"); if (s->skip_frame) { s->skip_frame = 0; } else s->samples += s->num_channels * s->samples_per_frame; if (s->len_prefix) { if (len != (get_bits_count(gb) - s->frame_offset) + 2) { av_log(s->avctx, AV_LOG_ERROR, "frame[%i] would have to skip %i bits\n", s->frame_num, len - (get_bits_count(gb) - s->frame_offset) - 1); s->packet_loss = 1; return 0; } skip_bits_long(gb, len - (get_bits_count(gb) - s->frame_offset) - 1); } else { } more_frames = get_bits1(gb); ++s->frame_num; return more_frames; }
1threat
Android - DatePickerDialog - Old APIs : <p>I am trying to create a <code>DatePickerDialog</code> in my app in Android but when I create a <code>DatePickerDialog</code> I receive the following message: <code>Call requires API level 24 (current min is 14): android.app.DatePickerDialog#DatePickerDialog</code></p> <p>How can I use a <code>DatePickerDialog</code> in old API versions?</p>
0debug
Return a failure result in inKeyguardRestrictedInputMode() : <p>I have a function to determine four states of phone's screen: screen on, screen off, screen on with lock, screen on without lock. My function is</p> <pre><code>private KeyguardManager keyguardManager; public String getScreenStatus() { String sreen_State="unknown"; keyguardManager = (KeyguardManager) getSystemService(KEYGUARD_SERVICE); PowerManager pm = (PowerManager) getApplicationContext().getSystemService(Context.POWER_SERVICE); if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.KITKAT_WATCH) { if (pm.isInteractive()) { sreen_State="screen_on"; if(!keyguardManager.inKeyguardRestrictedInputMode()) { sreen_State="screen_on_no_lock_screen"; }else{ Log.i(TAG, "screen_on_lock_screen"); sreen_State="screen_on_lock_screen"; } } else { sreen_State="screen_off"; } } else if(Build.VERSION.SDK_INT &lt; Build.VERSION_CODES.KITKAT_WATCH){ if(pm.isScreenOn()){ sreen_State="screen_on"; if(!keyguardManager.inKeyguardRestrictedInputMode()) { Log.i(TAG, "screen_on_no_lock_screen"); sreen_State="screen_on_no_lock_screen"; }else{ Log.i(TAG, "screen_on_lock_screen"); sreen_State="screen_on_lock_screen"; } } else { mIsScreenOn=false; sreen_State="screen_off"; } } return sreen_State; } </code></pre> <p>The above function returns corrected states of the screen. However, it has error when I add one more code as follows:</p> <pre><code> KeyguardManager.KeyguardLock kl = keyguardManager.newKeyguardLock("MyKeyguardLock"); if(index.equals("1")) kl.disableKeyguard(); else if(indexequals("2")) kl.reenableKeyguard(); getScreenStatus(); </code></pre> <p>The index can change by press a button. Now, the wrong state of screen is happen. It always return <code>screen_on_lock_screen</code>, although the screen is in <code>screen_on_no_lock_screen</code>. How could I fix my issue?</p>
0debug
How can i find img src value from a Text with asp.net? : <p>I have a html text like that:</p> <pre><code>string htmltext="&lt;p style="text-align: left;" align="center"&gt;&lt;img src="../image/1.jpg" alt="" width="310" height="162" /&gt;&lt;/p&gt;"; </code></pre> <p>And i want to find only src value (../image/1.jpg) from this string. help me please.</p>
0debug
How to Disable Start Page After Solution Close in Visual Studio 2017 : <p>In Visual Studio 2017, you can select Tools > Options > Environment > Startup > At startup: Show empty environment. This prevents the Start Page from displaying when you launch Visual Studio, and in previous versions it prevented the Start Page from appearing when closing a solution.</p> <p>In Visual Studio 2017, though, it seems <a href="https://developercommunity.visualstudio.com/content/problem/3456/file-close-solution-always-shows-start-page.html?childToView=3712#comment-3712" rel="noreferrer">the designers chose to show the Start Page</a> after closing a solution, even if the option was for an empty environment on startup.</p> <p>Are there any creative ways to get around this until the Visual Studio team decides to provide a reasonable option?</p>
0debug
C++ - create new constructor for std::vector<double>? : <p>I have written a custom container class which contains a <code>std::vector&lt;double&gt;</code> instance - works nicely. For compatibility with other API's I would like to export the content of the container as a <code>std::vector&lt;double&gt;</code> copy . Currently this works:</p> <pre><code>MyContainer container; .... std::vector&lt;double&gt; vc(container.begin(), container.end()); </code></pre> <p>But if possible would like to be able to write:</p> <pre><code>MyContainer container; .... std::vector&lt;double&gt; vc(container); </code></pre> <p>Can I (easily) create such a <code>std::vector&lt;double&gt;</code> constructor?</p>
0debug
difference between globalization and localization, where to use , when to use, same as what is culture and cultureUI : <p>anyone can you give me the perfect word for this difference between globalization and localization, where to use , when to use, same as what is culture and cultureUI</p>
0debug
How to add .0 if the value is not decimal in C# : I need to convert some value into decimal and show the value in WPF Text Box i have done with the below Double calculateinputPower="somegivenvalue"; String valuePower="somevalue"; Double calculatePower = Double.Parse(valuePower); calculatePower = calculatePower - calculateinputPower + calculateErp * 1; calculatePower = Double.Parse(String.Format("{0:0.0}", calculatePower)); valuePower = System.Convert.ToString(calculatePower); ERP.Text = valuePower; if my output value is like ex:66.2356 -> 66.2 , 32.568 -> 32.5 , 22.35264 ->22.3 i am getting the format which i need exactly but if the output value is like 22,33,11,66,55 something like this then i want convert that value to 22->22.0 33->33.0 11->11.0 66->66.0 how can i get this in C#.
0debug
static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eof) { int ret = 0, i; int got_output = 0; AVPacket avpkt; if (!ist->saw_first_ts) { ist->dts = ist->st->avg_frame_rate.num ? - ist->dec_ctx->has_b_frames * AV_TIME_BASE / av_q2d(ist->st->avg_frame_rate) : 0; ist->pts = 0; if (pkt && pkt->pts != AV_NOPTS_VALUE && !ist->decoding_needed) { ist->dts += av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q); ist->pts = ist->dts; } ist->saw_first_ts = 1; } if (ist->next_dts == AV_NOPTS_VALUE) ist->next_dts = ist->dts; if (ist->next_pts == AV_NOPTS_VALUE) ist->next_pts = ist->pts; if (!pkt) { av_init_packet(&avpkt); avpkt.data = NULL; avpkt.size = 0; goto handle_eof; } else { avpkt = *pkt; } if (pkt->dts != AV_NOPTS_VALUE) { ist->next_dts = ist->dts = av_rescale_q(pkt->dts, ist->st->time_base, AV_TIME_BASE_Q); if (ist->dec_ctx->codec_type != AVMEDIA_TYPE_VIDEO || !ist->decoding_needed) ist->next_pts = ist->pts = ist->dts; } while (ist->decoding_needed && (avpkt.size > 0 || (!pkt && got_output))) { int duration; handle_eof: ist->pts = ist->next_pts; ist->dts = ist->next_dts; switch (ist->dec_ctx->codec_type) { case AVMEDIA_TYPE_AUDIO: ret = decode_audio (ist, &avpkt, &got_output); break; case AVMEDIA_TYPE_VIDEO: ret = decode_video (ist, &avpkt, &got_output); if (avpkt.duration) { duration = av_rescale_q(avpkt.duration, ist->st->time_base, AV_TIME_BASE_Q); } else if(ist->dec_ctx->framerate.num != 0 && ist->dec_ctx->framerate.den != 0) { int ticks= av_stream_get_parser(ist->st) ? av_stream_get_parser(ist->st)->repeat_pict+1 : ist->dec_ctx->ticks_per_frame; duration = ((int64_t)AV_TIME_BASE * ist->dec_ctx->framerate.den * ticks) / ist->dec_ctx->framerate.num / ist->dec_ctx->ticks_per_frame; } else duration = 0; if(ist->dts != AV_NOPTS_VALUE && duration) { ist->next_dts += duration; }else ist->next_dts = AV_NOPTS_VALUE; if (got_output) ist->next_pts += duration; break; case AVMEDIA_TYPE_SUBTITLE: ret = transcode_subtitles(ist, &avpkt, &got_output); break; default: return -1; } if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Error while decoding stream #%d:%d: %s\n", ist->file_index, ist->st->index, av_err2str(ret)); if (exit_on_error) exit_program(1); break; } avpkt.dts= avpkt.pts= AV_NOPTS_VALUE; if (pkt) { if(ist->dec_ctx->codec_type != AVMEDIA_TYPE_AUDIO) ret = avpkt.size; avpkt.data += ret; avpkt.size -= ret; } if (!got_output) { continue; } if (got_output && !pkt) break; } if (!pkt && ist->decoding_needed && !got_output && !no_eof) { int ret = send_filter_eof(ist); if (ret < 0) { av_log(NULL, AV_LOG_FATAL, "Error marking filters as finished\n"); exit_program(1); } } if (!ist->decoding_needed) { ist->dts = ist->next_dts; switch (ist->dec_ctx->codec_type) { case AVMEDIA_TYPE_AUDIO: ist->next_dts += ((int64_t)AV_TIME_BASE * ist->dec_ctx->frame_size) / ist->dec_ctx->sample_rate; break; case AVMEDIA_TYPE_VIDEO: if (ist->framerate.num) { AVRational time_base_q = AV_TIME_BASE_Q; int64_t next_dts = av_rescale_q(ist->next_dts, time_base_q, av_inv_q(ist->framerate)); ist->next_dts = av_rescale_q(next_dts + 1, av_inv_q(ist->framerate), time_base_q); } else if (pkt->duration) { ist->next_dts += av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q); } else if(ist->dec_ctx->framerate.num != 0) { int ticks= av_stream_get_parser(ist->st) ? av_stream_get_parser(ist->st)->repeat_pict + 1 : ist->dec_ctx->ticks_per_frame; ist->next_dts += ((int64_t)AV_TIME_BASE * ist->dec_ctx->framerate.den * ticks) / ist->dec_ctx->framerate.num / ist->dec_ctx->ticks_per_frame; } break; } ist->pts = ist->dts; ist->next_pts = ist->next_dts; } for (i = 0; pkt && i < nb_output_streams; i++) { OutputStream *ost = output_streams[i]; if (!check_output_constraints(ist, ost) || ost->encoding_needed) continue; do_streamcopy(ist, ost, pkt); } return got_output; }
1threat
gpg: can't connect to the agent: IPC connect call failed : <p>I am having a problem while trying to decrypt some keys using GPG. The following output is given to me:</p> <pre><code>gpg: can't connect to the agent: IPC connect call failed </code></pre> <p>I already edited some files, pointed in this tutorial: <a href="https://michaelheap.com/gpg-cant-connect-to-the-agent-ipc-connect-call-failed/" rel="noreferrer">https://michaelheap.com/gpg-cant-connect-to-the-agent-ipc-connect-call-failed/</a> but with no success.</p> <p>Possible reasons for that?</p> <p>Thanks in advance</p>
0debug
alert('Hello ' + user_input);
1threat
int x86_cpu_handle_mmu_fault(CPUState *cs, vaddr addr, int is_write1, int mmu_idx) { X86CPU *cpu = X86_CPU(cs); CPUX86State *env = &cpu->env; uint64_t ptep, pte; target_ulong pde_addr, pte_addr; int error_code = 0; int is_dirty, prot, page_size, is_write, is_user; hwaddr paddr; uint64_t rsvd_mask = PG_HI_RSVD_MASK; uint32_t page_offset; target_ulong vaddr; is_user = mmu_idx == MMU_USER_IDX; #if defined(DEBUG_MMU) printf("MMU fault: addr=%" VADDR_PRIx " w=%d u=%d eip=" TARGET_FMT_lx "\n", addr, is_write1, is_user, env->eip); #endif is_write = is_write1 & 1; if (!(env->cr[0] & CR0_PG_MASK)) { pte = addr; #ifdef TARGET_X86_64 if (!(env->hflags & HF_LMA_MASK)) { pte = (uint32_t)pte; } #endif prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; page_size = 4096; goto do_mapping; } if (!(env->efer & MSR_EFER_NXE)) { rsvd_mask |= PG_NX_MASK; } if (env->cr[4] & CR4_PAE_MASK) { uint64_t pde, pdpe; target_ulong pdpe_addr; #ifdef TARGET_X86_64 if (env->hflags & HF_LMA_MASK) { uint64_t pml4e_addr, pml4e; int32_t sext; sext = (int64_t)addr >> 47; if (sext != 0 && sext != -1) { env->error_code = 0; cs->exception_index = EXCP0D_GPF; return 1; } pml4e_addr = ((env->cr[3] & ~0xfff) + (((addr >> 39) & 0x1ff) << 3)) & env->a20_mask; pml4e = ldq_phys(cs->as, pml4e_addr); if (!(pml4e & PG_PRESENT_MASK)) { goto do_fault; } if (pml4e & (rsvd_mask | PG_PSE_MASK)) { goto do_fault_rsvd; } if (!(pml4e & PG_ACCESSED_MASK)) { pml4e |= PG_ACCESSED_MASK; stl_phys_notdirty(cs->as, pml4e_addr, pml4e); } ptep = pml4e ^ PG_NX_MASK; pdpe_addr = ((pml4e & PG_ADDRESS_MASK) + (((addr >> 30) & 0x1ff) << 3)) & env->a20_mask; pdpe = ldq_phys(cs->as, pdpe_addr); if (!(pdpe & PG_PRESENT_MASK)) { goto do_fault; } if (pdpe & rsvd_mask) { goto do_fault_rsvd; } ptep &= pdpe ^ PG_NX_MASK; if (!(pdpe & PG_ACCESSED_MASK)) { pdpe |= PG_ACCESSED_MASK; stl_phys_notdirty(cs->as, pdpe_addr, pdpe); } if (pdpe & PG_PSE_MASK) { page_size = 1024 * 1024 * 1024; pte_addr = pdpe_addr; pte = pdpe; goto do_check_protect; } } else #endif { pdpe_addr = ((env->cr[3] & ~0x1f) + ((addr >> 27) & 0x18)) & env->a20_mask; pdpe = ldq_phys(cs->as, pdpe_addr); if (!(pdpe & PG_PRESENT_MASK)) { goto do_fault; } rsvd_mask |= PG_HI_USER_MASK | PG_NX_MASK; if (pdpe & rsvd_mask) { goto do_fault_rsvd; } ptep = PG_NX_MASK | PG_USER_MASK | PG_RW_MASK; } pde_addr = ((pdpe & PG_ADDRESS_MASK) + (((addr >> 21) & 0x1ff) << 3)) & env->a20_mask; pde = ldq_phys(cs->as, pde_addr); if (!(pde & PG_PRESENT_MASK)) { goto do_fault; } if (pde & rsvd_mask) { goto do_fault_rsvd; } ptep &= pde ^ PG_NX_MASK; if (pde & PG_PSE_MASK) { page_size = 2048 * 1024; pte_addr = pde_addr; pte = pde; goto do_check_protect; } if (!(pde & PG_ACCESSED_MASK)) { pde |= PG_ACCESSED_MASK; stl_phys_notdirty(cs->as, pde_addr, pde); } pte_addr = ((pde & PG_ADDRESS_MASK) + (((addr >> 12) & 0x1ff) << 3)) & env->a20_mask; pte = ldq_phys(cs->as, pte_addr); if (!(pte & PG_PRESENT_MASK)) { goto do_fault; } if (pte & rsvd_mask) { goto do_fault_rsvd; } ptep &= pte ^ PG_NX_MASK; page_size = 4096; } else { uint32_t pde; pde_addr = ((env->cr[3] & ~0xfff) + ((addr >> 20) & 0xffc)) & env->a20_mask; pde = ldl_phys(cs->as, pde_addr); if (!(pde & PG_PRESENT_MASK)) { goto do_fault; } ptep = pde | PG_NX_MASK; if ((pde & PG_PSE_MASK) && (env->cr[4] & CR4_PSE_MASK)) { page_size = 4096 * 1024; pte_addr = pde_addr; pte = pde | ((pde & 0x1fe000) << (32 - 13)); rsvd_mask = 0x200000; goto do_check_protect_pse36; } if (!(pde & PG_ACCESSED_MASK)) { pde |= PG_ACCESSED_MASK; stl_phys_notdirty(cs->as, pde_addr, pde); } pte_addr = ((pde & ~0xfff) + ((addr >> 10) & 0xffc)) & env->a20_mask; pte = ldl_phys(cs->as, pte_addr); if (!(pte & PG_PRESENT_MASK)) { goto do_fault; } ptep &= pte | PG_NX_MASK; page_size = 4096; rsvd_mask = 0; } do_check_protect: rsvd_mask |= (page_size - 1) & PG_ADDRESS_MASK & ~PG_PSE_PAT_MASK; do_check_protect_pse36: if (pte & rsvd_mask) { goto do_fault_rsvd; } ptep ^= PG_NX_MASK; if ((ptep & PG_NX_MASK) && is_write1 == 2) { goto do_fault_protect; } switch (mmu_idx) { case MMU_USER_IDX: if (!(ptep & PG_USER_MASK)) { goto do_fault_protect; } if (is_write && !(ptep & PG_RW_MASK)) { goto do_fault_protect; } break; case MMU_KSMAP_IDX: if (is_write1 != 2 && (ptep & PG_USER_MASK)) { goto do_fault_protect; } case MMU_KNOSMAP_IDX: if (is_write1 == 2 && (env->cr[4] & CR4_SMEP_MASK) && (ptep & PG_USER_MASK)) { goto do_fault_protect; } if ((env->cr[0] & CR0_WP_MASK) && is_write && !(ptep & PG_RW_MASK)) { goto do_fault_protect; } break; default: break; } is_dirty = is_write && !(pte & PG_DIRTY_MASK); if (!(pte & PG_ACCESSED_MASK) || is_dirty) { pte |= PG_ACCESSED_MASK; if (is_dirty) { pte |= PG_DIRTY_MASK; } stl_phys_notdirty(cs->as, pte_addr, pte); } prot = PAGE_READ; if (!(ptep & PG_NX_MASK)) prot |= PAGE_EXEC; if (pte & PG_DIRTY_MASK) { if (is_user) { if (ptep & PG_RW_MASK) prot |= PAGE_WRITE; } else { if (!(env->cr[0] & CR0_WP_MASK) || (ptep & PG_RW_MASK)) prot |= PAGE_WRITE; } } do_mapping: pte = pte & env->a20_mask; pte &= PG_ADDRESS_MASK & ~(page_size - 1); vaddr = addr & TARGET_PAGE_MASK; page_offset = vaddr & (page_size - 1); paddr = pte + page_offset; tlb_set_page(cs, vaddr, paddr, prot, mmu_idx, page_size); return 0; do_fault_rsvd: error_code |= PG_ERROR_RSVD_MASK; do_fault_protect: error_code |= PG_ERROR_P_MASK; do_fault: error_code |= (is_write << PG_ERROR_W_BIT); if (is_user) error_code |= PG_ERROR_U_MASK; if (is_write1 == 2 && (((env->efer & MSR_EFER_NXE) && (env->cr[4] & CR4_PAE_MASK)) || (env->cr[4] & CR4_SMEP_MASK))) error_code |= PG_ERROR_I_D_MASK; if (env->intercept_exceptions & (1 << EXCP0E_PAGE)) { stq_phys(cs->as, env->vm_vmcb + offsetof(struct vmcb, control.exit_info_2), addr); } else { env->cr[2] = addr; } env->error_code = error_code; cs->exception_index = EXCP0E_PAGE; return 1; }
1threat
AWS lambda api gateway error "Malformed Lambda proxy response" : <p>I am trying to set up a hello world example with AWS lambda and serving it through api gateway. I clicked the "Create a Lambda Function", which set up the api gatway and selected the Blank Function option. I added the lambda function found on <a href="http://docs.aws.amazon.com/apigateway/latest/developerguide/getting-started.html#getting-started-new-lambda" rel="noreferrer">AWS gateway getting started guide</a>: </p> <pre><code>exports.handler = function(event, context, callback) { callback(null, {"Hello":"World"}); // SUCCESS with message }; </code></pre> <p>The issue is that when I make a GET request to it, it's returning back a 502 response <code>{ "message": "Internal server error" }</code>. And the logs say "Execution failed due to configuration error: Malformed Lambda proxy response".</p>
0debug
Spring beans are not injected in flyway java based migration : <p>I'm trying to inject component of configuration properties in the flyway migration java code but it always null.</p> <p>I'm using spring boot with Flyway.</p> <pre><code>@Component @ConfigurationProperties(prefix = "code") public class CodesProp { private String codePath; } </code></pre> <p>Then inside Flyway migration code, trying to autowrire this component as following:</p> <pre><code>public class V1_4__Migrate_codes_metadata implements SpringJdbcMigration { @Autowired private CodesProp codesProp ; public void migrate(JdbcTemplate jdbcTemplate) throws Exception { codesProp.getCodePath(); } </code></pre> <p>Here, codesProp is always null.</p> <p>Is there any way to inject spring beans inside flyway or make it initialized before flyway bean?</p> <p>Thank You.</p>
0debug
RxJS takeWhile but include the last value : <p>I have a RxJS5 pipeline looks like this</p> <pre><code>Rx.Observable.from([2, 3, 4, 5, 6]) .takeWhile((v) =&gt; { v !== 4 }) </code></pre> <p>I want to keep the subscription until I see 4, but I want to last element 4 also to be included in the result. So the example above should be</p> <pre><code>2, 3, 4 </code></pre> <p>However, according to <a href="http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html#instance-method-takeWhile" rel="noreferrer">official document</a>, <code>takeWhile</code> operator is not inclusive. Which means when it encounters the element which doesn't match predicate we gave, it completes the stream immediately without the last element. As a result, the above code will actually output</p> <pre><code>2, 3 </code></pre> <p>So my question is, what's the easiest way I can achieve <code>takeWhile</code> but also emit the last element with RxJS?</p>
0debug
Revert a commit on remote branch : <p>I've worked on a local branch adding many commits.<br> Then i've pushed it to the <code>remote staging</code> branch. </p> <p>Now I have to undo the last commit already pushed to <code>remote staging</code> that is the merge of my local branch to <code>remote staging</code></p> <p>What I've understood looking on the other answers is that I have to use revert and not reset to do it in a clean way, isn't it?</p> <p>So what I have to do is:</p> <ol> <li>create a new local branch called for example <code>cleaning</code> having <code>master</code> as parent (that is behind staging)</li> <li>pull the remote <code>staging</code> into cleaning</li> <li>use <code>git revert {last good commit hash in staging}</code></li> <li>now <code>cleaning</code> should be in the good commit and in the same state of <code>remote staging</code> before my bad push, isn't it?</li> <li>now I should push <code>cleaning</code> into <code>remote staging</code> to having the remote branch reverted. With which flags?</li> </ol> <p>Am I correct? Because <code>git status</code> being at point 4 tells me that i'm up to date with <code>staging</code> </p>
0debug
static void spawn_thread_bh_fn(void *opaque) { ThreadPool *pool = opaque; qemu_mutex_lock(&pool->lock); do_spawn_thread(pool); qemu_mutex_unlock(&pool->lock); }
1threat
How to draw Horizontal line between two Linar layout in android : [![enter image description here][1]][1] this is my Current screen : <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/title" android:layout_margin="5dp" android:background="@drawable/radial_gradient"> <LinearLayout android:id="@+id/layout1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> <com.cognistrength.caregiver.cogniutils.CSTextView android:id="@+id/button" android:layout_width="45dp" android:layout_height="45dp" android:layout_gravity="right" android:layout_marginRight="34dp" android:layout_marginTop="18dp" android:layout_marginLeft="28dp" android:background="@drawable/purple_circular_layout" android:gravity="center" android:text="1" android:textColor="@color/milk_white" android:textSize="12sp" android:textStyle="bold" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/milk_white" android:text="Profile" android:layout_gravity="center"/> </LinearLayout> <LinearLayout android:id="@+id/layout2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/layout1" android:orientation="vertical"> <com.cognistrength.caregiver.cogniutils.CSTextView android:id="@+id/button2" android:layout_width="45dp" android:layout_height="45dp" android:layout_gravity="right" android:layout_marginRight="34dp" android:layout_marginTop="18dp" android:layout_marginLeft="28dp" android:background="@drawable/purple_circular_layout" android:gravity="center" android:text="2" android:textColor="@color/milk_white" android:textSize="12sp" android:textStyle="bold" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/milk_white" android:text="Familly" android:layout_gravity="center"/> </LinearLayout> <LinearLayout android:id="@+id/layout3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/layout2" android:orientation="vertical"> <com.cognistrength.caregiver.cogniutils.CSTextView android:id="@+id/button3" android:layout_width="60dp" android:layout_height="45dp" android:layout_gravity="right" android:layout_marginRight="34dp" android:layout_marginTop="18dp" android:layout_marginLeft="28dp" android:background="@drawable/purple_circular_layout" android:gravity="center" android:text="3" android:textColor="@color/milk_white" android:textSize="12sp" android:textStyle="bold" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/milk_white" android:text="Health Record" android:layout_gravity="center"/> </LinearLayout> </RelativeLayout> using this xml i am able plot 3 circular text-view inside relative layout i want to plot horizontal line between one and two and two and three text-view as given Screen below please suggest me how to achieve this i am trying to apply view but not able to set eject below screen . [![enter image description here][2]][2] [1]: https://i.stack.imgur.com/HQGa6.png [2]: https://i.stack.imgur.com/RkjUL.png
0debug
static av_cold int truemotion1_decode_init(AVCodecContext *avctx) { TrueMotion1Context *s = avctx->priv_data; s->avctx = avctx; s->frame.data[0] = NULL; av_fast_malloc(&s->vert_pred, &s->vert_pred_size, s->avctx->width * sizeof(unsigned int)); return 0; }
1threat
Why do we need to use bind() in ReactJS to access this.props or this.state? : <p>look at this code for example</p> <pre><code> import React, { Component } from ‘react’; class App extends Component { constructor(props) { super(props); this.clickFunction = this.clickFunction.bind(this); } clickFunction() { console.log(this.props.value); } render() { return( &lt;div onClick={this.clickFunction}&gt;Click Me!&lt;/div&gt; ); } } </code></pre> <p>what's the purpose of bind(this) ? it binds the function clickFunction to the context of the object which clickFunction is already bound to , let me illustrate what i am trying to say with a normal javascript code : </p> <pre><code>class my_class { constructor() { this.run = this.run.bind(this) } run() { console.log(this.data) } } my_class.data = 'this is data' new my_class().run() //outputs 'undefined' </code></pre> <p>and if you remove bind(this) it will give you the same results </p> <pre><code> constructor() { this.run = this.run } </code></pre> <p>results : </p> <pre><code>new my_class().run() //still outputs 'undefined' </code></pre> <p>i am sure i am understanding something wrong and this might the worst question on earth however i am new to es6 and i am not used to classes yet so i apologize for that</p>
0debug
disable angular ng-select window : <p>We are using <a href="https://github.com/ng-select/ng-select" rel="noreferrer">ng-select</a> in porject and i'm facing the problem now, that i can't disabled ng-select window. Is it possible to disable it with native code or i need to find some custom solution?</p> <pre><code> &lt;ng-select #changeowner class="custom-owner" [placeholder]="leagueOwner.full_name" [clearSearchOnAdd]="true" (change)="changeLeagueOwner($event)" [clearable]="false" [virtualScroll]="true" [items]="adminLeagueMembers" (scrollToEnd)="onAdminLoadScrollEnd()" bindLabel="full_name"&gt; &lt;/ng-select&gt; </code></pre>
0debug
Swift NSURLConnection deprecated in iOS 9.0 : <p>I am trying to do a URL request to an api and return the results.</p> <p>I am using NSURLConnection in Swift 2</p> <pre><code>let requestString = "URL HERE" let urlPath: String = requestString let url: NSURL = NSURL(string: urlPath)! let request: NSURLRequest = NSURLRequest(URL: url) let connection: NSURLConnection = NSURLConnection(request: request, delegate: self, startImmediately: true)! connection.start() </code></pre> <p>but I keep getting this warning:</p> <pre><code>'init(request:delegate:startImmediately:)' was deprecated in iOS 9.0: Use NSURLSession (see NSURLSession.h) </code></pre> <p>I googled the warning and came up with nothing....how do I fix this?</p>
0debug
static void v9fs_version(void *opaque) { V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; V9fsString version; size_t offset = 7; pdu_unmarshal(pdu, offset, "ds", &s->msize, &version); trace_v9fs_version(pdu->tag, pdu->id, s->msize, version.data); virtfs_reset(pdu); if (!strcmp(version.data, "9P2000.u")) { s->proto_version = V9FS_PROTO_2000U; } else if (!strcmp(version.data, "9P2000.L")) { s->proto_version = V9FS_PROTO_2000L; } else { v9fs_string_sprintf(&version, "unknown"); } offset += pdu_marshal(pdu, offset, "ds", s->msize, &version); trace_v9fs_version_return(pdu->tag, pdu->id, s->msize, version.data); complete_pdu(s, pdu, offset); v9fs_string_free(&version); return; }
1threat
CSS or jQuery : How to get visible top : <p>I have a need to make a hidden div element shown in an user event, in the visible top. </p> <p>What I mean by visible top is, - Its 0 if page is not scrolled - if page is scrolled then I need coordinate of visible top, not the page top </p> <p>Can that be set static with CSS or how to calculate it with jQuery or pure js.</p> <p>Best Regards</p>
0debug
bool qemu_log_in_addr_range(uint64_t addr) { if (debug_regions) { int i = 0; for (i = 0; i < debug_regions->len; i++) { Range *range = &g_array_index(debug_regions, Range, i); if (addr >= range->begin && addr <= range->end - 1) { return true; } } return false; } else { return true; } }
1threat
Sandbox subdomains are for test purposes only. Please add your own domain or add the address to authoriz : <p>I got this error </p> <pre><code>GuzzleHttp\Exception\ClientException: Client error: `POST https://api.mailgun.net/v3/sandbox22f9hisujrundei134m9nf84.mailgun.org/messages.mime` resulted in a `400 BAD REQUEST` response: { "message": "Sandbox subdomains are for test purposes only. Please add your own domain or add the address to authoriz (truncated...) </code></pre> <p>when i trying unit test for function i have ? how i can fix that ??</p>
0debug
static int virtcon_parse(const char *devname) { QemuOptsList *device = qemu_find_opts("device"); static int index = 0; char label[32]; QemuOpts *bus_opts, *dev_opts; if (strcmp(devname, "none") == 0) return 0; if (index == MAX_VIRTIO_CONSOLES) { fprintf(stderr, "qemu: too many virtio consoles\n"); exit(1); } bus_opts = qemu_opts_create(device, NULL, 0, &error_abort); if (arch_type == QEMU_ARCH_S390X) { qemu_opt_set(bus_opts, "driver", "virtio-serial-s390", &error_abort); } else { qemu_opt_set(bus_opts, "driver", "virtio-serial-pci", &error_abort); } dev_opts = qemu_opts_create(device, NULL, 0, &error_abort); qemu_opt_set(dev_opts, "driver", "virtconsole", &error_abort); snprintf(label, sizeof(label), "virtcon%d", index); virtcon_hds[index] = qemu_chr_new(label, devname, NULL); if (!virtcon_hds[index]) { fprintf(stderr, "qemu: could not connect virtio console" " to character backend '%s'\n", devname); return -1; } qemu_opt_set(dev_opts, "chardev", label, &error_abort); index++; return 0; }
1threat
How to merge two enums in TypeScript : <p>Suppose I have two enums as described below in Typescript, then How do I merge them</p> <pre><code>enum Mammals { Humans, Bats, Dolphins } enum Reptiles { Snakes, Alligators, Lizards } export default Mammals &amp; Reptiles // For Illustration purpose, Consider both the Enums have been merged. </code></pre> <p>Now, when I <code>import</code> the <code>exported value</code> in another file, I should be able to access values from both the enums. </p> <pre><code>import animalTypes from "./animalTypes" animalTypes.Humans //valid animalTypes.Snakes // valid </code></pre> <p>How can I achieve such functionality in Typescript?</p>
0debug
int qemu_add_balloon_handler(QEMUBalloonEvent *event_func, QEMUBalloonStatus *stat_func, void *opaque) { if (balloon_event_fn || balloon_stat_fn || balloon_opaque) { error_report("Another balloon device already registered"); return -1; } balloon_event_fn = event_func; balloon_stat_fn = stat_func; balloon_opaque = opaque; return 0; }
1threat
Using react-native-camera, how to access saved pictures? : <p>My goal is to use the react-native-camera and simply show a picture on the same screen, if a picture has been taken. I'm trying to save the picture source as "imageURI". If it exists, I want to show it, if a picture hasn't been taken yet, just show text saying No Image Yet. I've got the camera working, since I can trace the app is saving pictures to the disk. Having trouble with the following: </p> <ul> <li>How to assign the capture functions data to a variable when I take the picture, that I can call later (imageURI).</li> <li><p>Don't know how to do an if statement in Javascript to check if a variable exists yet.</p> <pre><code>import Camera from 'react-native-camera'; export default class camerahere extends Component { _takePicture () { this.camera.capture((err, data) =&gt; { if (err) return; imageURI = data; }); } render() { if ( typeof imageURI == undefined) { image = &lt;Text&gt; No Image Yet &lt;/Text&gt; } else { image = &lt;Image source={{uri: imageURI, isStatic:true}} style={{width: 100, height: 100}} /&gt; } return ( &lt;View style={styles.container}&gt; &lt;Camera captureTarget={Camera.constants.CaptureTarget.disk} ref={(cam) =&gt; { this.camera = cam; }} style={styles.preview} aspect={Camera.constants.Aspect.fill}&gt; {button} &lt;TouchableHighlight onPress={this._takePicture.bind(this)}&gt; &lt;View style={{height:50,width:50,backgroundColor:"pink"}}&gt;&lt;/View&gt; &lt;/TouchableHighlight&gt; &lt;/Camera&gt; </code></pre> <p></p></li> </ul>
0debug
Firebase Data messages not delivered to iOS when using new HTTP v1 API : <p>Firebase supports <em>Notification messages</em> and <em>Data messages</em>.</p> <p><em>Data messages</em> don't trigger visual notification and are handled by the client (iOS App) when the app is in foreground. Communication is then done using direct channel between Firebase and iOS App - without use of Apple Push Notification Service (APNS).</p> <p>Everything works fine when we use <a href="https://firebase.google.com/docs/cloud-messaging/http-server-ref" rel="noreferrer">Legacy FCM HTTP Protocol</a> but when using new <a href="https://firebase.google.com/docs/cloud-messaging/migrate-v1" rel="noreferrer">HTTP v1 API</a>, Data messages are not delivered to iOS client.</p> <p>Notification messages (even including data) are delivered fine using via APNS.</p> <p>We have tried interfacing to Firebase Cloud Messaging using:</p> <ul> <li>Admin FCM API (Java and Node.JS SDKs)</li> <li>Direct HTTP request to HTTP v1 API using OAuth2 tokens</li> </ul> <p>None of the above would result in Data message to be delivered to the iOS client. Such messages are only delivered when being sent using legacy HTTP Protocol.</p> <p>To make things more interesting Data messages send using HTTP v1 API (new) are successfully delivered to web JavaScript client, so it means that they are supported. They are also used in <a href="https://firebase.google.com/docs/cloud-messaging/admin/send-messages" rel="noreferrer">samples</a>. We haven't tried the Android client.</p>
0debug
Similar images tarining set generator : I want to train my machine learning (Watson visual recognition) to detect sun doodle(black and white). The problem that I have to train at least 700 images but I have just something like 30. A screenshot of my gallery: ![enter image description here](https://i.stack.imgur.com/G2oSQ.jpg) I thought about a generator that takes my images and change them and create a lot of similar images using pixle games. Do you know a generator like this? Or do you have a good idea for me? Thanks.
0debug
int qemu_set_fd_handler2(int fd, IOCanReadHandler *fd_read_poll, IOHandler *fd_read, IOHandler *fd_write, void *opaque) { IOHandlerRecord *ioh; if (!fd_read && !fd_write) { QLIST_FOREACH(ioh, &io_handlers, next) { if (ioh->fd == fd) { ioh->deleted = 1; break; } } } else { QLIST_FOREACH(ioh, &io_handlers, next) { if (ioh->fd == fd) goto found; } ioh = g_malloc0(sizeof(IOHandlerRecord)); QLIST_INSERT_HEAD(&io_handlers, ioh, next); found: ioh->fd = fd; ioh->fd_read_poll = fd_read_poll; ioh->fd_read = fd_read; ioh->fd_write = fd_write; ioh->opaque = opaque; ioh->deleted = 0; qemu_notify_event(); } return 0; }
1threat
static int real_seek(AVFormatContext *avf, int stream, int64_t min_ts, int64_t ts, int64_t max_ts, int flags) { ConcatContext *cat = avf->priv_data; int ret, left, right; if (stream >= 0) { if (stream >= avf->nb_streams) return AVERROR(EINVAL); rescale_interval(avf->streams[stream]->time_base, AV_TIME_BASE_Q, &min_ts, &ts, &max_ts); } left = 0; right = cat->nb_files; while (right - left > 1) { int mid = (left + right) / 2; if (ts < cat->files[mid].start_time) right = mid; else left = mid; } if ((ret = open_file(avf, left)) < 0) return ret; ret = try_seek(avf, stream, min_ts, ts, max_ts, flags); if (ret < 0 && !(flags & AVSEEK_FLAG_BACKWARD) && left < cat->nb_files - 1 && cat->files[left + 1].start_time < max_ts) { if ((ret = open_file(avf, left + 1)) < 0) return ret; ret = try_seek(avf, stream, min_ts, ts, max_ts, flags); } return ret; }
1threat
Selenium install Marionette webdriver : <p>I have this issue with firefox version 47 <a href="https://github.com/seleniumhq/selenium/issues/2110" rel="noreferrer">https://github.com/seleniumhq/selenium/issues/2110</a></p> <p>So, i have tried to add Marionette web driver to fix it: <a href="https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver" rel="noreferrer">https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver</a></p> <p>But:</p> <pre><code>from selenium.webdriver.common.desired_capabilities import DesiredCapabilities firefox_capabilities = DesiredCapabilities.FIREFOX firefox_capabilities['marionette'] = True firefox_capabilities['binary'] = '/Users/myproject/geckodriver-0.8.0-OSX' </code></pre> <p>returns error:</p> <blockquote> <p>selenium.common.exceptions.WebDriverException: Message: 'wires' executable needs to be in PATH. </p> <p>Exception AttributeError: "'Service' object has no attribute 'process'" in > ignored</p> </blockquote> <p>selenium==2.53.5</p>
0debug
static av_noinline void FUNC(hl_decode_mb_444)(H264Context *h, H264SliceContext *sl) { const int mb_x = h->mb_x; const int mb_y = h->mb_y; const int mb_xy = h->mb_xy; const int mb_type = h->cur_pic.mb_type[mb_xy]; uint8_t *dest[3]; int linesize; int i, j, p; int *block_offset = &h->block_offset[0]; const int transform_bypass = !SIMPLE && (sl->qscale == 0 && h->sps.transform_bypass); const int plane_count = (SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) ? 3 : 1; for (p = 0; p < plane_count; p++) { dest[p] = h->cur_pic.f.data[p] + ((mb_x << PIXEL_SHIFT) + mb_y * h->linesize) * 16; h->vdsp.prefetch(dest[p] + (h->mb_x & 3) * 4 * h->linesize + (64 << PIXEL_SHIFT), h->linesize, 4); } h->list_counts[mb_xy] = sl->list_count; if (!SIMPLE && MB_FIELD(h)) { linesize = sl->mb_linesize = sl->mb_uvlinesize = h->linesize * 2; block_offset = &h->block_offset[48]; if (mb_y & 1) for (p = 0; p < 3; p++) dest[p] -= h->linesize * 15; if (FRAME_MBAFF(h)) { int list; for (list = 0; list < sl->list_count; list++) { if (!USES_LIST(mb_type, list)) continue; if (IS_16X16(mb_type)) { int8_t *ref = &sl->ref_cache[list][scan8[0]]; fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (h->mb_y & 1), 1); } else { for (i = 0; i < 16; i += 4) { int ref = sl->ref_cache[list][scan8[i]]; if (ref >= 0) fill_rectangle(&sl->ref_cache[list][scan8[i]], 2, 2, 8, (16 + ref) ^ (h->mb_y & 1), 1); } } } } } else { linesize = sl->mb_linesize = sl->mb_uvlinesize = h->linesize; } if (!SIMPLE && IS_INTRA_PCM(mb_type)) { if (PIXEL_SHIFT) { const int bit_depth = h->sps.bit_depth_luma; GetBitContext gb; init_get_bits(&gb, sl->intra_pcm_ptr, 768 * bit_depth); for (p = 0; p < plane_count; p++) for (i = 0; i < 16; i++) { uint16_t *tmp = (uint16_t *)(dest[p] + i * linesize); for (j = 0; j < 16; j++) tmp[j] = get_bits(&gb, bit_depth); } } else { for (p = 0; p < plane_count; p++) for (i = 0; i < 16; i++) memcpy(dest[p] + i * linesize, sl->intra_pcm_ptr + p * 256 + i * 16, 16); } } else { if (IS_INTRA(mb_type)) { if (h->deblocking_filter) xchg_mb_border(h, sl, dest[0], dest[1], dest[2], linesize, linesize, 1, 1, SIMPLE, PIXEL_SHIFT); for (p = 0; p < plane_count; p++) hl_decode_mb_predict_luma(h, sl, mb_type, 1, SIMPLE, transform_bypass, PIXEL_SHIFT, block_offset, linesize, dest[p], p); if (h->deblocking_filter) xchg_mb_border(h, sl, dest[0], dest[1], dest[2], linesize, linesize, 0, 1, SIMPLE, PIXEL_SHIFT); } else { FUNC(hl_motion_444)(h, sl, dest[0], dest[1], dest[2], h->qpel_put, h->h264chroma.put_h264_chroma_pixels_tab, h->qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab, h->h264dsp.weight_h264_pixels_tab, h->h264dsp.biweight_h264_pixels_tab); } for (p = 0; p < plane_count; p++) hl_decode_mb_idct_luma(h, sl, mb_type, 1, SIMPLE, transform_bypass, PIXEL_SHIFT, block_offset, linesize, dest[p], p); } }
1threat
Encryption & Backup : I'm need some help on a project, the plan is to make a c program that can take an input file name and then do these three tasks 1-copy it's contents and store it's duplicate in another user specified location 2-change the backup file's format i.e from ".txt" to something like ".img" 3-encrypt the contents of file(any cypher method) ------*note: the input file name has to be scanned during execution I and my team have already made about 75% of it but it's in separate parts like each of the following three tasks is an individual program..and we are having trouble combining them. Another error is that we are using "rename" function from files concept to copy files and change their format and we don't have any idea of how to use scanf to read the file name and give it as input to the rename function.. So if you could give me any suggestions..I'd really be grateful.
0debug
Unable to view images in php : <p>I am unable to view images on my webserver in <code>php</code> and I keep getting <code>server 500</code> error.</p> <p>I believe that it is this line of code <code>echo "&lt;img src='$row["sourchPath"]'&gt;"</code>:</p> <pre><code>while ($row = mysqli_fetch_assoc($result)){ if($row){ echo $row["sourchPath"]; // this works echo "&lt;img src='$row["sourchPath"]'&gt;"; } else { echo "error"; } } </code></pre> <p>My file directory is like <code>images/football.jpg</code></p>
0debug
How can i parse this video url in this api and play on my android studio? : Here is the structure of the **API**.(JSON format).I have already parse title & subtitle from this API. But how can i parse this youtube video link and play it in android studio. { "success": true, "message": "All Contents of Nirdeshona Videos", "data": [ { "id": 1, "title": "New NVideo", "sub_title": "New song", **"link": "https://www.youtube.com/watch?v=lecITZkWqzg",** "status": 1, "created_at": "2019-10-01 08:41:29", "updated_at": "2019-10-01 08:41:29" } ] }
0debug
Print a character a random number of times in C : <p>Im trying to print a character a random number of times. I know that to print a random character I can type the code bellow but I cant get my head around this problem.Thanks!!!</p> <p>RANDLOWER = rand() % 26 + 'A'; printf("%c ", RANDLOWER);</p>
0debug
CaptureVoiceOut *AUD_add_capture ( struct audsettings *as, struct audio_capture_ops *ops, void *cb_opaque ) { AudioState *s = &glob_audio_state; CaptureVoiceOut *cap; struct capture_callback *cb; if (audio_validate_settings (as)) { dolog ("Invalid settings were passed when trying to add capture\n"); audio_print_settings (as); goto err0; } cb = audio_calloc (AUDIO_FUNC, 1, sizeof (*cb)); if (!cb) { dolog ("Could not allocate capture callback information, size %zu\n", sizeof (*cb)); goto err0; } cb->ops = *ops; cb->opaque = cb_opaque; cap = audio_pcm_capture_find_specific (as); if (cap) { LIST_INSERT_HEAD (&cap->cb_head, cb, entries); return cap; } else { HWVoiceOut *hw; CaptureVoiceOut *cap; cap = audio_calloc (AUDIO_FUNC, 1, sizeof (*cap)); if (!cap) { dolog ("Could not allocate capture voice, size %zu\n", sizeof (*cap)); goto err1; } hw = &cap->hw; LIST_INIT (&hw->sw_head); LIST_INIT (&cap->cb_head); hw->samples = 4096 * 4; hw->mix_buf = audio_calloc (AUDIO_FUNC, hw->samples, sizeof (struct st_sample)); if (!hw->mix_buf) { dolog ("Could not allocate capture mix buffer (%d samples)\n", hw->samples); goto err2; } audio_pcm_init_info (&hw->info, as); cap->buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); if (!cap->buf) { dolog ("Could not allocate capture buffer " "(%d samples, each %d bytes)\n", hw->samples, 1 << hw->info.shift); goto err3; } hw->clip = mixeng_clip [hw->info.nchannels == 2] [hw->info.sign] [hw->info.swap_endianness] [audio_bits_to_index (hw->info.bits)]; LIST_INSERT_HEAD (&s->cap_head, cap, entries); LIST_INSERT_HEAD (&cap->cb_head, cb, entries); hw = NULL; while ((hw = audio_pcm_hw_find_any_out (hw))) { audio_attach_capture (hw); } return cap; err3: qemu_free (cap->hw.mix_buf); err2: qemu_free (cap); err1: qemu_free (cb); err0: return NULL; } }
1threat
Error installing mysql-python: library not found for -lssl : <p>I'm having trouble installing mysql-python. Created a new virtualenv and when installing mysql-python... here's the error message:</p> <pre><code>(env)$ pip install mysql-python Collecting mysql-python ... clang -bundle -undefined dynamic_lookup -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk build/temp.macosx-10.12-x86_64-2.7/_mysql.o -L/usr /local/Cellar/mysql/5.7.16/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.12-x86_64-2.7/_mysql.so ld: library not found for -lssl clang: error: linker command failed with exit code 1 (use -v to see invocation) error: command 'clang' failed with exit status 1 </code></pre> <p>Using homebrew, I have installed:</p> <ul> <li>libressl</li> <li>openssl</li> <li>openssl@1.1</li> <li>mysql</li> </ul> <p>Already tried to <code>brew link</code> but brew refuses to do so.</p> <p>The OS is MacOS Sierra.</p> <p>Can anyone help? Thanks!</p>
0debug
static void icount_warp_rt(void *opaque) { if (vm_clock_warp_start == -1) { return; } if (runstate_is_running()) { int64_t clock = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); int64_t warp_delta = clock - vm_clock_warp_start; if (use_icount == 1) { qemu_icount_bias += warp_delta; } else { int64_t cur_time = cpu_get_clock(); int64_t cur_icount = cpu_get_icount(); int64_t delta = cur_time - cur_icount; qemu_icount_bias += MIN(warp_delta, delta); } if (qemu_clock_expired(QEMU_CLOCK_VIRTUAL)) { qemu_clock_notify(QEMU_CLOCK_VIRTUAL); } } vm_clock_warp_start = -1; }
1threat
How to convert 2016-06-14 21:40:53 to today in php : <p>How to convert 2016-06-14 21:40:53 as yesterday, 2016-06-15 21:40:53 as today and 2016-06-16 21:40:53 as tomorrow in php</p>
0debug
int qcow2_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab) { BDRVQcowState *s = bs->opaque; QEMUSnapshotInfo *sn_tab, *sn_info; QCowSnapshot *sn; int i; if (!s->nb_snapshots) { *psn_tab = NULL; return s->nb_snapshots; } sn_tab = g_malloc0(s->nb_snapshots * sizeof(QEMUSnapshotInfo)); for(i = 0; i < s->nb_snapshots; i++) { sn_info = sn_tab + i; sn = s->snapshots + i; pstrcpy(sn_info->id_str, sizeof(sn_info->id_str), sn->id_str); pstrcpy(sn_info->name, sizeof(sn_info->name), sn->name); sn_info->vm_state_size = sn->vm_state_size; sn_info->date_sec = sn->date_sec; sn_info->date_nsec = sn->date_nsec; sn_info->vm_clock_nsec = sn->vm_clock_nsec; } *psn_tab = sn_tab; return s->nb_snapshots; }
1threat
avs_decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; const uint8_t *buf_end = avpkt->data + avpkt->size; int buf_size = avpkt->size; AvsContext *const avs = avctx->priv_data; AVFrame *picture = data; AVFrame *const p = &avs->picture; const uint8_t *table, *vect; uint8_t *out; int i, j, x, y, stride, vect_w = 3, vect_h = 3; AvsVideoSubType sub_type; AvsBlockType type; GetBitContext change_map; if (avctx->reget_buffer(avctx, p)) { av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return -1; } p->reference = 3; p->pict_type = AV_PICTURE_TYPE_P; p->key_frame = 0; out = avs->picture.data[0]; stride = avs->picture.linesize[0]; if (buf_end - buf < 4) return AVERROR_INVALIDDATA; sub_type = buf[0]; type = buf[1]; buf += 4; if (type == AVS_PALETTE) { int first, last; uint32_t *pal = (uint32_t *) avs->picture.data[1]; first = AV_RL16(buf); last = first + AV_RL16(buf + 2); if (first >= 256 || last > 256 || buf_end - buf < 4 + 4 + 3 * (last - first)) return AVERROR_INVALIDDATA; buf += 4; for (i=first; i<last; i++, buf+=3) { pal[i] = (buf[0] << 18) | (buf[1] << 10) | (buf[2] << 2); pal[i] |= 0xFF << 24 | (pal[i] >> 6) & 0x30303; } sub_type = buf[0]; type = buf[1]; buf += 4; } if (type != AVS_VIDEO) return -1; switch (sub_type) { case AVS_I_FRAME: p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1; case AVS_P_FRAME_3X3: vect_w = 3; vect_h = 3; break; case AVS_P_FRAME_2X2: vect_w = 2; vect_h = 2; break; case AVS_P_FRAME_2X3: vect_w = 2; vect_h = 3; break; default: return -1; } if (buf_end - buf < 256 * vect_w * vect_h) return AVERROR_INVALIDDATA; table = buf + (256 * vect_w * vect_h); if (sub_type != AVS_I_FRAME) { int map_size = ((318 / vect_w + 7) / 8) * (198 / vect_h); if (buf_end - table < map_size) return AVERROR_INVALIDDATA; init_get_bits(&change_map, table, map_size * 8); table += map_size; } for (y=0; y<198; y+=vect_h) { for (x=0; x<318; x+=vect_w) { if (sub_type == AVS_I_FRAME || get_bits1(&change_map)) { if (buf_end - table < 1) return AVERROR_INVALIDDATA; vect = &buf[*table++ * (vect_w * vect_h)]; for (j=0; j<vect_w; j++) { out[(y + 0) * stride + x + j] = vect[(0 * vect_w) + j]; out[(y + 1) * stride + x + j] = vect[(1 * vect_w) + j]; if (vect_h == 3) out[(y + 2) * stride + x + j] = vect[(2 * vect_w) + j]; } } } if (sub_type != AVS_I_FRAME) align_get_bits(&change_map); } *picture = avs->picture; *data_size = sizeof(AVPicture); return buf_size; }
1threat
static int fic_decode_block(FICContext *ctx, GetBitContext *gb, uint8_t *dst, int stride, int16_t *block, int *is_p) { int i, num_coeff; if (get_bits1(gb)) { *is_p = 1; return 0; } memset(block, 0, sizeof(*block) * 64); num_coeff = get_bits(gb, 7); if (num_coeff > 64) return AVERROR_INVALIDDATA; for (i = 0; i < num_coeff; i++) block[ff_zigzag_direct[i]] = get_se_golomb(gb) * ctx->qmat[ff_zigzag_direct[i]]; fic_idct_put(dst, stride, block); return 0; }
1threat
jquery dropdown menu cant figure it out : <p>I cant figure out what is wrong in my code im trying to make a jquery dropdown menu. I have enclosed my html, css and javascript. please take a look and help me out, thank you.</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() { $("li").hover(function(){ $("this").find('ul &gt; li').fadeToggle(500); }); });</code></pre> <pre class="snippet-code-css lang-css prettyprint-override"><code>ul{ margin: 0; padding:0; list-style: none; } ul li{ float: left; width: 250px; height: 30px; line-height: 30px; background-color: #099; text-align: center; } ul li li { background-color: #099; color: #000; display: none; } ul li a { text-decoration:none; color: #000; } ul li li:hover{ background:#03F; } ul li li a { text decoration: none; color: #000; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt; &lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;link rel="stylesheet" type="text/css" href="css/main.css"&gt; &lt;meta charset="utf-8"&gt; &lt;title&gt;untitled&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="page"&gt; &lt;header&gt; &lt;a class="logo" href="#"&gt;&lt;/a&gt; &lt;nav class="nav_menu"&gt; &lt;ul class="dropmenu"&gt; &lt;li&gt;&lt;a href="#"&gt;Link 1&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;Sub Link 1-1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" class="selected"&gt;Sub Link 1-2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Sub Link 1-3&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Link 2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Link 3&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;Sub Link 2-1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Sub Link 2-2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Sub Link 2-3&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Link 4&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;Sub Link 4-1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Sub Link 4-2&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;Sub Link 4-2-1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Sub Link 4-2-2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Sub Link 4-2-3&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Sub Link 4-3&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/nav&gt; &lt;/header&gt; &lt;/div&gt; &lt;script type="text/javascript" src="js/plugin/jquery-1.12.1.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="js/application.js"&gt;&lt;/script&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> </div> </div> I cant figure out what is wrong in my code im trying to make a jquery dropdown menu. I have enclosed my html, css and javascript. please take a look and help me out, thank you.</p>
0debug
Merge Sort Python - Error message : I tried to write a Merge Sort function, but when I try to run the program I received an error :'the name mergesort is not defined'.Thank you very much! def merge(self,a,b): sorted_list=[] while len(a)!=0 and len(b)!=0: if a[0].get_type()<b[0].get_type(): sorted_list.append(a[0]) a.remove(a[0]) else: sorted_list.append(b[0]) b.remove(b[0]) if len(a)==0: sorted_list+=b else: sorted_list+=a return sorted_list def mergesort(self,lis): if len(lis) == 0 or len(lis) == 1: return lis else: middle = len(lis)// 2 a = mergesort(lis[middle:]) #in pycharm the next 3 lines are with red underlined b = mergesort(lis[middle:]) return merge(a,b)
0debug
does python find errors where there are none? : <p>while plotting functions with heaviside function I came up with this piece of code, in Idle:</p> <pre><code>import numpy as np import matplotlib.pyplot as plt n_i = [-5, 5] n = np.linspace(n_i[0], n_i[1], 1E3) u1 [n+30&gt;=0] = 1 u2 [n-15&gt;=0] =1 u3 = u1 - u2 x = np.sin(2*np.pi*(n/15))*u3 plt.axis([-30,15,-5,5]) plt.xlabel('$n$',fontsize=20) plt.ylabel('$x(n)$',fontsize=20) plt.stem(n, x, "--k", linefmt='black', basefmt='black') plt.grid() plt.show() </code></pre> <p>and prior to today, it ran without errors, same with all other of my plots, I've been dealing with python for two years now and throughout classes it had the habit of finding errors where even teachers don't see them. am I missing something here? it says "u1 is not defined", but it is. I even compared with coworkers and classmates alike, haven't seen it put in any other way in the code for the plot. help!</p>
0debug
static void fsl_imx31_realize(DeviceState *dev, Error **errp) { FslIMX31State *s = FSL_IMX31(dev); uint16_t i; Error *err = NULL; object_property_set_bool(OBJECT(&s->cpu), true, "realized", &err); if (err) { error_propagate(errp, err); return; } object_property_set_bool(OBJECT(&s->avic), true, "realized", &err); if (err) { error_propagate(errp, err); return; } sysbus_mmio_map(SYS_BUS_DEVICE(&s->avic), 0, FSL_IMX31_AVIC_ADDR); sysbus_connect_irq(SYS_BUS_DEVICE(&s->avic), 0, qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_IRQ)); sysbus_connect_irq(SYS_BUS_DEVICE(&s->avic), 1, qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_FIQ)); object_property_set_bool(OBJECT(&s->ccm), true, "realized", &err); if (err) { error_propagate(errp, err); return; } sysbus_mmio_map(SYS_BUS_DEVICE(&s->ccm), 0, FSL_IMX31_CCM_ADDR); for (i = 0; i < FSL_IMX31_NUM_UARTS; i++) { static const struct { hwaddr addr; unsigned int irq; } serial_table[FSL_IMX31_NUM_UARTS] = { { FSL_IMX31_UART1_ADDR, FSL_IMX31_UART1_IRQ }, { FSL_IMX31_UART2_ADDR, FSL_IMX31_UART2_IRQ }, }; if (i < MAX_SERIAL_PORTS) { Chardev *chr; chr = serial_hds[i]; if (!chr) { char label[20]; snprintf(label, sizeof(label), "imx31.uart%d", i); chr = qemu_chr_new(label, "null"); } qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", chr); } object_property_set_bool(OBJECT(&s->uart[i]), true, "realized", &err); if (err) { error_propagate(errp, err); return; } sysbus_mmio_map(SYS_BUS_DEVICE(&s->uart[i]), 0, serial_table[i].addr); sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart[i]), 0, qdev_get_gpio_in(DEVICE(&s->avic), serial_table[i].irq)); } s->gpt.ccm = IMX_CCM(&s->ccm); object_property_set_bool(OBJECT(&s->gpt), true, "realized", &err); if (err) { error_propagate(errp, err); return; } sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpt), 0, FSL_IMX31_GPT_ADDR); sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpt), 0, qdev_get_gpio_in(DEVICE(&s->avic), FSL_IMX31_GPT_IRQ)); for (i = 0; i < FSL_IMX31_NUM_EPITS; i++) { static const struct { hwaddr addr; unsigned int irq; } epit_table[FSL_IMX31_NUM_EPITS] = { { FSL_IMX31_EPIT1_ADDR, FSL_IMX31_EPIT1_IRQ }, { FSL_IMX31_EPIT2_ADDR, FSL_IMX31_EPIT2_IRQ }, }; s->epit[i].ccm = IMX_CCM(&s->ccm); object_property_set_bool(OBJECT(&s->epit[i]), true, "realized", &err); if (err) { error_propagate(errp, err); return; } sysbus_mmio_map(SYS_BUS_DEVICE(&s->epit[i]), 0, epit_table[i].addr); sysbus_connect_irq(SYS_BUS_DEVICE(&s->epit[i]), 0, qdev_get_gpio_in(DEVICE(&s->avic), epit_table[i].irq)); } for (i = 0; i < FSL_IMX31_NUM_I2CS; i++) { static const struct { hwaddr addr; unsigned int irq; } i2c_table[FSL_IMX31_NUM_I2CS] = { { FSL_IMX31_I2C1_ADDR, FSL_IMX31_I2C1_IRQ }, { FSL_IMX31_I2C2_ADDR, FSL_IMX31_I2C2_IRQ }, { FSL_IMX31_I2C3_ADDR, FSL_IMX31_I2C3_IRQ } }; object_property_set_bool(OBJECT(&s->i2c[i]), true, "realized", &err); if (err) { error_propagate(errp, err); return; } sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c[i]), 0, i2c_table[i].addr); sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c[i]), 0, qdev_get_gpio_in(DEVICE(&s->avic), i2c_table[i].irq)); } for (i = 0; i < FSL_IMX31_NUM_GPIOS; i++) { static const struct { hwaddr addr; unsigned int irq; } gpio_table[FSL_IMX31_NUM_GPIOS] = { { FSL_IMX31_GPIO1_ADDR, FSL_IMX31_GPIO1_IRQ }, { FSL_IMX31_GPIO2_ADDR, FSL_IMX31_GPIO2_IRQ }, { FSL_IMX31_GPIO3_ADDR, FSL_IMX31_GPIO3_IRQ } }; object_property_set_bool(OBJECT(&s->gpio[i]), false, "has-edge-sel", &error_abort); object_property_set_bool(OBJECT(&s->gpio[i]), true, "realized", &err); if (err) { error_propagate(errp, err); return; } sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio[i]), 0, gpio_table[i].addr); sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 0, qdev_get_gpio_in(DEVICE(&s->avic), gpio_table[i].irq)); } memory_region_init_rom_nomigrate(&s->secure_rom, NULL, "imx31.secure_rom", FSL_IMX31_SECURE_ROM_SIZE, &err); if (err) { error_propagate(errp, err); return; } memory_region_add_subregion(get_system_memory(), FSL_IMX31_SECURE_ROM_ADDR, &s->secure_rom); memory_region_init_rom_nomigrate(&s->rom, NULL, "imx31.rom", FSL_IMX31_ROM_SIZE, &err); if (err) { error_propagate(errp, err); return; } memory_region_add_subregion(get_system_memory(), FSL_IMX31_ROM_ADDR, &s->rom); memory_region_init_ram(&s->iram, NULL, "imx31.iram", FSL_IMX31_IRAM_SIZE, &err); if (err) { error_propagate(errp, err); return; } memory_region_add_subregion(get_system_memory(), FSL_IMX31_IRAM_ADDR, &s->iram); memory_region_init_alias(&s->iram_alias, NULL, "imx31.iram_alias", &s->iram, 0, FSL_IMX31_IRAM_ALIAS_SIZE); memory_region_add_subregion(get_system_memory(), FSL_IMX31_IRAM_ALIAS_ADDR, &s->iram_alias); }
1threat
build_dsdt(GArray *table_data, GArray *linker, AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc, PcPciInfo *pci, MachineState *machine) { CrsRangeEntry *entry; Aml *dsdt, *sb_scope, *scope, *dev, *method, *field, *pkg, *crs; GPtrArray *mem_ranges = g_ptr_array_new_with_free_func(crs_range_free); GPtrArray *io_ranges = g_ptr_array_new_with_free_func(crs_range_free); PCMachineState *pcms = PC_MACHINE(machine); uint32_t nr_mem = machine->ram_slots; int root_bus_limit = 0xFF; PCIBus *bus = NULL; int i; dsdt = init_aml_allocator(); acpi_data_push(dsdt->buf, sizeof(AcpiTableHeader)); build_dbg_aml(dsdt); if (misc->is_piix4) { sb_scope = aml_scope("_SB"); dev = aml_device("PCI0"); aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03"))); aml_append(dev, aml_name_decl("_ADR", aml_int(0))); aml_append(dev, aml_name_decl("_UID", aml_int(1))); aml_append(sb_scope, dev); aml_append(dsdt, sb_scope); build_hpet_aml(dsdt); build_piix4_pm(dsdt); build_piix4_isa_bridge(dsdt); build_isa_devices_aml(dsdt); build_piix4_pci_hotplug(dsdt); build_piix4_pci0_int(dsdt); } else { sb_scope = aml_scope("_SB"); aml_append(sb_scope, aml_operation_region("PCST", AML_SYSTEM_IO, aml_int(0xae00), 0x0c)); aml_append(sb_scope, aml_operation_region("PCSB", AML_SYSTEM_IO, aml_int(0xae0c), 0x01)); field = aml_field("PCSB", AML_ANY_ACC, AML_NOLOCK, AML_WRITE_AS_ZEROS); aml_append(field, aml_named_field("PCIB", 8)); aml_append(sb_scope, field); aml_append(dsdt, sb_scope); sb_scope = aml_scope("_SB"); dev = aml_device("PCI0"); aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08"))); aml_append(dev, aml_name_decl("_CID", aml_eisaid("PNP0A03"))); aml_append(dev, aml_name_decl("_ADR", aml_int(0))); aml_append(dev, aml_name_decl("_UID", aml_int(1))); aml_append(dev, aml_name_decl("SUPP", aml_int(0))); aml_append(dev, aml_name_decl("CTRL", aml_int(0))); aml_append(dev, build_q35_osc_method()); aml_append(sb_scope, dev); aml_append(dsdt, sb_scope); build_hpet_aml(dsdt); build_q35_isa_bridge(dsdt); build_isa_devices_aml(dsdt); build_q35_pci0_int(dsdt); } build_cpu_hotplug_aml(dsdt); build_memory_hotplug_aml(dsdt, nr_mem, pm->mem_hp_io_base, pm->mem_hp_io_len); scope = aml_scope("_GPE"); { aml_append(scope, aml_name_decl("_HID", aml_string("ACPI0006"))); aml_append(scope, aml_method("_L00", 0, AML_NOTSERIALIZED)); if (misc->is_piix4) { method = aml_method("_E01", 0, AML_NOTSERIALIZED); aml_append(method, aml_acquire(aml_name("\\_SB.PCI0.BLCK"), 0xFFFF)); aml_append(method, aml_call0("\\_SB.PCI0.PCNT")); aml_append(method, aml_release(aml_name("\\_SB.PCI0.BLCK"))); aml_append(scope, method); } else { aml_append(scope, aml_method("_L01", 0, AML_NOTSERIALIZED)); } method = aml_method("_E02", 0, AML_NOTSERIALIZED); aml_append(method, aml_call0("\\_SB." CPU_SCAN_METHOD)); aml_append(scope, method); method = aml_method("_E03", 0, AML_NOTSERIALIZED); aml_append(method, aml_call0(MEMORY_HOTPLUG_HANDLER_PATH)); aml_append(scope, method); aml_append(scope, aml_method("_L04", 0, AML_NOTSERIALIZED)); aml_append(scope, aml_method("_L05", 0, AML_NOTSERIALIZED)); aml_append(scope, aml_method("_L06", 0, AML_NOTSERIALIZED)); aml_append(scope, aml_method("_L07", 0, AML_NOTSERIALIZED)); aml_append(scope, aml_method("_L08", 0, AML_NOTSERIALIZED)); aml_append(scope, aml_method("_L09", 0, AML_NOTSERIALIZED)); aml_append(scope, aml_method("_L0A", 0, AML_NOTSERIALIZED)); aml_append(scope, aml_method("_L0B", 0, AML_NOTSERIALIZED)); aml_append(scope, aml_method("_L0C", 0, AML_NOTSERIALIZED)); aml_append(scope, aml_method("_L0D", 0, AML_NOTSERIALIZED)); aml_append(scope, aml_method("_L0E", 0, AML_NOTSERIALIZED)); aml_append(scope, aml_method("_L0F", 0, AML_NOTSERIALIZED)); } aml_append(dsdt, scope); bus = PC_MACHINE(machine)->bus; if (bus) { QLIST_FOREACH(bus, &bus->child, sibling) { uint8_t bus_num = pci_bus_num(bus); uint8_t numa_node = pci_bus_numa_node(bus); if (!pci_bus_is_root(bus)) { continue; } if (bus_num < root_bus_limit) { root_bus_limit = bus_num - 1; } scope = aml_scope("\\_SB"); dev = aml_device("PC%.02X", bus_num); aml_append(dev, aml_name_decl("_UID", aml_int(bus_num))); aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03"))); aml_append(dev, aml_name_decl("_BBN", aml_int(bus_num))); if (numa_node != NUMA_NODE_UNASSIGNED) { aml_append(dev, aml_name_decl("_PXM", aml_int(numa_node))); } aml_append(dev, build_prt(false)); crs = build_crs(PCI_HOST_BRIDGE(BUS(bus)->parent), io_ranges, mem_ranges); aml_append(dev, aml_name_decl("_CRS", crs)); aml_append(scope, dev); aml_append(dsdt, scope); } } scope = aml_scope("\\_SB.PCI0"); crs = aml_resource_template(); aml_append(crs, aml_word_bus_number(AML_MIN_FIXED, AML_MAX_FIXED, AML_POS_DECODE, 0x0000, 0x0, root_bus_limit, 0x0000, root_bus_limit + 1)); aml_append(crs, aml_io(AML_DECODE16, 0x0CF8, 0x0CF8, 0x01, 0x08)); aml_append(crs, aml_word_io(AML_MIN_FIXED, AML_MAX_FIXED, AML_POS_DECODE, AML_ENTIRE_RANGE, 0x0000, 0x0000, 0x0CF7, 0x0000, 0x0CF8)); crs_replace_with_free_ranges(io_ranges, 0x0D00, 0xFFFF); for (i = 0; i < io_ranges->len; i++) { entry = g_ptr_array_index(io_ranges, i); aml_append(crs, aml_word_io(AML_MIN_FIXED, AML_MAX_FIXED, AML_POS_DECODE, AML_ENTIRE_RANGE, 0x0000, entry->base, entry->limit, 0x0000, entry->limit - entry->base + 1)); } aml_append(crs, aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED, AML_CACHEABLE, AML_READ_WRITE, 0, 0x000A0000, 0x000BFFFF, 0, 0x00020000)); crs_replace_with_free_ranges(mem_ranges, pci->w32.begin, pci->w32.end - 1); for (i = 0; i < mem_ranges->len; i++) { entry = g_ptr_array_index(mem_ranges, i); aml_append(crs, aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED, AML_NON_CACHEABLE, AML_READ_WRITE, 0, entry->base, entry->limit, 0, entry->limit - entry->base + 1)); } if (pci->w64.begin) { aml_append(crs, aml_qword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED, AML_CACHEABLE, AML_READ_WRITE, 0, pci->w64.begin, pci->w64.end - 1, 0, pci->w64.end - pci->w64.begin)); } aml_append(scope, aml_name_decl("_CRS", crs)); dev = aml_device("GPE0"); aml_append(dev, aml_name_decl("_HID", aml_string("PNP0A06"))); aml_append(dev, aml_name_decl("_UID", aml_string("GPE0 resources"))); aml_append(dev, aml_name_decl("_STA", aml_int(0xB))); crs = aml_resource_template(); aml_append(crs, aml_io(AML_DECODE16, pm->gpe0_blk, pm->gpe0_blk, 1, pm->gpe0_blk_len) ); aml_append(dev, aml_name_decl("_CRS", crs)); aml_append(scope, dev); g_ptr_array_free(io_ranges, true); g_ptr_array_free(mem_ranges, true); if (pm->pcihp_io_len) { dev = aml_device("PHPR"); aml_append(dev, aml_name_decl("_HID", aml_string("PNP0A06"))); aml_append(dev, aml_name_decl("_UID", aml_string("PCI Hotplug resources"))); aml_append(dev, aml_name_decl("_STA", aml_int(0xB))); crs = aml_resource_template(); aml_append(crs, aml_io(AML_DECODE16, pm->pcihp_io_base, pm->pcihp_io_base, 1, pm->pcihp_io_len) ); aml_append(dev, aml_name_decl("_CRS", crs)); aml_append(scope, dev); } aml_append(dsdt, scope); scope = aml_scope("\\"); if (!pm->s3_disabled) { pkg = aml_package(4); aml_append(pkg, aml_int(1)); aml_append(pkg, aml_int(1)); aml_append(pkg, aml_int(0)); aml_append(pkg, aml_int(0)); aml_append(scope, aml_name_decl("_S3", pkg)); } if (!pm->s4_disabled) { pkg = aml_package(4); aml_append(pkg, aml_int(pm->s4_val)); aml_append(pkg, aml_int(pm->s4_val)); aml_append(pkg, aml_int(0)); aml_append(pkg, aml_int(0)); aml_append(scope, aml_name_decl("_S4", pkg)); } pkg = aml_package(4); aml_append(pkg, aml_int(0)); aml_append(pkg, aml_int(0)); aml_append(pkg, aml_int(0)); aml_append(pkg, aml_int(0)); aml_append(scope, aml_name_decl("_S5", pkg)); aml_append(dsdt, scope); { uint8_t io_size = object_property_get_bool(OBJECT(pcms->fw_cfg), "dma_enabled", NULL) ? ROUND_UP(FW_CFG_CTL_SIZE, 4) + sizeof(dma_addr_t) : FW_CFG_CTL_SIZE; scope = aml_scope("\\_SB.PCI0"); dev = aml_device("FWCF"); aml_append(dev, aml_name_decl("_HID", aml_string("QEMU0002"))); aml_append(dev, aml_name_decl("_STA", aml_int(0xB))); crs = aml_resource_template(); aml_append(crs, aml_io(AML_DECODE16, FW_CFG_IO_BASE, FW_CFG_IO_BASE, 0x01, io_size) ); aml_append(dev, aml_name_decl("_CRS", crs)); aml_append(scope, dev); aml_append(dsdt, scope); } if (misc->applesmc_io_base) { scope = aml_scope("\\_SB.PCI0.ISA"); dev = aml_device("SMC"); aml_append(dev, aml_name_decl("_HID", aml_eisaid("APP0001"))); aml_append(dev, aml_name_decl("_STA", aml_int(0xB))); crs = aml_resource_template(); aml_append(crs, aml_io(AML_DECODE16, misc->applesmc_io_base, misc->applesmc_io_base, 0x01, APPLESMC_MAX_DATA_LENGTH) ); aml_append(crs, aml_irq_no_flags(6)); aml_append(dev, aml_name_decl("_CRS", crs)); aml_append(scope, dev); aml_append(dsdt, scope); } if (misc->pvpanic_port) { scope = aml_scope("\\_SB.PCI0.ISA"); dev = aml_device("PEVT"); aml_append(dev, aml_name_decl("_HID", aml_string("QEMU0001"))); crs = aml_resource_template(); aml_append(crs, aml_io(AML_DECODE16, misc->pvpanic_port, misc->pvpanic_port, 1, 1) ); aml_append(dev, aml_name_decl("_CRS", crs)); aml_append(dev, aml_operation_region("PEOR", AML_SYSTEM_IO, aml_int(misc->pvpanic_port), 1)); field = aml_field("PEOR", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE); aml_append(field, aml_named_field("PEPT", 8)); aml_append(dev, field); aml_append(dev, aml_name_decl("_STA", aml_int(0xF))); method = aml_method("RDPT", 0, AML_NOTSERIALIZED); aml_append(method, aml_store(aml_name("PEPT"), aml_local(0))); aml_append(method, aml_return(aml_local(0))); aml_append(dev, method); method = aml_method("WRPT", 1, AML_NOTSERIALIZED); aml_append(method, aml_store(aml_arg(0), aml_name("PEPT"))); aml_append(dev, method); aml_append(scope, dev); aml_append(dsdt, scope); } sb_scope = aml_scope("\\_SB"); { build_processor_devices(sb_scope, pcms->apic_id_limit, cpu, pm); build_memory_devices(sb_scope, nr_mem, pm->mem_hp_io_base, pm->mem_hp_io_len); { Object *pci_host; PCIBus *bus = NULL; pci_host = acpi_get_i386_pci_host(); if (pci_host) { bus = PCI_HOST_BRIDGE(pci_host)->bus; } if (bus) { Aml *scope = aml_scope("PCI0"); build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en); if (misc->tpm_version != TPM_VERSION_UNSPEC) { dev = aml_device("ISA.TPM"); aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31"))); aml_append(dev, aml_name_decl("_STA", aml_int(0xF))); crs = aml_resource_template(); aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE, TPM_TIS_ADDR_SIZE, AML_READ_WRITE)); aml_append(crs, aml_irq_no_flags(TPM_TIS_IRQ)); aml_append(dev, aml_name_decl("_CRS", crs)); aml_append(scope, dev); } aml_append(sb_scope, scope); } } aml_append(dsdt, sb_scope); } g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len); build_header(linker, table_data, (void *)(table_data->data + table_data->len - dsdt->buf->len), "DSDT", dsdt->buf->len, 1, NULL, NULL); free_aml_allocator(); }
1threat
Unrecognized selector UIDeviceRGBColor countByEnumeratingWithState:objects:count: : <p>I know this is kind of a dupe, but I don't have enough reputation yet to comment on the original post and, while I don't have an answer, I do have more useful information (a concrete example). Moderators, feel free to move this to the proper location.</p> <p>When compiling my code using the latest XCode 8 beta 6 (iOS 10 SDK), I get an exception "Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIDeviceRGBColor countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x600000071340'"</p> <p>This happens during the call:</p> <pre><code> auto viewController = [[[UIViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease]; </code></pre> <p>I have isolated the problem by whittling down my project to the bare minimum that will compile and still exhibit the problem. You can download it here:</p> <p><a href="https://www.dropbox.com/s/b7jggae97889xka/Bugtest.zip?dl=0" rel="noreferrer">Example project</a></p> <p>Note that I took out lots of code, nearly all classes are gone, which results in a lot of warnings (not errors) for nonexistent classes referenced from the xib. But that doesn't matter, the code still compiles and runs just fine with the iOS 9 SDK. After compiling with the iOS 10 sdk, however, it crashes both in the simulator and on devices running iOS 9.</p> <p>You can work around the problem by changing "#if 0" into "#if 1" in the file "HackForUnrecognizedSelectorInIOS10.m". This adds a category defining the missing selectors for UIColor. But obviously you can't add that to shipping code, it's just a temporary stopgap measure to continue developing.</p> <p>I filed a bug report (28153870). But if anyone has any more information on how to avoid this problem without ugly hacks, any information is welcome.</p> <p>Thanks</p> <p>Michel Colman</p>
0debug