problem
stringlengths
26
131k
labels
class label
2 classes
static Suite *qstring_suite(void) { Suite *s; TCase *qstring_public_tcase; s = suite_create("QString test-suite"); qstring_public_tcase = tcase_create("Public Interface"); suite_add_tcase(s, qstring_public_tcase); tcase_add_test(qstring_public_tcase, qstring_from_str_test); tcase_add_test(qstring_public_tcase, qstring_destroy_test); tcase_add_test(qstring_public_tcase, qstring_get_str_test); tcase_add_test(qstring_public_tcase, qstring_append_chr_test); tcase_add_test(qstring_public_tcase, qstring_from_substr_test); tcase_add_test(qstring_public_tcase, qobject_to_qstring_test); return s; }
1threat
def get_perrin(n): if (n == 0): return 3 if (n == 1): return 0 if (n == 2): return 2 return get_perrin(n - 2) + get_perrin(n - 3)
0debug
Begginer java ,switch menu : Hi guys complete eclipse begginer here,on the firt block of code i need to make a menu that displays 3 types of vehicules, then the user types the number of wich vehicule he'll choose,after that he needs to be redirected to another menu that displays a list of vehicules and choose one , then fill up a couple questions.Its in spanihsh i kno , sorry ;__; import java.util.Scanner; public class Vehic { public static void main(String[] args) { int vehic;int comp; Scanner sc=new Scanner(System.in); System.out.println("¡Hola!,\nEscriba el numero de la clase de vehiculo que desea comprar:\n1.Autos \n2.Camionetas \n3.Motocicletas"); vehic=sc.nextInt(); switch(vehic) { case 1:System.out.println("-AUTOMOVILES-\nEscriba el numero de un automovil para añadirlo al carrito1. 542315 Tesla X 2017 4500km \n2. 892567Honda Civic 2015 4200km \n3. 634563 Tesla Z 2016 5600km \n4. 787256 Nissan Sentra 1000km \n5. 646464 Tesla Y 2300km \n6. 359812 BMW Hunter 7800km \n7. 159327 Mini Cooper 4500km \n8. 496251 Jeep 6000km"); comp=sc.nextInt(); while(comp<8) switch(comp){ case 1:String nom;String ap;int id;String model;System.out.println("Gracias por su compra!, ingrese su nombre:"); nom=sc.next(); System.out.println("Ahora, ingrese su apellido"); ap=sc.next(); System.out.println("Por ultimo, ingrese su ID de comprador:"); id=sc.nextInt(); System.out.println("Ingrese el modelo que adquirio"); model=sc.next(); System.out.println("-RECIBO- \nModelo adquirido:542315 Tesla X 2017 4500km"+model+" \n Almacenamos esta informacion de usted, \nNombre:"+nom+"\nApellido:"+ap+"ID:"+id);break; case 2:System.out.println("-CAMIONETAS-\nEscriba el numero de la camioneta para añadirla al carrito1. 263785 Tesla X 2017VAN 4500km \n2. 892567Honda Civic 2015VAN 4200km \n3. 634563 Tesla Z 2016VAN 5600km \n4. 787256 Nissan Sentra VAN1000km \n5. 646464 Tesla YVAN 2300km \n6. 359812 BMW HunterVAN 7800km \n7. 159327 Mini CooperVAN 4500km \n8. 496251 JeepVAN 6000km"); comp=sc.nextInt(); while(comp<8) switch(comp){ case 1:String Nom;String Ap;int Id;System.out.println("Gracias por su compra!, ingrese su nombre:"); Nom=sc.next(); System.out.println("Ahora, ingrese su apellido"); Ap=sc.next(); System.out.println("Por ultimo, ingrese su ID de comprador:"); Id=sc.nextInt(); System.out.println("Ingrese el modelo que adquirio"); model=sc.next(); System.out.println("-RECIBO- \nModelo adquirido:"+model+"\n Almacenamos esta informacion de usted, \nNombre:"+Nom+"\nApellido:"+Ap+"ID:"+Id);break; case 3:System.out.println("-MOTOCICLETAS-\nEscriba el numero de la camioneta para añadirla al carrito1. 378265 Harley Davidson 1995 4500km \n2. 736259Instict 2006 4200km \n3. 264254 Harley Davidson 2016 5600km \n4. 265731 Italika 3014 1000km \n5. 852645 JetX 2300km \n6. 356425Instict Hunter 7800km \n7. 3592145 Italika 2006 4500km \n8.234781 Harley Davidson 2008 6000km"); comp=sc.nextInt(); while(comp<8) switch(comp){ case 1:String NOm;String AP;int ID;System.out.println("Gracias por su compra!, ingrese su nombre:"); NOm=sc.next(); System.out.println("Ahora, ingrese su apellido"); AP=sc.next(); System.out.println("Por ultimo, ingrese su ID de comprador:"); ID=sc.nextInt(); System.out.println("Ingrese el modelo que adquirio"); model=sc.next(); System.out.println("-RECIBO- \nModelo adquirido:"+model+"\n Almacenamos esta informacion de usted, \nNombre:"+NOm+"\nApellido:"+AP+"ID:"+ID);break; } } } }}} First off, i cant select the 3rd case and dont know why,also when i select 1 of the 3 cases i cant get it to display and be able to answer the questions
0debug
Finding avg of n numbers in a list in Python : Everything is working except when the user types N to end the while loop, it doesn't go to the For Statement (this happens when you run the program, works fine in the shell and in the py). potato = [] kount = 0 avg = 0 question = input('Finding averages, continue? Y or N: ') while question == 'Y' and kount <= 12: num = int(input('Enter a number: ')) potato.append(num) kount += 1 question = input('Continue? Y or N: ') for fries in potato: avg = sum(potato)/kount print(fries,fries-avg) print('average is: ' + str(avg))
0debug
static void rc4030_dma_tt_write(void *opaque, hwaddr addr, uint64_t data, unsigned int size) { rc4030State *s = opaque; memcpy(memory_region_get_ram_ptr(&s->dma_tt) + addr, &data, size); if (addr % sizeof(dma_pagetable_entry) == 0) { int index = addr / sizeof(dma_pagetable_entry); memory_region_transaction_begin(); rc4030_dma_as_update_one(s, index, (uint32_t)data); memory_region_transaction_commit(); } }
1threat
static void virtio_net_cleanup(NetClientState *nc) { VirtIONet *n = qemu_get_nic_opaque(nc); n->nic = NULL; }
1threat
Undefined index : <p>I get Undefined index: image error in this code. Can I know the exact solution? I wanna know workflow from line abc to xyz that I commented in the code using //.Thanks for your help..</p> <pre><code> &lt;?php session_start(); include("config.php"); if(isset($_SESSION['name'])) { if(!$_SESSION['name']=='admin') { header("Location:login.php?id=You are not authorised to access this page unless you are administrator of this website"); } } ?&gt; &lt;?php $name=$_FILES['image']['name']; $tmp=$_FILES['image']['tmp_name']; $err=$_FILES['image']['error']; } if($err==0) { move_uploaded_file($tmp, $name); //xyz} $category=$_POST['category']; $title=$_POST['title']; $image=$_FILES["image"]["name"]; $content=$_POST['content']; } &lt;?php $qry=mysql_query("INSERT INTO articles(title,image,content,category)VALUES('$title','$image','$content','$category')"); if(!$qry) { die("Query Failed: ". mysql_error()); } else { echo "Article Added Successfully"; } ?&gt; The form code is here: &lt;?php include("config.php"); $sql=mysql_query("select * from category"); if(!$sql) { mysql_error(); } ?&gt; &lt;form action="created_article.php" method="post"&gt; Category: &lt;select name="category"&gt; &lt;?php while($row=mysql_fetch_array($sql)) { echo"&lt;option value='".$row['category']."'&gt;".$row['category']."&lt;/option&gt;"; } ?&gt; &lt;/select&gt; Title: &lt;input type="text" name="title"/&gt; Upload Image: &lt;input type="file" name="image" id="image" /&gt; Contents: &lt;textarea name="content" cols="100" rows="12" &gt;&lt;/textarea&gt; &lt;input type="submit" name="button" value="Submit" /&gt; &lt;/form&gt; </code></pre> <p>I need help with these code, I need to make project and I'm stuck here, so please kindly I request for your help,</p>
0debug
Waiting for process started by bash to end and get its PID : <p>I have a bash script that starts a java application using an until block. It gets the exit code from the java application and if it gets a known shutdown exit code the bash script exits, otherwise, it restarts the java application</p> <pre><code>$CMD=java -jar program.jar until $CMD; do EXIT=$? if [ $EXIT == 2 ] then exit fi sleep 10 done </code></pre> <p>This works fine, but I've got another application that needs to be aware of the pid of the process, up to this point, i've been using pgrep, but the powers that be don't like this idea. They want me to write the PID to a pid file. How can I modify my script so that it writes the pid to a pid file and removes it when it ends?</p> <p>Thank you.</p>
0debug
Converting a pandas multi-index series to a dataframe by using second index as columns : <p>Hi I have a DataFrame/Series with 2-level multi-index and one column. I would like to take the second-level index and use it as a column. For example (code taken from <a href="https://pandas.pydata.org/pandas-docs/stable/advanced.html#creating-a-multiindex-hierarchical-index-object" rel="noreferrer">multi-index docs</a>):</p> <pre><code>import pandas as pd import numpy as np arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'], ['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']] tuples = list(zip(*arrays)) index = pd.MultiIndex.from_tuples(tuples, names=['first', 'second']) s = pd.DataFrame(np.random.randn(8), index=index, columns=["col"]) </code></pre> <p>Which looks like:</p> <pre><code>first second bar one -0.982656 two -0.078237 baz one -0.345640 two -0.160661 foo one -0.605568 two -0.140384 qux one 1.434702 two -1.065408 dtype: float64 </code></pre> <p>What I would like is to have a DataFrame with index <code>[bar, baz, foo, qux]</code> and columns <code>[one, two]</code>.</p>
0debug
void kvm_setup_guest_memory(void *start, size_t size) { if (!kvm_has_sync_mmu()) { #ifdef MADV_DONTFORK int ret = madvise(start, size, MADV_DONTFORK); if (ret) { perror("madvice"); exit(1); } #else fprintf(stderr, "Need MADV_DONTFORK in absence of synchronous KVM MMU\n"); exit(1); #endif } }
1threat
static void dvbsub_parse_clut_segment(AVCodecContext *avctx, const uint8_t *buf, int buf_size) { DVBSubContext *ctx = avctx->priv_data; const uint8_t *buf_end = buf + buf_size; int i, clut_id; DVBSubCLUT *clut; int entry_id, depth , full_range; int y, cr, cb, alpha; int r, g, b, r_add, g_add, b_add; av_dlog(avctx, "DVB clut packet:\n"); for (i=0; i < buf_size; i++) { av_dlog(avctx, "%02x ", buf[i]); if (i % 16 == 15) av_dlog(avctx, "\n"); } if (i % 16) av_dlog(avctx, "\n"); clut_id = *buf++; buf += 1; clut = get_clut(ctx, clut_id); if (!clut) { clut = av_malloc(sizeof(DVBSubCLUT)); memcpy(clut, &default_clut, sizeof(DVBSubCLUT)); clut->id = clut_id; clut->next = ctx->clut_list; ctx->clut_list = clut; } while (buf + 4 < buf_end) { entry_id = *buf++; depth = (*buf) & 0xe0; if (depth == 0) { av_log(avctx, AV_LOG_ERROR, "Invalid clut depth 0x%x!\n", *buf); return; } full_range = (*buf++) & 1; if (full_range) { y = *buf++; cr = *buf++; cb = *buf++; alpha = *buf++; } else { y = buf[0] & 0xfc; cr = (((buf[0] & 3) << 2) | ((buf[1] >> 6) & 3)) << 4; cb = (buf[1] << 2) & 0xf0; alpha = (buf[1] << 6) & 0xc0; buf += 2; } if (y == 0) alpha = 0xff; YUV_TO_RGB1_CCIR(cb, cr); YUV_TO_RGB2_CCIR(r, g, b, y); av_dlog(avctx, "clut %d := (%d,%d,%d,%d)\n", entry_id, r, g, b, alpha); if (depth & 0x80) clut->clut4[entry_id] = RGBA(r,g,b,255 - alpha); if (depth & 0x40) clut->clut16[entry_id] = RGBA(r,g,b,255 - alpha); if (depth & 0x20) clut->clut256[entry_id] = RGBA(r,g,b,255 - alpha); } }
1threat
How to check li element using jquery? : I try to make chaked ul il element using jquery. Here is ul li elements: <ul data-role="listview" data-inset="true" data-theme="d" data-dividertheme="c" id="layerslist" class="ui-listview ui-listview-inset ui-corner-all ui-shadow ui-group-theme-d"> <li data-icon="check" class=""><a class="geomind-list-item ui-btn ui-btn-icon-right ui-icon-check"> "valves1" </a></li> <li data-icon="check" class=""><a class="geomind-list-item ui-btn ui-btn-icon-right ui-icon-check"> "valves2" </a></li> <li data-icon="check" class=""><a class="geomind-list-item ui-btn ui-btn-icon-right ui-icon-check"> "valves3" </a></li> <li data-icon="check" class=""><a class="geomind-list-item ui-btn ui-btn-icon-right ui-icon-check"> "valves4" </a></li> </ul> I want to make chaked li element that has "valves3" text. How do I check li eklement that has "valves3" text?
0debug
static int init_opaque_surf(QSVContext *qsv) { AVQSVContext *hwctx_enc = qsv->ost->enc_ctx->hwaccel_context; mfxFrameSurface1 *surfaces; int i; qsv->nb_surfaces = hwctx_enc->nb_opaque_surfaces; qsv->opaque_surfaces_buf = av_buffer_ref(hwctx_enc->opaque_surfaces); qsv->surface_ptrs = av_mallocz_array(qsv->nb_surfaces, sizeof(*qsv->surface_ptrs)); qsv->surface_used = av_mallocz_array(qsv->nb_surfaces, sizeof(*qsv->surface_used)); if (!qsv->opaque_surfaces_buf || !qsv->surface_ptrs || !qsv->surface_used) return AVERROR(ENOMEM); surfaces = (mfxFrameSurface1*)qsv->opaque_surfaces_buf->data; for (i = 0; i < qsv->nb_surfaces; i++) qsv->surface_ptrs[i] = surfaces + i; qsv->opaque_alloc.Out.Surfaces = qsv->surface_ptrs; qsv->opaque_alloc.Out.NumSurface = qsv->nb_surfaces; qsv->opaque_alloc.Out.Type = hwctx_enc->opaque_alloc_type; qsv->opaque_alloc.Header.BufferId = MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION; qsv->opaque_alloc.Header.BufferSz = sizeof(qsv->opaque_alloc); qsv->ext_buffers[0] = (mfxExtBuffer*)&qsv->opaque_alloc; return 0; }
1threat
mssql get all emails and phone numbers from address column : A table in MSSQL looks like sn|name| address | ------------------------------------------------ 1 |abc| new street, ND, homeemail@email.com | work workemail@email.com, Contact numbers | Home phone 0019827343, Mobile 990288394 2 | .. The output should display sn| name| phone1 | phone2 | email1 | email2| --------------------------------------------- Any TSQL command ?
0debug
static void scsi_free_request(SCSIRequest *req) { SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, req, req); qemu_vfree(r->iov.iov_base); }
1threat
how to sum each column in mysql with php? : <p>I'm trying to sum all the columns from a table but its not working. This is my query to the DB: </p> <pre><code>$sql = mysql_query("SELECT SUM(clicks) as total FROM urls WHERE member_id='$mem_id'"); $row = mysql_fetch_array($sql); $sum = $row['total']; </code></pre> <p>When I try to run the script nothing is working. I tried also with while loop and I get all the results from column clicks on a new line and I cannot sum them. Where I am doing a mistake ?</p>
0debug
text isn't minimizing with screen html/css : hope someone can help! When I minimize the browser screen on this code, everything is minimizing appropriately except for my body text. Not sure why this is happening! Can anybody find the issue in the html or css? <!DOCTYPE html> <!-- Ex Machina by TEMPLATED templated.co @templatedco Released for free under the Creative Commons Attribution 3.0 license (templated.co/license) --> <html> <head> <title>History: Skating Today</title> <meta content="text/html; charset=utf-8" http-equiv="content-type"> <meta content="" name="description"> <meta content="" name="keywords"> <!--[if lte IE 8]><script src="js/html5shiv.js"></script><![endif]--> <script src= "http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"> </script> <script src="js/skel.min.js"> </script> <script src="js/skel-panels.min.js"> </script> <script src="js/init.js"> </script> <noscript> <link href="css/style.css" rel="stylesheet"> <style type="text/css"> .header { } </style></noscript> <!--[if lte IE 8]><link rel="stylesheet" href="css/ie/v8.css" /><![endif]--> <!--[if lte IE 9]><link rel="stylesheet" href="css/ie/v9.css" /><![endif]--> </head> <body class="page"> <!-- Header --> <div id="page"> <img alt="Black and white photo of boy skateboarding" height="" src= "images/OldTimey.jpg" width="100%"> <div class="unit header"> <section> <header> <h3>Unit 1: Skateboarding, Then and Now<br> Lesson 1/3</h3> </header> </section> </div><!-- Main --> <div class="container" id="main"> <div class="row"> <div class="3u"> <section class="sidebar"> <h4><a href="Index.html">Home</a></h4> </section> <section class="sidebar"> <h4><a href="Programme%20Overview.html">Programme Overview</a></h4> </section> <section class="sidebar"> <h4><a href="Unit1.html">Unit 1: Skateboarding, Then and Now</a></h4> <ul class="style3"> <li><a href="History.html">Lesson 1: History of Skateboarding</a></li> <li><a href="Types.html">Lesson 2: Types of Skating</a></li> <li><a href="Quiz1.html">Unit 1 Quiz</a></li> </ul> </section> <section class="sidebar"> <h4><a href="Unit2.html">Unit 2: Why You Should Skate</a></h4> <ul class="style3"> <li><a href="EmotionalBenefits.html">Lesson 1: Emotional and Physical Benefits</a></li> <li><a href="SocialBenefits.html">Lesson 2: Social and Enviromental Benefits (Plus a Few More!)</a></li> <li><a href="Quiz2.html">Unit 2 Quiz</a></li> </ul> </section> <section class="sidebar"> <h4><a href = "Unit3.html">Unit 3: Safety & Upkeep</a></h4> <ul class="style3"> <li><a href="SafePlace.html">Lesson 1: Determining Safe Places to Skate</a></li> <li><a href="Stopping.html">Lesson 2: How to Stop a Board</a></li> <li><a href="Rules.html">Lesson 3: Rules of the Road</a></li> <li><a href="Bearings.html">Lesson 4: Changing Your Bearings</a></li> <li><a href="Trucks.html">Lesson 5: Adjusting Your Trucks</a></li> </ul> </section> <section class="sidebar"> <h4>Extras: Skating Routes & Meet a Skater</h4> <ul class="style3"> <li><a href="#">From the Flag Poles</a></li> <li><a href="#">From the White Gates</a></li> <li><a href="#">From the Pavilion</a></li> <li><a href="MeetandGreet.html">Meet a Skater</a></li> </ul> </section> </div> <div class= "9u skel-cell-important""> <header> <h3>Skating Today</h3> </header> <p> While some people may still see skaters as rebellious or alternative, skateboarding has once again evolved. In places like Afghanistan, where girls are not allowed to ride bikes but can skateboard, the sport is used to engage and empower youth (skateistan.org). Furthermore, although many skaters still take part in skateboarding to perfect tricks and take risks, skateboarding has become the way that many people get from point A to point B.</p> <p></p> <p>While any type of skateboard may be used for transportation, the longboard is having its heyday. A longboard can range anywhere from 33 to 80 inches and typically has softer wheels, making for a smoother and more stable ride, perfect for cruising, less experienced, and older skaters (Ruibal 2006).</p> <img src="images/header.jpg" width="736" height="189" alt=""/><br> <div id="course description"> <br> <p>This lesson is now complete. To continue to lesson 2, "Types of Skating", click <a href= "Types.html">next</a>.</p> </div> </div> </section> </div><!-- Main --> </div> </div> </div> </body> </html> And the CSS here: @charset "UTF-8"; /* Ex Machina by TEMPLATED templated.co @templatedco Released for free under the Creative Commons Attribution 3.0 license (templated.co/license) */ /*********************************************************************************/ /* Basic */ /*********************************************************************************/ body { background-image: url(../images/BackgroundImage.jpg); } body,input,textarea,select { font-family: Verdana,Geneva,sans-serif; font-weight: 300; font-size: 16px; line-height: 1.5em; } h1,h2,h3,h4,h5,h6 { letter-spacing: 1px; font-weight: 300; color: #1b1b5e; } h4 { letter-spacing: 1px; font-weight: 700; color: #1b1b5e; } /* Change this to whatever font weight/color pairing is most suitable */ strong,b { font-weight: 700; color: #000; } em,i { font-style: italic; } /* Don't forget to set this to something that matches the design */ a { color: blue; text-decoration: none; } a:hover { text-decoration: underline; } sub { position: relative; top: .5em; font-size: .8em; } sup { position: relative; top: -.5em; font-size: .8em; } hr { border: 0; border-top: solid 1px #ddd; } blockquote { border-left: solid .5em #ddd; padding: 1em 0 1em 2em; font-style: italic; } p,ul,ol,dl,table { margin-right: ; margin-bottom: 1em; color: #1b1b5e; } tr. highlight td { padding: 2em; } header { margin-bottom: .5em; line-height: 2.5em; color: #1b1b5e; } header h2 { font-size: 24px; text-align: left; } header h3 { font-size: 22px; } footer { margin-top: 1em; } /* Sections/Articles */ section,article { margin-bottom: 1em; } .row { padding: 0; position; center; } .intro { text-align: left; padding-bottom: 2em; font-weight: 700; } .aims { padding-top: 2px; } .unit header { text-align: right; margin-right: 1em; color: purple; } table,th,td { border: ; border-collapse: collapse; align-content: center; } th,td { padding: 5px; } .boxed { border: 1px solid #000; padding: 2%; margin-right: 10%; margin-bottom: 2em; } * { margin: 0; padding: 0; outline: none; } .formativequiz { margin-top: 10px; margin-bottom: 10px; padding: 10px; background: ; text-align: left; } .formativequiz h1 { font: bold; } .formativequiz p { font: bold; } .question { overflow: auto; margin: ; width: 80%; background: #fff; } .question h2 { float: left; margin: 0 40px; color: blue; font: bold; } .question h2:hover { color: #333; cursor: pointer; } .question p { float: left; margin-right: 0; color: #fff; font: bold 0; -webkit-transition: color .3s ease; -moz-transition: color .3s ease; -ms-transition: color .3s ease; -o-transition: color .3s ease; transition: color .3s ease; } h2:active ~ .yes { color: #1b1b5e; font-size: ; } .course description { margin-bottom: 3em; padding-right: 10%; } #icons { height: 128; text-align: justify; border: none; font-size: .1px; /* IE 9 & 10 don't like font-size: 0; */ max-width: 888px; } #icons div { display: inline-block; margin-top: 3em; margin-bottom: 3em; padding-right: 10%; } #icons:after { content: ''; width: 100%; /* Ensures there are at least 2 lines of text, so justification works */ display: inline-block; } /* Images */ .image { display: block; margin: 2em; } .image img { display: block ; width: ; margin: 2em; padding: 2em; } .image.featured { display: block; width: 100%; margin: 0; } .image.full { display: block; width: 100%; margin-bottom: 2em; } .image.left { float: left; margin: 0 2em .8em 0; } .image.centered { display: block; margin: 0 0 .8em; } .image.centered img { margin: 0 auto; width: auto; } /* Lists */ ul.default { margin-bottom: 0; padding-bottom: 0; list-style: none; } ul.default li { display: block; padding: 2em 0 1.25em; border-top: 1px solid #303030; } ul.default li:first-child { padding-top: 0; border-top: none; } ul.default a { text-decoration: none; color: rgba(255,255,255,.5); } ul.default a:hover { } ul.style1 { margin: 0; padding: 0; list-style: none; } ul.style1 li { padding: .6em 0; } ul.style1 li:first-child { padding-top: 0; border-top: 0; } ul.style1 img { } ul.style2 { text-align: left; margin-right: 10%; padding: 2%; list-style: disc; padding-bottom: 1em; } ul.style2 li { padding: .5em 0 0; list-style-position: inside; } ul.style2 li:first-child { padding-top: 0; border-top: 0; } ul.style3 { margin: 0; padding: 5px; list-style: none; font: 14px; } ul.style3 li { padding-left: .6em; line-height: 150%; } ul.style3 li:first-child { padding-top: 0; border-top: 0; } ul.style5 { overflow: hidden; margin: 0 0 1em; padding: 0; list-style: none; } ul.style5 li { float: left; padding: .25em; line-height: 0; } ul.style5 a { } /*********************************************************************************/ /* Header */ /*********************************************************************************/ /*********************************************************************************/ /* Main */ /*********************************************************************************/ #page { margin: 7em; position: center; background: #fff; } #main { padding: 1em; } #container { position: center; margin: 1em; padding: 1em; } /*********************************************************************************/ /* Icons */ /*********************************************************************************/ .greenleaf { align-content: relative; } .trafficlight { align-content: relative; } .pinkskater { } .map { }
0debug
static target_ulong h_bulk_remove(PowerPCCPU *cpu, sPAPRMachineState *spapr, target_ulong opcode, target_ulong *args) { CPUPPCState *env = &cpu->env; int i; target_ulong rc = H_SUCCESS; for (i = 0; i < H_BULK_REMOVE_MAX_BATCH; i++) { target_ulong *tsh = &args[i*2]; target_ulong tsl = args[i*2 + 1]; target_ulong v, r, ret; if ((*tsh & H_BULK_REMOVE_TYPE) == H_BULK_REMOVE_END) { break; } else if ((*tsh & H_BULK_REMOVE_TYPE) != H_BULK_REMOVE_REQUEST) { return H_PARAMETER; } *tsh &= H_BULK_REMOVE_PTEX | H_BULK_REMOVE_FLAGS; *tsh |= H_BULK_REMOVE_RESPONSE; if ((*tsh & H_BULK_REMOVE_ANDCOND) && (*tsh & H_BULK_REMOVE_AVPN)) { *tsh |= H_BULK_REMOVE_PARM; return H_PARAMETER; } ret = remove_hpte(cpu, *tsh & H_BULK_REMOVE_PTEX, tsl, (*tsh & H_BULK_REMOVE_FLAGS) >> 26, &v, &r); *tsh |= ret << 60; switch (ret) { case REMOVE_SUCCESS: *tsh |= (r & (HPTE64_R_C | HPTE64_R_R)) << 43; break; case REMOVE_PARM: rc = H_PARAMETER; goto exit; case REMOVE_HW: rc = H_HARDWARE; goto exit; } } exit: check_tlb_flush(env); return rc; }
1threat
trying to use recursion to find the possibilities of two known numbers adding to N : <p>I have this recursion problem that I spent hours on but unable to transform some of my thoughts into code. I have a problem where I need to build a function that tries to fit 3's and 1's into a given number(n). I try to get n from user but then I cannot go further. Basically I need to calculate the possibility of 3's and 1's that add up to n. I know that a constant solution is that I can fit 1n times into n. </p> <p>Any help is appreciated. Thanks in advance</p> <pre><code>public static void main(String[] args) { // TODO code application logic here Scanner ask = new Scanner(System.in); System.out.println("input number: "); int n = ask.nextInt(); } public static int getPossibility(int n, int k, int p) { if (n == 0) { return 0; } else if (n / p == n ) { return n; } else { int ctr = n; for (int i = 1; i &lt;= n; i++) { ctr += getPossibility(n, k - 1, p - 1) ; } return ctr; } } </code></pre> <p>}</p>
0debug
int qemu_add_child_watch(pid_t pid) { ChildProcessRecord *rec; if (!sigchld_bh) { qemu_init_child_watch(); } QLIST_FOREACH(rec, &child_watches, next) { if (rec->pid == pid) { return 1; } } rec = g_malloc0(sizeof(ChildProcessRecord)); rec->pid = pid; QLIST_INSERT_HEAD(&child_watches, rec, next); return 0; }
1threat
PXA2xxState *pxa270_init(unsigned int sdram_size, const char *revision) { PXA2xxState *s; int iomemtype, i; DriveInfo *dinfo; s = (PXA2xxState *) qemu_mallocz(sizeof(PXA2xxState)); if (revision && strncmp(revision, "pxa27", 5)) { fprintf(stderr, "Machine requires a PXA27x processor.\n"); exit(1); } if (!revision) revision = "pxa270"; s->env = cpu_init(revision); if (!s->env) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } s->reset = qemu_allocate_irqs(pxa2xx_reset, s, 1)[0]; cpu_register_physical_memory(PXA2XX_SDRAM_BASE, sdram_size, qemu_ram_alloc(NULL, "pxa270.sdram", sdram_size) | IO_MEM_RAM); cpu_register_physical_memory(PXA2XX_INTERNAL_BASE, 0x40000, qemu_ram_alloc(NULL, "pxa270.internal", 0x40000) | IO_MEM_RAM); s->pic = pxa2xx_pic_init(0x40d00000, s->env); s->dma = pxa27x_dma_init(0x40000000, s->pic[PXA2XX_PIC_DMA]); pxa27x_timer_init(0x40a00000, &s->pic[PXA2XX_PIC_OST_0], s->pic[PXA27X_PIC_OST_4_11]); s->gpio = pxa2xx_gpio_init(0x40e00000, s->env, s->pic, 121); dinfo = drive_get(IF_SD, 0, 0); if (!dinfo) { fprintf(stderr, "qemu: missing SecureDigital device\n"); exit(1); } s->mmc = pxa2xx_mmci_init(0x41100000, dinfo->bdrv, s->pic[PXA2XX_PIC_MMC], s->dma); for (i = 0; pxa270_serial[i].io_base; i ++) if (serial_hds[i]) #ifdef TARGET_WORDS_BIGENDIAN serial_mm_init(pxa270_serial[i].io_base, 2, s->pic[pxa270_serial[i].irqn], 14857000/16, serial_hds[i], 1, 1); #else serial_mm_init(pxa270_serial[i].io_base, 2, s->pic[pxa270_serial[i].irqn], 14857000/16, serial_hds[i], 1, 0); #endif else break; if (serial_hds[i]) s->fir = pxa2xx_fir_init(0x40800000, s->pic[PXA2XX_PIC_ICP], s->dma, serial_hds[i]); s->lcd = pxa2xx_lcdc_init(0x44000000, s->pic[PXA2XX_PIC_LCD]); s->cm_base = 0x41300000; s->cm_regs[CCCR >> 2] = 0x02000210; s->clkcfg = 0x00000009; iomemtype = cpu_register_io_memory(pxa2xx_cm_readfn, pxa2xx_cm_writefn, s, DEVICE_NATIVE_ENDIAN); cpu_register_physical_memory(s->cm_base, 0x1000, iomemtype); register_savevm(NULL, "pxa2xx_cm", 0, 0, pxa2xx_cm_save, pxa2xx_cm_load, s); cpu_arm_set_cp_io(s->env, 14, pxa2xx_cp14_read, pxa2xx_cp14_write, s); s->mm_base = 0x48000000; s->mm_regs[MDMRS >> 2] = 0x00020002; s->mm_regs[MDREFR >> 2] = 0x03ca4000; s->mm_regs[MECR >> 2] = 0x00000001; iomemtype = cpu_register_io_memory(pxa2xx_mm_readfn, pxa2xx_mm_writefn, s, DEVICE_NATIVE_ENDIAN); cpu_register_physical_memory(s->mm_base, 0x1000, iomemtype); register_savevm(NULL, "pxa2xx_mm", 0, 0, pxa2xx_mm_save, pxa2xx_mm_load, s); s->pm_base = 0x40f00000; iomemtype = cpu_register_io_memory(pxa2xx_pm_readfn, pxa2xx_pm_writefn, s, DEVICE_NATIVE_ENDIAN); cpu_register_physical_memory(s->pm_base, 0x100, iomemtype); register_savevm(NULL, "pxa2xx_pm", 0, 0, pxa2xx_pm_save, pxa2xx_pm_load, s); for (i = 0; pxa27x_ssp[i].io_base; i ++); s->ssp = (SSIBus **)qemu_mallocz(sizeof(SSIBus *) * i); for (i = 0; pxa27x_ssp[i].io_base; i ++) { DeviceState *dev; dev = sysbus_create_simple("pxa2xx-ssp", pxa27x_ssp[i].io_base, s->pic[pxa27x_ssp[i].irqn]); s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi"); } if (usb_enabled) { sysbus_create_simple("sysbus-ohci", 0x4c000000, s->pic[PXA2XX_PIC_USBH1]); } s->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000); s->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000); s->rtc_base = 0x40900000; iomemtype = cpu_register_io_memory(pxa2xx_rtc_readfn, pxa2xx_rtc_writefn, s, DEVICE_NATIVE_ENDIAN); cpu_register_physical_memory(s->rtc_base, 0x1000, iomemtype); pxa2xx_rtc_init(s); register_savevm(NULL, "pxa2xx_rtc", 0, 0, pxa2xx_rtc_save, pxa2xx_rtc_load, s); s->i2c[0] = pxa2xx_i2c_init(0x40301600, s->pic[PXA2XX_PIC_I2C], 0xffff); s->i2c[1] = pxa2xx_i2c_init(0x40f00100, s->pic[PXA2XX_PIC_PWRI2C], 0xff); s->i2s = pxa2xx_i2s_init(0x40400000, s->pic[PXA2XX_PIC_I2S], s->dma); s->kp = pxa27x_keypad_init(0x41500000, s->pic[PXA2XX_PIC_KEYPAD]); qdev_connect_gpio_out(s->gpio, 1, s->reset); return s; }
1threat
Using the class type of an object to create a new instance : <p>I call a method with the signature <code>save(Object o)</code> this way:</p> <pre><code>EntityManager em = new EntityManager(); // My own EntityManager User user = new User(); // Constructor provides values em.save(user); </code></pre> <p>In the save-method I need to instantiate a new object, in this case it would be of type <code>User</code> this way: <code>User user = (User) o;</code></p> <p>Well, so far I can extract the class of the object with <code>o.getClass()</code>, which delivers <code>class org.example.User</code>, which is <code>User.class</code> I guess. But I can't figure out how I could realize the line <code>User user = (User) o;</code> with that.</p>
0debug
Tkinter or ttk GUI programming? : <p>I'm a beginner in python programming and have to make a project that has to be submitted in school. I discovered tkinter and ttk a month ago and am wondering which one would be better to code.</p> <p>The purpose of my program is for it to be user-interactive and look as modern as possible. I would appreciate it if you could tell me the advantages of tkinter over ttk and vice versa and which one you recommend I should use.</p> <p>The program purpose is to interact with the resident of a place and allow him to access different features of the place and stuff like that.</p>
0debug
Angular CLI build target vs environment : <p>In the <a href="https://github.com/angular/angular-cli" rel="noreferrer">Angular CLI</a>, what is the difference between the <code>--target</code> and <code>--environment</code> options when running the <a href="https://github.com/angular/angular-cli/wiki/build" rel="noreferrer">build</a> command?</p> <p>From the documentation:</p> <blockquote> <p>ng build can specify both a build target (--target=production or --target=development) and an environment file to be used with that build (--environment=dev or --environment=prod). By default, the development build target and environment are used.</p> </blockquote> <p>However, they never really clarify the distinction between the two.</p> <p>From what I can gather, the <code>--environment</code> flag controls which environment file (<code>environment.ts</code> vs <code>environment.prod.ts</code>) gets used when doing the build. But then what does <code>--target</code> control?</p>
0debug
Shifting array index : Please Help me. I have And Following array : [["Name","Age"],["Name 1","20"],["Name 2","23"],["Name 3","30"],["Name 4","20"],["Name 5","26"],["Name 6","27"],["Name 7","21"],["Name 8","26"]] I want to shift the values of array with index 1 like this : [["Name","20"],["Name 1","23"],["Name 2","30"],["Name 3","20"],["Name 4","26"],["Name 5","27"],["Name 6","21"],["Name 7","26"],["Name 8",""]] I tried with array_shift but not working Checkout Demo [PHPFiddle][1] Here [1]: http:////phpfiddle.org/lite?code=%3C?php%5Cn$array%20=%20'[[%22Name%22,%22Age%22],[%22Name%201%22,%2220%22],[%22Name%202%22,%2223%22],[%22Name%203%22,%2230%22],[%22Name%204%22,%2220%22],[%22Name%205%22,%2226%22],[%22Name%206%22,%2227%22],[%22Name%207%22,%2221%22],[%22Name%208%22,%2226%22]]';%5Cn$b%20=%20array($array);%5Cn$a%20=%20array_shift($b);%5Cnprint_r($a);%5Cn?%3E%5Cn Thanks In Advance.
0debug
How to call a function in a component from a service in Angular 5? Without the use of @input or @output : I have to make a call to a function in a component from an angular service. How do i go about doing this? On success of a web service call I want to call a function in the component
0debug
static void xlnx_zynqmp_init(Object *obj) { XlnxZynqMPState *s = XLNX_ZYNQMP(obj); int i; for (i = 0; i < XLNX_ZYNQMP_NUM_APU_CPUS; i++) { object_initialize(&s->apu_cpu[i], sizeof(s->apu_cpu[i]), "cortex-a53-" TYPE_ARM_CPU); object_property_add_child(obj, "apu-cpu[*]", OBJECT(&s->apu_cpu[i]), &error_abort); } for (i = 0; i < XLNX_ZYNQMP_NUM_RPU_CPUS; i++) { object_initialize(&s->rpu_cpu[i], sizeof(s->rpu_cpu[i]), "cortex-r5-" TYPE_ARM_CPU); object_property_add_child(obj, "rpu-cpu[*]", OBJECT(&s->rpu_cpu[i]), &error_abort); } object_property_add_link(obj, "ddr-ram", TYPE_MEMORY_REGION, (Object **)&s->ddr_ram, qdev_prop_allow_set_link_before_realize, OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort); object_initialize(&s->gic, sizeof(s->gic), TYPE_ARM_GIC); qdev_set_parent_bus(DEVICE(&s->gic), sysbus_get_default()); for (i = 0; i < XLNX_ZYNQMP_NUM_GEMS; i++) { object_initialize(&s->gem[i], sizeof(s->gem[i]), TYPE_CADENCE_GEM); qdev_set_parent_bus(DEVICE(&s->gem[i]), sysbus_get_default()); } for (i = 0; i < XLNX_ZYNQMP_NUM_UARTS; i++) { object_initialize(&s->uart[i], sizeof(s->uart[i]), TYPE_CADENCE_UART); qdev_set_parent_bus(DEVICE(&s->uart[i]), sysbus_get_default()); } object_initialize(&s->sata, sizeof(s->sata), TYPE_SYSBUS_AHCI); qdev_set_parent_bus(DEVICE(&s->sata), sysbus_get_default()); for (i = 0; i < XLNX_ZYNQMP_NUM_SDHCI; i++) { object_initialize(&s->sdhci[i], sizeof(s->sdhci[i]), TYPE_SYSBUS_SDHCI); qdev_set_parent_bus(DEVICE(&s->sdhci[i]), sysbus_get_default()); } for (i = 0; i < XLNX_ZYNQMP_NUM_SPIS; i++) { object_initialize(&s->spi[i], sizeof(s->spi[i]), TYPE_XILINX_SPIPS); qdev_set_parent_bus(DEVICE(&s->spi[i]), sysbus_get_default()); } }
1threat
AWS dynamodb over AWS S3 : <p>I am new to AWS and need to decide what to choose between AWS dynamo db or AWS S3.</p> <p>I have a use case in which I need to fetch multiple items from the data source and update the items and put back to the data source. I have searched and found that we can't perform multiple get in S3. </p> <p>Any Suggestions it will be helpful !!</p>
0debug
static inline void vring_used_flags_set_bit(VirtQueue *vq, int mask) { VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches); VirtIODevice *vdev = vq->vdev; hwaddr pa = offsetof(VRingUsed, flags); uint16_t flags = virtio_lduw_phys_cached(vq->vdev, &caches->used, pa); virtio_stw_phys_cached(vdev, &caches->used, pa, flags | mask); address_space_cache_invalidate(&caches->used, pa, sizeof(flags)); }
1threat
mandrill alternative for laravel (easy to setup) : <p>I am a newbie to Laravel and have many problems in configuring the mail server. Is there any free and easy to set up mail service for Laravel?</p>
0debug
static int qcow_write(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors) { Coroutine *co; AioContext *aio_context = bdrv_get_aio_context(bs); QcowWriteCo data = { .bs = bs, .sector_num = sector_num, .buf = buf, .nb_sectors = nb_sectors, .ret = -EINPROGRESS, }; co = qemu_coroutine_create(qcow_write_co_entry); qemu_coroutine_enter(co, &data); while (data.ret == -EINPROGRESS) { aio_poll(aio_context, true); } return data.ret; }
1threat
How do I make a variable public? : I am making a game with c# (WINFORM Application) in Visual Studio. I have a int named "mode" and I want to make every function be able to access it. Here is my code. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form5 : Form { public Form5() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { int wow = mode - 1; } private void Form5_Load(object sender, EventArgs e) { int mode = 4; } } }
0debug
Tallying values in single column and separating into Rows in R : <p>I have a single row of numbers. I'm wondering how I can separate it out so that it outputs columns that total the tally of each set of numbers. I've tried playing around with "separate" but I can't figure out how to make it work. </p> <pre><code>Here's my data frame: 2 2 2 2 2 4 4 4 I'd like it to be 2 4 5 3 </code></pre>
0debug
db.execute('SELECT * FROM employees WHERE id = ' + user_input)
1threat
MATLAB: cell matrix to 2d matrix : I want to find easy way to convert 1x324 matrix which contains cells to 2-dimensional matrix/table. Each cell size is 27x94 so it contains 2538 different values. I want to convert this matrix of cells to 324x2538 matrix so that each row element of cells will be added after each other. To clarify what kind of structure matrixes I have and what i'm trying to create: What I have: ---- A = [cell1, cell2, cell3, ..., cell324] (Cells are in 1st row of matrix) cell(n) = [1,2,3,4,...,27 ; 28,29,30,... ; 2512,2513,2514,...,2538] (27x94 matrix) ---- What I trying to do: B = [1,2,3,4,5,...,2538;2538,2539,...;819775,819776...822312] (324x2538 matrix)
0debug
static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap) { NUTContext *nut = s->priv_data; ByteIOContext *bc = &s->pb; int64_t pos; int inited_stream_count; nut->avf= s; pos=0; for(;;){ pos= find_startcode(bc, MAIN_STARTCODE, pos)+1; if (pos<0){ av_log(s, AV_LOG_ERROR, "no main startcode found\n"); return -1; } if(decode_main_header(nut) >= 0) break; } s->bit_rate = 0; nut->stream = av_malloc(sizeof(StreamContext)*nut->stream_count); pos=0; for(inited_stream_count=0; inited_stream_count < nut->stream_count;){ pos= find_startcode(bc, STREAM_STARTCODE, pos)+1; if (pos<0){ av_log(s, AV_LOG_ERROR, "not all stream headers found\n"); return -1; } if(decode_stream_header(nut) >= 0) inited_stream_count++; } pos=0; for(;;){ uint64_t startcode= find_any_startcode(bc, pos); pos= url_ftell(bc); if(startcode==0){ av_log(s, AV_LOG_ERROR, "EOF before video frames\n"); return -1; }else if(startcode == KEYFRAME_STARTCODE){ nut->next_startcode= startcode; break; }else if(startcode != INFO_STARTCODE){ continue; } decode_info_header(nut); } return 0; }
1threat
How to clear master.dbo.sysprocesses ? : I see all connection session by query statement: Select * From master.dbo.sysprocesses And i try to clear by statement: Delete From master.dbo.sysprocesses or Truncate table master.dbo.sysprocesses or update but not allow. [How to clear master.dbo.sysprocesses][1] Please help me know how to clear or update ***master.dbo.sysprocesses*** ? Thank you very much! [1]: http://i.stack.imgur.com/q1AmQ.png
0debug
opencv SUFR feature detection. is it reliably enough? : i want to develop an app, it needs to search similar pictures from back-end according to a uploaded picture. just like google's "search by image" function [![enter image description here][1]][1] [1]: http://i.stack.imgur.com/h767p.jpg As far as i know, opencv can handle this kind of thing, e.g Mean Shift, Contours Match . SUFT... and seems SUFT is the best one. but now i'm worried about whether can use it in enterprise product or whether it is reliably enough? as i'm not just write a hello world program now and suppose the detection error rate is not too high! if anyone who ever use this in your project before, expect you could share your experience. i will appreciate it very much
0debug
Destructure an object parameter two levels? : <p>So, I'm passing an object to an ES6 function that I'd like to <strong>destructure</strong> down to the parameter of a parameter. For example, the code below will log the <code>data</code> prop of <code>stuff</code>, but I'd like it to log the <code>things</code> prop of <code>data</code> of <code>stuff</code>. So the correct answer would log <code>[1,2,3,4]</code>. Not confusing at all, I know. Anyone know if this is possible?</p> <pre><code>const stuff = { data: { things: [1,2,3,4] } }; const getThings = ({ data }) =&gt; { console.log(data) }; getThings(stuff); </code></pre>
0debug
void mpeg_motion_internal(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int field_based, int bottom_field, int field_select, uint8_t **ref_picture, op_pixels_func (*pix_op)[4], int motion_x, int motion_y, int h, int is_mpeg12, int mb_y) { uint8_t *ptr_y, *ptr_cb, *ptr_cr; int dxy, uvdxy, mx, my, src_x, src_y, uvsrc_x, uvsrc_y, v_edge_pos; ptrdiff_t uvlinesize, linesize; #if 0 if (s->quarter_sample) { motion_x >>= 1; motion_y >>= 1; } #endif v_edge_pos = s->v_edge_pos >> field_based; linesize = s->current_picture.f.linesize[0] << field_based; uvlinesize = s->current_picture.f.linesize[1] << field_based; dxy = ((motion_y & 1) << 1) | (motion_x & 1); src_x = s->mb_x * 16 + (motion_x >> 1); src_y = (mb_y << (4 - field_based)) + (motion_y >> 1); if (!is_mpeg12 && s->out_format == FMT_H263) { if ((s->workaround_bugs & FF_BUG_HPEL_CHROMA) && field_based) { mx = (motion_x >> 1) | (motion_x & 1); my = motion_y >> 1; uvdxy = ((my & 1) << 1) | (mx & 1); uvsrc_x = s->mb_x * 8 + (mx >> 1); uvsrc_y = (mb_y << (3 - field_based)) + (my >> 1); } else { uvdxy = dxy | (motion_y & 2) | ((motion_x & 2) >> 1); uvsrc_x = src_x >> 1; uvsrc_y = src_y >> 1; } } else if (!is_mpeg12 && s->out_format == FMT_H261) { mx = motion_x / 4; my = motion_y / 4; uvdxy = 0; uvsrc_x = s->mb_x * 8 + mx; uvsrc_y = mb_y * 8 + my; } else { if (s->chroma_y_shift) { mx = motion_x / 2; my = motion_y / 2; uvdxy = ((my & 1) << 1) | (mx & 1); uvsrc_x = s->mb_x * 8 + (mx >> 1); uvsrc_y = (mb_y << (3 - field_based)) + (my >> 1); } else { if (s->chroma_x_shift) { mx = motion_x / 2; uvdxy = ((motion_y & 1) << 1) | (mx & 1); uvsrc_x = s->mb_x * 8 + (mx >> 1); uvsrc_y = src_y; } else { uvdxy = dxy; uvsrc_x = src_x; uvsrc_y = src_y; } } } ptr_y = ref_picture[0] + src_y * linesize + src_x; ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x; ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x; if ((unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x & 1) - 16, 0) || (unsigned)src_y > FFMAX(v_edge_pos - (motion_y & 1) - h, 0)) { if (is_mpeg12 || s->codec_id == AV_CODEC_ID_MPEG2VIDEO || s->codec_id == AV_CODEC_ID_MPEG1VIDEO) { av_log(s->avctx, AV_LOG_DEBUG, "MPEG motion vector out of boundary (%d %d)\n", src_x, src_y); return; } s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, s->linesize, 17, 17 + field_based, src_x, src_y << field_based, s->h_edge_pos, s->v_edge_pos); ptr_y = s->edge_emu_buffer; if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { uint8_t *uvbuf = s->edge_emu_buffer + 18 * s->linesize; s->vdsp.emulated_edge_mc(uvbuf, ptr_cb, s->uvlinesize, s->uvlinesize, 9, 9 + field_based, uvsrc_x, uvsrc_y << field_based, s->h_edge_pos >> 1, s->v_edge_pos >> 1); s->vdsp.emulated_edge_mc(uvbuf + 16, ptr_cr, s->uvlinesize, s->uvlinesize, 9, 9 + field_based, uvsrc_x, uvsrc_y << field_based, s->h_edge_pos >> 1, s->v_edge_pos >> 1); ptr_cb = uvbuf; ptr_cr = uvbuf + 16; } } if (bottom_field) { dest_y += s->linesize; dest_cb += s->uvlinesize; dest_cr += s->uvlinesize; } if (field_select) { ptr_y += s->linesize; ptr_cb += s->uvlinesize; ptr_cr += s->uvlinesize; } pix_op[0][dxy](dest_y, ptr_y, linesize, h); if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { pix_op[s->chroma_x_shift][uvdxy] (dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift); pix_op[s->chroma_x_shift][uvdxy] (dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift); } if (!is_mpeg12 && (CONFIG_H261_ENCODER || CONFIG_H261_DECODER) && s->out_format == FMT_H261) { ff_h261_loop_filter(s); } }
1threat
How to short multidimensional PHP array (recent news time based implementation) : i got some recent news rss in xml format and change in to json format , it is needed for android application to display recent news. i have an following JSON array ... { "rss_news": [ { "title": " ", "rss_original_src": "recent_news1(google news)", "rss_original_src_img": "", "link": "", "pubDate": "Tue, 19 Apr 2016 14:05:47 +0530", "description": "" }, { "title": " ", "rss_original_src": "recent_news2(yahoo news)", "rss_original_src_img": "", "link": "", "pubDate": "Tue, 19 Apr 2016 16:05:47 +0530", "description": "" }, { "title": " ", "rss_original_src": "recent_news3", "rss_original_src_img": "", "link": "", "pubDate": "Tue, 19 Apr 2016 11:05:47 +0530", "description": "" }, .... ] } --------- Now i need ... PHP multi dimensional array short based on value(pubDate).. Thanks in advance..
0debug
static inline void RENAME(rgb15to16)(const uint8_t *src, uint8_t *dst, int src_size) { register const uint8_t* s=src; register uint8_t* d=dst; register const uint8_t *end; const uint8_t *mm_end; end = s + src_size; __asm__ volatile(PREFETCH" %0"::"m"(*s)); __asm__ volatile("movq %0, %%mm4"::"m"(mask15s)); mm_end = end - 15; while (s<mm_end) { __asm__ volatile( PREFETCH" 32%1 \n\t" "movq %1, %%mm0 \n\t" "movq 8%1, %%mm2 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm2, %%mm3 \n\t" "pand %%mm4, %%mm0 \n\t" "pand %%mm4, %%mm2 \n\t" "paddw %%mm1, %%mm0 \n\t" "paddw %%mm3, %%mm2 \n\t" MOVNTQ" %%mm0, %0 \n\t" MOVNTQ" %%mm2, 8%0" :"=m"(*d) :"m"(*s) ); d+=16; s+=16; } __asm__ volatile(SFENCE:::"memory"); __asm__ volatile(EMMS:::"memory"); mm_end = end - 3; while (s < mm_end) { register unsigned x= *((const uint32_t *)s); *((uint32_t *)d) = (x&0x7FFF7FFF) + (x&0x7FE07FE0); d+=4; s+=4; } if (s < end) { register unsigned short x= *((const uint16_t *)s); *((uint16_t *)d) = (x&0x7FFF) + (x&0x7FE0); } }
1threat
static int ata_passthrough_16_xfer_size(SCSIDevice *dev, uint8_t *buf) { int extend = buf[1] & 0x1; int length = buf[2] & 0x3; int xfer; int unit = ata_passthrough_xfer_unit(dev, buf); switch (length) { case 0: case 3: xfer = 0; break; case 1: xfer = buf[4]; xfer |= (extend ? buf[3] << 8 : 0); break; case 2: xfer = buf[6]; xfer |= (extend ? buf[5] << 8 : 0); break; } return xfer * unit; }
1threat
How does "|" operator evaluates two integer ? : I have some thing that i haven't yet wrapped my head around yet enter code here #include<iostream> int main() { int x,y,z; x=2; y=4; z=x|y; } why does z gets assigned 6 how does this work
0debug
Why cant i overload the * operator? : <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; using namespace std; class sequence{ public: sequence(); sequence(int x); sequence&amp; operator*=(const &amp;left, const &amp;right); ~sequence(); friend istream&amp; operator &gt;&gt;(istream&amp;, sequence&amp;); friend ostream&amp; operator &lt;&lt;(ostream&amp;, sequence&amp;); void set_num_samples(); //Set no. of samples float* value; //pointer to float variable void allocate_memory(); //Allocates memory void set_values_array(); //Sets the values of an array void check_array_input(float l); //Checks the values of the array void reset_input(float j); //Resets the array void de_allocate(); //deallocates memory int get_num_samples(); void set_full_array(int x); void calculate_full(float array1[], float array2[]); void combine_seq_coef(sequence&amp; inputvoltageA); //Combines the passed in sequence and coefficient void combine_seq(sequence&amp; objectcombine, int sample); // combine the sequences private: int num_samples; //number of samples in the object sequence }; class FIR{ public: FIR(); ~FIR(); private: int num_coefficients; //Number of coefficients in an FIR (filter impulse response) }; //Constructor for each object void sequence::set_num_samples() { //Set_num_sample definition cout &lt;&lt; "Please enter the number of values in your sequence: \n"; cin &gt;&gt; num_samples; if(num_samples &lt; 0){ cout &lt;&lt; "Value entered must be greater than 0 "&lt;&lt; endl; cout &lt;&lt; "Please enter the value again: " &lt;&lt; endl; cin &gt;&gt; num_samples; } }; //ok (stream op) void sequence::allocate_memory() { value = new float[num_samples]; //Allocated memory for Array. }; //ok void sequence::set_values_array(){ //Set values for array int k; for(k=0; k&lt;num_samples; k++){ cout &lt;&lt; "Please enter a positive value for element : " &lt;&lt; (k+1) &lt;&lt; endl; cin &gt;&gt; value[k]; while(value[k] &lt; 0){ cout &lt;&lt; "Enter positive value " &lt;&lt; endl; cin &gt;&gt; value[k]; } } cout &lt;&lt; "Values have been assigned successfully! " &lt;&lt; endl; }; //ok //Constructor functions void sequence::check_array_input(float l) { //Checks array values. cout &lt;&lt; endl &lt;&lt; "If you would like to check input values, enter 'y' otherwise, enter 'n' to continue..." &lt;&lt; endl; char check_value; cin &gt;&gt; check_value; if (check_value == 'y') { int i; for (i = 0; i &lt; l; i++) { cout &lt;&lt; "Value no. " &lt;&lt; (i + 1) &lt;&lt; " is:" &lt;&lt; endl; cout &lt;&lt; value[i] &lt;&lt; endl; } } } void sequence::reset_input(float j) { //Reset voltage value and set to 0; cout &lt;&lt; endl &lt;&lt; "If you would like to reset all input values, enter 'y' otherwise, enter 'n' to continue..." &lt;&lt; endl; char check_value2; cin &gt;&gt; check_value2; if (check_value2 == 'y') { int i; for (i = 0; i &lt; j; i++) { cout &lt;&lt; "Value no." &lt;&lt; (i + 1) &lt;&lt; ": " &lt;&lt; value[i]; value[i] = 0; cout &lt;&lt; " is set to 0!" &lt;&lt; endl; } } } void sequence::de_allocate(){ delete[] value; //De-allocate memory num_samples = 0; cout &lt;&lt; "De-allocation of input array successful, num of samples reset to 0! " &lt;&lt; endl; } int sequence::get_num_samples(){ return num_samples; } /* void sequence::calculate_full(float array1[], float array2[]){ int loop; for(loop=0; loop&lt;num_samples; loop++){ cout &lt;&lt; "CoefficientA value no: " &lt;&lt; (loop+1) &lt;&lt; ": " &lt;&lt; array1[loop].value[loop] &lt;&lt; endl; cout &lt;&lt; "InputvoltageA value no." &lt;&lt; (loop+1) &lt;&lt; ": " &lt;&lt; array2[loop].value[loop] &lt;&lt; endl; value[loop] = (array1[loop].value[loop])*(array2[loop].value[loop]); cout &lt;&lt; "Combined value no. " &lt;&lt; (i+1) &lt;&lt; ": " &lt;&lt; value[loop] &lt;&lt; endl; cout &lt;&lt; "The combined value gives" &lt;&lt; full[loop] &lt;&lt; endl; } }; */ void sequence::set_full_array(int x){ num_samples = x; } void sequence::combine_seq(sequence&amp; object_combine, int sample_num){ int loop; for(loop=0; loop&lt;sample_num; loop++){ } }; sequence&amp; sequence::operator*=(const &amp;left, const &amp;right){ int y = left.get_num_samples(); int x; for (x=0; ) sequence = left.value * right.value return sequence; } sequence::sequence(){ //SEQUENCE CONSTRUCTOR set_num_samples(); allocate_memory(); set_values_array(); check_array_input(num_samples); reset_input(num_samples); de_allocate(); cout &lt;&lt; endl &lt;&lt; "Constructor complete!" &lt;&lt; endl; }; sequence::sequence(int a){ //sequence constructor 2 set_full_array(a); allocate_memory(); } /* sequence::sequence(int a){ set_full_samples(); allocate_memory(); int i; for(i=0; i&lt;num_samples; i++){ cout &lt;&lt; "CoefficientA value no: " &lt;&lt; (i+1) &lt;&lt; ": " &lt;&lt; coefficientA().value[i] &lt;&lt; endl; cout &lt;&lt; "InputvoltageA value no." &lt;&lt; (i+1) &lt;&lt; ": " &lt;&lt; inputvoltageA.value[i] &lt;&lt; endl; cout &lt;&lt; "Combined value no. " &lt;&lt; (i+1) &lt;&lt; ": " &lt;&lt; value[i] &lt;&lt; endl; } } */ sequence::~sequence(){ //Destructor cout &lt;&lt; "Destructor is called" &lt;&lt; endl; }; //destructor int main(){ // Create object, constructor called // Constructor calls, set_num_sample, allocate_memory, set_values_array // Enters values for voltage Inputs to the sequence into an array // Checks values of the array // Asks user if they want to reset values and set num samples = 0. do { cout &lt;&lt; "Press the Enter key to continue:" &lt;&lt; endl; } while (cin.get() != '\n'); cout &lt;&lt; "Input voltage sequence created!" &lt;&lt; endl; sequence inputvoltageA; cout &lt;&lt; endl &lt;&lt; "CoefficientA sequence created!" &lt;&lt; endl; sequence coefficientA; //Combines sequence and coefficients cout &lt;&lt; "If you would like to combine the coefficients with the input sequence A enter 'y', otherwise enter 'n'" &lt;&lt; endl; char prompt4; cin &gt;&gt; prompt4; if(prompt4 == 'y'){ int x = coefficientA.get_num_samples(); sequence full(x); full = coefficientA*inputvoltageA; } /* Ask the user if they want to create new object cout &lt;&lt; "If you would like to create a new input voltage sequence enter 'y', otherwise enter 'n'" &lt;&lt; endl; char prompt3; cin &gt;&gt; prompt3; if(prompt3 == 'y'){ sequence inputvoltageB; } cout &lt;&lt; "CoefficientA sequence created!" &lt;&lt; endl; sequence coefficientB; */ /* cout &lt;&lt; "If you would like to combine this sequence with the sequence before enter 'y', otherwise enter 'n'" &lt;&lt; endl; char prompt5; cin &gt;&gt; prompt5; if(prompt5 == 'y'){ combine_seq(inputvoltageA, num_samples); } */ return 0; } </code></pre> <p>Why cant i overload the * operator? The compiler gives me the error c++ must have a type specifier. My type specifier is a reference to a sequence object... I think ive defined the overload operator * function correctly in the class and outside of it.</p>
0debug
how to save multiple values of record in php to enter in database : this is the code that retrive data from database for taking attendance. <?php while($row4 = mysqli_fetch_array($result4)) { echo " <tr> <td> <input type='text' name='enrol' value='$row4[enrolment_no]' /> <div class='make-switch switch-small'> <input type='checkbox' name='attendance' /> </div> </td> <td> <div class='checkbox'> <label> <input class='uniform' type='checkbox' name='event'/> </label> </div> </td> <td>$row4[roll_no]</td> <td>$row4[stud_fname] $row4[stud_lname]</td> </tr> "; } ?>
0debug
Is there a proof that runST is indeed pure? : <p>The <a href="http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Monad-ST.html" rel="noreferrer">ST monad</a>, originally devised by <a href="http://dl.acm.org/citation.cfm?doid=178243.178246" rel="noreferrer">Launchbury and Peyton Jones</a>, allows Haskell programmers to write imperative code (with mutable variables, arrays, etc.) while obtaining a pure interface to that code.</p> <p>More concretely, the polymorphic type of the <a href="http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Monad-ST.html#v:runST" rel="noreferrer">entry point function</a></p> <pre><code>runST :: (forall s. ST s a) -&gt; a </code></pre> <p>ensures that all side-effects of the <code>ST</code> computation is contained, and the resulting value is pure.</p> <p>Has this ever been rigorously (or even formally) proven?</p>
0debug
Dropbox bug: Missing text for Folder Settings : <p>So I was sharing a folder on Dropbox and decided to see its Folder Settings. I noticed then that some label text was missing from the form. It might just be me (Linux Mint), but can anyone tell me what these fields do?</p> <p><a href="https://i.stack.imgur.com/6F8fD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6F8fD.png" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/4S56e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4S56e.png" alt="enter image description here"></a></p>
0debug
Weird colors on Chrome/Linux : <p>I'm experiencing a weird issue on Chrome 61 on Linux,</p> <p>Colors on chrome are very different compared to others browsers:</p> <p><a href="https://i.stack.imgur.com/A3PC3.png" rel="noreferrer"><img src="https://i.stack.imgur.com/A3PC3.png" alt="enter image description here"></a> On the left this is Firefox, on the right Chrome</p> <p>As you see, Chrome colors are not enough saturated. </p> <p>The chrome internal color picker show the expected Hex value, but any other external color pickers indicates this is not the good red and yellow.</p> <p>I've reset my chrome settings and removed all extensions, but this not solved my issue.</p> <p>Did someone have experienced the same issue?</p> <p>Thanks</p>
0debug
restore_fpu_state(CPUSPARCState *env, qemu_siginfo_fpu_t *fpu) { int err; #if 0 #ifdef CONFIG_SMP if (current->flags & PF_USEDFPU) regs->psr &= ~PSR_EF; #else if (current == last_task_used_math) { last_task_used_math = 0; regs->psr &= ~PSR_EF; } #endif current->used_math = 1; current->flags &= ~PF_USEDFPU; #endif #if 0 if (verify_area (VERIFY_READ, fpu, sizeof(*fpu))) return -EFAULT; #endif err = copy_from_user(&env->fpr[0], fpu->si_float_regs[0], (sizeof(abi_ulong) * 32)); err |= __get_user(env->fsr, &fpu->si_fsr); #if 0 err |= __get_user(current->thread.fpqdepth, &fpu->si_fpqdepth); if (current->thread.fpqdepth != 0) err |= __copy_from_user(&current->thread.fpqueue[0], &fpu->si_fpqueue[0], ((sizeof(unsigned long) + (sizeof(unsigned long *)))*16)); #endif return err; }
1threat
Ionic 4 Angular Application Mac Address App restart needed after allowing permission : <p>Implemented ionic code with required plugin but it gives the message "Please Restart App!". Without restart app Mac address getting null. After restart getting proper Mac address. How to get Mac address without restart app.</p> <p>Link refered : <a href="https://www.freakyjolly.com/ionic-4-get-unique-device-id-other-uids-of-uuid-imei-imsi-iccid-and-mac-using-native-cordova-plugins/" rel="nofollow noreferrer">https://www.freakyjolly.com/ionic-4-get-unique-device-id-other-uids-of-uuid-imei-imsi-iccid-and-mac-using-native-cordova-plugins/</a></p>
0debug
Invalid syntax with else statement in python3 : <p>When I try to run my code it says I have invalid syntax with my else statement, but I can't figure out what's wrong.</p> <pre><code>import random import time username = input("Hello. Please enter your name, then press 'enter'. After you type something, you will need to /n" "click the 'enter' key to send it") print ("Hello " + username) time.sleep(3) game_tutorial_input = input("Do you wish to see the tutorial? (y/n)") if game_tutorial_input == "y": print ("Great! Press enter after each instruction to move /n" "onto the next one.") else print("Are you sure? (y/n") </code></pre>
0debug
static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp) { uint8_t* config = qxl->pci.config; uint32_t pci_device_rev; uint32_t io_size; qxl->mode = QXL_MODE_UNDEFINED; qxl->generation = 1; qxl->num_memslots = NUM_MEMSLOTS; qemu_mutex_init(&qxl->track_lock); qemu_mutex_init(&qxl->async_lock); qxl->current_async = QXL_UNDEFINED_IO; qxl->guest_bug = 0; switch (qxl->revision) { case 1: pci_device_rev = QXL_REVISION_STABLE_V04; io_size = 8; break; case 2: pci_device_rev = QXL_REVISION_STABLE_V06; io_size = 16; break; case 3: pci_device_rev = QXL_REVISION_STABLE_V10; io_size = 32; break; case 4: pci_device_rev = QXL_REVISION_STABLE_V12; io_size = pow2ceil(QXL_IO_RANGE_SIZE); break; default: error_setg(errp, "Invalid revision %d for qxl device (max %d)", qxl->revision, QXL_DEFAULT_REVISION); return; } pci_set_byte(&config[PCI_REVISION_ID], pci_device_rev); pci_set_byte(&config[PCI_INTERRUPT_PIN], 1); qxl->rom_size = qxl_rom_size(); memory_region_init_ram(&qxl->rom_bar, OBJECT(qxl), "qxl.vrom", qxl->rom_size, &error_fatal); vmstate_register_ram(&qxl->rom_bar, &qxl->pci.qdev); init_qxl_rom(qxl); init_qxl_ram(qxl); qxl->guest_surfaces.cmds = g_new0(QXLPHYSICAL, qxl->ssd.num_surfaces); memory_region_init_ram(&qxl->vram_bar, OBJECT(qxl), "qxl.vram", qxl->vram_size, &error_fatal); vmstate_register_ram(&qxl->vram_bar, &qxl->pci.qdev); memory_region_init_alias(&qxl->vram32_bar, OBJECT(qxl), "qxl.vram32", &qxl->vram_bar, 0, qxl->vram32_size); memory_region_init_io(&qxl->io_bar, OBJECT(qxl), &qxl_io_ops, qxl, "qxl-ioports", io_size); if (qxl->id == 0) { vga_dirty_log_start(&qxl->vga); } memory_region_set_flush_coalesced(&qxl->io_bar); pci_register_bar(&qxl->pci, QXL_IO_RANGE_INDEX, PCI_BASE_ADDRESS_SPACE_IO, &qxl->io_bar); pci_register_bar(&qxl->pci, QXL_ROM_RANGE_INDEX, PCI_BASE_ADDRESS_SPACE_MEMORY, &qxl->rom_bar); pci_register_bar(&qxl->pci, QXL_RAM_RANGE_INDEX, PCI_BASE_ADDRESS_SPACE_MEMORY, &qxl->vga.vram); pci_register_bar(&qxl->pci, QXL_VRAM_RANGE_INDEX, PCI_BASE_ADDRESS_SPACE_MEMORY, &qxl->vram32_bar); if (qxl->vram32_size < qxl->vram_size) { pci_register_bar(&qxl->pci, QXL_VRAM64_RANGE_INDEX, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64 | PCI_BASE_ADDRESS_MEM_PREFETCH, &qxl->vram_bar); } dprint(qxl, 1, "ram/%s: %d MB [region 0]\n", qxl->id == 0 ? "pri" : "sec", qxl->vga.vram_size / (1024*1024)); dprint(qxl, 1, "vram/32: %d MB [region 1]\n", qxl->vram32_size / (1024*1024)); dprint(qxl, 1, "vram/64: %d MB %s\n", qxl->vram_size / (1024*1024), qxl->vram32_size < qxl->vram_size ? "[region 4]" : "[unmapped]"); qxl->ssd.qxl.base.sif = &qxl_interface.base; if (qemu_spice_add_display_interface(&qxl->ssd.qxl, qxl->vga.con) != 0) { error_setg(errp, "qxl interface %d.%d not supported by spice-server", SPICE_INTERFACE_QXL_MAJOR, SPICE_INTERFACE_QXL_MINOR); return; } qemu_add_vm_change_state_handler(qxl_vm_change_state_handler, qxl); qxl->update_irq = qemu_bh_new(qxl_update_irq_bh, qxl); qxl_reset_state(qxl); qxl->update_area_bh = qemu_bh_new(qxl_render_update_area_bh, qxl); qxl->ssd.cursor_bh = qemu_bh_new(qemu_spice_cursor_refresh_bh, &qxl->ssd); }
1threat
No events trigger and buttons are not pressable : <p>When creating a winforms application I added a pannel as a header so I could make the application borderless, I was going to add some buttons when I realised no events were getting registered by the program. Have I flicked a wrong switch somewhere?</p> <p>I have already tried clicking the main form and changing the AutoValidation as well as checking that the form, as well as the panel, were both enabled.</p> <pre class="lang-cs prettyprint-override"><code>public App() { InitializeComponent(); } private void TopBar_MouseHover(object sender, EventArgs e) { Application.Exit(); } private void ExitButton_Click(object sender, EventArgs e) { Application.Exit(); } </code></pre> <p>Expect result is that it should just close the application when I hover over the topbar or when I click the ExitButton.</p>
0debug
Java Eclipse Error "cannot be resolved to a type" : <p>Im trying to model a solar system but am running into an issue. </p> <pre><code>public class Main { public static void main(String[] args) { drawSolarObject sun = new drawSolarObject(5,5,20,"YELLOW"); s.finishedDrawing(); public class Solar { public void drawSolarObject(double distance, double angle, double diameter, String col) </code></pre> <p>This is giving me an error </p> <blockquote> <p>"drawSolarObject cannot be resolved to a type"</p> </blockquote> <p>and im not sure why.</p> <p>Any help would be greatly appreciated. Thanks.</p>
0debug
background invalid property : <p>The page only accepts colors in the backgroud, images not</p> <pre><code> background: url (img/fondo-ingresar.jpg); </code></pre> <p>I even tried to put it in the HTML but still the same error of <strong>"Invalid Property Value"</strong></p>
0debug
Convert String to Date in Objective-C : <p>How do i convert string to date in Objective C.</p> <p>I have tried the following but did not figure it out.</p> <pre><code>NSString *str = @"3/2/2018 11:44:32 AM"; NSDateFormatter *df = [[NSDateFormatter alloc] init]; [df setDateFormat:@"MM/d/yyyy h:mm:ss a"]; NSDate *resultDate = [[NSDate alloc] init]; resultDate = [df dateFromString:str]; NSLog(@"result date: %@", resultDate); result date: 2018-03-02 06:14:32 +0000 ,but i need to get it as result date: 3/2/2018 11:44:32 AM </code></pre>
0debug
How to pass int optional parameter in webmethod using C# : I am passing int optional parameter in webmethod but i am getting ' Cannot convert to System.Int32.', my code is : [WebMethod] public string Test([Optional] int ID) { return "Test"; } can you please let me know that where is the issue, and what i am missing . please anyone reply me asap..
0debug
static void spr_write_ibatl (void *opaque, int sprn) { DisasContext *ctx = opaque; gen_op_store_ibatl((sprn - SPR_IBAT0L) / 2); RET_STOP(ctx); }
1threat
What is the purpose of Resolving model jre:call:zip:1.0.0? : <p>I try to run a Java program, I see:</p> <blockquote> <p>Resolving model jre:call:zip:1.0.0</p> </blockquote> <p><a href="https://i.stack.imgur.com/gG1bK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/gG1bK.png" alt="enter image description here"></a></p>
0debug
How to increase padding or margin between menu item icon and title in app toolbar? : <p>I'm having a problem with an item in my action bar: <a href="https://i.stack.imgur.com/4VqOR.png" rel="noreferrer"><img src="https://i.stack.imgur.com/4VqOR.png" alt="enter image description here"></a></p> <p>The refresh icon is too close to the title "REFRESH". It looks awkward.</p> <p>I am aware that one approach to fix this it to edit the image to forcibly add padding to it, or wrap it in an XML drawable that does so.</p> <p>It seems like I should not have to add space in the image itself to fix this. I feel that there should be an easy way to change a padding or margin attribute to fix the problem. I'm surprised they are so close together here.</p> <p>Any ideas?</p>
0debug
How to pass the match when using render in Route component from react router (v4) : <p>When declaring a route like this:</p> <p>App.js</p> <p><code>&lt;Route path="/:id" component={RunningProject} /&gt;</code></p> <p>I can obtain the id param in RunningProject.js like this</p> <pre><code>constructor(props){ super(props) console.log(props.match.params.id); } </code></pre> <p>But when declaring the route like this</p> <p><code>&lt;Route path="/:id" render={() =&gt; &lt;RunningProject getProjectById={this.getProject} /&gt;} /&gt;</code></p> <p>I get an error because match no longer get passed into the props.</p> <p>How can I pass the match object into the <code>props</code> using <code>render=</code> instead of <code>component=</code> ?</p>
0debug
how can i add google route plan with PHP array : honestly I'm new in php, and using a WP theme. This theme is a directory theme. So that there is an address with street, number and city. I have a php array get this values and converts them into a google map location link, (a button in front end that says "Open in Google map"). But I want to change this to open at google map and route the plan from my location. here is the code : `if( !function_exists('estate_listing_address') ): function estate_listing_address($post_id,$col=3){ $property_address = esc_html( get_post_meta($post_id, 'property_address', true) ); $property_city = strip_tags ( get_the_term_list($post_id, 'property_city', '', ', ', '') ); $url = urlencode($property_address.','.$property_city); $google_map_url = "http://maps.google.com/?q=".$url; $return_string.= ' <a href="'.$google_map_url.'" target="_blank" class="button">'.__('Route plan','wpestate').'</a>'; return $return_string; } endif; I think $url, has the address and is added to google map url, but should I add here more so that will also route the plan from my location ! thanks, `
0debug
Write a program to print odd numbers in a list by userentered input : #WAP to print odd numbers in a list. list2 = [ list2 for list2 in input("list").split(",")] odd_nos = [ num for num in list2 if num % 2 !=0] print ("Odd numbers in the list: ",odd_nos) I cant runthis program it came type error like: odd_nos =[ num for num in list2 if num % 2 !=0] TypeError: not all arguments converted during string formatting
0debug
VBscript to merge multiple excel files into a new excel file : I know the question has been asked so many times already, and I have tried to use Google to search the interest but failed to find the correct VBscript. ( Trust me, I am not a taker). Anyway, the idea is to run a VBscript to merge all excel files (CAD,GBP,JPY,USD) to a new excel file ( tab shows name "CAD","GBP", "JPY","USD") in the current folder. I have wrote the following script to merge excel files, but it does not even work. Please kindly help me on it. Thanks for the time. Sub CombineWorkbooks() Dim Path As String Dim FileName As String Dim Wkb As Workbook Dim WS As Worksheet Application.EnableEvents = False Application.ScreenUpdating = False Path = "X:\PATH\TO\EXCEL\FILES" FileName = Dir(Path & "\*.xls", vbNormal) Do Until FileName = "" Set Wkb = Workbooks.Open(FileName:=Path & "\" & FileName) For Each WS In Wkb.Worksheets WS.Copy After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count) Next WS Wkb.Close False FileName = Dir() Loop Application.EnableEvents = True Application.ScreenUpdating = True End Sub
0debug
bool kvmppc_is_mem_backend_page_size_ok(const char *obj_path) { Object *mem_obj = object_resolve_path(obj_path, NULL); char *mempath = object_property_get_str(mem_obj, "mem-path", NULL); long pagesize; if (mempath) { pagesize = qemu_mempath_getpagesize(mempath); } else { pagesize = getpagesize(); } return pagesize >= max_cpu_page_size; }
1threat
How do I replace an ImageView with a Layout containing many elements in Android Studio? : <p>I have an ImageView which among other elements is contained in a main linear layout. On a certain button click , I want to replace the ImageView with a Linear Layout. Is there a way to do this in Android ? I already set up the event listener and everything.</p>
0debug
av_cold void ff_vp9dsp_init_x86(VP9DSPContext *dsp, int bpp) { #if HAVE_YASM int cpu_flags; if (bpp != 8) return; cpu_flags = av_get_cpu_flags(); #define init_fpel(idx1, idx2, sz, type, opt) \ dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][0][0] = \ dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][0][0] = \ dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][0][0] = \ dsp->mc[idx1][FILTER_BILINEAR ][idx2][0][0] = ff_vp9_##type##sz##_##opt #define init_subpel1(idx1, idx2, idxh, idxv, sz, dir, type, opt) \ dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][idxh][idxv] = type##_8tap_smooth_##sz##dir##_##opt; \ dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][idxh][idxv] = type##_8tap_regular_##sz##dir##_##opt; \ dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][idxh][idxv] = type##_8tap_sharp_##sz##dir##_##opt #define init_subpel2(idx1, idx2, sz, type, opt) \ init_subpel1(idx1, idx2, 1, 1, sz, hv, type, opt); \ init_subpel1(idx1, idx2, 0, 1, sz, v, type, opt); \ init_subpel1(idx1, idx2, 1, 0, sz, h, type, opt) #define init_subpel3_32_64(idx, type, opt) \ init_subpel2(0, idx, 64, type, opt); \ init_subpel2(1, idx, 32, type, opt) #define init_subpel3_8to64(idx, type, opt) \ init_subpel3_32_64(idx, type, opt); \ init_subpel2(2, idx, 16, type, opt); \ init_subpel2(3, idx, 8, type, opt) #define init_subpel3(idx, type, opt) \ init_subpel3_8to64(idx, type, opt); \ init_subpel2(4, idx, 4, type, opt) #define init_lpf(opt) do { \ dsp->loop_filter_16[0] = ff_vp9_loop_filter_h_16_16_##opt; \ dsp->loop_filter_16[1] = ff_vp9_loop_filter_v_16_16_##opt; \ dsp->loop_filter_mix2[0][0][0] = ff_vp9_loop_filter_h_44_16_##opt; \ dsp->loop_filter_mix2[0][0][1] = ff_vp9_loop_filter_v_44_16_##opt; \ dsp->loop_filter_mix2[0][1][0] = ff_vp9_loop_filter_h_48_16_##opt; \ dsp->loop_filter_mix2[0][1][1] = ff_vp9_loop_filter_v_48_16_##opt; \ dsp->loop_filter_mix2[1][0][0] = ff_vp9_loop_filter_h_84_16_##opt; \ dsp->loop_filter_mix2[1][0][1] = ff_vp9_loop_filter_v_84_16_##opt; \ dsp->loop_filter_mix2[1][1][0] = ff_vp9_loop_filter_h_88_16_##opt; \ dsp->loop_filter_mix2[1][1][1] = ff_vp9_loop_filter_v_88_16_##opt; \ } while (0) #define init_ipred(sz, opt, t, e) \ dsp->intra_pred[TX_##sz##X##sz][e##_PRED] = ff_vp9_ipred_##t##_##sz##x##sz##_##opt #define ff_vp9_ipred_hd_4x4_ssse3 ff_vp9_ipred_hd_4x4_mmxext #define ff_vp9_ipred_vl_4x4_ssse3 ff_vp9_ipred_vl_4x4_mmxext #define init_dir_tm_ipred(sz, opt) do { \ init_ipred(sz, opt, dl, DIAG_DOWN_LEFT); \ init_ipred(sz, opt, dr, DIAG_DOWN_RIGHT); \ init_ipred(sz, opt, hd, HOR_DOWN); \ init_ipred(sz, opt, vl, VERT_LEFT); \ init_ipred(sz, opt, hu, HOR_UP); \ init_ipred(sz, opt, tm, TM_VP8); \ init_ipred(sz, opt, vr, VERT_RIGHT); \ } while (0) #define init_dir_tm_h_ipred(sz, opt) do { \ init_dir_tm_ipred(sz, opt); \ init_ipred(sz, opt, h, HOR); \ } while (0) #define init_dc_ipred(sz, opt) do { \ init_ipred(sz, opt, dc, DC); \ init_ipred(sz, opt, dc_left, LEFT_DC); \ init_ipred(sz, opt, dc_top, TOP_DC); \ } while (0) #define init_all_ipred(sz, opt) do { \ init_dc_ipred(sz, opt); \ init_dir_tm_h_ipred(sz, opt); \ } while (0) if (EXTERNAL_MMX(cpu_flags)) { init_fpel(4, 0, 4, put, mmx); init_fpel(3, 0, 8, put, mmx); dsp->itxfm_add[4 ][DCT_DCT] = dsp->itxfm_add[4 ][ADST_DCT] = dsp->itxfm_add[4 ][DCT_ADST] = dsp->itxfm_add[4 ][ADST_ADST] = ff_vp9_iwht_iwht_4x4_add_mmx; init_ipred(8, mmx, v, VERT); } if (EXTERNAL_MMXEXT(cpu_flags)) { init_subpel2(4, 0, 4, put, mmxext); init_subpel2(4, 1, 4, avg, mmxext); init_fpel(4, 1, 4, avg, mmxext); init_fpel(3, 1, 8, avg, mmxext); dsp->itxfm_add[TX_4X4][DCT_DCT] = ff_vp9_idct_idct_4x4_add_mmxext; init_dc_ipred(4, mmxext); init_dc_ipred(8, mmxext); init_dir_tm_ipred(4, mmxext); } if (EXTERNAL_SSE(cpu_flags)) { init_fpel(2, 0, 16, put, sse); init_fpel(1, 0, 32, put, sse); init_fpel(0, 0, 64, put, sse); init_ipred(16, sse, v, VERT); init_ipred(32, sse, v, VERT); } if (EXTERNAL_SSE2(cpu_flags)) { init_subpel3_8to64(0, put, sse2); init_subpel3_8to64(1, avg, sse2); init_fpel(2, 1, 16, avg, sse2); init_fpel(1, 1, 32, avg, sse2); init_fpel(0, 1, 64, avg, sse2); init_lpf(sse2); dsp->itxfm_add[TX_4X4][ADST_DCT] = ff_vp9_idct_iadst_4x4_add_sse2; dsp->itxfm_add[TX_4X4][DCT_ADST] = ff_vp9_iadst_idct_4x4_add_sse2; dsp->itxfm_add[TX_4X4][ADST_ADST] = ff_vp9_iadst_iadst_4x4_add_sse2; dsp->itxfm_add[TX_8X8][DCT_DCT] = ff_vp9_idct_idct_8x8_add_sse2; dsp->itxfm_add[TX_8X8][ADST_DCT] = ff_vp9_idct_iadst_8x8_add_sse2; dsp->itxfm_add[TX_8X8][DCT_ADST] = ff_vp9_iadst_idct_8x8_add_sse2; dsp->itxfm_add[TX_8X8][ADST_ADST] = ff_vp9_iadst_iadst_8x8_add_sse2; dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_sse2; dsp->itxfm_add[TX_16X16][ADST_DCT] = ff_vp9_idct_iadst_16x16_add_sse2; dsp->itxfm_add[TX_16X16][DCT_ADST] = ff_vp9_iadst_idct_16x16_add_sse2; dsp->itxfm_add[TX_16X16][ADST_ADST] = ff_vp9_iadst_iadst_16x16_add_sse2; dsp->itxfm_add[TX_32X32][ADST_ADST] = dsp->itxfm_add[TX_32X32][ADST_DCT] = dsp->itxfm_add[TX_32X32][DCT_ADST] = dsp->itxfm_add[TX_32X32][DCT_DCT] = ff_vp9_idct_idct_32x32_add_sse2; init_dc_ipred(16, sse2); init_dc_ipred(32, sse2); init_dir_tm_h_ipred(8, sse2); init_dir_tm_h_ipred(16, sse2); init_dir_tm_h_ipred(32, sse2); init_ipred(4, sse2, h, HOR); } if (EXTERNAL_SSSE3(cpu_flags)) { init_subpel3(0, put, ssse3); init_subpel3(1, avg, ssse3); dsp->itxfm_add[TX_4X4][DCT_DCT] = ff_vp9_idct_idct_4x4_add_ssse3; dsp->itxfm_add[TX_4X4][ADST_DCT] = ff_vp9_idct_iadst_4x4_add_ssse3; dsp->itxfm_add[TX_4X4][DCT_ADST] = ff_vp9_iadst_idct_4x4_add_ssse3; dsp->itxfm_add[TX_4X4][ADST_ADST] = ff_vp9_iadst_iadst_4x4_add_ssse3; dsp->itxfm_add[TX_8X8][DCT_DCT] = ff_vp9_idct_idct_8x8_add_ssse3; dsp->itxfm_add[TX_8X8][ADST_DCT] = ff_vp9_idct_iadst_8x8_add_ssse3; dsp->itxfm_add[TX_8X8][DCT_ADST] = ff_vp9_iadst_idct_8x8_add_ssse3; dsp->itxfm_add[TX_8X8][ADST_ADST] = ff_vp9_iadst_iadst_8x8_add_ssse3; dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_ssse3; dsp->itxfm_add[TX_16X16][ADST_DCT] = ff_vp9_idct_iadst_16x16_add_ssse3; dsp->itxfm_add[TX_16X16][DCT_ADST] = ff_vp9_iadst_idct_16x16_add_ssse3; dsp->itxfm_add[TX_16X16][ADST_ADST] = ff_vp9_iadst_iadst_16x16_add_ssse3; dsp->itxfm_add[TX_32X32][ADST_ADST] = dsp->itxfm_add[TX_32X32][ADST_DCT] = dsp->itxfm_add[TX_32X32][DCT_ADST] = dsp->itxfm_add[TX_32X32][DCT_DCT] = ff_vp9_idct_idct_32x32_add_ssse3; init_lpf(ssse3); init_all_ipred(4, ssse3); init_all_ipred(8, ssse3); init_all_ipred(16, ssse3); init_all_ipred(32, ssse3); } if (EXTERNAL_AVX(cpu_flags)) { dsp->itxfm_add[TX_8X8][DCT_DCT] = ff_vp9_idct_idct_8x8_add_avx; dsp->itxfm_add[TX_8X8][ADST_DCT] = ff_vp9_idct_iadst_8x8_add_avx; dsp->itxfm_add[TX_8X8][DCT_ADST] = ff_vp9_iadst_idct_8x8_add_avx; dsp->itxfm_add[TX_8X8][ADST_ADST] = ff_vp9_iadst_iadst_8x8_add_avx; dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_avx; dsp->itxfm_add[TX_16X16][ADST_DCT] = ff_vp9_idct_iadst_16x16_add_avx; dsp->itxfm_add[TX_16X16][DCT_ADST] = ff_vp9_iadst_idct_16x16_add_avx; dsp->itxfm_add[TX_16X16][ADST_ADST] = ff_vp9_iadst_iadst_16x16_add_avx; dsp->itxfm_add[TX_32X32][ADST_ADST] = dsp->itxfm_add[TX_32X32][ADST_DCT] = dsp->itxfm_add[TX_32X32][DCT_ADST] = dsp->itxfm_add[TX_32X32][DCT_DCT] = ff_vp9_idct_idct_32x32_add_avx; init_fpel(1, 0, 32, put, avx); init_fpel(0, 0, 64, put, avx); init_lpf(avx); init_dir_tm_h_ipred(8, avx); init_dir_tm_h_ipred(16, avx); init_dir_tm_h_ipred(32, avx); init_ipred(32, avx, v, VERT); } if (EXTERNAL_AVX2(cpu_flags)) { init_fpel(1, 1, 32, avg, avx2); init_fpel(0, 1, 64, avg, avx2); if (ARCH_X86_64) { #if ARCH_X86_64 && HAVE_AVX2_EXTERNAL init_subpel3_32_64(0, put, avx2); init_subpel3_32_64(1, avg, avx2); #endif } init_dc_ipred(32, avx2); init_ipred(32, avx2, h, HOR); init_ipred(32, avx2, tm, TM_VP8); } #undef init_fpel #undef init_subpel1 #undef init_subpel2 #undef init_subpel3 #endif }
1threat
My regex will not work if applied to a multiline xml schema : <p>I've written a regex to alter some XML nodes - taking a generic node name and replacing it instead with the nodes attribute value like so: Regex</p> <pre><code>&lt;custom-attribute attribute-id="(.*)?"\s*(&gt;*)(.*?)&lt;/custom-attribute&gt; </code></pre> <p>for the following xml:</p> <pre><code>&lt;custom-attribute attribute-id="isNewtest"&gt;false&lt;/custom-attribute&gt; </code></pre> <p>using replace regex</p> <pre><code>&lt;$1&gt;$3&lt;/$1&gt; </code></pre> <p>gives output of</p> <pre><code>&lt;isNewtest&gt;false&lt;/isNewtest&gt; </code></pre> <p>which is what I am looking for - however - once more than one node is introduced into the schema - e.g</p> <pre><code>&lt;custom-attribute attribute-id="isNewtest"&gt;false&lt;/custom-attribute&gt; &lt;custom-attribute attribute-id="isAnotherNewtest"&gt;false&lt;/custom-attribute&gt; </code></pre> <p>and I run the regex, the output is:</p> <pre><code>&lt;isNewtest"&gt;false&lt;/custom-attribute&gt; &lt;custom-attribute attribute-id="isAnotherNewtest&gt;false&lt;/isNewtest"&gt;false&lt;/custom-attribute&gt; &lt;custom-attribute attribute-id="isAnotherNewtest&gt; </code></pre> <p>which is not what I was expecting, I was hoping for:</p> <pre><code>&lt;isNewtest&gt;false&lt;/isNewtest&gt; &lt;isAnotherNewtest&gt;false&lt;/isAnotherNewtest&gt; </code></pre> <p>I'm obviously missing something to do with searching through more than one node at a time or multiline selector? - Can someone point me in the right direction please? I've got to restructure a 20,000 line xml doc and not relishing the idea of doing it manually line by line..</p>
0debug
.gitignore still including asp.net core wwwroot/lib directory : <p>Before I even create my ASP.NET Core project I first create my git repository and select the initial gitignore template to be VisualStudio. I then added the line: </p> <p>wwwroot/lib/</p> <p>After committing and publishing this change I then created my ASP.NET Core Web Application project using the standard Web Application template to start with, and it still shows the brought in jquery and bootstrap files pulled down by bower as modified files ready to be committed? Is there a step I am missing here to prevent these as showing up as modified?</p>
0debug
API to extract text from a image for andoird mobile : I am trying to extract text from the picture taken in andoird mobile through some API .will that google Vision helps me ?Used OCR too but i felt that the output is not accurate. any suggestions?
0debug
static int virtio_ccw_blk_init(VirtioCcwDevice *ccw_dev) { VirtIOBlkCcw *dev = VIRTIO_BLK_CCW(ccw_dev); DeviceState *vdev = DEVICE(&dev->vdev); virtio_blk_set_conf(vdev, &(dev->blk)); qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); if (qdev_init(vdev) < 0) { return -1; } return virtio_ccw_device_init(ccw_dev, VIRTIO_DEVICE(vdev)); }
1threat
Remove background of an image in imageview in xcode. : How can i edit the background of an image (not imageview) and set it to be transparent. I had search a lot but can find nothing. Any help??
0debug
@RunWith(SpringRunner.class) vs @RunWith(MockitoJUnitRunner.class) : <p>I was using <code>@RunWith(MockitoJUnitRunner.class)</code> for my junit test with mockito. But now i am working with spring boot app and trying to use <code>@RunWith(SpringRunner.class)</code> . Does using <code>@RunWith(SpringRunner.class)</code> has any advantages over using <code>@RunWith(MockitoJUnitRunner.class)</code>? Can i still use feature like <code>@Injectmock</code>, <code>@Mock</code>, <code>@Spy</code> with <code>@RunWith(SpringRunner.class)</code></p>
0debug
What exactly onCreate() method will do in a Fragment Life Cycle in an Android Application : <p>I am confusing onCreate() method in both Activity and Fragment. What onCreate() will do in Fragment and What are differences onCreate() method between Activity and Fragment.Please help me i am learning by myself.</p> <p>Thanks......</p>
0debug
Assigning 2 values to radio button element and calling them in PHP : <p>I have radio inputs on a form </p> <p>I am trying to assign them two separate values. One shall be the name of the product, the other is the price of the product. Then in php I will be totaling the selections.</p> <pre><code>&lt;input type="radio" id="tile1" name="tile" value="Calcatta 12x 24 | 2.99" /&gt; &lt;input type="radio" id="tile2" name="tile" value="Subway 3x12 | 1.99" /&gt; &lt;input type="radio" id="tile3" name="tile" value="Marazza 12x24 | 2.99" /&gt; &lt;input type="radio" id="tile4" name="tile" value="Chicaro 12x12 | 3.99" /&gt; </code></pre> <p>For my confirmation email, I need to be able to call on the name of the product.<br> For totaling cost, I need to be able to call on the price of the product.</p> <p>i have tried to search a solution, but I haven't been able to find a specific solution that works.</p>
0debug
static void smp_parse(QemuOpts *opts) { if (opts) { unsigned cpus = qemu_opt_get_number(opts, "cpus", 0); unsigned sockets = qemu_opt_get_number(opts, "sockets", 0); unsigned cores = qemu_opt_get_number(opts, "cores", 0); unsigned threads = qemu_opt_get_number(opts, "threads", 0); if (cpus == 0 || sockets == 0) { sockets = sockets > 0 ? sockets : 1; cores = cores > 0 ? cores : 1; threads = threads > 0 ? threads : 1; if (cpus == 0) { cpus = cores * threads * sockets; } } else if (cores == 0) { threads = threads > 0 ? threads : 1; cores = cpus / (sockets * threads); } else if (threads == 0) { threads = cpus / (cores * sockets); } else if (sockets * cores * threads < cpus) { fprintf(stderr, "cpu topology: error: " "sockets (%u) * cores (%u) * threads (%u) < " "smp_cpus (%u)\n", sockets, cores, threads, cpus); exit(1); } max_cpus = qemu_opt_get_number(opts, "maxcpus", 0); smp_cpus = cpus; smp_cores = cores > 0 ? cores : 1; smp_threads = threads > 0 ? threads : 1; } if (max_cpus == 0) { max_cpus = smp_cpus; } if (max_cpus > MAX_CPUMASK_BITS) { fprintf(stderr, "Unsupported number of maxcpus\n"); exit(1); } if (max_cpus < smp_cpus) { fprintf(stderr, "maxcpus must be equal to or greater than smp\n"); exit(1); } }
1threat
(Android / Java) How am I get it and store the data that I can have from another activity? : I have a MainActivity and a CalendarActivity. My application's MainActivity should display always another informations based on the chosen date. If someone change the date in the CalendarActivity CalendarView, another info should appear in MainActivity's TextBox + it should remember what was the last chosen date, even if the user close the application and later opens it. 1) How am I supposed to get the date from CalendarActivity's CalendarView in the MainActivity? 2) How am I supposed to save the last chosen date, and when the application starts second time, the last chosen date will be highlighted in the CalendarView? Thanks.
0debug
How to send a notification on android extracting data from the database firebase? : I know firebase contains a section to send notifications writing your message in console, but i want get values from a table to display the values in a notification. is this possible?
0debug
JavaFX alignment of Label in GridPane : <p>I'm confused as to why setting the Label.setAlignment(Pos.CENTER_RIGHT) does not affect the alignment of a label that is then added into a GridPane? The only way to do it is seemingly through the grid (e.g. ColumnConstraints) or by e.g. adding the Label to a HBox that has right alignment.</p> <p>Why does setting the alignment of the label to CENTER_RIGHT have no effect? I can see the API says: "Specifies how the text and graphic within the Labeled should be aligned when there is empty space within the Labeled." But how do I get empty space in a label?</p>
0debug
static bool cmd_write_multiple(IDEState *s, uint8_t cmd) { bool lba48 = (cmd == WIN_MULTWRITE_EXT); int n; if (!s->bs || !s->mult_sectors) { ide_abort_command(s); return true; } ide_cmd_lba48_transform(s, lba48); s->req_nb_sectors = s->mult_sectors; n = MIN(s->nsector, s->req_nb_sectors); s->status = SEEK_STAT | READY_STAT; ide_transfer_start(s, s->io_buffer, 512 * n, ide_sector_write); s->media_changed = 1; return false; }
1threat
void cpu_physical_memory_write_rom(target_phys_addr_t addr, const uint8_t *buf, int len) { AddressSpaceDispatch *d = address_space_memory.dispatch; int l; uint8_t *ptr; target_phys_addr_t page; MemoryRegionSection *section; while (len > 0) { page = addr & TARGET_PAGE_MASK; l = (page + TARGET_PAGE_SIZE) - addr; if (l > len) l = len; section = phys_page_find(d, page >> TARGET_PAGE_BITS); if (!(memory_region_is_ram(section->mr) || memory_region_is_romd(section->mr))) { } else { unsigned long addr1; addr1 = memory_region_get_ram_addr(section->mr) + memory_region_section_addr(section, addr); ptr = qemu_get_ram_ptr(addr1); memcpy(ptr, buf, l); invalidate_and_set_dirty(addr1, l); qemu_put_ram_ptr(ptr); } len -= l; buf += l; addr += l; } }
1threat
expected 2d array got scalar array instead, Please help out : Hello everyone i am getting this error ValueError: Expected 2D array, got scalar array instead: array=6.5. Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample. while executing this code #SVR # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('Position_Salaries.csv') X = dataset.iloc[:, 1:2].values y = dataset.iloc[:, 2].values #Fitting the SVR to the Data Set from sklearn.svm import SVR regressor = SVR(kernel = 'rbf', gamma = 'auto') regressor.fit(X, y) #Predicting a new result y_pred = regressor.predict(6.5)
0debug
static DisplaySurface* sdl_create_displaysurface(int width, int height) { DisplaySurface *surface = (DisplaySurface*) g_malloc0(sizeof(DisplaySurface)); if (surface == NULL) { fprintf(stderr, "sdl_create_displaysurface: malloc failed\n"); exit(1); } surface->width = width; surface->height = height; if (scaling_active) { int linesize; PixelFormat pf; if (host_format.BytesPerPixel != 2 && host_format.BytesPerPixel != 4) { linesize = width * 4; pf = qemu_default_pixelformat(32); } else { linesize = width * host_format.BytesPerPixel; pf = sdl_to_qemu_pixelformat(&host_format); } qemu_alloc_display(surface, width, height, linesize, pf, 0); return surface; } if (host_format.BitsPerPixel == 16) do_sdl_resize(width, height, 16); else do_sdl_resize(width, height, 32); surface->pf = sdl_to_qemu_pixelformat(real_screen->format); surface->linesize = real_screen->pitch; surface->data = real_screen->pixels; #ifdef HOST_WORDS_BIGENDIAN surface->flags = QEMU_REALPIXELS_FLAG | QEMU_BIG_ENDIAN_FLAG; #else surface->flags = QEMU_REALPIXELS_FLAG; #endif allocator = 1; return surface; }
1threat
iOS : Testflight No build available for external testers : <p>I am using testflight as a beta testing tool for my app. I have uploaded the build but invitation are successfully sent to the internal testers but no invitations are sent to external tester.</p> <p>Below image shows both the groups has been invited <a href="https://i.stack.imgur.com/gBfTf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/gBfTf.png" alt="This image shows both the groups has been invited"></a></p> <p>And this image shows that no build available for external testers <a href="https://i.stack.imgur.com/Nz9Pg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Nz9Pg.png" alt="This image shows no build available for external testers"></a></p> <p>Can anyone help me how I can get through with this?</p>
0debug
static void rv34_idct_dc_add_c(uint8_t *dst, ptrdiff_t stride, int dc) { const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; int i, j; cm += (13*13*dc + 0x200) >> 10; for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) dst[j] = cm[ dst[j] ]; dst += stride; } }
1threat
RxJava: How to convert List of objects to List of another objects : <p>I have the List of SourceObjects and I need to convert it to the List of ResultObjects.</p> <p>I can fetch one object to another using method of ResultObject:</p> <pre><code>convertFromSource(srcObj); </code></pre> <p>of course I can do it like this:</p> <pre><code>public void onNext(List&lt;SourceObject&gt; srcObjects) { List&lt;ResultsObject&gt; resObjects = new ArrayList&lt;&gt;(); for (SourceObject srcObj : srcObjects) { resObjects.add(new ResultsObject().convertFromSource(srcObj)); } } </code></pre> <p>but I will be very appreciate to someone who can show how to do the same using <strong>rxJava</strong>.</p>
0debug
YAML How many spaces per indent? : <p>Is there any difference if i use one space, two or four spaces per indent level in <strong>YAML</strong>?</p> <p>Are there any specific rules for space numbers per Structure type??</p> <p>For example <strong>4</strong> spaces for nesting <strong>maps</strong> , <strong>1</strong> space per <strong>list item</strong> etc??</p> <p>I am writing a yaml configuration file for elastic beanstalk .ebextensions and i am having really hard time constructing this correctly. Although i have valid yaml in <a href="http://www.yamllint.com/" rel="noreferrer">YAML Validator</a> elastic beanstalk seems to understand a different structure.</p>
0debug
display property is not properly working : <html> <div class = "centralcontainer"> <div class ="firstcontainer"> <div class = "imagecontainer"> <img src="http://subs-40ea.kxcdn.com/posters/better- call-saul.jpg"> </div> <div class = "SeasonCounterContainer"> <p>46 min | Crime, Drama</p> </div> </div> </div> <style type = "text\css" > .firstcontainer{ display: block; } .imagecontainer{ display: inline-block; margin-left: 70px; } .SeasonCounterContainer{ margin-left: 20px; display: inline-block; } </style> </html> In the above code,I want the two div containers present inside the div class "firstcontainer" to appear side by side and so I have applied for inline- block.But doesn't seem to work. Note:I already searched the issue in stackoverflow and got answers.Still didnt work for me.
0debug
static void pc_dimm_post_plug(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { PCMachineState *pcms = PC_MACHINE(hotplug_dev); if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) { nvdimm_acpi_hotplug(&pcms->acpi_nvdimm_state); } }
1threat
AStudio issue #66894 : <p>In the middle of development it threw an error at me complaining about gradle plugin being too old (was 2.0.0-alpha3, changed to 2.0.0-alpha5 and worked. Hurrah!). Then it complained about <code>distributionUrl</code> pointing to an also outdated piece of software. I have Overcome that as well. Now google nailed me with </p> <pre><code> Error:Execution failed for task ':app:buildInfoDebugLoader'. &gt; Exception while loading build-info.xml : null </code></pre> <p>Invalidate + restart didnt do the trick. What next ?</p>
0debug
Where condition in timestamp to date. i want only date based results from timestamp : <p><a href="https://i.stack.imgur.com/MVzgo.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MVzgo.jpg" alt="enter image description here"></a></p> <p>Where created_date = 2016-09-11. like that kind of result i want. any solution is there for that?</p>
0debug
I'm brand new to coding : I am having a problem getting this code to work. When ever I input anything 249 or lower it works as it should. But anything else gets me the *else* statement. My experience level with code is almost zero. This is my first class and it's only week two. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ILAB02 { class Program { static void Main(string[] args) { double salesAmount, shippingAmount; salesAmount = 0.00; shippingAmount = 0.00; Console.WriteLine("What is the total amount of sales?"); salesAmount = Convert.ToDouble(Console.ReadLine()); if (salesAmount > 5000.00) { shippingAmount = 20.00; } if (salesAmount > 1000.00 && salesAmount <= 5000.00) { shippingAmount = 15.00; } if (salesAmount > 500.00 && salesAmount<=1000.00) { shippingAmount = 10.00; } if (salesAmount > 250.00 && salesAmount <=500.00) { shippingAmount = 8.00; } if (salesAmount > 0.00 && salesAmount <=250.00) { shippingAmount = 5.00; } else { shippingAmount = 0.00; Console.WriteLine("Error incorrect input!"); } Console.WriteLine("Total sales amount is {0:C}",salesAmount); Console.WriteLine("Shipping charges is {0:C}", shippingAmount); Console.ReadLine(); } } }
0debug
What is a sidecar in the context of microservices? : <p>I'm currently looking through an Istio and Kubernetes talk and mention the management of services along with the use of sidecars. I'm not sure what that is.</p>
0debug
static void FUNCC(pred8x8l_vertical)(uint8_t *_src, int has_topleft, int has_topright, int _stride) { int y; pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); PREDICT_8x8_LOAD_TOP; src[0] = t0; src[1] = t1; src[2] = t2; src[3] = t3; src[4] = t4; src[5] = t5; src[6] = t6; src[7] = t7; for( y = 1; y < 8; y++ ) { ((pixel4*)(src+y*stride))[0] = ((pixel4*)src)[0]; ((pixel4*)(src+y*stride))[1] = ((pixel4*)src)[1]; } }
1threat
Automatically force mobile browser to desktop view : <p>Having completed a lot of work on a project that uses Paypal IPN to initiate payments, I've found that this is successful on a desktop browser, but fails completely 100% on mobile (on Chrome, at least).</p> <p>After some research, I've found that this is due to the mobile browser using the GET method for returning Paypal data, as opposed to the desktop using POST.</p> <p>If I click on 'Request Desktop View' on the mobile browser then this will allow the process to complete properly, but this is obviously not great fun for the end-user.</p> <p>So, as I've come to a bit of a dead end with this (I've actually been advised it's a Paypal issue that there's no control over - not sure if true or not), is there a way to automatically force the desktop view on a mobile browser as a last resort?</p> <p>I've tried to change the viewport width (<code>&lt;meta name="viewport" content="width=1024"&gt;</code> ), but all this does is widen the mobile browser view. It doesn't actually give the proper desktop view as you would get by clicking on 'Request Desktop View' manually.</p> <p>Would anyone know if there's a way to force to desktop view via HTML or JS, please?</p> <p>Thanks,<br> Dan.</p>
0debug
Why am i getting access violation at printf? : <p>call stack below: ucrtbased.dll!01905fcc() Unknown [Frames below may be incorrect and/or missing, no symbols loaded for ucrtbased.dll] [External Code] basketball.exe!_vfprintf_l(_iobuf * const _Stream, const char * const _Format, __crt_locale_pointers * const _Locale, char * _ArgList) Line 639 C++ basketball.exe!printf(const char * const _Format, ...) Line 954 C++</p> <blockquote> <p>basketball.exe!main() Line 81 C++ [External Code] </p> </blockquote> <pre><code>//I keep getting an access violation. #include &lt;iostream&gt; #include &lt;string&gt; using namespace std; int main() { int x; string playername, hometown,position,height,Class; int weight; cout &lt;&lt; "Enter player number: "; cin &gt;&gt; x; switch(x){ case 0: { playername = "Brandon Sampson"; position = "Guard"; weight = 193; hometown = "Baton Rouge, LA"; height = "6-5"; Class = "Sophomore"; break; } case 1: { playername = "Dupo Reath"; position = "Forward"; weight = 235; hometown = "Perth, Australia"; height = "6-10"; Class = "Junior"; break; } case 2: { playername = "Antonio Blakeney"; position = "Guard"; weight = 197; hometown = "Sarasota, Fla"; height = "6-4"; Class = "Sophomore"; break; } case 3: { playername = "Elbert Robinton III"; position = "Center"; weight = 290; hometown = "Garland, Texas"; height = "7-1"; Class = "Junior"; break; } case 4: { playername = "Skylar Mays"; position = "Guard"; weight = 205; hometown = "Baton Rouge, La"; height = "6-4"; Class = "Junior"; break; } case 5: { playername = "Kieran Hayward"; position = "Guard"; weight = 195; hometown = "Sydney, Australia"; height = "6-4"; Class = "Freshman"; break; } case 10: { playername = "Branden Jenkins"; position = "Guard"; weight = 180; hometown = "Maywood, Ill"; height = "6-4"; Class = "Junior"; break; } } printf("Name: %s", playername); printf("Position: %s\n", position); printf("Height: %s", height); printf(" Weight: %d", weight); printf("Hometown: %s\n", hometown); printf("Class: %s\n", Class); return 0; } </code></pre>
0debug
static TRBCCode xhci_disable_ep(XHCIState *xhci, unsigned int slotid, unsigned int epid) { XHCISlot *slot; XHCIEPContext *epctx; int i; trace_usb_xhci_ep_disable(slotid, epid); assert(slotid >= 1 && slotid <= xhci->numslots); assert(epid >= 1 && epid <= 31); slot = &xhci->slots[slotid-1]; if (!slot->eps[epid-1]) { DPRINTF("xhci: slot %d ep %d already disabled\n", slotid, epid); return CC_SUCCESS; } xhci_ep_nuke_xfers(xhci, slotid, epid, 0); epctx = slot->eps[epid-1]; if (epctx->nr_pstreams) { xhci_free_streams(epctx); } for (i = 0; i < ARRAY_SIZE(epctx->transfers); i++) { usb_packet_cleanup(&epctx->transfers[i].packet); } xhci_set_ep_state(xhci, epctx, NULL, EP_DISABLED); timer_free(epctx->kick_timer); g_free(epctx); slot->eps[epid-1] = NULL; return CC_SUCCESS; }
1threat
def combinations_list(list1): if len(list1) == 0: return [[]] result = [] for el in combinations_list(list1[1:]): result += [el, el+[list1[0]]] return result
0debug
static int read_channel_params(MLPDecodeContext *m, unsigned int substr, GetBitContext *gbp, unsigned int ch) { ChannelParams *cp = &m->channel_params[ch]; FilterParams *fir = &cp->filter_params[FIR]; FilterParams *iir = &cp->filter_params[IIR]; SubStream *s = &m->substream[substr]; if (s->param_presence_flags & PARAM_FIR) if (get_bits1(gbp)) if (read_filter_params(m, gbp, ch, FIR) < 0) return -1; if (s->param_presence_flags & PARAM_IIR) if (get_bits1(gbp)) if (read_filter_params(m, gbp, ch, IIR) < 0) return -1; if (fir->order && iir->order && fir->shift != iir->shift) { av_log(m->avctx, AV_LOG_ERROR, "FIR and IIR filters must use the same precision.\n"); return -1; } if (!fir->order && iir->order) fir->shift = iir->shift; if (s->param_presence_flags & PARAM_HUFFOFFSET) if (get_bits1(gbp)) cp->huff_offset = get_sbits(gbp, 15); cp->codebook = get_bits(gbp, 2); cp->huff_lsbs = get_bits(gbp, 5); cp->sign_huff_offset = calculate_sign_huff(m, substr, ch); return 0; }
1threat