problem
stringlengths
26
131k
labels
class label
2 classes
ImportError: cannot import name 'Timestamp' : <p>I have ggplot successfully installed in my python 3.6.3 using the code below:</p> <pre><code>conda install -c conda-forge ggplot </code></pre> <p>But when I import it in my notebook using the code below, I get an error:</p> <pre><code>from ggplot import * ImportError: cannot import name 'Timestamp' </code></pre> <p>I would appreciate any idea on how I can solve this problem.</p>
0debug
av_cold void ff_cavsdsp_init_x86(CAVSDSPContext *c, AVCodecContext *avctx) { av_unused int cpu_flags = av_get_cpu_flags(); cavsdsp_init_mmx(c, avctx); #if HAVE_AMD3DNOW_INLINE if (INLINE_AMD3DNOW(cpu_flags)) cavsdsp_init_3dnow(c, avctx); #endif #if HAVE_MMXEXT_INLINE if (INLINE_MMXEXT(cpu_flags)) { DSPFUNC(put, 0, 16, mmxext); DSPFUNC(put, 1, 8, mmxext); DSPFUNC(avg, 0, 16, mmxext); DSPFUNC(avg, 1, 8, mmxext); } #endif #if HAVE_MMX_EXTERNAL if (EXTERNAL_MMXEXT(cpu_flags)) { c->avg_cavs_qpel_pixels_tab[0][0] = avg_cavs_qpel16_mc00_mmxext; c->avg_cavs_qpel_pixels_tab[1][0] = avg_cavs_qpel8_mc00_mmxext; } #endif #if HAVE_SSE2_EXTERNAL if (EXTERNAL_SSE2(cpu_flags)) { c->put_cavs_qpel_pixels_tab[0][0] = put_cavs_qpel16_mc00_sse2; c->avg_cavs_qpel_pixels_tab[0][0] = avg_cavs_qpel16_mc00_sse2; } #endif }
1threat
static void qxl_realize_secondary(PCIDevice *dev, Error **errp) { static int device_id = 1; PCIQXLDevice *qxl = PCI_QXL(dev); qxl->id = device_id++; qxl_init_ramsize(qxl); memory_region_init_ram(&qxl->vga.vram, OBJECT(dev), "qxl.vgavram", qxl->vga.vram_size, &error_abort); vmstate_register_ram(&qxl->vga.vram, &qxl->pci.qdev); qxl->vga.vram_ptr = memory_region_get_ram_ptr(&qxl->vga.vram); qxl->vga.con = graphic_console_init(DEVICE(dev), 0, &qxl_ops, qxl); qxl_realize_common(qxl, errp); }
1threat
jmeter aggregate report malfunctioning : Did anybody encounter an incorrect report? I set up a web test plan following the tutorial http://jmeter.apache.org/usermanual/build-web-test-plan.html, except that I added a CSV Data Set Config to read requst parameters from file. The test process finished without warning, but the data in the aggerate report is weird. It gives something like this: [![jmeter result][1]][1] However according to the document http://jmeter.apache.org/usermanual/component_reference.html#Aggregate_Report, Throughput = (number of requests) / (total time in secs) = 1000 * (number of requests) / (total time in millionsec) Average = (total time in millionsec) / (number of requests) which means ``` Average * Throughput``` should almost be ```1000 ```. What's wrong with my report? ps: the formular above come from http://jmeter.apache.org/usermanual/glossary.html#Throughput [1]: http://i.stack.imgur.com/GvVyu.png
0debug
Recursive Stored Procedures USE : <p>I just want to know the scenario where I can use the stored procedure recursively. Please give me a better Example.</p>
0debug
int ff_lpc_calc_coefs(LPCContext *s, const int32_t *samples, int blocksize, int min_order, int max_order, int precision, int32_t coefs[][MAX_LPC_ORDER], int *shift, enum FFLPCType lpc_type, int lpc_passes, int omethod, int max_shift, int zero_shift) { double autoc[MAX_LPC_ORDER+1]; double ref[MAX_LPC_ORDER]; double lpc[MAX_LPC_ORDER][MAX_LPC_ORDER]; int i, j, pass; int opt_order; av_assert2(max_order >= MIN_LPC_ORDER && max_order <= MAX_LPC_ORDER && lpc_type > FF_LPC_TYPE_FIXED); if (blocksize != s->blocksize || max_order != s->max_order || lpc_type != s->lpc_type) { ff_lpc_end(s); ff_lpc_init(s, blocksize, max_order, lpc_type); } if (lpc_type == FF_LPC_TYPE_LEVINSON) { s->lpc_apply_welch_window(samples, blocksize, s->windowed_samples); s->lpc_compute_autocorr(s->windowed_samples, blocksize, max_order, autoc); compute_lpc_coefs(autoc, max_order, &lpc[0][0], MAX_LPC_ORDER, 0, 1); for(i=0; i<max_order; i++) ref[i] = fabs(lpc[i][i]); } else if (lpc_type == FF_LPC_TYPE_CHOLESKY) { LLSModel m[2]; double var[MAX_LPC_ORDER+1], av_uninit(weight); if(lpc_passes <= 0) lpc_passes = 2; for(pass=0; pass<lpc_passes; pass++){ av_init_lls(&m[pass&1], max_order); weight=0; for(i=max_order; i<blocksize; i++){ for(j=0; j<=max_order; j++) var[j]= samples[i-j]; if(pass){ double eval, inv, rinv; eval= av_evaluate_lls(&m[(pass-1)&1], var+1, max_order-1); eval= (512>>pass) + fabs(eval - var[0]); inv = 1/eval; rinv = sqrt(inv); for(j=0; j<=max_order; j++) var[j] *= rinv; weight += inv; }else weight++; av_update_lls(&m[pass&1], var, 1.0); } av_solve_lls(&m[pass&1], 0.001, 0); } for(i=0; i<max_order; i++){ for(j=0; j<max_order; j++) lpc[i][j]=-m[(pass-1)&1].coeff[i][j]; ref[i]= sqrt(m[(pass-1)&1].variance[i] / weight) * (blocksize - max_order) / 4000; } for(i=max_order-1; i>0; i--) ref[i] = ref[i-1] - ref[i]; } opt_order = max_order; if(omethod == ORDER_METHOD_EST) { opt_order = estimate_best_order(ref, min_order, max_order); i = opt_order-1; quantize_lpc_coefs(lpc[i], i+1, precision, coefs[i], &shift[i], max_shift, zero_shift); } else { for(i=min_order-1; i<max_order; i++) { quantize_lpc_coefs(lpc[i], i+1, precision, coefs[i], &shift[i], max_shift, zero_shift); } } return opt_order; }
1threat
Android ProgressBar styled like progress view in SwipeRefreshLayout : <p>I use <code>android.support.v4.widget.SwipeRefreshLayout</code> in my Android app. It wraps a <code>ListView</code>. The content of the list view is downloaded from a server.</p> <p>A progress view is shown when user swipes down in order to reload data from server. The progress view looks like a piece of circle that grows and shrinks during the animation. It seems that the style of this progress view cannot be customized much. However, I am fine with its built-in style.</p> <p>I also show the same progress animation during initial data loading. This can be achieved by calling <code>mySwipeRefreshLayout.setRefreshing(true)</code>. That's perfectly OK too.</p> <p>However, I would like to show the same progress indication through the whole app. Consider e.g. another activity that looks like a form with submit button. There is neither a <code>ListView</code> nor a <code>SwipeRefreshLayout</code> in this form activity. Some progress indication should be displayed while the submitted data are transferred to the server. I want to show a progress bar with the same animation like in SwipeRefreshLayout.</p> <p>Is there a simple and clean way to have the same progress indicator for both a <code>SwipeRefreshLayout</code> and a form activity that does not contain any list view and refresh layout and does not support any swipe gesture?</p> <p>Thanks.</p>
0debug
qio_channel_socket_accept(QIOChannelSocket *ioc, Error **errp) { QIOChannelSocket *cioc; cioc = QIO_CHANNEL_SOCKET(object_new(TYPE_QIO_CHANNEL_SOCKET)); cioc->fd = -1; cioc->remoteAddrLen = sizeof(ioc->remoteAddr); cioc->localAddrLen = sizeof(ioc->localAddr); #ifdef WIN32 QIO_CHANNEL(cioc)->event = CreateEvent(NULL, FALSE, FALSE, NULL); #endif retry: trace_qio_channel_socket_accept(ioc); cioc->fd = qemu_accept(ioc->fd, (struct sockaddr *)&cioc->remoteAddr, &cioc->remoteAddrLen); if (cioc->fd < 0) { trace_qio_channel_socket_accept_fail(ioc); if (errno == EINTR) { goto retry; } goto error; } if (getsockname(cioc->fd, (struct sockaddr *)&cioc->localAddr, &cioc->localAddrLen) < 0) { error_setg_errno(errp, errno, "Unable to query local socket address"); goto error; } #ifndef WIN32 if (cioc->localAddr.ss_family == AF_UNIX) { QIOChannel *ioc_local = QIO_CHANNEL(cioc); qio_channel_set_feature(ioc_local, QIO_CHANNEL_FEATURE_FD_PASS); } #endif trace_qio_channel_socket_accept_complete(ioc, cioc, cioc->fd); return cioc; error: object_unref(OBJECT(cioc)); return NULL; }
1threat
Where does DOM manipulation belong in Angular 2? : <p>In Angular 1 all DOM manipulation should be done in directives to ensure proper testability, but what about Angular 2? How has this changed?</p> <p>I've been searching for good articles or any information at all about where to put DOM manipulation and how to think when doing it, but I come up empty every time. </p> <p>Take this component for example (this is really a directive but let's pretend that it's not):</p> <pre><code>export class MyComponent { constructor(private _elementRef: ElementRef) { this.setHeight(); window.addEventListener('resize', (e) =&gt; { this.setHeight(); }); } setHeight() { this._elementRef.nativeElement.style.height = this.getHeight() + 'px'; } getHeight() { return window.innerHeight; } } </code></pre> <p>Does event binding belong in a constructor for example, or should this be put in the <code>ngAfterViewInit</code> function or somewhere else? Should you try to break out the DOM manipulation of a component into a directive? </p> <p>It's all just a blur at the moment so I'm not sure that I'm going about it correctly and I'm sure I'm not the only one.</p> <p>What are the rules for DOM manipulation in Angular2? </p>
0debug
Pandas: Combining Two DataFrames Horizontally : <p>I have two Pandas DataFrames, each with different columns. I want to basically glue them together horizontally (they each have the same number of rows so this shouldn't be an issue).</p> <p>There must be a simple way of doing this but I've gone through the docs and <code>concat</code> isn't what I'm looking for (I don't think).</p> <p>Any ideas?</p> <p>Thanks!</p>
0debug
static void RENAME(yuv2bgr24_2)(SwsContext *c, const uint16_t *buf0, const uint16_t *buf1, const uint16_t *ubuf0, const uint16_t *ubuf1, const uint16_t *vbuf0, const uint16_t *vbuf1, const uint16_t *abuf0, const uint16_t *abuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int y) { __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" WRITEBGR24(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), "a" (&c->redDither) ); }
1threat
"Starting a new Gradle Daemon for this build (subsequent builds will be faster)"... every time : <p>I use Gradle 2.10 on Ubuntu 16.04.1 LTS</p> <p>I was getting told "<em>This build could be faster, please consider using the Gradle Daemon</em>" so I created a <code>~/.gradle/gradle.properties</code> file containing <code>org.gradle.daemon=true</code>.</p> <p>Result: Every time I run <code>./gradlew build</code>, I am now told:</p> <pre><code>Starting a new Gradle Daemon for this build (subsequent builds will be faster). </code></pre> <p>... every single time. And the build does not get faster and faster: it always takes about 10 seconds. If I run the build 3 times in a row, it outputs the message above 3 times, and though I am well below Gradle's <a href="https://docs.gradle.org/current/userguide/gradle_daemon.html#sec:how_can_i_stop_a_daemon" rel="noreferrer">3 hours of inactivity automatic shutdown</a>.</p> <p>How to fix this and make the daemon survive for a longer time?</p>
0debug
static int i440fx_pcihost_initfn(SysBusDevice *dev) { I440FXState *s = FROM_SYSBUS(I440FXState, dev); register_ioport_write(0xcf8, 4, 4, i440fx_addr_writel, s); register_ioport_read(0xcf8, 4, 4, i440fx_addr_readl, s); register_ioport_write(0xcfc, 4, 1, pci_host_data_writeb, s); register_ioport_write(0xcfc, 4, 2, pci_host_data_writew, s); register_ioport_write(0xcfc, 4, 4, pci_host_data_writel, s); register_ioport_read(0xcfc, 4, 1, pci_host_data_readb, s); register_ioport_read(0xcfc, 4, 2, pci_host_data_readw, s); register_ioport_read(0xcfc, 4, 4, pci_host_data_readl, s); return 0; }
1threat
Normalizing the edit distance : <p>I have a question that can we normalize the levenshtein edit distance by dividing the e.d value by the length of the two strings? I am asking this because, if we compare two strings of unequal length, the difference between the lengths of the two will be counted as well. for eg: ed('has a', 'has a ball') = 4 and ed('has a', 'has a ball the is round') = 15. if we increase the length of the string, the edit distance will increase even though they are similar. Therefore, I can not set a value, what a good edit distance value should be.</p>
0debug
Jquery code does not work on mobile(Andriod) : $(document).ready(function() { $(".solutions").hide(); //solutions is a class name for div element $("button").click(function() { $(this).next("div").toggle(); }); }); I have checked through the related questions and none addressed my situation.
0debug
sed/bash move digits from end of line to front of line : <p>Okay so I want to move all digits from end of the line to the front of the line, example of lines:</p> <pre><code>example123 example321 example2920 </code></pre> <p>expected output:</p> <pre><code>123example 321example 2920example </code></pre> <p>the following sed command works to place numbers at the start to end -</p> <pre><code>sed -E 's/^([0-9]+)(.*)/\2\1/' file </code></pre> <p>input of this is</p> <pre><code>123example 321example </code></pre> <p>and output is</p> <pre><code>example123 example321 </code></pre> <p>but when trying to do the same for numbers at the end moved to the front I can't seem to do it..</p> <p>I've tried changing</p> <pre><code>^ </code></pre> <p>to</p> <pre><code>$ </code></pre> <p>and other things but I'm new to sed so I don't really understand alot.</p>
0debug
is not a function error getting : var newSalary = function(){ var salary = 30000; function update(amount){ salary += amount; } return { hike: function(){ update(5000); }, lower: function(){ update(-5000); }, current: function(){ return salary; } } } console.log('current salary::'+newSalary.current()); getting newSalary.current is not a function. what's wrong in the code I need a solution like without using self execution functions. sorry for my english.
0debug
void visit_start_struct(Visitor *v, void **obj, const char *kind, const char *name, size_t size, Error **errp) { if (!error_is_set(errp)) { v->start_struct(v, obj, kind, name, size, errp); } }
1threat
Angular 2: Disable input change not working : <p>Up until "final" 2.0 of Angular I have done this:</p> <pre><code>&lt;input type="text" formControlName="name" [disabled]="!showName"&gt; </code></pre> <p>To dynamically disable/enable form inputs. </p> <p>After upgrading from Rc7 to 2.0 I get this warning in the console window:</p> <blockquote> <p>It looks like you're using the disabled attribute with a reactive form directive. If you set disabled to true when you set up this control in your component class, the disabled attribute will actually be set in the DOM for you. We recommend using this approach to avoid 'changed after checked' errors.</p> </blockquote> <p>I have changed my code to follow these instructions like this:</p> <pre><code>this._userGroupUsersForm = this._formBuilder.group({ 'users': [{'', disabled: this.showName}, Validators.compose([Validators.required, Validators.minLength(3), Validators.maxLength(50), Validators.pattern("^[a-zA-ZåäöÅÄÖ 0-9_-]+$")])] }); </code></pre> <p>And that works fine for the initial page load, but I can no longer toggle the status like this:</p> <pre><code>toggleName() : void { this.showName = !this.showName; } </code></pre> <p>How do I solve this?</p> <p>Note: My "old" way of doing this (by setting [disabled]) doesn't work any more either. </p>
0debug
Tomcat 8 - context.xml use Environment Variable in Datasource : <p>I have a Tomcat 8 project that uses a datasource (see below)</p> <pre><code>&lt;Resource auth="Container" name="jdbc/JtmDS" driverClassName="org.apache.derby.jdbc.EmbeddedDriver" type="javax.sql.DataSource" username="xfer" password="xfer10" url="jdbc:derby:/home/PUID/tm/control/JtmDB" initialSize="25" maxTotal="100" maxIdle="30" maxWaitMillis="10000" removeAbandonedOnBorrow="true" removeAbandonedTimeout="20" /&gt; </code></pre> <p>This works perfectly well. </p> <p>However the url is a hard-coded path <code>/home/PUID/tm/control/JtmDB</code></p> <p>When this gets into production the PUID part of the path will differ across numerous systems. I have an environment variable set <code>export PUID=abcd</code> The rest of the application is able to use things like <code>System.getenv( )</code> or <code>${env:PUID}</code> as and where appropriate.</p> <p>These all work fine.</p> <p>My question is very simply: How can I make the PUID value in my context.xml a variable that can be read from an environment variable?</p>
0debug
static int pci_cirrus_vga_initfn(PCIDevice *dev) { PCICirrusVGAState *d = DO_UPCAST(PCICirrusVGAState, dev, dev); CirrusVGAState *s = &d->cirrus_vga; PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev); int16_t device_id = pc->device_id; vga_common_init(&s->vga, OBJECT(dev), true); cirrus_init_common(s, OBJECT(dev), device_id, 1, pci_address_space(dev), pci_address_space_io(dev)); s->vga.con = graphic_console_init(DEVICE(dev), 0, s->vga.hw_ops, &s->vga); memory_region_init(&s->pci_bar, OBJECT(dev), "cirrus-pci-bar0", 0x2000000); memory_region_add_subregion(&s->pci_bar, 0, &s->cirrus_linear_io); memory_region_add_subregion(&s->pci_bar, 0x1000000, &s->cirrus_linear_bitblt_io); pci_register_bar(&d->dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->pci_bar); if (device_id == CIRRUS_ID_CLGD5446) { pci_register_bar(&d->dev, 1, 0, &s->cirrus_mmio_io); return 0;
1threat
static void aux_bus_map_device(AUXBus *bus, AUXSlave *dev, hwaddr addr) { memory_region_add_subregion(bus->aux_io, addr, dev->mmio); }
1threat
Compare names in columns and copy paste totals in matching columns on different worksheets : I need to create a Macro to compare last names in columns on 2 separate worksheets, and when there matches with the last names copy and paste totals from a different column from one worksheet to another. [Sheet1 where the totals should be copied to, once names on both sheets match[\]\[1\]][1] [Sheet 2 where the totals should be copied from once the names match][2] [1]: https://i.stack.imgur.com/UnqeW.png [2]: https://i.stack.imgur.com/d3Q7v.png
0debug
Go to hyperlink on scroll? : <p>I have a question:</p> <p>Is it possible to go to a hyperlink once you scroll past a certain point? I don't mean jumping to an anchor, I mean once you scroll past an anchor or point a new page loads.</p> <p>Any help will be appreciated!</p> <p>Thanks,</p> <p>Samson Zhang</p>
0debug
Customise array of object to string : <p>Hi now i'm working on some laravel generator stuff to provide user to user admin panel for generator. <a href="https://github.com/nicoaudy/laravelmanthra" rel="nofollow noreferrer">laravel manthra</a>. i have some issue when to merging and custom array to string. I have array like this :</p> <pre class="lang-php prettyprint-override"><code>array:3 [ 0 =&gt; array:2 [ "name" =&gt; "name" "type" =&gt; "string" ] 1 =&gt; array:2 [ "name" =&gt; "slug" "type" =&gt; "string" ] 2 =&gt; array:2 [ "name" =&gt; "content" "type" =&gt; "text" ] ] </code></pre> <p>i want merge array object with <code>#</code> separator, each object should separates with <code>;</code>. Result something like this</p> <pre class="lang-php prettyprint-override"><code>name#string;slug#string;content#text; </code></pre> <p>how can i achieve this, thanks for your help! 🔥</p>
0debug
Visual Studio NHibernate CreateSQLQuery(string) throws System.ArgumentException : I`m trying to select data from db with NHibernate v.5.1.3 in Visual Studio 2017 using `CreateSQLQuery("Select name from student").List< **object[]**> ()` and, it throws **System.ArgumentException**, because my query **have to return 1 column**. With two or more columns it works properly. But it is no way to change the type of List< object[]> because it was used many times in code. How can we resolve this problem?
0debug
Project Euler #1 Python Using list sum and while loops : x = 3 y = 5 x_list = [] y_list = [] while x < 1000: x_list.append(x) x += 3 while y < 1000: y_list.append(y) y += 5 numsum = sum(x_list + y_list) print(numsum) I am getting an output of 266333, and am unsure of why this code doesn't get me the correct answer
0debug
type_init(assign_register_types) static void assigned_dev_load_option_rom(AssignedDevice *dev) { int size = 0; pci_assign_dev_load_option_rom(&dev->dev, OBJECT(dev), &size, dev->host.domain, dev->host.bus, dev->host.slot, dev->host.function); if (!size) { error_report("pci-assign: Invalid ROM."); } }
1threat
document.location = 'http://evil.com?username=' + user_input;
1threat
static void gen_icread(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } #endif }
1threat
void host_net_remove_completion(ReadLineState *rs, int nb_args, const char *str) { NetClientState *ncs[MAX_QUEUE_NUM]; int count, i, len; len = strlen(str); readline_set_completion_index(rs, len); if (nb_args == 2) { count = qemu_find_net_clients_except(NULL, ncs, NET_CLIENT_OPTIONS_KIND_NONE, MAX_QUEUE_NUM); for (i = 0; i < count; i++) { int id; char name[16]; if (net_hub_id_for_client(ncs[i], &id)) { continue; } snprintf(name, sizeof(name), "%d", id); if (!strncmp(str, name, len)) { readline_add_completion(rs, name); } } return; } else if (nb_args == 3) { count = qemu_find_net_clients_except(NULL, ncs, NET_CLIENT_OPTIONS_KIND_NIC, MAX_QUEUE_NUM); for (i = 0; i < count; i++) { int id; const char *name; if (ncs[i]->info->type == NET_CLIENT_OPTIONS_KIND_HUBPORT || net_hub_id_for_client(ncs[i], &id)) { continue; } name = ncs[i]->name; if (!strncmp(str, name, len)) { readline_add_completion(rs, name); } } return; } }
1threat
int ff_wma_end(AVCodecContext *avctx) { WMACodecContext *s = avctx->priv_data; int i; for(i = 0; i < s->nb_block_sizes; i++) ff_mdct_end(&s->mdct_ctx[i]); for(i = 0; i < s->nb_block_sizes; i++) av_free(s->windows[i]); if (s->use_exp_vlc) { free_vlc(&s->exp_vlc); } if (s->use_noise_coding) { free_vlc(&s->hgain_vlc); } for(i = 0;i < 2; i++) { free_vlc(&s->coef_vlc[i]); av_free(s->run_table[i]); av_free(s->level_table[i]); } return 0; }
1threat
scala sum of an array elements through 'while loop' : scala throws me the error whenever i try to add/sum the elements of an array through 'while loop' i am able to get the sum by using 'for loop' def sum(input:Array[Int]):Int= { var i=0; while(i<input.length){ sum=i+input(i); i=i+1; } sum } <console>:17: error: reassignment to val sum= (i+input(i)) ^ <console>:21: error: missing argument list for method sum Unapplied methods are only converted to functions when a function type is expected. You can make this conversion explicit by writing `sum _` or `sum(_)` instead of `sum`. i also tried with return "sum()" but i got a diff error <console>:17: error: reassignment to val sum=i+input(i); ^ <console>:20: error: not enough arguments for method sum: (input: Array[Int])Int. Unspecified value parameter input.sum()
0debug
Why does the reverse() function in the Swift standard library return ReverseRandomAccessCollection? : <p>Now that I've learned Swift (to a reasonable level) I'm trying to get to grips with the standard library, but in truth it's mainly ελληνικά to me!</p> <p>So a specific question: I have an array of strings and I can call reverse() on it.</p> <pre><code>let arr = ["Mykonos", "Rhodes", "Naxos"].reverse() </code></pre> <p>Now naively I thought I'd get back a type of Array from this. (Ruby for example has a similar method that you pass an array and get back an array)</p> <p>But arr is now actually of type</p> <pre><code>ReverseRandomAccessCollection&lt;Array&lt;String&gt;&gt; </code></pre> <p>which is actually a struct, which conforms to CollectionType:</p> <pre><code>public struct ReverseRandomAccessCollection&lt;Base : CollectionType where Base.Index : RandomAccessIndexType&gt; : _ReverseCollectionType </code></pre> <p>This means I can do this:</p> <pre><code>for item in arr { print(item) } </code></pre> <p>but I can't do</p> <pre><code>print(arr[0]) </code></pre> <p>Why is this designed to be this way?</p> <p>Dictionaries in Swift also implement CollectionType, so I can do this:</p> <pre><code>let dict = ["greek" : "swift sometimes", "notgreek" : "ruby for this example"].reverse() </code></pre> <p>But dictionaries are not ordered like arrays, so why can I call reverse() on dicts?</p> <p>Bonus points if anyone can point me in the direction of where I can read up and improve my Swift stdlib foo, Ευχαριστώ!</p>
0debug
static int msix_is_masked(PCIDevice *dev, int vector) { unsigned offset = vector * MSIX_ENTRY_SIZE + MSIX_VECTOR_CTRL; return dev->msix_table_page[offset] & MSIX_VECTOR_MASK; }
1threat
Inputs not triggering if statments in python : <p>I've been working on a python old-shool computer system for fun but when I run the code the inputs don't trigger the next line of code. This is the code: </p> <pre><code>correctPassword = "testpassword" guess = "" guesses = "" query = "" run = 1 datacmd = "" newfilename = "" newtext = "" filename = "" appendtext = "" helpcmd = "" helpdcmd = "" gameselect = "" import time import random import datetime while guess != correctPassword: guess = input("Password: ") print ("loging in") time.sleep(5) print("Login complete.") time.sleep(0.5) while query == "": input("Please select one of the following queries by typing it into the box. data, helpme, games, date, close.") query = input #data section. read, write and edit files here if query == "data": print("Welcome to data. For information on how to use your data section visit the help page.") input("command:") </code></pre> <p>The specific lines are the if query lines. Anyone know why this is happening?</p>
0debug
How to show hidden text on hover? With CSS : I would like to show text on hover at a button or "a" tag. Like you have a Button with some text for example: [Example][1] I already got that when i hover on it that it gets bigger like this: [enter image description here][2] but what I want is, that the text and the image stays on top if i hover and below it there should shown some text on hover. Could anyone help me out there with some random examples? i preshade it, thanks for any answers. [1]: https://i.stack.imgur.com/KX0Kp.png [2]: https://i.stack.imgur.com/qC3WF.png
0debug
void mcf_fec_init(MemoryRegion *sysmem, NICInfo *nd, target_phys_addr_t base, qemu_irq *irq) { mcf_fec_state *s; qemu_check_nic_model(nd, "mcf_fec"); s = (mcf_fec_state *)g_malloc0(sizeof(mcf_fec_state)); s->sysmem = sysmem; s->irq = irq; memory_region_init_io(&s->iomem, &mcf_fec_ops, s, "fec", 0x400); memory_region_add_subregion(sysmem, base, &s->iomem); s->conf.macaddr = nd->macaddr; s->conf.peer = nd->netdev; s->nic = qemu_new_nic(&net_mcf_fec_info, &s->conf, nd->model, nd->name, s); qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a); }
1threat
What switches can run a .exe file with no human interaction? : I am in the process of automating the installation of different programs on a Windows system. I am having a hard time getting programs that end in .EXE to run on their own but I am able to have scripts that end in .MSI run with the appropriate switches. 1. I am not in a position to download additional software to accomplish this goal. 2. In the command Prompt I would enter: "\\temp\Notepad++\Current Installer\npp current installer.exe" /(? or h or help) to see what switches were available. I expect the program to install and that the batch script that contains this process proceeds to close on its own. Instead the process requires user input an becomes manual than automatic
0debug
onclick = return confirm () not working in me : hy Im new in php,please help me, <td><a onclick='return confirm('Are you sure?') href='Delete_Vendor.php?ID=$row[ID]' ;> Delete </a> </td> this code working in me but the alert of " Are you sure? " are not showing up. can someone help me? thanks alot regards
0debug
How many training examples should i take for a convoluted neural network , which takes an input image of 180x180 pixels? : Hi i am building a CNN for face recognition(specifically only my face).I would be resizing my images to around 180x180 pixels. how many images should i have in my dataset so as to get good results. For normal neural nets i know the number of features should be less than data set so as to prevent overfitting, but is it true for CNN also ? Thanks in advance EDIT: what i would be doing is just classifying my image as 'mypic' and other peoples image as 'others'
0debug
Access THIS inside Jquery listener : <p>I'm trying to achieve the task shown by the example code below, but get this error :</p> <blockquote> <p>Uncaught TypeError: this.myFunction is not a function</p> </blockquote> <p>I know i'm doing something wrong but don't know the right way to do it : how can i access the 'this' object inside a Jquery listener ?</p> <p>Thanks in advance !</p> <pre><code>var MyClass = function () { return { myFunction: function () { console.log('Do something'); }, myOtherFunction: function() { $('#myButton').on('click', function () { this.myFunction(); // here i get the error }); } } } </code></pre>
0debug
I want to use named parameters in Dart for clarity. How should I handle them? : <p>TL;DR: Named parameters are optional as a result of <a href="https://github.com/dart-lang/sdk/issues/4188" rel="noreferrer">a conscious design choice</a>. Short of having official language support, is there any way to enforce (and inform) required named arguments?</p> <hr> <p>I find it extremely useful to use named parameters when defining a class. Take, for instance, an <code>Ability</code> in an MMORPG:</p> <pre><code>class Ability { final name; final effectDuration; final recast; // wait time until next use // ... } </code></pre> <p><code>effectDuration</code> and <code>recast</code> both carry the same type of information (i.e. duration of time) and are likely represented by the same datatype. It is easy to mix up which number goes where. However, they are both information vital to the correctness of the object, so they can't be missing during instantiation.</p> <p>I could just break the program via a try-catch to enforce the requirement of those parameters, but that doesn't sound like fun for someone who uses the class and has no idea (short of reading the docs and understanding intuitively what the class does) that they are required.</p> <p>Is there any way to enforce the requirement of certain named parameters while managing to inform the caller of said requirement and/or help them use it correctly?</p>
0debug
How do I obtain spaces before prepositions? : <p>I have the string 'WordsofWisdom' and if I apply this:</p> <pre><code>replaceAll("([^_])([A-Z])", "$1 $2") </code></pre> <p>it produces 'Wordsof Wisdom', but what do I have to write to obtain a space before the word 'of'?</p>
0debug
How can i pass parameters in assembler x86 function call : <p>Look at this assembler code. It is designed for 32 bits x86 and will be compiled by nasm</p> <pre><code> ... my_function: pop %eax ... ret main: push 0x08 call my_function </code></pre> <p>I have learned a long time ago that we can use stack for passing parameters between main program and functions. I would expect that eax contains 0x08, but this is false and i can not explain why. How should i do for fetching my function parameters ?</p>
0debug
static void qvirtio_pci_queue_select(QVirtioDevice *d, uint16_t index) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; qpci_io_writeb(dev->pdev, dev->addr + VIRTIO_PCI_QUEUE_SEL, index); }
1threat
How a button click can call another class? : So I am trying to create an android app to show some simple battery information. And now I want to take that info and plot a graph inside the app. I have the following codes: public class MainActivity extends ActionBarActivity { private TextView level,voltage, status1,temp,health1,tech,sour,amp; Thread myThread; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); level=(TextView)findViewById(R.id.level); voltage=(TextView)findViewById(R.id.volt); status1=(TextView)findViewById(R.id.stat); temp=(TextView)findViewById(R.id.temp); health1=(TextView)findViewById(R.id.healt); tech=(TextView)findViewById(R.id.tech); sour=(TextView)findViewById(R.id.source); Button b = (Button) findViewById(R.id.ex); Button g = (Button) findViewById(R.id.graphButton); amp=(TextView)findViewById(R.id.current); b.setOnClickListener(new View.OnClickListener(){ public void onClick(View v) { // TODO Auto-generated method stub finish(); System.exit(0);} }); g.setOnClickListener(new View.OnClickListener(){ public void onClick(View v) { final DynamicGraphActivity test=new DynamicGraphActivity (); } }); this.registerReceiver(this.myBatteryReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); } private BroadcastReceiver myBatteryReceiver = new BroadcastReceiver(){ @SuppressLint("InlinedApi") @Override public void onReceive(Context arg0, Intent arg1) { // TODO Auto-generated method stub if (arg1.getAction().equals(Intent.ACTION_BATTERY_CHANGED)){ int lv = arg1.getIntExtra("level", 0); level.setText("Level: " + String.valueOf(lv) + "%"); voltage.setText("Voltage: " + String.valueOf((float)arg1.getIntExtra("voltage", 0)/1000) + "V"); temp.setText("Temperature: " + String.valueOf((float)arg1.getIntExtra("temperature", 0)/10) + "c"); tech.setText("Technology: " + arg1.getStringExtra("technology")); int status = arg1.getIntExtra("status", BatteryManager.BATTERY_STATUS_UNKNOWN); String strStatus; if (status == BatteryManager.BATTERY_STATUS_CHARGING){ strStatus = "Charging"; } else if (status == BatteryManager.BATTERY_STATUS_DISCHARGING){ strStatus = "Dis-charging"; } else if (status == BatteryManager.BATTERY_STATUS_NOT_CHARGING){ strStatus = "Not charging"; } else if (status == BatteryManager.BATTERY_STATUS_FULL){ strStatus = "Full"; } else { strStatus = "Unknown"; } status1.setText("Status: " + strStatus); //int source=arg1.getIntExtra("source", BatteryManager.BATTERY_STATUS_UNKNOWN); if(Build.VERSION.SDK_INT >= 21){ BatteryManager battery = (BatteryManager)getSystemService(Context.BATTERY_SERVICE); int current=battery.getIntProperty(BatteryManager.BATTERY_PROPERTY_CURRENT_NOW); int currentAvg=battery.getIntProperty(BatteryManager.BATTERY_PROPERTY_CURRENT_AVERAGE); int energy=battery.getIntProperty(BatteryManager.BATTERY_PROPERTY_ENERGY_COUNTER); int capacity=battery.getIntProperty(BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER); int bCapacity=battery.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY); String string1 = "Current: "+ current*1000+" uA"+"\n"; string1+="Average Current: "+currentAvg+" uA"+"\n"; string1+="Remaining energy: "+energy+" nWh"+"\n"; string1+="Capacity: "+capacity+" uAh"+"\n\n"; amp.setText(string1); } int health = arg1.getIntExtra("health", BatteryManager.BATTERY_HEALTH_UNKNOWN); String strHealth; if (health == BatteryManager.BATTERY_HEALTH_GOOD){ strHealth = "Good"; } else if (health == BatteryManager.BATTERY_HEALTH_OVERHEAT){ strHealth = "Over Heat"; } else if (health == BatteryManager.BATTERY_HEALTH_DEAD){ strHealth = "Dead"; } else if (health == BatteryManager.BATTERY_HEALTH_OVER_VOLTAGE){ strHealth = "Over Voltage"; } else if (health == BatteryManager.BATTERY_HEALTH_UNSPECIFIED_FAILURE){ strHealth = "Unspecified Failure"; } else{ strHealth = "Unknown"; } health1.setText("Health: " + strHealth); } } }; @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } 2nd class: public class DynamicGraphActivity extends Activity { private static GraphicalView view; private LineGraph line = new LineGraph(); private static Thread thread; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); thread = new Thread() { public void run() { for (int i = 0; i < 15; i++) { try { Thread.sleep(2000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } Point p = MockData.getDataFromReceiver(i); // We got new data! line.addNewPoints(p); // Add it to our graph view.repaint(); } } }; thread.start(); } @Override protected void onStart() { super.onStart(); view = line.getView(this); setContentView(view); } } import org.achartengine.ChartFactory; import org.achartengine.GraphicalView; import org.achartengine.chart.PointStyle; import org.achartengine.model.TimeSeries; import org.achartengine.model.XYMultipleSeriesDataset; import org.achartengine.renderer.XYMultipleSeriesRenderer; import org.achartengine.renderer.XYSeriesRenderer; import android.content.Context; import android.graphics.Color; public class LineGraph { private GraphicalView view; private TimeSeries dataset = new TimeSeries("Rain Fall"); private XYMultipleSeriesDataset mDataset = new XYMultipleSeriesDataset(); private XYSeriesRenderer renderer = new XYSeriesRenderer(); // This will be used to customize line 1 private XYMultipleSeriesRenderer mRenderer = new XYMultipleSeriesRenderer(); // Holds a collection of XYSeriesRenderer and customizes the graph public LineGraph() { // Add single dataset to multiple dataset mDataset.addSeries(dataset); // Customization time for line 1! renderer.setColor(Color.WHITE); renderer.setPointStyle(PointStyle.SQUARE); renderer.setFillPoints(true); // Enable Zoom mRenderer.setZoomButtonsVisible(true); mRenderer.setXTitle("Day #"); mRenderer.setYTitle("CM in Rainfall"); // Add single renderer to multiple renderer mRenderer.addSeriesRenderer(renderer); } public GraphicalView getView(Context context) { view = ChartFactory.getLineChartView(context, mDataset, mRenderer); return view; } public void addNewPoints(Point p) { dataset.add(p.getX(), p.getY()); } } import java.util.Random; public class MockData { // x is the day number, 0, 1, 2, 3 public static Point getDataFromReceiver(int x) { return new Point(x, generateRandomData()); } private static int generateRandomData() { Random random = new Random(); return random.nextInt(40); } } public class Point { private int x; private int y; public Point( int x, int y) { this.x = x; this.y = y; } public int getX() { return x; } public int getY() { return y; } } Now inside the button g, I want to call DynamicGraphActivity class so that it calls the class and plots a graph using some random values. but its not working. When i click on the button, it doesnt do anything. How can I fix this? And my another question is, how can I plot the battery info such as voltage, charge or discharge over time using these codes/ Any help would be greatly appreciated. Thank you
0debug
static void readline_completion(ReadLineState *rs) { Monitor *mon = cur_mon; int len, i, j, max_width, nb_cols, max_prefix; char *cmdline; rs->nb_completions = 0; cmdline = g_malloc(rs->cmd_buf_index + 1); memcpy(cmdline, rs->cmd_buf, rs->cmd_buf_index); cmdline[rs->cmd_buf_index] = '\0'; rs->completion_finder(cmdline); g_free(cmdline); if (rs->nb_completions <= 0) return; if (rs->nb_completions == 1) { len = strlen(rs->completions[0]); for(i = rs->completion_index; i < len; i++) { readline_insert_char(rs, rs->completions[0][i]); if (len > 0 && rs->completions[0][len - 1] != '/') readline_insert_char(rs, ' '); } else { monitor_printf(mon, "\n"); max_width = 0; max_prefix = 0; for(i = 0; i < rs->nb_completions; i++) { len = strlen(rs->completions[i]); if (i==0) { max_prefix = len; } else { if (len < max_prefix) max_prefix = len; for(j=0; j<max_prefix; j++) { if (rs->completions[i][j] != rs->completions[0][j]) max_prefix = j; if (len > max_width) max_width = len; if (max_prefix > 0) for(i = rs->completion_index; i < max_prefix; i++) { readline_insert_char(rs, rs->completions[0][i]); max_width += 2; if (max_width < 10) max_width = 10; else if (max_width > 80) max_width = 80; nb_cols = 80 / max_width; j = 0; for(i = 0; i < rs->nb_completions; i++) { monitor_printf(rs->mon, "%-*s", max_width, rs->completions[i]); if (++j == nb_cols || i == (rs->nb_completions - 1)) { monitor_printf(rs->mon, "\n"); j = 0; readline_show_prompt(rs);
1threat
static int parallels_probe(const uint8_t *buf, int buf_size, const char *filename) { const ParallelsHeader *ph = (const void *)buf; if (buf_size < sizeof(ParallelsHeader)) return 0; if ((!memcmp(ph->magic, HEADER_MAGIC, 16) || !memcmp(ph->magic, HEADER_MAGIC2, 16)) && (le32_to_cpu(ph->version) == HEADER_VERSION)) return 100; return 0; }
1threat
How can I implement asyncio websockets in a class? : <p>I would like to connect to a websocket via <code>asyncio</code> and <code>websockets</code>, with a format as shown below. How would I be able to accomplish this?</p> <pre><code>from websockets import connect class EchoWebsocket: def __init__(self): self.websocket = self._connect() def _connect(self): return connect("wss://echo.websocket.org") def send(self, message): self.websocket.send(message) def receive(self): return self.websocket.recv() echo = EchoWebsocket() echo.send("Hello!") print(echo.receive()) # "Hello!" </code></pre>
0debug
void avcodec_get_context_defaults2(AVCodecContext *s, enum CodecType codec_type){ int flags=0; memset(s, 0, sizeof(AVCodecContext)); s->av_class= &av_codec_context_class; s->codec_type = codec_type; if(codec_type == CODEC_TYPE_AUDIO) flags= AV_OPT_FLAG_AUDIO_PARAM; else if(codec_type == CODEC_TYPE_VIDEO) flags= AV_OPT_FLAG_VIDEO_PARAM; else if(codec_type == CODEC_TYPE_SUBTITLE) flags= AV_OPT_FLAG_SUBTITLE_PARAM; av_opt_set_defaults2(s, flags, flags); s->rc_eq= av_strdup("tex^qComp"); s->time_base= (AVRational){0,1}; s->get_buffer= avcodec_default_get_buffer; s->release_buffer= avcodec_default_release_buffer; s->get_format= avcodec_default_get_format; s->execute= avcodec_default_execute; s->sample_aspect_ratio= (AVRational){0,1}; s->pix_fmt= PIX_FMT_NONE; s->sample_fmt= SAMPLE_FMT_S16; s->palctrl = NULL; s->reget_buffer= avcodec_default_reget_buffer; }
1threat
Stored Procedures & SQL : I'm doing some revision on SQL and I have a question that I'm trying to work out, I'm meant to be creating a stored procedure that displays all details of branch name, book code, and quantity on hand,the stored procedure takes paramater called @BranchName, I'm also meant to use EXEC to call this procedure with a value for the parameter. This is my statement so far. **(I know that it's wrong and doesn't work some reason, I can't work it out)** > CREATE PROCEDURE BranchDetails > SELECT B.BookCode, BR.BranchName, I.OnHand > FROM BOOK, BRANCH, INVENTORY > WHERE BranchName = 'BookCode'
0debug
R : understanding simplified script with brackets or hooks? : <p>I would like to understand how really works this script :</p> <p><code>y &lt;- y[keep, , keep.lib.sizes=FALSE]</code></p> <p>in : <code>keep &lt;- rowSums(cpm(y)&gt;1) &gt;= 3 y &lt;- y[keep, , keep.lib.sizes=FALSE]</code></p> <p>I do know <code>d.f[a,b]</code> but I can not find R-doc for <code>d.f[a, ,b]</code>.</p> <p>I tried "brackets", "hooks", "commas"... :-(</p> <p>(Sometimes I would prefer that one does not simplifie his R script !)</p> <p>Thanks in advance.</p>
0debug
We're sorry, but something went wrong.If you are the application owner check the logs for more information : When I go to update the page "localhost: 3000" at the end of the lesson happens what you see in the picture that I have attached. While if I unload "node.js" the "localhost: 3000" does not work anymore, ie it gives me this error "We're sorry, but something went wrong.If you are the application owner check the logs for more information." Why? [Image][1] [1]: https://i.stack.imgur.com/qYzqk.png
0debug
Xamarin Unknown Build Error : I'm new here and my English language is not very good. I installed xamarin. Now I want test compiling with a blank app but it can't compile. It has an unknown error: [http://cd8ba0b44a15c10065fd-24461f391e20b7336331d5789078af53.r23.cf1.rackcdn.com/xamarin.vanillaforums.com/FileUpload/a1/092e22f68d6fb1e587c7eac985617c.png][1] [1]: http://i.stack.imgur.com/zzOeT.png
0debug
document.location = 'http://evil.com?username=' + user_input;
1threat
You uploaded an APK that is not zip aligned. You will need to run a zip align tool on your APK and upload it again : Gives this error on updating my 2nd version on google play store for beta testing. My first version was developed in eclipse whereas this version is in android studio. Please help.
0debug
vmdk_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { BDRVVmdkState *s = bs->opaque; int ret; uint64_t n_bytes, offset_in_cluster; VmdkExtent *extent = NULL; QEMUIOVector local_qiov; uint64_t cluster_offset; uint64_t bytes_done = 0; qemu_iovec_init(&local_qiov, qiov->niov); qemu_co_mutex_lock(&s->lock); while (bytes > 0) { extent = find_extent(s, offset >> BDRV_SECTOR_BITS, extent); if (!extent) { ret = -EIO; goto fail; } ret = get_cluster_offset(bs, extent, NULL, offset, false, &cluster_offset, 0, 0); offset_in_cluster = vmdk_find_offset_in_cluster(extent, offset); n_bytes = MIN(bytes, extent->cluster_sectors * BDRV_SECTOR_SIZE - offset_in_cluster); if (ret != VMDK_OK) { if (bs->backing && ret != VMDK_ZEROED) { if (!vmdk_is_cid_valid(bs)) { ret = -EINVAL; goto fail; } qemu_iovec_reset(&local_qiov); qemu_iovec_concat(&local_qiov, qiov, bytes_done, n_bytes); ret = bdrv_co_preadv(bs->backing->bs, offset, n_bytes, &local_qiov, 0); if (ret < 0) { goto fail; } } else { qemu_iovec_memset(qiov, bytes_done, 0, n_bytes); } } else { qemu_iovec_reset(&local_qiov); qemu_iovec_concat(&local_qiov, qiov, bytes_done, n_bytes); ret = vmdk_read_extent(extent, cluster_offset, offset_in_cluster, &local_qiov, n_bytes); if (ret) { goto fail; } } bytes -= n_bytes; offset += n_bytes; bytes_done += n_bytes; } ret = 0; fail: qemu_co_mutex_unlock(&s->lock); qemu_iovec_destroy(&local_qiov); return ret; }
1threat
Regex - Extract string between square bracket tag : <p>I've tags in string like <code>[note]some text[/note]</code> where I want to extract the inside text between the tags.</p> <p>Sample Text:</p> <pre><code>Want to extract data [note]This is the text I want to extract[/note] but this is not only tag [note]Another text I want to [text:sample] extract[/note]. Can you do it? </code></pre> <p>From the given text, extract following:</p> <p><code>This is the text I want to extract</code></p> <p><code>Another text I want to [text:sample] extract</code></p>
0debug
clarification using strdup() or strcpy() : <p>i have a problem this method works fine, it returns a struct with the right NaME value</p> <pre><code>prodotti creaProdotto(char *name, float price, prodotti next){ prodotti p = malloc(sizeof(prodotti)); p-&gt;name = malloc(30 * sizeof(char)); p-&gt;name = strdup( name); p-&gt;price = price; p-&gt;next = next; return p; } </code></pre> <p>else this do not works,</p> <pre><code>prodotti creaProdotto(char *name, float price, prodotti next){ prodotti p = malloc(sizeof(prodotti)); p-&gt;name = malloc(30 * sizeof(char)); strcpy(p-&gt;name, name); p-&gt;price = price; p-&gt;next = next; return p; } </code></pre> <p>the problem in the second is: name does not contains the right value, please explain ne why.</p>
0debug
Necessisty of Comparable interface : <p>Comparable interface contains only one method <code>compareTo(T o)</code>and for example <code>Collections.sort()</code> method first type-cast the compared object to <code>Comparable</code> and then compares it.</p> <p>Now I am unable to understand why we need this process in the first place. Wouldn't it be just simpler to call directly <code>compareTo()</code> method of the object and get rid of the <code>Comparable</code> interface? If the object doesn't have <code>compareTo()</code> method it would raise an error anyway just like it does if the object didn't implement <code>Comparable</code> interface.</p> <p>Besides I don't see a reason one would need a <code>Comparable</code> type object. Is there any advantages of having a <code>Comparable</code> interface ? </p>
0debug
Is it possible to emulate the notch from the Huawei P20 with Android Studio : <p>Huawei's P20 has an iPhone X like notch on the top of the screen. Can this "notch" be emulated in Android Studio so it is possible to test how an app is rendered on it without owning a P20? I looked in the settings and it is possible to select a "skin" in the Hardware profile but Huawei's P20 is not part of it.</p>
0debug
pip or pip3 to install packages for Python 3? : <p>I have a Macbook with OS X El Captain. I think that <code>Python 2.7</code> comes preinstalled on it. However, I installed <code>Python 3.5</code> too. When I started using <code>Python 3</code>, I read that if I want to install a package, I should type:</p> <pre><code>pip3 install some_package </code></pre> <p>Anyway, now when I use</p> <pre><code>pip install some_package </code></pre> <p>I get <code>some_package</code> installed for <code>Python 3</code>. I mean I can import it and use it without problems. Moreover, when I type just <code>pip3</code> in <code>Terminal</code>, I got this message about the usage:</p> <pre><code>Usage: pip &lt;command&gt; [options] </code></pre> <p>which is the same message I get when I type just <code>pip</code>.</p> <p>Does it mean that in previos versions, things were different, and now <code>pip</code> and <code>pip3</code> can be used interchangeably? If so, and for the sake of argument, how can I install packages for <code>Python 2</code> instead of <code>Python 3</code>?</p>
0debug
Gson Deserialization with Kotlin, Initializer block not called : <p>My initializer block is working perfectly fine when I create my Object</p> <pre><code>class ObjectToDeserialize(var someString: String = "") : Serializable { init{ someString += " initialized" } } </code></pre> <p>this way:</p> <pre><code>@Test fun createObject_checkIfInitialized() { assertEquals("someString initialized",ObjectToDeserialize("someString").someString) } </code></pre> <p>But when I deserialize the object with Gson, the initializer block does not get executed:</p> <pre><code>@Test fun deserializeObject_checkIfInitialized(){ val someJson: String = "{\"someString\":\"someString\" }" val jsonObject = Gson().fromJson(someJson, ObjectToDeserialize::class.java) assertEquals("someString initialized",jsonObject.someString) // Expected :someString initialized // Actual :someString } </code></pre> <p>I think that gson is creating the object in a different way than by executing the primary constructor. Is it nevertheless possible to have something similar like initializer blocks?</p> <hr>
0debug
static void spatial_decompose97i(DWTELEM *buffer, int width, int height, int stride){ int y; DWTELEM *b0= buffer + mirror(-4-1, height-1)*stride; DWTELEM *b1= buffer + mirror(-4 , height-1)*stride; DWTELEM *b2= buffer + mirror(-4+1, height-1)*stride; DWTELEM *b3= buffer + mirror(-4+2, height-1)*stride; for(y=-4; y<height; y+=2){ DWTELEM *b4= buffer + mirror(y+3, height-1)*stride; DWTELEM *b5= buffer + mirror(y+4, height-1)*stride; {START_TIMER if(b3 <= b5) horizontal_decompose97i(b4, width); if(y+4 < height) horizontal_decompose97i(b5, width); if(width>400){ STOP_TIMER("horizontal_decompose97i") }} {START_TIMER if(b3 <= b5) vertical_decompose97iH0(b3, b4, b5, width); if(b2 <= b4) vertical_decompose97iL0(b2, b3, b4, width); if(b1 <= b3) vertical_decompose97iH1(b1, b2, b3, width); if(b0 <= b2) vertical_decompose97iL1(b0, b1, b2, width); if(width>400){ STOP_TIMER("vertical_decompose97i") }} b0=b2; b1=b3; b2=b4; b3=b5; } }
1threat
static int qemu_rdma_init_ram_blocks(RDMAContext *rdma) { RDMALocalBlocks *local = &rdma->local_ram_blocks; assert(rdma->blockmap == NULL); rdma->blockmap = g_hash_table_new(g_direct_hash, g_direct_equal); memset(local, 0, sizeof *local); qemu_ram_foreach_block(qemu_rdma_init_one_block, rdma); DPRINTF("Allocated %d local ram block structures\n", local->nb_blocks); rdma->block = (RDMARemoteBlock *) g_malloc0(sizeof(RDMARemoteBlock) * rdma->local_ram_blocks.nb_blocks); local->init = true; return 0; }
1threat
Pass data through navigation back button : <p>I am in this situation:</p> <p><a href="https://i.stack.imgur.com/si4UZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/si4UZ.png" alt="img1"></a></p> <p>I am passing 4 array from Progress Table to Detail Exercise using prepare for segue and it works fine! The problem begin when I try to pass the data back from the Detail Exercise Controller to the Progress Table Controller. I would like to use the default navigation back button to go back to the parent view. Actually I'm using this code but it doesn't work, well the data pass from the child to the parent view but i can't see the result in the Progress Table, seems like i need to refresh but i also tryed the reloadData after the viewDidLoad and it doesn't work. Any suggestion? Thank you.</p> <pre><code>override func viewWillDisappear(animated : Bool) { super.viewWillDisappear(animated) if (self.isMovingFromParentViewController()){ print("n'drio") let historyView = self.storyboard!.instantiateViewControllerWithIdentifier("historyView") as! HistoryTableViewController historyView.isFirstTime = false historyView.arrayData = arrayDataDetails historyView.arrayRipetizioni = arrayRipetizioniDetails historyView.arrayPeso = arrayPesoDetails historyView.arrayRecupero = arrayRecuperoDetails historyView.tableView.reloadData() } } </code></pre>
0debug
static inline void RENAME(rgb24tobgr32)(const uint8_t *src, uint8_t *dst, int src_size) { uint8_t *dest = dst; const uint8_t *s = src; const uint8_t *end; const uint8_t *mm_end; end = s + src_size; __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory"); mm_end = end - 23; __asm__ volatile("movq %0, %%mm7"::"m"(mask32a):"memory"); while (s < mm_end) { __asm__ volatile( PREFETCH" 32%1 \n\t" "movd %1, %%mm0 \n\t" "punpckldq 3%1, %%mm0 \n\t" "movd 6%1, %%mm1 \n\t" "punpckldq 9%1, %%mm1 \n\t" "movd 12%1, %%mm2 \n\t" "punpckldq 15%1, %%mm2 \n\t" "movd 18%1, %%mm3 \n\t" "punpckldq 21%1, %%mm3 \n\t" "por %%mm7, %%mm0 \n\t" "por %%mm7, %%mm1 \n\t" "por %%mm7, %%mm2 \n\t" "por %%mm7, %%mm3 \n\t" MOVNTQ" %%mm0, %0 \n\t" MOVNTQ" %%mm1, 8%0 \n\t" MOVNTQ" %%mm2, 16%0 \n\t" MOVNTQ" %%mm3, 24%0" :"=m"(*dest) :"m"(*s) :"memory"); dest += 32; s += 24; } __asm__ volatile(SFENCE:::"memory"); __asm__ volatile(EMMS:::"memory"); while (s < end) { *dest++ = *s++; *dest++ = *s++; *dest++ = *s++; *dest++ = 255; } }
1threat
static IOMMUTLBEntry s390_translate_iommu(MemoryRegion *mr, hwaddr addr, bool is_write) { uint64_t pte; uint32_t flags; S390PCIIOMMU *iommu = container_of(mr, S390PCIIOMMU, iommu_mr); IOMMUTLBEntry ret = { .target_as = &address_space_memory, .iova = 0, .translated_addr = 0, .addr_mask = ~(hwaddr)0, .perm = IOMMU_NONE, }; switch (iommu->pbdev->state) { case ZPCI_FS_ENABLED: case ZPCI_FS_BLOCKED: if (!iommu->enabled) { return ret; } break; default: return ret; } DPRINTF("iommu trans addr 0x%" PRIx64 "\n", addr); if (addr < iommu->pba || addr > iommu->pal) { return ret; } pte = s390_guest_io_table_walk(s390_pci_get_table_origin(iommu->g_iota), addr); if (!pte) { return ret; } flags = pte & ZPCI_PTE_FLAG_MASK; ret.iova = addr; ret.translated_addr = pte & ZPCI_PTE_ADDR_MASK; ret.addr_mask = 0xfff; if (flags & ZPCI_PTE_INVALID) { ret.perm = IOMMU_NONE; } else { ret.perm = IOMMU_RW; } return ret; }
1threat
Preserve or save default values explicitely in RAD Studio IDE : I'm following the example to load a custom font (Segoe UI) in an Android app: http://community.embarcadero.com/index.php/blogs/entry/true-type-font-iconography-for-android-and-ios-apps My problem is, that the IDE (RAD Studio 10.1 Berlin) does not save default values to FMX files (the form files). At design time the default font seems to be already "Segoe UI", so the IDE shows only `(Default)` in the Object inspector and so does not store that value to the FMX form file. **BUT**, the default font in Android is "Roboto", not "Segoe UI", and the application indeed uses "Roboto" as the default font at runtime. So default values in the object inspector are not preserved for different target platforms. This is very annoying! Is this a (logical) bug in the IDE or how can I disable this IDE feature or explicitely set a value at **design time** (which is accidentally also the default value at design time in the IDE under Windows) and preserve it for the target platform (in this case Android)? I tried to go to text mode of the FMX form file and set it manually there, but when switching back to design mode, the IDE changes the value in the object inspector back to `(Default)` and when going back again to text-mode of the FMX form file, that line is removed. I want/need to set it at design time, not runtime, but I can't make it. I also need such default values for other properties, not only the font.
0debug
Swift find if a String.Index is undefined : <p>I want to find if my variable midPoint is undefined. Unfortunately the following will not compile</p> <pre><code>let midPoint : String.Index if (typeof midPoint === "undefined" ) {print ("undefined")} </code></pre> <blockquote> <p>typeof</p> </blockquote> <p>does not work, and neither does </p> <blockquote> <p>type</p> </blockquote>
0debug
static void lfe_downsample(DCAEncContext *c, const int32_t *input) { const int lfech = lfe_index[c->channel_config]; int i, j, lfes; int32_t hist[512]; int32_t accum; int hist_start = 0; for (i = 0; i < 512; i++) hist[i] = c->history[i][c->channels - 1]; for (lfes = 0; lfes < DCA_LFE_SAMPLES; lfes++) { accum = 0; for (i = hist_start, j = 0; i < 512; i++, j++) accum += mul32(hist[i], lfe_fir_64i[j]); for (i = 0; i < hist_start; i++, j++) accum += mul32(hist[i], lfe_fir_64i[j]); c->downsampled_lfe[lfes] = accum; for (i = 0; i < 64; i++) hist[i + hist_start] = input[(lfes * 64 + i) * c->channels + lfech]; hist_start = (hist_start + 64) & 511; } }
1threat
How do I check that a docker host is in swarm mode? : <p>After executing this;</p> <pre><code>eval $(docker-machine env mymachine) </code></pre> <p>How do I check if the docker daemon on <code>mymachine</code> is a swarm manager?</p>
0debug
Bind query to props with vue-router : <p>Is it possible to bind query values to props declaratively? </p> <p>I want <code>/my-foo?bar=my-bar</code> to pass the props <code>{foo: "my-foo", bar: "my-bar"}</code>.</p> <p>I'm currently using something like this:</p> <pre><code>export default new Router({ routes: [ { path: "/:foo", name: "Foo", component: FooPage, props: route =&gt; ({ foo: route.params.foo, bar: route.query.bar}) } ] }); </code></pre> <p>And I'm looking for something like: </p> <pre><code>export default new Router({ routes: [ { path: "/:foo?bar=:bar", name: "Foo", component: FooPage, props: true } ] }); </code></pre> <p>I'm using vue-router 2.3.1</p>
0debug
static int hda_codec_dev_init(DeviceState *qdev, DeviceInfo *base) { HDACodecBus *bus = DO_UPCAST(HDACodecBus, qbus, qdev->parent_bus); HDACodecDevice *dev = DO_UPCAST(HDACodecDevice, qdev, qdev); HDACodecDeviceInfo *info = DO_UPCAST(HDACodecDeviceInfo, qdev, base); dev->info = info; if (dev->cad == -1) { dev->cad = bus->next_cad; } if (dev->cad > 15) return -1; bus->next_cad = dev->cad + 1; return info->init(dev); }
1threat
static OSStatus ffat_encode_callback(AudioConverterRef converter, UInt32 *nb_packets, AudioBufferList *data, AudioStreamPacketDescription **packets, void *inctx) { AVCodecContext *avctx = inctx; ATDecodeContext *at = avctx->priv_data; if (at->eof) { *nb_packets = 0; return 0; } av_frame_unref(&at->in_frame); av_frame_move_ref(&at->in_frame, &at->new_in_frame); if (!at->in_frame.data[0]) { *nb_packets = 0; return 1; } data->mNumberBuffers = 1; data->mBuffers[0].mNumberChannels = avctx->channels; data->mBuffers[0].mDataByteSize = at->in_frame.nb_samples * av_get_bytes_per_sample(avctx->sample_fmt) * avctx->channels; data->mBuffers[0].mData = at->in_frame.data[0]; if (*nb_packets > at->in_frame.nb_samples) *nb_packets = at->in_frame.nb_samples; return 0; }
1threat
Fabric.io: new app does not show up in the dashboard : <p>For some reason we needed to change the package-id of our existing android application. We already use Fabric for Crashlytics. </p> <p>I'm trying to bring that new app up in the Fabric dashboard, but it's not showing there, despite the device log showing no issues (as fas as I can see): <a href="https://i.stack.imgur.com/b0tDV.png" rel="noreferrer">device log</a></p> <p>Any ideas why the new package-id isn't visible in our dashboard?</p> <p>Best, Sven</p>
0debug
How to use dotenv with Vue.js : <p>I'm trying to add some environment variables into my vue app.</p> <p>here is content of my <code>.env</code> file, which is placed on root(outside <code>src</code>):</p> <pre><code>VUE_APP_GOODREADS_KEY = my_key </code></pre> <p>and I added code for dot env on the top of my <code>main.js</code></p> <pre><code>import Vue from 'vue' import App from './App' import VueResource from 'vue-resource' import Vuetify from 'vuetify' import dotenv from 'dotenv' dotenv.config() import { router } from './router' import store from './store' </code></pre> <p>I want to use this variable within my store <code>./store/index.js</code></p> <p>I tried to console.log environment variables within store but no luck:</p> <pre><code>console.log(process.env) </code></pre> <p>But all I'm getting is </p> <pre><code>NODE_ENV:"development" </code></pre> <p>Only related thread I found was <a href="https://stackoverflow.com/questions/39426214/load-environment-variables-into-vue-js">Load environment variables into vue.js</a>, but it only mentions how to use existing variables in the <code>process.env</code>. I want to add environment variables using dotenv. Why this code is not working?</p>
0debug
def max_similar_indices(test_list1, test_list2): res = [(max(x[0], y[0]), max(x[1], y[1])) for x, y in zip(test_list1, test_list2)] return (res)
0debug
void bdrv_aio_cancel(BlockAIOCB *acb) { qemu_aio_ref(acb); bdrv_aio_cancel_async(acb); while (acb->refcnt > 1) { if (acb->aiocb_info->get_aio_context) { aio_poll(acb->aiocb_info->get_aio_context(acb), true); } else if (acb->bs) { aio_poll(bdrv_get_aio_context(acb->bs), true); } else { abort(); } } qemu_aio_unref(acb); }
1threat
ORDER BY TWO COLUMNS IF RESULT IS REQUL CONSIDER ANOTHER COLOUMN : am having a table called marks. total_marks and aggregate . iwant to sort the results first depending on the aggregate .but when the aggregate in the same colom is equal to the next the consider the student with the highest total ie oder by agregate bu if the last aggregate is equal to the new one then give the highest rank to the one wiith higher total
0debug
Graphlab commercial license : <p>Is anyone using Graphlab machine learning modules with a commercial license ? I cannot find any information about a commercial license on their website since they got acquired by Apple. </p> <p>Thanks, Ashish</p>
0debug
How to create a page automatically after pressing the Submit button (HTML) : <p>When I enter information in a website then press the Submit button, the information is automatically saved in a database after that how the information display on a page?</p> <p>Example: I entered my personal information in a website and saved it by pressing the submit button then I will see my profile page How did this happen? and would I need to specify the action in the form if the page shows up when the end user submits the info?</p> <p>like in StackOverflow site when we create an account automatically we have a URL and page contain our information</p> <p>NOTE: I am a beginner in coding</p>
0debug
Cloud Foundry - How to fetch all apps running across Orgs? : Using `cf cli`, I can login with a specific org(as option) and get the list of apps across spaces in that specific org. `cf login --skip-ssl-validation -a <URL> -u <user_name> -p <password> -o <org_name> -s <space>` ----------------------------------------------------- Org names can be increasing/decreasing, as multiple users access app manager To write a custom tool to get list of all `Running` apps(and its details) across orgs, does cloud foundry provide any API?
0debug
int avpriv_unlock_avformat(void) { if (lockmgr_cb) { if ((*lockmgr_cb)(&avformat_mutex, AV_LOCK_RELEASE)) return -1; } return 0; }
1threat
Function behavior in JS : There is such a piece of JS code... <script> function test1() { console.log('Test 1'); } function test2() { console.log('Test 2'); } const button = document.getElementById('button'); button.onclick = function() { test1(); } button.onclick = function() { test2(); } </script> ...and a little ntml <button id="button">RGB</button> When you click on a button, only "Test 2" is displayed in the console. I would like to hear only an explanation of this behavior. Еhank
0debug
In ORACLE SQL, How to find no of sundays in a given year (ex: input_year = 1996) and also the dates of that sundays : Can you please let me know how to find the No:Of sundays in a given year in ORACLE SQL. input: 1996 output: <date-of-sunday-1> <date-of-sunday-2> ............. ............. <date-of-sunday-n> <count-of-no-of-sundays-in-that-year>
0debug
Decompile protected C# : <p>I have a C# program and i want to decompile it, i used [ILSpy &amp; NetReflector] and everything worked fine the program was decompiled but the source was encrypted or protected in a way because all the .cs file doesn't content the exact code that i want. I tried the decompiling on other programs and the results was nice but only this file. and this is a picture for the <a href="https://i.stack.imgur.com/TgQUm.png" rel="nofollow noreferrer">encrypted .cs files</a></p>
0debug
jQuery and replace does not work in IE : I want to replace all dimensions 375x270 and 250x180 with 750x1280 in this code-snippet: <img class="j-webview-product-image" imgsrc=" https://image.jimcdn.com/app/cms/image/transf/dimension=375x270:format=jpg/path/sbcfc830c2d85c206/image/i547767095dfc0c2d/version/1475157973/image.jpg 375w, https://image.jimcdn.com/app/cms/image/transf/dimension=250x180:format=jpg/path/sbcfc830c2d85c206/image/i547767095dfc0c2d/version/1475157973/image.jpg 250w" sizes="(max-width: 480px) 100vw, 250px" src=" https://image.jimcdn.com/app/cms/image/transf/dimension=250x180:format=jpg/path/sbcfc830c2d85c206/image/i547767095dfc0c2d/version/1475157973/image.jpg" alt="" title="" data-pin-nopin="true"> Here´s my fiddle: http://jsfiddle.net/andreaszeike/rtywrt9k/4/ - the code works well on all browsers except IE... Thank´s for your suggestions! BR, az
0debug
Angular Material mat-datepicker (change) event and format : <p>I am using angular material datepicker directive and I have few problems. </p> <p><strong>1.</strong> When I open date picker dialog and select any date, date shows up in input text box, but I want to call a function when ever any change occur in input text box. </p> <p>Right now if I manually enter any value in input text box, I am triggering function using (input) directive and it is working fine as shown in code. I want to trigger same function when date gets change using date picker dialog.</p> <p><strong>2.</strong> I also want to change the format of date from <strong>mm/dd/yyyy</strong> to <strong>dd/mm/yyyy</strong> when selected from date picker dialog. Here mm/dd/yyyy is set by default in this directive.</p> <pre><code>&lt;input matInput [matDatepicker]="organizationValue" formControlName="organizationValue" (input)="orgValueChange(i)"&gt; &lt;mat-datepicker-toggle matSuffix [for]="organizationValue"&gt;&lt;/mat-datepicker-toggle&gt; &lt;mat-datepicker #organizationValue&gt;&lt;/mat-datepicker&gt; </code></pre>
0debug
running a saved script in python interpreter : <p>I am a beginner in python programming. I am trying to run a file I saved in the interpreter but it always returns a Traceback error after importing and it does not import the file. Thanks for your candid answers </p>
0debug
How see total app installs on iTunes Connect? : <p>I see on iTunes Connect in AppAnalytics/SalesAndTrends sections only app units (that means the difference of app installs from previous week/month). Where can I see the total app installs number? Thanks </p>
0debug
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def get_height(root): if root is None: return 0 return max(get_height(root.left), get_height(root.right)) + 1 def is_tree_balanced(root): if root is None: return True lh = get_height(root.left) rh = get_height(root.right) if (abs(lh - rh) <= 1) and is_tree_balanced( root.left) is True and is_tree_balanced( root.right) is True: return True return False
0debug
Adding elements to different collections in a single lambda expression : <p>I possibly use the wrong terms, feel free to correct.</p> <p>I have a test method which takes a <code>Runnable</code>:</p> <pre><code>void expectRollback(Runnable r) { .. } </code></pre> <p>I can call this method like this:</p> <pre><code>expectRollback(() -&gt; aList.add(x)) </code></pre> <p>Cool, I understand lambdas! This is awesome. Let's be super clever...</p> <pre><code>expectRollback(() -&gt; aList.add(x) &amp;&amp; bList.add(y)) </code></pre> <p>But what? That doesn't compile: <code>'void' methods cannot return a value.</code> Doesn't the first call also return a value though? What is the difference between the first and the second call?</p>
0debug
Preventing email from going into spam PHP? : <p>I'm using the <code>mail()</code> to send a simple email but from some reason everything I try it goes straight to spam, am I missing something here? </p> <pre><code>&lt;?php $to = "toemail@example.com"; $subject = "your subject"; $body = "&lt;p&gt;Your Body&lt;/p&gt;"; $headers = "From: Sender Name &lt;from@example.com&gt;" . "\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; mail($to, $subject, $body, $headers); ?&gt; </code></pre>
0debug
Convert data on AlterField django migration : <p>I have a production database and need to keep safe the data. I want to change a Field in model and convert all data inside that database with this change.</p> <p>Old field</p> <pre><code>class MyModel(models.Model): field_name = models.TimeField() </code></pre> <p>Changed field</p> <pre><code>class MyModel(models.Model): field_name = models.PositiveIntegerField() </code></pre> <p>Basically I want to convert the TimeField value (that has a Time object) in minutes.</p> <p>Example: I have in an object <code>time(hour=2, minute=0, second=0)</code> and I want to convert that field value in all database table to <code>120</code> when I apply the migrate.</p>
0debug
Is there a way to use angular base href as variable in image path? : <p>Using the Angular template built in to VS 2017. I have an image in the assets/image folder, so ClientApp > src > assets > images.</p> <p>I reference the image in my component like:</p> <pre><code> &lt;img src="../../../assets/images/Logo.png" /&gt; </code></pre> <p>When deployed local, it works but after deploying to IIS it results in 404 error.</p> <p>On the server, the app is deployed to a subfolder: inetsrv8/internal/MyApp</p> <p>I have to change the BASE HREF before deploying to get the app to work, so I'm thinking a fix would be to build custom paths for the images along the lines of BaseHref + './pathToImage'. Problem is I cant figure out how to grab the BASE Href to put it in a variable.</p> <p>Is there a better way? A proper way? If not, how would I get the base href? </p>
0debug
static uint64_t omap_prcm_read(void *opaque, target_phys_addr_t addr, unsigned size) { struct omap_prcm_s *s = (struct omap_prcm_s *) opaque; uint32_t ret; if (size != 4) { return omap_badwidth_read32(opaque, addr); } switch (addr) { case 0x000: return 0x10; case 0x010: return s->sysconfig; case 0x018: return s->irqst[0]; case 0x01c: return s->irqen[0]; case 0x050: return s->voltctrl; case 0x054: return s->voltctrl & 3; case 0x060: return s->clksrc[0]; case 0x070: return s->clkout[0]; case 0x078: return s->clkemul[0]; case 0x080: case 0x084: return 0; case 0x090: return s->setuptime[0]; case 0x094: return s->setuptime[1]; case 0x098: return s->clkpol[0]; case 0x0b0: case 0x0b4: case 0x0b8: case 0x0bc: case 0x0c0: case 0x0c4: case 0x0c8: case 0x0cc: case 0x0d0: case 0x0d4: case 0x0d8: case 0x0dc: case 0x0e0: case 0x0e4: case 0x0e8: case 0x0ec: case 0x0f0: case 0x0f4: case 0x0f8: case 0x0fc: return s->scratch[(addr - 0xb0) >> 2]; case 0x140: return s->clksel[0]; case 0x148: return s->clkctrl[0]; case 0x158: return s->rst[0]; case 0x1c8: return s->wkup[0]; case 0x1d4: return s->ev; case 0x1d8: return s->evtime[0]; case 0x1dc: return s->evtime[1]; case 0x1e0: return s->power[0]; case 0x1e4: return 0; case 0x200: return s->clken[0]; case 0x204: return s->clken[1]; case 0x210: return s->clken[2]; case 0x214: return s->clken[3]; case 0x21c: return s->clken[4]; case 0x220: return 0x7ffffff9; case 0x224: return 0x00000007; case 0x22c: return 0x0000001f; case 0x230: return s->clkidle[0]; case 0x234: return s->clkidle[1]; case 0x238: return s->clkidle[2]; case 0x23c: return s->clkidle[3]; case 0x240: return s->clksel[1]; case 0x244: return s->clksel[2]; case 0x248: return s->clkctrl[1]; case 0x2a0: return s->wken[0]; case 0x2a4: return s->wken[1]; case 0x2b0: return s->wkst[0]; case 0x2b4: return s->wkst[1]; case 0x2c8: return 0x1e; case 0x2e0: return s->power[1]; case 0x2e4: return 0x000030 | (s->power[1] & 0xfc00); case 0x300: return s->clken[5]; case 0x310: return s->clken[6]; case 0x320: return 0x00000001; case 0x340: return s->clksel[3]; case 0x348: return s->clkctrl[2]; case 0x350: return s->rstctrl[0]; case 0x358: return s->rst[1]; case 0x3c8: return s->wkup[1]; case 0x3e0: return s->power[2]; case 0x3e4: return s->power[2] & 3; case 0x400: return s->clken[7]; case 0x410: return s->clken[8]; case 0x420: return 0x0000003f; case 0x430: return s->clkidle[4]; case 0x440: return s->clksel[4]; case 0x450: return 0; case 0x454: return s->rsttime_wkup; case 0x458: return s->rst[2]; case 0x4a0: return s->wken[2]; case 0x4b0: return s->wkst[2]; case 0x500: return s->clken[9]; case 0x520: ret = 0x0000070 | (s->apll_lock[0] << 9) | (s->apll_lock[1] << 8); if (!(s->clksel[6] & 3)) ret |= 3 << 0; else if (!s->dpll_lock) ret |= 1 << 0; else ret |= 2 << 0; return ret; case 0x530: return s->clkidle[5]; case 0x540: return s->clksel[5]; case 0x544: return s->clksel[6]; case 0x800: return s->clken[10]; case 0x810: return s->clken[11]; case 0x820: return 0x00000103; case 0x830: return s->clkidle[6]; case 0x840: return s->clksel[7]; case 0x848: return s->clkctrl[3]; case 0x850: return 0; case 0x858: return s->rst[3]; case 0x8c8: return s->wkup[2]; case 0x8e0: return s->power[3]; case 0x8e4: return 0x008030 | (s->power[3] & 0x3003); case 0x8f0: return s->irqst[1]; case 0x8f4: return s->irqen[1]; case 0x8f8: return s->irqst[2]; case 0x8fc: return s->irqen[2]; } OMAP_BAD_REG(addr); return 0; }
1threat
Why takes no effect in css? : I use a selector in my html,if i set the style in html,It looks normal. <div class="input-group" style="margin-bottom: 10px;margin-top: 0px"> <input type="text" class="form-control" id="search" value="{{ search_word }}" style="height: 30px " onkeydown="entersearch()" placeholder="Enter to search..."> <div class="input-group-btn" style="font-size: x-small"> <!--<select id="idsel" class="form-control select-input" >--> <option value="campaignid">campaignid</option> <option value="vender" >vender</option> <option value="pkgname" >package</option> </select> </div> </div> But when I changed to set the style in css,It takes no effect... <div class="input-group" style="margin-bottom: 10px;margin-top: 0px"> <input type="text" class="form-control" id="search" value="{{ search_word }}" style="height: 30px " onkeydown="entersearch()" placeholder="Enter to search..."> <div class="input-group-btn" style="font-size: x-small"> <select id="idsel" class="form-control select-input-gp" > <option value="campaignid">campaignid</option> <option value="vender" >vender</option> <option value="pkgname" >package</option> </select> </div> </div> <script type="text/css"> .select-input-gp{ height: 30px; width: 200px; color:#fff; background-color:#337ab7; border-color:#2e6da4; } </script> It is strange,Can anyone give me a guide?
0debug
int qdev_build_hotpluggable_device_list(Object *obj, void *opaque) { GSList **list = opaque; DeviceState *dev = DEVICE(obj); if (dev->realized && object_property_get_bool(obj, "hotpluggable", NULL)) { *list = g_slist_append(*list, dev); } object_child_foreach(obj, qdev_build_hotpluggable_device_list, opaque); return 0; }
1threat