problem
stringlengths
26
131k
labels
class label
2 classes
What is the difference between Google App Engine and Google Cloud Run? : <p>Does anyone know, difference between Google App Engine Flex and Google Cloud Run?</p> <p>Thanks</p>
0debug
Regex: match any word (including foobar), but not foo : <p>I'm very new to regex and I've looked but haven't found the syntax I'm looking for.</p> <p>I want to match any word (including foobar), but not foo. However, everythimg I've found catches foobar with foo.</p> <p>What's the correct way to do this? I'm working in Python, if that matters</p>
0debug
Is there Rx.NET for .NET Core? : <p>Found <a href="https://github.com/Reactive-Extensions/Rx.NET/issues/148" rel="noreferrer">https://github.com/Reactive-Extensions/Rx.NET/issues/148</a>, but I could not figure out the bottom line - where is Rx.NET for .NET Core and how to get it?</p> <p>I am using Enterprise Visual Studio 2015 Update 3 with .NET Core installed.</p>
0debug
vorbis_comment(AVFormatContext * as, uint8_t *buf, int size) { const uint8_t *p = buf; const uint8_t *end = buf + size; unsigned s, n, j; if (size < 8) return -1; s = bytestream_get_le32(&p); if (end - p < s) return -1; p += s; n = bytestream_get_le32(&p); while (p < end && n > 0) { const char *t, *v; int tl, vl; s = bytestream_get_le32(&p); if (end - p < s) break; t = p; p += s; n--; v = memchr(t, '=', s); if (!v) continue; tl = v - t; vl = s - tl - 1; v++; if (tl && vl) { char *tt, *ct; tt = av_malloc(tl + 1); ct = av_malloc(vl + 1); if (!tt || !ct) { av_freep(&tt); av_freep(&ct); av_log(as, AV_LOG_WARNING, "out-of-memory error. skipping VorbisComment tag.\n"); continue; } for (j = 0; j < tl; j++) tt[j] = toupper(t[j]); tt[tl] = 0; memcpy(ct, v, vl); ct[vl] = 0; av_metadata_set(&as->metadata, tt, ct); av_freep(&tt); av_freep(&ct); } } if (p != end) av_log(as, AV_LOG_INFO, "%ti bytes of comment header remain\n", end-p); if (n > 0) av_log(as, AV_LOG_INFO, "truncated comment header, %i comments not found\n", n); return 0; }
1threat
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
how to override the equals() method when you have to compare 7 instance variables? : <p>I am currently doing my programming assignment. But there is one step that i don't quite understand. There are 7 private instance variables and we are supposed to use the equals() method to compare all the instance variables. How is that possible? This is the question- The class has to override Object’s equals() method in order to return true if the object as argument equal to the object who invoked the method and false otherwise. The method should compare all instance variables of the two objects.</p> <p>And these are the instance variables-</p> <pre><code>public class Book implements Usable{ //instance variables private String b1, b2, b3, b4, b5, b6, b7; private boolean bookReference; </code></pre>
0debug
Dereferencing an uninitialized pointer in c++ : <p>I was going through c++ pointer concepts. I was not able to understand the concept of dereferencing an uninitialized pointer. In the book which I was going through, it was saying that if we try to dereference an uninitialized pointer, then we will cause runtime error by referring to any other location in the memory. Can anyone explain this? if possible with some examples....</p>
0debug
How to execute Linux shell script with inttab file : I created a shell script with the following content. #!/bin/bash TMP_FILE=/tmp/inet_up no_inet_action(){ reboot } HOUR="$(date +'%H')" if [ $HOUR -le 22 -a $HOUR -ge 9 ]; then if ping -c5 192.168.7.100; then echo "Internet OK">$TMP_FILE else echo "No Internet">$TMP_FILE no_inet_action fi fi It will ping an IP address during 09:00 to 22:00 and if no internet connection it will write a line to a file and reboot the device. I put the following line in inittab and expect that it will run every 5 minutes interval. I don't see the file in /tmp folder. The script is executable. What is the right way to execute it? I saw some blog suggest to put it under /etc/init.d, which is right way? inittab is located in /etc/ folder. ::respawn:/sbin/delayexec 600 /etc/check_inet.sh
0debug
How to create a multi diamental array in jqury? : i want create a jquery blow formate with help of using two each statements. arrar [ 'aaa'=>'ccsdfccc', 'bb'=>'aaddsaaaa', '1'=>[ 'cccc'=>'dcvcdd' 'ddd'=>'eeee' ] '2'=>[ 'cccc'=>'dcvcdd' 'ddd'=>'eeee' ] ]
0debug
Powershell Script Active Directory : <p>need some pointers on how to construct a Powershell script that does the following things : asks for active directory username, gives a menu to enable these active directory actions given for username :Reset password, Disable user account, Enable user account, Unlock user account, Delete user account?</p>
0debug
How I write a function in python that determines whether a word has no vowels? : <p>How I write a function "noVowel" in python that determines whether a word has no vowels?</p> <p>In my case, "y" is not a vowel.</p> <p>For example, I want the function to return True if the word is something like "My" and to return false if the word is something like "banana".</p>
0debug
How to switch Python versions in Terminal? : <p>My Mac came with Python 2.7 installed by default, but I'd like to use Python 3.6.1 instead.</p> <p>How can I change the Python version used in Terminal (on Mac OS)?</p> <p>Please explain clearly and <em>offer no third party version manager suggestions</em>.</p>
0debug
static int load_apply_palette(FFFrameSync *fs) { AVFilterContext *ctx = fs->parent; AVFilterLink *inlink = ctx->inputs[0]; PaletteUseContext *s = ctx->priv; AVFrame *master, *second, *out; int ret; ret = ff_framesync_dualinput_get_writable(fs, &master, &second); if (ret < 0) return ret; if (!master || !second) { ret = AVERROR_BUG; goto error; } if (!s->palette_loaded) { load_palette(s, second); } out = apply_palette(inlink, master); return ff_filter_frame(ctx->outputs[0], out); error: av_frame_free(&master); av_frame_free(&second); return ret; }
1threat
how do i get the horizantal line behind the buttons : Hi there i was trying to create background line behind the buttons, before that i was using image but i want the line <div class="feedback-option"> <div class="radios2"> <label> <input type="radio" name="rating-1" value="1"> <span>1</span> </label> <label> <input type="radio" name="rating-1" value="2" /> <span>2</span> </label> <label> <input type="radio" name="rating-1" value="3"> <span>3</span> </label> <label> <input type="radio" name="rating-1" value="4"> <span>4</span> </label> <label> <input type="radio" name="rating-1" value="5"> <span>5</span> </label> </div> </div> [JsFiddle][1] [1]: https://jsfiddle.net/babuharry/azfmje8c/
0debug
splitting variable product code(letters and numbers) in r : i have a product code variable like Product Code RMMI001, RMMI001, CMCM009, ASCMOT064, ASPMOA023, CMCM009, CMCM012, CMCM001, ASCMBW001, RMMI001, TMHO002, TMSP001, TMHO002, TMDMST003 i need to split those and need that character in anaother column
0debug
Ruby .. Effective way to implement if else condition : I have three database boolean columns "google", "yahoo", "bing". I need to print them on html.erb page like this. "google + yahoo" if only google and yahoo is true. "google + yahoo + bing" if all three are true. "google" if only google is true. I am using ruby on rails. Is there any effective way to implement this. If I do it in a traditional way then "if .. else" conditions will be large. Thanks in advance!
0debug
static void channel_load_c(struct fs_dma_ctrl *ctrl, int c) { target_phys_addr_t addr = channel_reg(ctrl, c, RW_GROUP_DOWN); cpu_physical_memory_read (addr, (void *) &ctrl->channels[c].current_c, sizeof ctrl->channels[c].current_c); D(dump_c(c, &ctrl->channels[c].current_c)); ctrl->channels[c].regs[RW_SAVED_DATA] = (uint32_t)(unsigned long)ctrl->channels[c].current_c.saved_data; ctrl->channels[c].regs[RW_SAVED_DATA_BUF] = (uint32_t)(unsigned long)ctrl->channels[c].current_c.saved_data_buf; }
1threat
Does the LOAD DATA INFILE disabled on most shared hostings? : <p>I want to use LOAD DATA INFILE to significantly faster MySQL import process in my plugin software. I hear that some shared hostings disabled this (cool) feature. Is it correct? If yes, why they did it and is it a possibility to emulate this somehow? My software is intended to run successfully on shared hostings.</p>
0debug
single toggle button in angularjs to switch ON/OFF : i have this code of 2 different labels.. I want it should work on toggle slider button. plz help. this is my code <div class="btn-group" id="save"> <label href="#pre_sum" for="id_url" data-toggle="modal" class="btn btn-default btn-on btn-lg" ng-click="getdata()" id="saveOn"> ON </label> <label id="devicesStatusId" class="btn btn-default btn-off btn-lg" style="color:#fff;background-color:#DA4F49" id="saveOff" ng-click="changeDeviceStatus();" id="devicesStatusId"> OFF </label> </div>
0debug
I want to filter Nested JSON wich contain array also : { "data": { "typeList": [ { "name": "Important" }, { "name": "Govt" }, { "name": "Bank" }, { "name": "Other" } ], "cropList": [ "Ajwan", "Alasande Gram", "Alsandikai", "Amaranthus", "Amla(Nelli Kai)", "Amphophalus", "Apple", "Arecanut(Betelnut/Supari)", "Arhar (Tur/Red Gram)(Whole)", "Arhar Dal(Tur Dal)", "Ashgourd", "Avare Dal", "BOP", "Bajra(Pearl Millet/Cumbu)", "Banana", "Banana - Green", "Barley (Jau)", "Beans", "Beaten Rice", "Beetroot", "Bengal Gram Dal (Chana Dal)", "Bengal Gram(Gram)(Whole)", "Ber(Zizyphus/Borehannu)", "Betal Leaves", "Bhindi(Ladies Finger)", "Bitter gourd", "Black Gram (Urd Beans)(Whole)", "Black Gram Dal (Urd Dal)", "Black pepper", "Borehannu", "Bottle gourd", "Bran", "Brinjal", "Broken Rice", "Bunch Beans", "Cabbage", "Capsicum", "Cardamoms", "Carnation", "Carrot", "Cashewnuts", "Castor Seed", "Cauliflower", "Chapparad Avare", "Chennangi Dal", "Chikoos(Sapota)", "Chili Red", "Chilly Capsicum", "Chow Chow", "Cloves", "Cluster beans", "Coca", "Cock", "Coconut", "Coconut Oil", "Coconut Seed", "Coffee", "Colacasia", "Copra", "Coriander(Leaves)", "Corriander seed", "Cotton", "Cowpea (Lobia/Karamani)", "Cowpea(Veg)", "Cucumbar(Kheera)", "Cummin Seed(Jeera)", "Dalda", "Delha", "Dhaincha", "Drumstick", "Dry Chillies", "Dry Fodder", "Dry Grapes", "Duck", "Duster Beans", "Egg", "Elephant Yam (Suran)", "Field Pea", "Firewood", "Fish", "Foxtail Millet(Navane)", "French Beans (Frasbean)", "Galgal(Lemon)", "Garlic", "Ghee", "Gingelly Oil", "Ginger(Dry)", "Ginger(Green)", "Gladiolus Cut Flower", "Goat", "Gram Raw(Chholia)", "Grapes", "Green Avare (W)", "Green Chilli", "Green Fodder", "Green Gram (Moong)(Whole)", "Green Gram Dal (Moong Dal)", "Green Peas", "Ground Nut Seed", "Groundnut", "Groundnut (Split)", "Groundnut pods (raw)", "Guar", "Guar Seed(Cluster Beans Seed)", "Guava", "Gur(Jaggery)", "Hen", "Honge seed", "Hybrid Cumbu", "Indian Beans (Seam)", "Indian Colza(Sarson)", "Isabgul (Psyllium)", "Jack Fruit", "Jarbara", "Jasmine", "Jowar(Sorghum)", "Jute", "Kabuli Chana(Chickpeas-White)", "Karbuja(Musk Melon)", "Kinnow", "Knool Khol", "Kodo Millet(Varagu)", "Kulthi(Horse Gram)", "Lak(Teora)", "Leafy Vegetable", "Lemon", "Lentil (Masur)(Whole)", "Lilly", "Lime", "Linseed", "Little gourd (Kundru)", "Long Melon(Kakri)", "Lotus Sticks", "Mace", "Mahua", "Mahua Seed(Hippe seed)", "Maida Atta", "Maize", "Mango", "Mango (Raw-Ripe)", "Marigold(Calcutta)", "Mashrooms", "Masur Dal", "Mataki", "Methi Seeds", "Methi(Leaves)", "Millets", "Mint(Pudina)", "Moath Dal", "Mousambi(Sweet Lime)", "Mustard", "Mustard Oil", "Neem Seed", "Niger Seed (Ramtil)", "Nutmeg", "Onion", "Onion Green", "Orange", "Orchid", "Paddy(Dhan)(Basmati)", "Paddy(Dhan)(Common)", "Papaya", "Papaya (Raw)", "Patti Calcutta", "Pear(Marasebu)", "Peas Wet", "Peas cod", "Peas(Dry)", "Pegeon Pea (Arhar Fali)", "Pepper garbled", "Pepper ungarbled", "Pigs", "Pineapple", "Plum", "Pointed gourd (Parval)", "Pomegranate", "Potato", "Pumpkin", "Raddish", "Ragi (Finger Millet)", "Raibel", "Rajgir", "Rat Tail Radish (Mogari)", "Rice", "Ridgeguard(Tori)", "Rose(Local)", "Round gourd", "Rubber", "Safflower", "Sajje", "Season Leaves", "Seemebadnekai", "Seetapal", "Sesamum(Sesame,Gingelly,Til)", "Sheep", "Snakeguard", "Soanf", "Soji", "Soyabean", "Spinach", "Sponge gourd", "Squash(Chappal Kadoo)", "Sugar", "Sunflower", "Surat Beans (Papadi)", "Suva (Dill Seed)", "Suvarna Gadde", "Sweet Potato", "Sweet Pumpkin", "T.V. Cumbu", "Tamarind Fruit", "Tamarind Seed", "Tapioca", "Taramira", "Tender Coconut", "Thinai (Italian Millet)", "Thondekai", "Tinda", "Tobacco", "Tomato", "Tube Rose(Double)", "Tube Rose(Single)", "Turmeric", "Turmeric (raw)", "Turnip", "Water Melon", "Wheat", "Wheat Atta", "White Peas", "White Pumpkin", "Wood", "Yam", "Yam (Ratalu)" ], "notifications": [ { "description": "sansjd", "date": "20-03-2019", "month": "3", "type": "Bank", "croptypes": [ "Alasande Gram", "Ajwan", "Ajwan" ], "notificationDetailsId": 953, "isPublished": false, "statesAndDis": [ { "districtName": [ "Anand" ], "stateName": "Gujarat" }, { "districtName": [ "Amreli" ], "stateName": "Gujarat" } ] }, { "description": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.", "date": "20-03-2019", "month": "3", "type": "Bank", "croptypes": [ "Ajwan", "Ajwan", "Alasande Gram" ], "notificationDetailsId": 1010, "isPublished": false, "statesAndDis": [ { "districtName": [ "Anand" ], "stateName": "Gujarat" }, { "districtName": [ "Amreli" ], "stateName": "Gujarat" } ] }, { "description": "sansjd", "date": "20-03-2019", "month": "3", "type": "Bank", "croptypes": [ "Alasande Gram", "Ajwan", "Ajwan" ], "notificationDetailsId": 1052, "isPublished": false, "statesAndDis": [ { "districtName": [ "Amreli" ], "stateName": "Gujarat" }, { "districtName": [ "Anand" ], "stateName": "Gujarat" } ] }, { "description": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.", "date": "19-03-2019", "month": "3", "type": "Important", "croptypes": [ "Alsandikai", "Ajwan", "Alasande Gram" ], "notificationDetailsId": 1002, "isPublished": false, "statesAndDis": [ { "districtName": [ "Kozhikode(Calicut)" ], "stateName": "Kerala" }, { "districtName": [ "Gandhinagar" ], "stateName": "Gujarat" } ] }, { "description": "sndnds", "date": "13-03-2019", "month": "3", "type": "Important", "croptypes": [ "Alsandikai", "Ajwan", "Ajwan" ], "notificationDetailsId": 954, "isPublished": false, "statesAndDis": [ { "districtName": [ "East Khasi Hills" ], "stateName": "Meghalaya" } ] }, { "description": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.", "date": "13-03-2019", "month": "3", "type": "Important", "croptypes": [ "Alsandikai", "Amaranthus", "Alasande Gram" ], "notificationDetailsId": 1005, "isPublished": true, "statesAndDis": [ { "districtName": [ "Kozhikode(Calicut)" ], "stateName": "Kerala" } ] }, { "description": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.", "date": "12-03-2019", "month": "3", "type": "Important", "croptypes": [ "Alasande Gram", "Alsandikai", "Alasande Gram" ], "notificationDetailsId": 1004, "isPublished": true, "statesAndDis": [ { "districtName": [ "Anand" ], "stateName": "Gujarat" } ] }, { "description": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.", "date": "05-03-2019", "month": "3", "type": "Important", "croptypes": [ "Alasande Gram", "Amaranthus", "Amaranthus" ], "notificationDetailsId": 1003, "isPublished": false, "statesAndDis": [ { "districtName": [ "Anand" ], "stateName": "Gujarat" } ] }, { "description": "Last fall’s harvest was challenging for a lot of Missouri’s farmers. Andy Luke, a University of Missouri Extension agronomist based in Harrison County, in northwest Missouri, says wet weather slowed harvest progress, even preventing some fields from being harvested.", "date": "04-03-2019", "month": "3", "type": "Important", "croptypes": [ "Alasande Gram", "Alasande Gram", "Alasande Gram" ], "notificationDetailsId": 1952, "isPublished": true, "statesAndDis": [ { "districtName": [ "East Khasi Hills" ], "stateName": "Meghalaya" }, { "districtName": [ "Kozhikode(Calicut)" ], "stateName": "Kerala" }, { "districtName": [ "Ernakulam" ], "stateName": "Kerala" } ] }, { "description": "Palmer amaranth is the pigweed species that rightfully earns the most consternation from Midwest farmers. But don’t forget that waterhemp can be just as invasive and contains many of the same characteristics as Palmer.\n\nThat’s the take-home message from Brian Jenks, weed specialist at North Dakota State University, during the annual Ag Horizons Conference in Pierre, South Dakota, on November 26.\n\n“From the Dakotas, through Iowa, Illinois, and Indiana and across the Midwest, waterhemp is becoming a huge problem,” warns Jenks.", "date": "02-03-2019", "month": "3", "type": "Important", "croptypes": [ "Alsandikai", "Alasande Gram", "Ajwan" ], "notificationDetailsId": 1007, "isPublished": false, "statesAndDis": [ { "districtName": [ "Kozhikode(Calicut)" ], "stateName": "Kerala" }, { "districtName": [ "Gandhinagar" ], "stateName": "Gujarat" } ] }, { "description": "An aid of Rs. 1,507 crore has been credited into bank accounts of 42 lakh drought-affected farmers, Maharashtra Finance Minister Sudhir Mungantiwar said on Wednesday. He said Rs. 2,909 crore have been allocated for this purpose.\nPresenting a vote-on-account in the Legislative Assembly, Mr Mungantiwar said 82,27,166 farmers in 151 tehsils with land holding of 85.76 lakh hectares have been affected by drought.", "date": "02-03-2019", "month": "3", "type": "Bank", "croptypes": [ "Alasande Gram", "Ajwan", "Ajwan" ], "notificationDetailsId": 1008, "isPublished": true, "statesAndDis": [ { "districtName": [ "Anand", "Amreli" ], "stateName": "Gujarat" }, { "districtName": [ "Anand" ], "stateName": "Gujarat" } ] }, { "description": "An aid of Rs. 1,507 crore has been credited into bank accounts of 42 lakh drought-affected farmers, Maharashtra Finance Minister Sudhir Mungantiwar said on Wednesday. He said Rs. 2,909 crore have been allocated for this purpose.\nPresenting a vote-on-account in the Legislative Assembly, Mr Mungantiwar said 82,27,166 farmers in 151 tehsils with land holding of 85.76 lakh hectares have been affected by drought.", "date": "02-03-2019", "month": "3", "type": "Bank", "croptypes": [ "Ajwan", "Ajwan", "Alasande Gram" ], "notificationDetailsId": 1009, "isPublished": true, "statesAndDis": [ { "districtName": [ "Amreli", "Anand" ], "stateName": "Gujarat" }, { "districtName": [ "Anand", "Amreli" ], "stateName": "Gujarat" } ] }, { "description": "Test", "date": "12-02-2019", "month": "2", "type": "Important", "croptypes": [ "Alasande Gram", "Alasande Gram", "Alsandikai" ], "notificationDetailsId": 1, "isPublished": false, "statesAndDis": [ { "districtName": [ "Amreli" ], "stateName": "Gujarat" } ] }, { "description": "Test", "date": "12-02-2019", "month": "2", "type": "Govt", "croptypes": [ "Alasande Gram", "Alasande Gram", "Alsandikai" ], "notificationDetailsId": 2, "isPublished": false, "statesAndDis": [ { "districtName": [ "Amreli" ], "stateName": "Gujarat" } ] }, { "description": "english desc", "date": "30-01-2019", "month": "1", "type": "Important", "croptypes": [ "Cowpea (Lobia/Karamani)", "Karbuja(Musk Melon)", "Pointed gourd (Parval)" ], "notificationDetailsId": 1103, "isPublished": false, "statesAndDis": [ { "districtName": [ "Banaskanth", "Amreli", "Anand" ], "stateName": "Gujarat" }, { "districtName": [ "Baghpat", "Bahraich", "Bareilly" ], "stateName": "Uttar Pradesh" }, { "districtName": [ "Dindigul", "Kancheepuram", "Coimbatore" ], "stateName": "Tamil Nadu" } ] } ] } } Above is my json object.i have three dropdown month,croplist and statelist. i want to write one filter function for example if i selected month=3 croplist="Ajwan" and state="gujrat" then is should show below result from notifcation array { "description": "sansjd", "date": "20-03-2019", "month": "3", "type": "Bank", "croptypes": [ "Alasande Gram", "Ajwan", "Ajwan" ], "notificationDetailsId": 953, "isPublished": false, "statesAndDis": [ { "districtName": [ "Anand" ], "stateName": "Gujarat" }, { "districtName": [ "Amreli" ], "stateName": "Gujarat" } ] } I am able to get result by selecting month and croplist using below code in pipe import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'objectFilter' }) export class ObjectFilterPipe implements PipeTransform { transform(value: any, args?: any): any { if(Object.keys(args).length<1){ return false; } else { return value.filter(function(obj) { return Object.keys(args).every(function(c) { return new RegExp(args[c]).test(obj[c]); }); }); } } } filter function in component filterSelection() { let monthValue = this.monthControl.value; let stateDistValue = this.statedistControl.value; let croptypeValue = this.croptypeControl.value; let crpArr: Array<any> = [] let statedisarray:Array<any>=[] if (monthValue == null || monthValue == 0) { monthValue = '' } if (stateDistValue == null || stateDistValue == "All") { stateDistValue = '' } if (croptypeValue == null || croptypeValue == "All") { croptypeValue = '' } crpArr.push(croptypeValue) this.notificationList = this.objflt.transform(this.newList, { month: monthValue,statesAndDis:[{stateName:stateDistValue}], croptypes: crpArr }) console.log("After Filter ----",this.notificationList) }
0debug
Can't call function Python : <p>Here is my code that calls the <code>__init__</code> of <code>Game_Events</code> class:</p> <pre><code>class Game_Events(object): def __init__(self, DoSetup): if DoSetup == "yes": print "Done" GE = Game_Events() GE.__init__("no") </code></pre> <p>But when ever I run the code I get:</p> <pre><code>TypeError: __init__() takes exactly 2 arguments (1 given) </code></pre> <p>How can I fix this?</p>
0debug
MSBuild 15 NuGet restore and build : <p>I'm trying to get the new MSBuild NuGet restore feature to work and having an odd problem.</p> <p>If I do:</p> <pre><code>msbuild.exe mySolution.sln /p:Configuration=Release </code></pre> <p>I get an error about missing packages. This is expected behaviour. However, if I do:</p> <pre><code>msbuild.exe mySolution.sln /p:Configuration=Release /t:restore </code></pre> <p>MSBuild "succeeds" but just creates an obj folder with some files relating to the NuGet restore i.e. no bin\Release\ folder.</p> <p>In order to restore <strong>and</strong> build I have to issue both commands above (restore first, obviously).</p> <p>I have upgrade all of the packages.config files to use the latest PackageReference in the .csproj file.</p> <p><strong><em>Is there a way to both restore and build using a single command?</em></strong></p>
0debug
Access key from within Web.config : I have a username and password key within my web.config file. I need to access those keys within the web.config in a provider. Is this possible if so what is the best way to accomplish this. Thanks
0debug
int cpu_signal_handler(int host_signum, void *pinfo, void *puc) { siginfo_t *info = pinfo; ucontext_t *uc = puc; unsigned long ip; int is_write = 0; ip = uc->uc_mcontext.sc_ip; switch (host_signum) { case SIGILL: case SIGFPE: case SIGSEGV: case SIGBUS: case SIGTRAP: if (info->si_code && (info->si_segvflags & __ISR_VALID)) { is_write = (info->si_isr >> 33) & 1; } break; default: break; } return handle_cpu_signal(ip, (unsigned long)info->si_addr, is_write, (sigset_t *)&uc->uc_sigmask); }
1threat
Loading script in functions.php Wordpress : <p>So I'm trying to put some javascript into my functions.php and run it from there but everytime I do that I get an error on my page when site is reloaded... </p> <p>"Parse error: syntax error, unexpected 'wp_enqueue_script' (T_STRING) Local Sites\custom-site\app\public\wp-content\themes\theme\functions.php on line 35"</p> <p>Here is the code, and yes I did put wp_footer in my footer.php file to run it... </p> <pre><code>function addjs() { wp_register_script('jquery', get_template_directory_uri() . '/plugin-frameworks/jquery-3.2.1.min.js', array() , 1, 1, 1) wp_enqueue_script('jquery'); wp_register_script('bootstrap', get_template_directory_uri() . '/plugin-frameworks/bootstrap.min.js', array() , 1, 1, 1) wp_enqueue_script('bootstrap'); wp_register_script('swiper', get_template_directory_uri() . '/plugin-frameworks/swiper.js', array() , 1, 1, 1) wp_enqueue_script('swiper'); wp_register_script('scripts', get_template_directory_uri() . '/common/scripts.js', array() , 1, 1, 1) wp_enqueue_script('scripts'); wp_register_script('custom', get_template_directory_uri() . '/custom.js', array() , 1, 1, 1) wp_enqueue_script('custom'); } add_action('wp_enqueue_script', 'addjs', 999); </code></pre> <p>I really don't know what I'm doing wrong here... Thanks in advance :)</p>
0debug
Text doesnt pass to a second line in contenteditable div : I use html **contenteditable div** instead of a **textarea**. But problem is that when i typing something in contenteditable div and input text hits the right border of contenteditable div text doesnt pass to a second line it keeps on staying on a first line thus text horizontally overflows a contenteditable div. **Is it normal? How to prevent this? How to force a text to pass to the next line when it hits to the right broder of contenteditable div? Thanks!**
0debug
static int sys_openat(int dirfd, const char *pathname, int flags, ...) { if ((flags & O_CREAT) != 0) { va_list ap; mode_t mode; va_start(ap, flags); mode = va_arg(ap, mode_t); mode = target_to_host_bitmask(mode, fcntl_flags_tbl); va_end(ap); return (openat(dirfd, pathname, flags, mode)); } return (openat(dirfd, pathname, flags)); }
1threat
How to add js and css files in ASP.net Core? : <p>I've been assigned to migrate an application from MVC into ASP.net Core, I'm new to ASP.net Core. In MVC we have <code>BundleConfig.cs</code> and in there we add references to our css and js files, how does it work in ASP.net Core? Let's say that I created a <code>test.js</code> and a <code>MyStyle.css</code> class, which is the best way to add references to it in every view? Should I place the <code>.js</code> and <code>.css</code> files inside <code>wwwroot/js</code> and <code>wwwroot/css</code>?</p>
0debug
static int tcp_chr_add_client(CharDriverState *chr, int fd) { TCPCharDriver *s = chr->opaque; if (s->fd != -1) return -1; qemu_set_nonblock(fd); if (s->do_nodelay) socket_set_nodelay(fd); s->fd = fd; s->chan = io_channel_from_socket(fd); g_source_remove(s->listen_tag); s->listen_tag = 0; tcp_chr_connect(chr); return 0; }
1threat
void arm_sysctl_init(uint32_t base, uint32_t sys_id) { DeviceState *dev; dev = qdev_create(NULL, "realview_sysctl"); qdev_prop_set_uint32(dev, "sys_id", sys_id); qdev_init_nofail(dev); sysbus_mmio_map(sysbus_from_qdev(dev), 0, base); }
1threat
static inline int is_bit_set(BlockDriverState *bs, int64_t bitnum) { uint64_t offset = sizeof(struct cow_header_v2) + bitnum / 8; uint8_t bitmap; if (bdrv_pread(bs->file, offset, &bitmap, sizeof(bitmap)) != sizeof(bitmap)) { return -errno; } return !!(bitmap & (1 << (bitnum % 8))); }
1threat
How To Display the Local image(drawable image file) to cardview via json. I wan,t to load image in offline rather then using picasso library : ## How To Display the Local image(drawable image file) to cardview via json. I wan,t to load image in offline rather then using picasso library ---------- ## i'm using tab layout And my Frament.java @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View rootView = inflater.inflate( R.layout.fragment, container, false); return rootView; } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final ArrayList<Website> babyList = Website.getbabyFromFile("baby&kids.json", getActivity()); adapter = new WebsiteAdapter(this, babyList); recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view); recyclerView.setLayoutManager(new GridLayoutManager(getActivity(),2)); recyclerView.setAdapter(adapter); } My Website.java is private String url; public String imageUrl; public Website() { } public Website(String url) { this.url = url; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public static ArrayList<Website> getbabyFromFile(String filename, Context context) { final ArrayList<Website> babyList = new ArrayList<>(); try { // Load data String jsonString = loadJsonFromAsset("baby&kids.json", context); JSONObject json = new JSONObject(jsonString); JSONArray baby = json.getJSONArray("baby&kids"); // Get Website objects from data for(int i = 0; i < baby.length(); i++){ Website recipe = new Website(); recipe.setUrl(baby.getJSONObject(i).getString("url")); babyList.add(recipe); } } catch (JSONException e) { e.printStackTrace(); } return babyList; } private static String loadJsonFromAsset(String filename, Context context) { String json = null; try { InputStream is = context.getAssets().open(filename); int size = is.available(); byte[] buffer = new byte[size]; is.read(buffer); is.close(); json = new String(buffer, "UTF-8"); } catch (java.io.IOException ex) { ex.printStackTrace(); return null; } return json; } And this is my WebsitAdapter.java private Fragment mContext; // private LayoutInflater mInflater; private ArrayList<Website> mDataSource; OnItemClickListener mItemClickListener; public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{ //each data item is just a string in this case public TextView url; public ImageView thumbnailImageView; public ViewHolder(View v) { super(v); url = (TextView) v.findViewById(R.id.websitename_id); thumbnailImageView = (ImageView) v.findViewById(R.id.website_image_id); v.setOnClickListener(this); } @Override public void onClick(View view) { Intent detailIntent = new Intent(view.getContext(), Webview.class); detailIntent.putExtra("url", url.getText().toString()); mContext.startActivity(detailIntent); } } public interface OnItemClickListener{ public void onItemClick(View view, int Position); } public void SetOnItemClickListner(final OnItemClickListener mItemClickListener){ this.mItemClickListener = mItemClickListener; } public WebsiteAdapter(Fragment context, ArrayList<Website> items) { mContext = context; mDataSource = items; // mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.cardview_item_website, parent, false); return new ViewHolder(itemView); } @Override public void onBindViewHolder(WebsiteAdapter.ViewHolder holder, int position) { // - get element from arraylist at this position // - replace the contents of the view with that element Website website = mDataSource.get(position); holder.url.setText(website.getUrl()); //Picasso.with(mContext).load(website.imageUrl).placeholder(R.mipmap.ic_launcher).into(holder.thumbnailImageView); } @Override public int getItemCount() { return mDataSource.size(); } And My output is [1]: https://i.stack.imgur.com/LVrf6.png**Please give me a solution that if theres is any possible ways to display images that is stored on drawable folder**
0debug
how to add markers on navigationlauncher of mapbox? : Im using mapbox for map navigation.. is it possible to add markers on navigation view on mapbox like the waze app.. when you start navigating markers is still shown on navigation
0debug
swipl: how to reload file : <p>First I load the file with <code>SWI-Prolog</code></p> <pre><code>$ swipl file.pl </code></pre> <p>then I modify the file and save.</p> <p>Now how do I reload the file like</p> <pre><code>?- reload </code></pre> <p>for this modified <code>file.pl</code>?</p>
0debug
how to read a string from user with spaces : my program will be given this as an input: 1 T T T T T F T T F F Bobb, Bill 123456789 T T T T T F T T F F Lou, Mary 974387643 F T T T T F T T F F Bobb, Sam 213458679 F T F T f t 6 T F f Bobb, Joe 315274986 t t t t t f t t f f ZZZZ how do I read the first line in as a single string? i tried using a string tokenizer but that only grabs the '1' and drops the rest.
0debug
complex case statement in sql where clause : i have this code but i cannot make it work: AND CASE DO11_DOCUM_MG36 WHEN 'TSC-ORDINE-RIC' THEN (CONVERT(DATE,ISNULL(dbo.DO31_DOCCORPOORD.DO31_DATACONS,DATEADD(day,ISNULL(dbo.DO17_DOCTESTAPERS.DO17_NUMPERS4,15),dbo.DO12_DOCTESTARIF.DO12_DATAVSCONF)),102) <= '2016-02-29' AND dbo.DO12_DOCTESTARIF.DO12_DATAVSCONF is not null) AND (dbo.DO36_DOCCORPOEST.DO36_DATAST1 is null or CONVERT(DATE,dbo.DO36_DOCCORPOEST.DO36_DATAST1,102) >= '2016-02-01') ELSE (CONVERT(DATE,ISNULL(dbo.DO31_DOCCORPOORD.DO31_DATACONS,DATEADD(day,ISNULL(dbo.DO17_DOCTESTAPERS.DO17_NUMPERS4,15),dbo.DO12_DOCTESTARIF.DO12_DATAVSCONF)),102) BETWEEN '2016-02-01' AND '2016-02-29' AND dbo.DO12_DOCTESTARIF.DO12_DATAVSCONF is not null) END Thanks
0debug
static bool aux_bus_is_bridge(AUXBus *bus, DeviceState *dev) { return (dev == DEVICE(bus->bridge)); }
1threat
void qemu_system_reset(ShutdownCause reason) { MachineClass *mc; mc = current_machine ? MACHINE_GET_CLASS(current_machine) : NULL; cpu_synchronize_all_states(); if (mc && mc->reset) { mc->reset(); } else { qemu_devices_reset(); } if (reason) { qapi_event_send_reset(&error_abort); } cpu_synchronize_all_post_reset(); }
1threat
Function not returning default value C++ : <p>This code will return the values of 1 or 0 when those returns are called, but if it falls to the default return value of 2, it doesn't return it. I'm sure it's something small I'm missing, but I can't figure it out. </p> <pre><code>int comp(string a, string b){ char x; char y; int i = 1; int len; len = a.length(); if(b.length() &lt; (unsigned)len){ len = b.length(); } len++; while(i!=len){ x = a.at(i); y = b.at(i); if(getNum(x) &lt; getNum(y)){ return 1; } else if (getNum(x) &gt; getNum(y)){ return 0; } i++; } return 2; } </code></pre>
0debug
domain configuration in docker-compose : <p>How to configure hostnames with domains in <code>docker-compose.yml</code>?</p> <p>Let's say the service <code>worker</code> expects the service <code>web</code> on the <code>http://web.local/</code> address. But <code>web.local</code> doesn't resolve to an ip address no matter what I configure using the <code>hostname</code> directive. Adding an <code>extra_hosts</code> directive doesn't work either as I should know the ip of the service <code>web</code> for that, which I don't as it is assigned by docker. </p> <p>docker-compose.yml:</p> <pre><code>version: '3' services: worker: build: ./worker networks: - mynet web: build: ./web ports: - 80:80 hostname: web.local networks: - mynet networks: mynet: </code></pre> <p>but <code>ping web.local</code> doesn't resolve inside the service <code>worker</code></p>
0debug
static void vfio_probe_ati_bar4_quirk(VFIOPCIDevice *vdev, int nr) { VFIOQuirk *quirk; VFIOConfigWindowQuirk *window; if (!vfio_pci_is(vdev, PCI_VENDOR_ID_ATI, PCI_ANY_ID) || !vdev->has_vga || nr != 4) { return; } quirk = g_malloc0(sizeof(*quirk)); quirk->mem = g_malloc0(sizeof(MemoryRegion) * 2); quirk->nr_mem = 2; window = quirk->data = g_malloc0(sizeof(*window) + sizeof(VFIOConfigWindowMatch)); window->vdev = vdev; window->address_offset = 0; window->data_offset = 4; window->nr_matches = 1; window->matches[0].match = 0x4000; window->matches[0].mask = PCIE_CONFIG_SPACE_SIZE - 1; window->bar = nr; window->addr_mem = &quirk->mem[0]; window->data_mem = &quirk->mem[1]; memory_region_init_io(window->addr_mem, OBJECT(vdev), &vfio_generic_window_address_quirk, window, "vfio-ati-bar4-window-address-quirk", 4); memory_region_add_subregion_overlap(&vdev->bars[nr].region.mem, window->address_offset, window->addr_mem, 1); memory_region_init_io(window->data_mem, OBJECT(vdev), &vfio_generic_window_data_quirk, window, "vfio-ati-bar4-window-data-quirk", 4); memory_region_add_subregion_overlap(&vdev->bars[nr].region.mem, window->data_offset, window->data_mem, 1); QLIST_INSERT_HEAD(&vdev->bars[nr].quirks, quirk, next); trace_vfio_quirk_ati_bar4_probe(vdev->vbasedev.name); }
1threat
I want to find in witch position are all specific letters : I have this text: “555”;”general”;”pfss”;”16” “444”;”compa”;”sss”;”5” In visual basic 2008 express edition I want to find in witch position are all the ; The result must be: 5,15,22,32,40,46 THNX
0debug
int floatx80_is_nan( floatx80 a1 ) { floatx80u u; u.f = a1; return ( ( u.i.high & 0x7FFF ) == 0x7FFF ) && (bits64) ( u.i.low<<1 ); }
1threat
static int get_device_type(SCSIDiskState *s) { BlockDriverState *bdrv = s->qdev.conf.bs; uint8_t cmd[16]; uint8_t buf[36]; uint8_t sensebuf[8]; sg_io_hdr_t io_header; int ret; memset(cmd, 0, sizeof(cmd)); memset(buf, 0, sizeof(buf)); cmd[0] = INQUIRY; cmd[4] = sizeof(buf); memset(&io_header, 0, sizeof(io_header)); io_header.interface_id = 'S'; io_header.dxfer_direction = SG_DXFER_FROM_DEV; io_header.dxfer_len = sizeof(buf); io_header.dxferp = buf; io_header.cmdp = cmd; io_header.cmd_len = sizeof(cmd); io_header.mx_sb_len = sizeof(sensebuf); io_header.sbp = sensebuf; io_header.timeout = 6000; ret = bdrv_ioctl(bdrv, SG_IO, &io_header); if (ret < 0 || io_header.driver_status || io_header.host_status) { return -1; } s->qdev.type = buf[0]; if (buf[1] & 0x80) { s->features |= 1 << SCSI_DISK_F_REMOVABLE; } return 0; }
1threat
Need a PHP script to limit number of checkboxes checked : I have tried several javascript scripts to limit the number of checkboxes checked in my php file but nothing work is there a php one please help
0debug
How store multiple commands in a variable in shell script : I want to store multiple commands in a variable using for loop iteration. i am using the below code but not getting the expected result. start=720000003999086110 end=720000003999086119 for((c=$start; c<= $end; c++)) do list= lookupSerialNumber $c done Please help me on this.
0debug
JAVA EE SAVE ME PLEASE - PRIMEFACE ISSUES NETBEANS : sorry for the awlful error, I have some issue with java ee using netbeans and primefaces.This is my index.xhtml ``` <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" http://primefaces.prime.com.tr/ui> xmlns:p="http://xmlns.jcp.org/jsf/passthrough" template="/webpages/resources/template.xhtml" <h:head> <title>Reservation</title> <h:outputStylesheet name="css/jsfcrud.css"/> <h:outputStylesheet library="resources/css/styles.css"/> </h:head> <h:body> <h3>Reservation Page</h3> <style type="text/css"> .label { width:20%; padding:4px; } .value { width:80%; padding:4px; } .grid { width:100%; } .error { color: red; } .outputLabel { font-weight: bold; } .grid { width:33%; padding:4px; } </style> <h:form> <p:growl id="growl" sticky="true" showDetail="true"/> <p:wizard flowListener="#{userWizard.onFlowProcess}"> <p:tab id="customer" title="Customer Details"> <p:panel header="Customer Details"> <p:messages /> <h:panelGrid columns="2" columnClasses="label, value"> <h:outputText value="Firstname: *" /> <p:inputText value="#{userWizard.user.firstName}" required="true" label="Firstname"/> <h:outputText value="Lastname: *" /> <p:inputText value="#{userWizard.user.lastName}" required="true" label="Lastname"/> <h:outputText value="Age: " /> <p:inputText value="#{userWizard.user.age}" /> <h:outputText value="Birthday: " /> <p:inputText value="#{userWizard.user.birthday}" /> <h:outputText value="Email: " /> <p:inputText value="#{userWizard.user.email}" /> <h:outputText value="Skip to last: " /> <h:selectBooleanCheckbox value="#{userWizard.skip}" /> </h:panelGrid> </p:panel> </p:tab> <p:tab id="address" title="Address"> <p:panel header="Address Details"> <p:messages /> <h:panelGrid columns="2" columnClasses="label, value"> <h:outputText value="Zip Code: " /> <p:inputText value="#{userWizard.user.zipcode}" /> <h:outputText value="Country: " /> <p:inputText value="#{userWizard.user.country}" /> <h:outputText value="Adress: " /> <p:inputText value="#{userWizard.user.adress}" /> <h:outputText value="City: " /> <p:inputText value="#{userWizard.user.adress}" /> <h:outputText value="State: " /> <p:inputText value="#{userWizard.user.adress}" /> <h:outputText value="Skip to last: " /> <h:selectBooleanCheckbox value="#{userWizard.skip}" /> </h:panelGrid> </p:panel> </p:tab> <p:tab id="room" title="Room Selection"> <p:panel header="Room Selection"> <p:messages /> <h:panelGrid columns="3" columnClasses="label, value"> <h:outputText value="Selecione o número do quarto: *" /> <p:inputText value="#{userWizard.user.roomNumber}" required="true" label="Email"/> <h:outputText value="Selecion a dimensão do quarto(10m²,20m²,40m²: " /> <p:inputText value="#{userWizard.user.dimensionRoom}"/> <h:outputText value="Informações adicionais para o quarto: " /> <p:inputText value="#{userWizard.user.info}"/> </h:panelGrid> </p:panel> </p:tab> <p:tab id="reservation" title="Reservation"> <p:panel header="Reservation Selection"> <p:messages /> <h:panelGrid columns="2" columnClasses="label, value"> <h:outputText value="Number of guests?: " /> <p:inputText value="#{userWizard.user.numberGuests}" required="true"/> <h:outputText value="Entre com o dia da sua Reserva: " /> <p:inputText value="#{userWizard.user.reservationDate}"/> <h:outputText value="Entre com a data do seu Check-in: " /> <p:inputText value="#{userWizard.user.checkIn}"/> <h:outputText value="Entre com a data do seu Check-out: " /> <p:inputText value="#{userWizard.user.checkOut}"/> </h:panelGrid> </p:panel> </p:tab> <p:tab id="confirm" title="Confirmation"> <p:panel header="Confirmation"> <h:panelGrid id="confirmation" columns="3" columnClasses="grid,grid,grid"> <h:panelGrid columns="2" columnClasses="label, value"> <h:outputText value="Firstname: " /> <h:outputText value="#{userWizard.user.firstName}" styleClass="outputLabel"/> <h:outputText value="Lastname: " /> <h:outputText value="#{userWizard.user.lastName}" styleClass="outputLabel"/> <h:outputText value="Age: " /> <h:outputText value="#{userWizard.user.age}" styleClass="outputLabel"/> </h:panelGrid> <h:panelGrid columns="2" columnClasses="label, value"> <h:outputText value="Email: " /> <h:outputText value="#{userWizard.user.email}" styleClass="outputLabel"/> <h:outputText value="Adress: " /> <h:outputText value="#{userWizard.user.adress}" styleClass="outputLabel"/> <h:outputText value="Zipcode: " /> <h:outputText value="#{userWizard.user.zipcode}" styleClass="outputLabel"/> </h:panelGrid> <h:panelGrid columns="2" columnClasses="label, value"> <h:outputText value="Country: " /> <h:outputText value="#{userWizard.user.country}" styleClass="outputLabel"/> <h:outputText value="Title " /> <h:outputText value="#{userWizard.user.title}" styleClass="outputLabel"/> <h:outputText value="City: " /> <h:outputText value="#{userWizard.user.city}" styleClass="outputLabel"/> </h:panelGrid> <h:panelGrid columns="2" columnClasses="label, value"> <h:outputText value="State: " /> <h:outputText value="#{userWizard.user.state}" styleClass="outputLabel"/> <h:outputText value="Birthday: " /> <h:outputText value="#{userWizard.user.birthday}" styleClass="outputLabel"/> <h:outputText value="Room Number: " /> <h:outputText value="#{userWizard.user.roomNumber}" styleClass="outputLabel"/> </h:panelGrid> <h:panelGrid columns="2" columnClasses="label, value"> <h:outputText value="Dimension Room: " /> <h:outputText value="#{userWizard.user.dimensionRoom}" styleClass="outputLabel"/> <h:outputText value="Info: " /> <h:outputText value="#{userWizard.user.info}" styleClass="outputLabel"/> <h:outputText value="Number of Guests: " /> <h:outputText value="#{userWizard.user.numberGuests}" styleClass="outputLabel"/> </h:panelGrid> <h:panelGrid columns="2" columnClasses="label, value"> <h:outputText value="Reservation Date: " /> <h:outputText value="#{userWizard.user.reservationDate}" styleClass="outputLabel"/> <h:outputText value="Check-in: " /> <h:outputText value="#{userWizard.user.checkIn}" styleClass="outputLabel"/> <h:outputText value="Check-out: " /> <h:outputText value="#{userWizard.user.checkOut}" styleClass="outputLabel"/> </h:panelGrid> </h:panelGrid> <p:commandButton value="Submit" action="#{userWizard.save}" update="growl" process="@this"/> </p:panel> </p:tab> </p:wizard> </h:form> <br /> <h:link outcome="/customer/List" value="Show All Customer Items"/> </h:body> </html> ``` and my pom.xml I'm actually using maven. ``` <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.mycompany</groupId> <artifactId>mavenproject1</artifactId> <version>1.0-SNAPSHOT</version> <packaging>war</packaging> <name>mavenproject1</name> <properties> <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>javax</groupId> <artifactId>javaee-web-api</artifactId> <version>7.0</version> <scope>provided</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.7</source> <target>1.7</target> <compilerArguments> <endorseddirs>${endorsed.dir}</endorseddirs> </compilerArguments> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.3</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.6</version> <executions> <execution> <phase>validate</phase> <goals> <goal>copy</goal> </goals> <configuration> <outputDirectory>${endorsed.dir}</outputDirectory> <silent>true</silent> <artifactItems> <artifactItem> <groupId>javax</groupId> <artifactId>javaee-endorsed-api</artifactId> <version>7.0</version> <type>jar</type> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin> </plugins> </build> </project> ``` The error that appears is that a component is undeclared, and asks to add this library xmlns: p = "http://xmlns.jcp.org/jsf/passthrough" but when added it does not resolve and asks to put back in a Infinite loop. [enter image description here][1] [1]: https://i.stack.imgur.com/qtOo8.png
0debug
How to order regular expression alternatives to get longest match? : <p>I have a number of regular expressions <code>regex1</code>, <code>regex2</code>, ..., <code>regexN</code> combined into a single regex as <code>regex1|regex2|...|regexN</code>. I would like to reorder the component expressions so that the combined expression gives the longest possible match at the beginning of a given string.</p> <p>I believe this means reordering the regular expressions such that "if <code>regexK</code> matches a prefix of <code>regexL</code>, then <code>L &lt; K</code>". If this is correct, is it possible to find out, in general, whether <code>regexK</code> can match a prefix of <code>regexL</code>?</p>
0debug
void hd_geometry_guess(BlockBackend *blk, uint32_t *pcyls, uint32_t *pheads, uint32_t *psecs, int *ptrans) { int cylinders, heads, secs, translation; if (guess_disk_lchs(blk, &cylinders, &heads, &secs) < 0) { guess_chs_for_size(blk, pcyls, pheads, psecs); translation = hd_bios_chs_auto_trans(*pcyls, *pheads, *psecs); } else if (heads > 16) { guess_chs_for_size(blk, pcyls, pheads, psecs); translation = *pcyls * *pheads <= 131072 ? BIOS_ATA_TRANSLATION_LARGE : BIOS_ATA_TRANSLATION_LBA; } else { *pcyls = cylinders; *pheads = heads; *psecs = secs; translation = BIOS_ATA_TRANSLATION_NONE; } if (ptrans) { *ptrans = translation; } trace_hd_geometry_guess(blk, *pcyls, *pheads, *psecs, translation); }
1threat
static void mv88w8618_pit_write(void *opaque, target_phys_addr_t offset, uint64_t value, unsigned size) { mv88w8618_pit_state *s = opaque; mv88w8618_timer_state *t; int i; switch (offset) { case MP_PIT_TIMER1_LENGTH ... MP_PIT_TIMER4_LENGTH: t = &s->timer[offset >> 2]; t->limit = value; if (t->limit > 0) { ptimer_set_limit(t->ptimer, t->limit, 1); } else { ptimer_stop(t->ptimer); } break; case MP_PIT_CONTROL: for (i = 0; i < 4; i++) { t = &s->timer[i]; if (value & 0xf && t->limit > 0) { ptimer_set_limit(t->ptimer, t->limit, 0); ptimer_set_freq(t->ptimer, t->freq); ptimer_run(t->ptimer, 0); } else { ptimer_stop(t->ptimer); } value >>= 4; } break; case MP_BOARD_RESET: if (value == MP_BOARD_RESET_MAGIC) { qemu_system_reset_request(); } break; } }
1threat
java - What does || mean in a conditional statement? : <p>What does this mean:</p> <p><code>if (value &gt; 10 || value == 20) {</code></p> <p>Any answer would be nice. thanks!</p>
0debug
static int decode_tsw1(uint8_t *frame, int width, int height, const uint8_t *src, const uint8_t *src_end) { const uint8_t *frame_start = frame; const uint8_t *frame_end = frame + width * height; int mask = 0x10000, bitbuf = 0; int v, offset, count, segments; segments = bytestream_get_le32(&src); frame += bytestream_get_le32(&src); if (frame < frame_start || frame > frame_end) return -1; while (segments--) { if (mask == 0x10000) { if (src >= src_end) return -1; bitbuf = bytestream_get_le16(&src); mask = 1; } if (src_end - src < 2 || frame_end - frame < 2) return -1; if (bitbuf & mask) { v = bytestream_get_le16(&src); offset = (v & 0x1FFF) << 1; count = ((v >> 13) + 2) << 1; if (frame - frame_start < offset || frame_end - frame < count) return -1; av_memcpy_backptr(frame, offset, count); frame += count; } else { *frame++ = *src++; *frame++ = *src++; } mask <<= 1; } return 0; }
1threat
[C#]I modified 1 variable, 2 changed : I was writting my code, i fought all was good and then I tested my code. In the code i'am changing the value: ennemy.object_infos[0] = "Ennemy"; player.object_infos[0] = "Player"; And the output of Console.WriteLine(player.object_infos[0]) was "Ennemy" and the output of Console.WriteLine(ennemi.object_infos[0]) was "Ennemy" Exactly the code was : using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using System.Drawing; public class Program { public static void Main() { GameEngine game = new GameEngine(); GameEngine.GameObject ennemy = new GameEngine.GameObject(); GameEngine.GameObject player = new GameEngine.GameObject(); ennemy.object_infos = GameEngine.GameObject.object_infos_default; player.object_infos = GameEngine.GameObject.object_infos_default; ennemy.object_infos[0] = "Ennemy"; player.object_infos[0] = "Player"; Console.WriteLine(ennemy.object_infos[0] + "," + player.object_infos[0]); } } public class GameEngine { public List<GameObject> objects = new List<GameObject>(); /* Vector2 : vector with 2 values x,y */ public struct Vector2 { public float x,y; public Vector2(float xaxis,float yaxis) { x = xaxis; y = yaxis; } } public class GameObject { /* object_infos indexes: 0 = name(string), 1 = id(double), 2 = sprite path in assets(string), 3 = transform (array of 3 vectors2) 4 = rectangle collider(Vector2 size w,h) 5 = isActive(bool) 6 = isVisible(bool) 7 = tag */ public object[] object_infos; /* transform default : index 0 = position, index 1 = rotation, index 2 = scale */ private static Vector2[] transform_default = {new Vector2(0,0),new Vector2(0,0),new Vector2(1,1)}; /* On new object creation apply this object infos */ public static object[] object_infos_default = {"New Object", 0, "/Assets/default.png", transform_default, new Vector2(1,1), true, true, "object"}; } /* engine class for all mathematics */ public class Math { /* public static bool areColliding(Vector2 first_object_pos, Vector2 first_object_collidersize,Vector2 second_object_pos, Vector2 second_object_collidersize) { } */ } } Its really strange i changed one value and two changed please someone help me! ----------------------------------------------------------------------------- [post_tooshort:-0][post_tooshort:-0][post_tooshort:-0][post_tooshort:-0] [post_tooshort:-0][post_tooshort:-0][post_tooshort:-0][post_tooshort:-0][post_tooshort:-0][post_tooshort:-0][post_tooshort:-0][post_tooshort:-0][post_tooshort:-0][post_tooshort:-0][post_tooshort:-0][post_tooshort:-0]
0debug
Generating random distinct pair with no diagonals java : i want to generate two random pair of integer with no duplicate in an arry of length 8 and i dont want any pair in the same diagonal public static int[] randomizer(int[] v){ int [] a= new int[8]; for (int i = 0; i < a.length; i++) { a[i] = (int)(Math.random()*9); for (int j = 0; j < i; j++) { if (a[i] == a[j]) { i--; break; } } } a[0] = v[0] ; return a; } this is what i have done so far
0debug
How to remove all Docker containers : <p>I want to remove all of my docker containers at once. I tried to use $ docker rm [container_id] to do so, but it removed only one container, not all.</p> <p>Is there any way to remove all docker containers using one single line of code?</p>
0debug
Python 3.x Is there anyway to take the users input in one variable and use that input in another variable? : [Python 3.x] Is there anyway to take the users input in one variable and use that input in another variable? For example: def user_input(): numb = input("Please input the number ") numb_process() def numb_process(): if numb == '1': print("Good") else: print("Bad") user_input() Sorry if this is a silly question, I am quite new to Python and am still learning. Any help would be very appreciated. Thanks
0debug
Chart JS - Use time for xAxes : <p>i added this code</p> <pre><code>scales: { xAxes: [{ type: 'time', time: { unit: 'month', displayFormats: { month: 'MM' }, max: '2017-10-09 18:43:53', min: '2017-10-02 18:43:53' } }] }, </code></pre> <p>to the options but it does not work. Any ideas what i'm making wrong?</p> <p><strong>FIDDLE -></strong> <a href="https://jsfiddle.net/o473y9pw/" rel="noreferrer">https://jsfiddle.net/o473y9pw/</a></p>
0debug
How to insert Line From MemoList2 on Top of MemoList1 in Delphi : <b>Memolist1,Memolist2:TStringList;</b> <b>MemoList2 have one Line</b> <b>MemoList1 Have many Lines </b> <b>How to insert Line From MemoList2 To Top Lines Of MemoList1</b>
0debug
ROW CONCATENATION LOGIC IN PYTHON (PANDAS DATAFRAME) : In the below mentioned table, concatenate the rows which has column "Sentence" with distinct values in another table. `Tri_gram_sents Value sentence (('<s>', '<s>'), 'ABC') 0.161681 1 (('<s>', 'ABC'), 'ABC') 0.472973 1 (('ABC', 'ABC'), 'ABC') 0.305732 1 (('ABC', 'ABC'), 'ABC') 0.005655 1 (('ABC', 'ABC'), '</s>') 0.434783 1 (('ABC', '</s>'), '</s>') 0.008547 1 (('<s>', '<s>'), 'DEF') 0.111111 2 (('<s>', 'DEF'), 'DEF') 0.039474 2 (('DEF', 'DEF'), 'DEF') 0.207317 2 (('DEF', 'DEF'), 'DEF') 0.074803 2 (('DEF', 'DEF'), '</s>') 0.037940 2 (('DEF', '</s>'), '</s>') 0.033163 2 (('<s>', '<s>'), 'GHI') 0.250000 3 (('<s>', 'GHI'), 'GHI') 0.103316 3 (('GHI', 'GHI'), 'GHI') 0.024155 3 (('GHI', 'GHI'), '</s>') 0.028302 3 (('GHI', '</s>'), '</s>') 0.117647 3 ` 1. For below set of rows, i will get a total of 3 rows in another table by combining all rows in a single row with column "sentence" as reference "1", "2", "3" `my output in this manner` (('<s>', '<s>'), 'ABC') 0.161681/(('<s>', 'ABC'), 'ABC') 0.472973/(('ABC', 'ABC'), 'ABC') 0.305732/(('ABC', 'ABC'), 'ABC') 0.005655/(('ABC', 'ABC'), '</s>') 0.434783/(('ABC', '</s>'), '</s>') 0.008547 (('<s>', '<s>'), 'DEF') 0.111111/(('<s>', 'DEF'), 'DEF') 0.039474/(('DEF', 'DEF'), 'DEF') 0.207317/(('DEF', 'DEF'), 'DEF') 0.074803/(('DEF', 'DEF'), '</s>') 0.037940/(('DEF', '</s>'), '</s>') 0.033163 (('<s>', '<s>'), 'GHI') 0.250000/(('<s>', 'GHI'), 'GHI') 0.103316/(('GHI', 'GHI'), 'GHI') 0.024155/(('GHI', 'GHI'), '</s>') 0.028302/(('GHI', '</s>'), '</s>') 0.117647
0debug
Platform invoke #define directive : <p>I am trying to understand platform invokes. So, i understood many concepts but how can i invoke <code>#define</code> directives in c#.</p> <p>Example:</p> <p>in C++ side i have this: </p> <pre><code>#define dont_care_how_you_invoke_me (ptr) </code></pre> <p>I've tried this:</p> <pre><code>[DllImport("mydll.dll")] static extern void dont_care_how_you_invoke_me(IntPtr ptr); </code></pre> <p>This didn't work. I've searched on google for a while and couldn't find anything so i'm not even sure if this is possible or not.</p> <p>Thanks in advance</p>
0debug
Select button in selemium c# : <p>How can I select the last button in this code? the only thing that changes is the value.</p> <p>button class="btn btn-link btn-star" data-value="26">/button></p> <p>button class="btn btn-link btn-star" data-value="27">/button></p>
0debug
static void external_snapshot_prepare(BlkTransactionStates *common, Error **errp) { BlockDriver *proto_drv; BlockDriver *drv; int flags, ret; Error *local_err = NULL; const char *device; const char *new_image_file; const char *format = "qcow2"; enum NewImageMode mode = NEW_IMAGE_MODE_ABSOLUTE_PATHS; ExternalSnapshotStates *states = DO_UPCAST(ExternalSnapshotStates, common, common); TransactionAction *action = common->action; g_assert(action->kind == TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC); device = action->blockdev_snapshot_sync->device; new_image_file = action->blockdev_snapshot_sync->snapshot_file; if (action->blockdev_snapshot_sync->has_format) { format = action->blockdev_snapshot_sync->format; } if (action->blockdev_snapshot_sync->has_mode) { mode = action->blockdev_snapshot_sync->mode; } drv = bdrv_find_format(format); if (!drv) { error_set(errp, QERR_INVALID_BLOCK_FORMAT, format); return; } states->old_bs = bdrv_find(device); if (!states->old_bs) { error_set(errp, QERR_DEVICE_NOT_FOUND, device); return; } if (!bdrv_is_inserted(states->old_bs)) { error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device); return; } if (bdrv_in_use(states->old_bs)) { error_set(errp, QERR_DEVICE_IN_USE, device); return; } if (!bdrv_is_read_only(states->old_bs)) { if (bdrv_flush(states->old_bs)) { error_set(errp, QERR_IO_ERROR); return; } } flags = states->old_bs->open_flags; proto_drv = bdrv_find_protocol(new_image_file); if (!proto_drv) { error_set(errp, QERR_INVALID_BLOCK_FORMAT, format); return; } if (mode != NEW_IMAGE_MODE_EXISTING) { bdrv_img_create(new_image_file, format, states->old_bs->filename, states->old_bs->drv->format_name, NULL, -1, flags, &local_err, false); if (error_is_set(&local_err)) { error_propagate(errp, local_err); return; } } states->new_bs = bdrv_new(""); ret = bdrv_open(states->new_bs, new_image_file, NULL, flags | BDRV_O_NO_BACKING, drv); if (ret != 0) { error_setg_file_open(errp, -ret, new_image_file); } }
1threat
Combining two accounts : <p>This is a homework assignment. I need to consolidate the two accounts (acct2 and acct3) and produce a third one with the same name, different account number and $200. I also have to close the first two accounts. That is not really the issue though. I can get everything to work fine if I do not declare public static Account accountConsolidate(Account acct1, Account acct2) as a static method, and just create an object in the main. This does not work though because I am required to declare this method as static. Also, if I do declare it as static I can get the proper return value in the <code>if(acct1.name.equalsIgnoreCase(acct2.name) &amp;&amp; acct1.acctNum != acct2.acctNum)</code> if I exclude the `&amp;&amp; acct1.acctNum != acct2.acctNum other wise it will return null ("These two accounts are not able to be consolidated. Please check the criteria again", not sure why. </p> <p>Any help would be great. Thanks</p> <pre><code>import java.util.Random; public class Account { private static int numAccounts = 0; private double balance; private static String name; private static double acctNum; static Random gen = new Random(); //------------------------------------------------- //Constructor -- initializes balance, owner, and account number //------------------------------------------------- public Account(double initBal, String owner, double number) { balance = initBal; name = owner; acctNum = number; numAccounts++; } public Account(double initBal, String owner) { balance = initBal; name = owner; acctNum = Math.abs(gen.nextDouble()); numAccounts++; } public Account(String owner) { balance = 0; name = owner; acctNum = Math.abs(gen.nextDouble()); numAccounts++; } //------------------------------------------------- // Checks to see if balance is sufficient for withdrawal. // If so, decrements balance by amount; if not, prints message. //------------------------------------------------- public void withdraw(double amount) { if (balance &gt;= amount) { balance -= amount; } else System.out.println("Insufficient funds"); } public void withdraw(double amount, double fee) { if (balance &gt;= amount) { balance -= amount; balance -= fee; } else System.out.println("Insufficient funds"); } public String getName() { return name; } public double getNum() { return acctNum; } //------------------------------------------------- // Adds deposit amount to balance. //------------------------------------------------- public void deposit(double amount) { balance += amount; } //------------------------------------------------- // Returns balance. //------------------------------------------------- public double getBalance() { return balance; } // Static method to keep track of incrementing Account public static int getNumAccounts() { return numAccounts; } // Close the account public void close() { balance = 0; name = "CLOSED"; numAccounts--; } // Consolidate accounts public static Account accountConsolidate(Account acct1, Account acct2) { if(acct1.name.equalsIgnoreCase(acct2.name) &amp;&amp; acct1.acctNum != acct2.acctNum) { Account Account2 = new Account(0, acct1.name); Account2.balance = acct1.getBalance() + acct2.getBalance(); acctNum = Math.abs(gen.nextDouble()); acct1.close(); acct2.close(); return Account2; } else { System.out.println("These two accounts are not able to be consolidated. Please check the criteria again"); return null; } } //------------------------------------------------- // Returns a string containing the name, account number, and balance. //------------------------------------------------- public String toString() { return "Name:" + name + "\nAccount Number: " + acctNum + "\nBalance: " + balance; } } //************************************************************ //TestAccounts1 //A simple program to test the numAccts method of the //Account class. //************************************************************ import java.util.Scanner; public class TestAccount1 { public static void main(String[] args) { String name1; String name2; String name3; Scanner scan = new Scanner(System.in); System.out.print("Please enter the name for account 1: "); name1 = scan.nextLine(); Account acct1 = new Account (100, name1); System.out.println(acct1); System.out.println("Now there are " + Account.getNumAccounts() + " accounts"); System.out.println(""); System.out.print("Please enter the name for account 2: "); name2 = scan.nextLine(); Account acct2 = new Account (100, name2); System.out.println(acct2); System.out.println("Now there are " + Account.getNumAccounts() + " accounts"); System.out.println(""); System.out.print("Please enter the name for account 3: "); name3 = scan.nextLine(); Account acct3 = new Account (100, name3); System.out.println(acct3); System.out.println("Now there are " + Account.getNumAccounts() + " accounts"); System.out.println(""); acct1.close(); System.out.println(""); System.out.println("There are now " + Account.getNumAccounts() + " accounts"); System.out.println("Accounts consolidated"); System.out.println(Account.accountConsolidate(acct2, acct3)); } } </code></pre>
0debug
Azure Service Bus equivalent for AWS : <p>I am in the process of moving an application from c# to node.js. I am a node.js newbie, coming from a .net background. I am looking to incorporate domain driven design patterns into the app. development which led me to the concept of bounded contexts and micro services. I would like to use aws as my cloud provider but am having a problem in determining which tool I should use for handlling command and event processing? Azure has the service bus which seems to work pretty good for this.</p> <p>Is there an equivalent to the service bus for aws or should I just look to use SQS?</p>
0debug
static int transcode(AVFormatContext **output_files, int nb_output_files, InputFile *input_files, int nb_input_files, StreamMap *stream_maps, int nb_stream_maps) { int ret = 0, i, j, k, n, nb_ostreams = 0, step; AVFormatContext *is, *os; AVCodecContext *codec, *icodec; OutputStream *ost, **ost_table = NULL; InputStream *ist; char error[1024]; int key; int want_sdp = 1; uint8_t no_packet[MAX_FILES]={0}; int no_packet_count=0; int nb_frame_threshold[AVMEDIA_TYPE_NB]={0}; int nb_streams[AVMEDIA_TYPE_NB]={0}; if (rate_emu) for (i = 0; i < nb_input_streams; i++) input_streams[i].start = av_gettime(); nb_ostreams = 0; for(i=0;i<nb_output_files;i++) { os = output_files[i]; if (!os->nb_streams && !(os->oformat->flags & AVFMT_NOSTREAMS)) { av_dump_format(output_files[i], i, output_files[i]->filename, 1); fprintf(stderr, "Output file #%d does not contain any stream\n", i); ret = AVERROR(EINVAL); goto fail; } nb_ostreams += os->nb_streams; } if (nb_stream_maps > 0 && nb_stream_maps != nb_ostreams) { fprintf(stderr, "Number of stream maps must match number of output streams\n"); ret = AVERROR(EINVAL); goto fail; } for(i=0;i<nb_stream_maps;i++) { int fi = stream_maps[i].file_index; int si = stream_maps[i].stream_index; if (fi < 0 || fi > nb_input_files - 1 || si < 0 || si > input_files[fi].ctx->nb_streams - 1) { fprintf(stderr,"Could not find input stream #%d.%d\n", fi, si); ret = AVERROR(EINVAL); goto fail; } fi = stream_maps[i].sync_file_index; si = stream_maps[i].sync_stream_index; if (fi < 0 || fi > nb_input_files - 1 || si < 0 || si > input_files[fi].ctx->nb_streams - 1) { fprintf(stderr,"Could not find sync stream #%d.%d\n", fi, si); ret = AVERROR(EINVAL); goto fail; } } ost_table = av_mallocz(sizeof(OutputStream *) * nb_ostreams); if (!ost_table) goto fail; for(k=0;k<nb_output_files;k++) { os = output_files[k]; for(i=0;i<os->nb_streams;i++,n++) { nb_streams[os->streams[i]->codec->codec_type]++; } } for(step=1<<30; step; step>>=1){ int found_streams[AVMEDIA_TYPE_NB]={0}; for(j=0; j<AVMEDIA_TYPE_NB; j++) nb_frame_threshold[j] += step; for(j=0; j<nb_input_streams; j++) { int skip=0; ist = &input_streams[j]; if(opt_programid){ int pi,si; AVFormatContext *f= input_files[ ist->file_index ].ctx; skip=1; for(pi=0; pi<f->nb_programs; pi++){ AVProgram *p= f->programs[pi]; if(p->id == opt_programid) for(si=0; si<p->nb_stream_indexes; si++){ if(f->streams[ p->stream_index[si] ] == ist->st) skip=0; } } } if (ist->discard && ist->st->discard != AVDISCARD_ALL && !skip && nb_frame_threshold[ist->st->codec->codec_type] <= ist->st->codec_info_nb_frames){ found_streams[ist->st->codec->codec_type]++; } } for(j=0; j<AVMEDIA_TYPE_NB; j++) if(found_streams[j] < nb_streams[j]) nb_frame_threshold[j] -= step; } n = 0; for(k=0;k<nb_output_files;k++) { os = output_files[k]; for(i=0;i<os->nb_streams;i++,n++) { int found; ost = ost_table[n] = output_streams_for_file[k][i]; if (nb_stream_maps > 0) { ost->source_index = input_files[stream_maps[n].file_index].ist_index + stream_maps[n].stream_index; if (input_streams[ost->source_index].st->codec->codec_type != ost->st->codec->codec_type) { int i= ost->file_index; av_dump_format(output_files[i], i, output_files[i]->filename, 1); fprintf(stderr, "Codec type mismatch for mapping #%d.%d -> #%d.%d\n", stream_maps[n].file_index, stream_maps[n].stream_index, ost->file_index, ost->index); ffmpeg_exit(1); } } else { found = 0; for (j = 0; j < nb_input_streams; j++) { int skip=0; ist = &input_streams[j]; if(opt_programid){ int pi,si; AVFormatContext *f = input_files[ist->file_index].ctx; skip=1; for(pi=0; pi<f->nb_programs; pi++){ AVProgram *p= f->programs[pi]; if(p->id == opt_programid) for(si=0; si<p->nb_stream_indexes; si++){ if(f->streams[ p->stream_index[si] ] == ist->st) skip=0; } } } if (ist->discard && ist->st->discard != AVDISCARD_ALL && !skip && ist->st->codec->codec_type == ost->st->codec->codec_type && nb_frame_threshold[ist->st->codec->codec_type] <= ist->st->codec_info_nb_frames) { ost->source_index = j; found = 1; break; } } if (!found) { if(! opt_programid) { for (j = 0; j < nb_input_streams; j++) { ist = &input_streams[j]; if ( ist->st->codec->codec_type == ost->st->codec->codec_type && ist->st->discard != AVDISCARD_ALL) { ost->source_index = j; found = 1; } } } if (!found) { int i= ost->file_index; av_dump_format(output_files[i], i, output_files[i]->filename, 1); fprintf(stderr, "Could not find input stream matching output stream #%d.%d\n", ost->file_index, ost->index); ffmpeg_exit(1); } } } ist = &input_streams[ost->source_index]; ist->discard = 0; ost->sync_ist = (nb_stream_maps > 0) ? &input_streams[input_files[stream_maps[n].sync_file_index].ist_index + stream_maps[n].sync_stream_index] : ist; } } for(i=0;i<nb_ostreams;i++) { ost = ost_table[i]; os = output_files[ost->file_index]; ist = &input_streams[ost->source_index]; codec = ost->st->codec; icodec = ist->st->codec; if (metadata_streams_autocopy) av_dict_copy(&ost->st->metadata, ist->st->metadata, AV_DICT_DONT_OVERWRITE); ost->st->disposition = ist->st->disposition; codec->bits_per_raw_sample= icodec->bits_per_raw_sample; codec->chroma_sample_location = icodec->chroma_sample_location; if (ost->st->stream_copy) { uint64_t extra_size = (uint64_t)icodec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE; if (extra_size > INT_MAX) goto fail; codec->codec_id = icodec->codec_id; codec->codec_type = icodec->codec_type; if(!codec->codec_tag){ if( !os->oformat->codec_tag || av_codec_get_id (os->oformat->codec_tag, icodec->codec_tag) == codec->codec_id || av_codec_get_tag(os->oformat->codec_tag, icodec->codec_id) <= 0) codec->codec_tag = icodec->codec_tag; } codec->bit_rate = icodec->bit_rate; codec->rc_max_rate = icodec->rc_max_rate; codec->rc_buffer_size = icodec->rc_buffer_size; codec->extradata= av_mallocz(extra_size); if (!codec->extradata) goto fail; memcpy(codec->extradata, icodec->extradata, icodec->extradata_size); codec->extradata_size= icodec->extradata_size; if(!copy_tb && av_q2d(icodec->time_base)*icodec->ticks_per_frame > av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/500){ codec->time_base = icodec->time_base; codec->time_base.num *= icodec->ticks_per_frame; av_reduce(&codec->time_base.num, &codec->time_base.den, codec->time_base.num, codec->time_base.den, INT_MAX); }else codec->time_base = ist->st->time_base; switch(codec->codec_type) { case AVMEDIA_TYPE_AUDIO: if(audio_volume != 256) { fprintf(stderr,"-acodec copy and -vol are incompatible (frames are not decoded)\n"); ffmpeg_exit(1); } codec->channel_layout = icodec->channel_layout; codec->sample_rate = icodec->sample_rate; codec->channels = icodec->channels; codec->frame_size = icodec->frame_size; codec->audio_service_type = icodec->audio_service_type; codec->block_align= icodec->block_align; if(codec->block_align == 1 && codec->codec_id == CODEC_ID_MP3) codec->block_align= 0; if(codec->codec_id == CODEC_ID_AC3) codec->block_align= 0; break; case AVMEDIA_TYPE_VIDEO: codec->pix_fmt = icodec->pix_fmt; codec->width = icodec->width; codec->height = icodec->height; codec->has_b_frames = icodec->has_b_frames; if (!codec->sample_aspect_ratio.num) { codec->sample_aspect_ratio = ost->st->sample_aspect_ratio = ist->st->sample_aspect_ratio.num ? ist->st->sample_aspect_ratio : ist->st->codec->sample_aspect_ratio.num ? ist->st->codec->sample_aspect_ratio : (AVRational){0, 1}; } break; case AVMEDIA_TYPE_SUBTITLE: codec->width = icodec->width; codec->height = icodec->height; break; case AVMEDIA_TYPE_DATA: break; default: abort(); } } else { if (!ost->enc) ost->enc = avcodec_find_encoder(ost->st->codec->codec_id); switch(codec->codec_type) { case AVMEDIA_TYPE_AUDIO: ost->fifo= av_fifo_alloc(1024); if(!ost->fifo) goto fail; ost->reformat_pair = MAKE_SFMT_PAIR(AV_SAMPLE_FMT_NONE,AV_SAMPLE_FMT_NONE); if (!codec->sample_rate) { codec->sample_rate = icodec->sample_rate; if (icodec->lowres) codec->sample_rate >>= icodec->lowres; } choose_sample_rate(ost->st, ost->enc); codec->time_base = (AVRational){1, codec->sample_rate}; if (codec->sample_fmt == AV_SAMPLE_FMT_NONE) codec->sample_fmt = icodec->sample_fmt; choose_sample_fmt(ost->st, ost->enc); if (!codec->channels) { codec->channels = icodec->channels; codec->channel_layout = icodec->channel_layout; } if (av_get_channel_layout_nb_channels(codec->channel_layout) != codec->channels) codec->channel_layout = 0; ost->audio_resample = codec->sample_rate != icodec->sample_rate || audio_sync_method > 1; icodec->request_channels = codec->channels; ist->decoding_needed = 1; ost->encoding_needed = 1; ost->resample_sample_fmt = icodec->sample_fmt; ost->resample_sample_rate = icodec->sample_rate; ost->resample_channels = icodec->channels; break; case AVMEDIA_TYPE_VIDEO: if (codec->pix_fmt == PIX_FMT_NONE) codec->pix_fmt = icodec->pix_fmt; choose_pixel_fmt(ost->st, ost->enc); if (ost->st->codec->pix_fmt == PIX_FMT_NONE) { fprintf(stderr, "Video pixel format is unknown, stream cannot be encoded\n"); ffmpeg_exit(1); } ost->video_resample = codec->width != icodec->width || codec->height != icodec->height || codec->pix_fmt != icodec->pix_fmt; if (ost->video_resample) { codec->bits_per_raw_sample= frame_bits_per_raw_sample; } if (!codec->width || !codec->height) { codec->width = icodec->width; codec->height = icodec->height; } ost->resample_height = icodec->height; ost->resample_width = icodec->width; ost->resample_pix_fmt= icodec->pix_fmt; ost->encoding_needed = 1; ist->decoding_needed = 1; if (!ost->frame_rate.num) ost->frame_rate = ist->st->r_frame_rate.num ? ist->st->r_frame_rate : (AVRational){25,1}; if (ost->enc && ost->enc->supported_framerates && !force_fps) { int idx = av_find_nearest_q_idx(ost->frame_rate, ost->enc->supported_framerates); ost->frame_rate = ost->enc->supported_framerates[idx]; } codec->time_base = (AVRational){ost->frame_rate.den, ost->frame_rate.num}; if( av_q2d(codec->time_base) < 0.001 && video_sync_method && (video_sync_method==1 || (video_sync_method<0 && !(os->oformat->flags & AVFMT_VARIABLE_FPS)))){ av_log(os, AV_LOG_WARNING, "Frame rate very high for a muxer not effciciently supporting it.\n" "Please consider specifiying a lower framerate, a different muxer or -vsync 2\n"); } #if CONFIG_AVFILTER if (configure_video_filters(ist, ost)) { fprintf(stderr, "Error opening filters!\n"); exit(1); } #endif break; case AVMEDIA_TYPE_SUBTITLE: ost->encoding_needed = 1; ist->decoding_needed = 1; break; default: abort(); break; } if (ost->encoding_needed && codec->codec_id != CODEC_ID_H264 && (codec->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2))) { char logfilename[1024]; FILE *f; snprintf(logfilename, sizeof(logfilename), "%s-%d.log", pass_logfilename_prefix ? pass_logfilename_prefix : DEFAULT_PASS_LOGFILENAME_PREFIX, i); if (codec->flags & CODEC_FLAG_PASS1) { f = fopen(logfilename, "wb"); if (!f) { fprintf(stderr, "Cannot write log file '%s' for pass-1 encoding: %s\n", logfilename, strerror(errno)); ffmpeg_exit(1); } ost->logfile = f; } else { char *logbuffer; size_t logbuffer_size; if (read_file(logfilename, &logbuffer, &logbuffer_size) < 0) { fprintf(stderr, "Error reading log file '%s' for pass-2 encoding\n", logfilename); ffmpeg_exit(1); } codec->stats_in = logbuffer; } } } if(codec->codec_type == AVMEDIA_TYPE_VIDEO){ int size= codec->width * codec->height; bit_buffer_size= FFMAX(bit_buffer_size, 6*size + 1664); } } if (!bit_buffer) bit_buffer = av_malloc(bit_buffer_size); if (!bit_buffer) { fprintf(stderr, "Cannot allocate %d bytes output buffer\n", bit_buffer_size); ret = AVERROR(ENOMEM); goto fail; } for(i=0;i<nb_ostreams;i++) { ost = ost_table[i]; if (ost->encoding_needed) { AVCodec *codec = ost->enc; AVCodecContext *dec = input_streams[ost->source_index].st->codec; if (!codec) { snprintf(error, sizeof(error), "Encoder (codec id %d) not found for output stream #%d.%d", ost->st->codec->codec_id, ost->file_index, ost->index); ret = AVERROR(EINVAL); goto dump_format; } if (dec->subtitle_header) { ost->st->codec->subtitle_header = av_malloc(dec->subtitle_header_size); if (!ost->st->codec->subtitle_header) { ret = AVERROR(ENOMEM); goto dump_format; } memcpy(ost->st->codec->subtitle_header, dec->subtitle_header, dec->subtitle_header_size); ost->st->codec->subtitle_header_size = dec->subtitle_header_size; } if (avcodec_open2(ost->st->codec, codec, &ost->opts) < 0) { snprintf(error, sizeof(error), "Error while opening encoder for output stream #%d.%d - maybe incorrect parameters such as bit_rate, rate, width or height", ost->file_index, ost->index); ret = AVERROR(EINVAL); goto dump_format; } assert_codec_experimental(ost->st->codec, 1); assert_avoptions(ost->opts); if (ost->st->codec->bit_rate && ost->st->codec->bit_rate < 1000) av_log(NULL, AV_LOG_WARNING, "The bitrate parameter is set too low." "It takes bits/s as argument, not kbits/s\n"); extra_size += ost->st->codec->extradata_size; } } for (i = 0; i < nb_input_streams; i++) { ist = &input_streams[i]; if (ist->decoding_needed) { AVCodec *codec = ist->dec; if (!codec) codec = avcodec_find_decoder(ist->st->codec->codec_id); if (!codec) { snprintf(error, sizeof(error), "Decoder (codec id %d) not found for input stream #%d.%d", ist->st->codec->codec_id, ist->file_index, ist->st->index); ret = AVERROR(EINVAL); goto dump_format; } if (avcodec_open2(ist->st->codec, codec, &ist->opts) < 0) { snprintf(error, sizeof(error), "Error while opening decoder for input stream #%d.%d", ist->file_index, ist->st->index); ret = AVERROR(EINVAL); goto dump_format; } assert_codec_experimental(ist->st->codec, 0); assert_avoptions(ost->opts); } } for (i = 0; i < nb_input_streams; i++) { AVStream *st; ist = &input_streams[i]; st= ist->st; ist->pts = st->avg_frame_rate.num ? - st->codec->has_b_frames*AV_TIME_BASE / av_q2d(st->avg_frame_rate) : 0; ist->next_pts = AV_NOPTS_VALUE; ist->is_start = 1; } for (i=0;i<nb_meta_data_maps;i++) { AVFormatContext *files[2]; AVDictionary **meta[2]; int j; #define METADATA_CHECK_INDEX(index, nb_elems, desc)\ if ((index) < 0 || (index) >= (nb_elems)) {\ snprintf(error, sizeof(error), "Invalid %s index %d while processing metadata maps\n",\ (desc), (index));\ ret = AVERROR(EINVAL);\ goto dump_format;\ } int out_file_index = meta_data_maps[i][0].file; int in_file_index = meta_data_maps[i][1].file; if (in_file_index < 0 || out_file_index < 0) continue; METADATA_CHECK_INDEX(out_file_index, nb_output_files, "output file") METADATA_CHECK_INDEX(in_file_index, nb_input_files, "input file") files[0] = output_files[out_file_index]; files[1] = input_files[in_file_index].ctx; for (j = 0; j < 2; j++) { MetadataMap *map = &meta_data_maps[i][j]; switch (map->type) { case 'g': meta[j] = &files[j]->metadata; break; case 's': METADATA_CHECK_INDEX(map->index, files[j]->nb_streams, "stream") meta[j] = &files[j]->streams[map->index]->metadata; break; case 'c': METADATA_CHECK_INDEX(map->index, files[j]->nb_chapters, "chapter") meta[j] = &files[j]->chapters[map->index]->metadata; break; case 'p': METADATA_CHECK_INDEX(map->index, files[j]->nb_programs, "program") meta[j] = &files[j]->programs[map->index]->metadata; break; } } av_dict_copy(meta[0], *meta[1], AV_DICT_DONT_OVERWRITE); } if (metadata_global_autocopy) { for (i = 0; i < nb_output_files; i++) av_dict_copy(&output_files[i]->metadata, input_files[0].ctx->metadata, AV_DICT_DONT_OVERWRITE); } for (i = 0; i < nb_chapter_maps; i++) { int infile = chapter_maps[i].in_file; int outfile = chapter_maps[i].out_file; if (infile < 0 || outfile < 0) continue; if (infile >= nb_input_files) { snprintf(error, sizeof(error), "Invalid input file index %d in chapter mapping.\n", infile); ret = AVERROR(EINVAL); goto dump_format; } if (outfile >= nb_output_files) { snprintf(error, sizeof(error), "Invalid output file index %d in chapter mapping.\n",outfile); ret = AVERROR(EINVAL); goto dump_format; } copy_chapters(infile, outfile); } if (!nb_chapter_maps) for (i = 0; i < nb_input_files; i++) { if (!input_files[i].ctx->nb_chapters) continue; for (j = 0; j < nb_output_files; j++) if ((ret = copy_chapters(i, j)) < 0) goto dump_format; break; } for(i=0;i<nb_output_files;i++) { os = output_files[i]; if (avformat_write_header(os, &output_opts[i]) < 0) { snprintf(error, sizeof(error), "Could not write header for output file #%d (incorrect codec parameters ?)", i); ret = AVERROR(EINVAL); goto dump_format; } assert_avoptions(output_opts[i]); if (strcmp(output_files[i]->oformat->name, "rtp")) { want_sdp = 0; } } dump_format: for(i=0;i<nb_output_files;i++) { av_dump_format(output_files[i], i, output_files[i]->filename, 1); } if (verbose >= 0) { fprintf(stderr, "Stream mapping:\n"); for(i=0;i<nb_ostreams;i++) { ost = ost_table[i]; fprintf(stderr, " Stream #%d.%d -> #%d.%d", input_streams[ost->source_index].file_index, input_streams[ost->source_index].st->index, ost->file_index, ost->index); if (ost->sync_ist != &input_streams[ost->source_index]) fprintf(stderr, " [sync #%d.%d]", ost->sync_ist->file_index, ost->sync_ist->st->index); fprintf(stderr, "\n"); } } if (ret) { fprintf(stderr, "%s\n", error); goto fail; } if (want_sdp) { print_sdp(output_files, nb_output_files); } if (!using_stdin) { if(verbose >= 0) fprintf(stderr, "Press [q] to stop, [?] for help\n"); avio_set_interrupt_cb(decode_interrupt_cb); } term_init(); timer_start = av_gettime(); for(; received_sigterm == 0;) { int file_index, ist_index; AVPacket pkt; double ipts_min; double opts_min; redo: ipts_min= 1e100; opts_min= 1e100; if (!using_stdin) { if (q_pressed) break; key = read_key(); if (key == 'q') break; if (key == '+') verbose++; if (key == '-') verbose--; if (key == 's') qp_hist ^= 1; if (key == 'h'){ if (do_hex_dump){ do_hex_dump = do_pkt_dump = 0; } else if(do_pkt_dump){ do_hex_dump = 1; } else do_pkt_dump = 1; av_log_set_level(AV_LOG_DEBUG); } if (key == 'd' || key == 'D'){ int debug=0; if(key == 'D') { debug = input_streams[0].st->codec->debug<<1; if(!debug) debug = 1; while(debug & (FF_DEBUG_DCT_COEFF|FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) debug += debug; }else scanf("%d", &debug); for(i=0;i<nb_input_streams;i++) { input_streams[i].st->codec->debug = debug; } for(i=0;i<nb_ostreams;i++) { ost = ost_table[i]; ost->st->codec->debug = debug; } if(debug) av_log_set_level(AV_LOG_DEBUG); fprintf(stderr,"debug=%d\n", debug); } if (key == '?'){ fprintf(stderr, "key function\n" "? show this help\n" "+ increase verbosity\n" "- decrease verbosity\n" "D cycle through available debug modes\n" "h dump packets/hex press to cycle through the 3 states\n" "q quit\n" "s Show QP histogram\n" ); } } file_index = -1; for(i=0;i<nb_ostreams;i++) { double ipts, opts; ost = ost_table[i]; os = output_files[ost->file_index]; ist = &input_streams[ost->source_index]; if(ist->is_past_recording_time || no_packet[ist->file_index]) continue; opts = ost->st->pts.val * av_q2d(ost->st->time_base); ipts = (double)ist->pts; if (!input_files[ist->file_index].eof_reached){ if(ipts < ipts_min) { ipts_min = ipts; if(input_sync ) file_index = ist->file_index; } if(opts < opts_min) { opts_min = opts; if(!input_sync) file_index = ist->file_index; } } if(ost->frame_number >= max_frames[ost->st->codec->codec_type]){ file_index= -1; break; } } if (file_index < 0) { if(no_packet_count){ no_packet_count=0; memset(no_packet, 0, sizeof(no_packet)); usleep(10000); continue; } break; } if (limit_filesize != 0 && limit_filesize <= avio_tell(output_files[0]->pb)) break; is = input_files[file_index].ctx; ret= av_read_frame(is, &pkt); if(ret == AVERROR(EAGAIN)){ no_packet[file_index]=1; no_packet_count++; continue; } if (ret < 0) { input_files[file_index].eof_reached = 1; if (opt_shortest) break; else continue; } no_packet_count=0; memset(no_packet, 0, sizeof(no_packet)); if (do_pkt_dump) { av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump, is->streams[pkt.stream_index]); } if (pkt.stream_index >= input_files[file_index].ctx->nb_streams) goto discard_packet; ist_index = input_files[file_index].ist_index + pkt.stream_index; ist = &input_streams[ist_index]; if (ist->discard) goto discard_packet; if (pkt.dts != AV_NOPTS_VALUE) pkt.dts += av_rescale_q(input_files[ist->file_index].ts_offset, AV_TIME_BASE_Q, ist->st->time_base); if (pkt.pts != AV_NOPTS_VALUE) pkt.pts += av_rescale_q(input_files[ist->file_index].ts_offset, AV_TIME_BASE_Q, ist->st->time_base); if (ist->ts_scale) { if(pkt.pts != AV_NOPTS_VALUE) pkt.pts *= ist->ts_scale; if(pkt.dts != AV_NOPTS_VALUE) pkt.dts *= ist->ts_scale; } if (pkt.dts != AV_NOPTS_VALUE && ist->next_pts != AV_NOPTS_VALUE && (is->iformat->flags & AVFMT_TS_DISCONT)) { int64_t pkt_dts= av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q); int64_t delta= pkt_dts - ist->next_pts; if((FFABS(delta) > 1LL*dts_delta_threshold*AV_TIME_BASE || pkt_dts+1<ist->pts)&& !copy_ts){ input_files[ist->file_index].ts_offset -= delta; if (verbose > 2) fprintf(stderr, "timestamp discontinuity %"PRId64", new offset= %"PRId64"\n", delta, input_files[ist->file_index].ts_offset); pkt.dts-= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base); if(pkt.pts != AV_NOPTS_VALUE) pkt.pts-= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base); } } if (recording_time != INT64_MAX && (pkt.pts != AV_NOPTS_VALUE ? av_compare_ts(pkt.pts, ist->st->time_base, recording_time + start_time, (AVRational){1, 1000000}) : av_compare_ts(ist->pts, AV_TIME_BASE_Q, recording_time + start_time, (AVRational){1, 1000000}) )>= 0) { ist->is_past_recording_time = 1; goto discard_packet; } if (output_packet(ist, ist_index, ost_table, nb_ostreams, &pkt) < 0) { if (verbose >= 0) fprintf(stderr, "Error while decoding stream #%d.%d\n", ist->file_index, ist->st->index); if (exit_on_error) ffmpeg_exit(1); av_free_packet(&pkt); goto redo; } discard_packet: av_free_packet(&pkt); print_report(output_files, ost_table, nb_ostreams, 0); } for (i = 0; i < nb_input_streams; i++) { ist = &input_streams[i]; if (ist->decoding_needed) { output_packet(ist, i, ost_table, nb_ostreams, NULL); } } term_exit(); for(i=0;i<nb_output_files;i++) { os = output_files[i]; av_write_trailer(os); } print_report(output_files, ost_table, nb_ostreams, 1); for(i=0;i<nb_ostreams;i++) { ost = ost_table[i]; if (ost->encoding_needed) { av_freep(&ost->st->codec->stats_in); avcodec_close(ost->st->codec); } #if CONFIG_AVFILTER avfilter_graph_free(&ost->graph); #endif } for (i = 0; i < nb_input_streams; i++) { ist = &input_streams[i]; if (ist->decoding_needed) { avcodec_close(ist->st->codec); } } ret = 0; fail: av_freep(&bit_buffer); if (ost_table) { for(i=0;i<nb_ostreams;i++) { ost = ost_table[i]; if (ost) { if (ost->st->stream_copy) av_freep(&ost->st->codec->extradata); if (ost->logfile) { fclose(ost->logfile); ost->logfile = NULL; } av_fifo_free(ost->fifo); av_freep(&ost->st->codec->subtitle_header); av_free(ost->resample_frame.data[0]); av_free(ost->forced_kf_pts); if (ost->video_resample) sws_freeContext(ost->img_resample_ctx); if (ost->resample) audio_resample_close(ost->resample); if (ost->reformat_ctx) av_audio_convert_free(ost->reformat_ctx); av_dict_free(&ost->opts); av_free(ost); } } av_free(ost_table); } return ret; }
1threat
Need explanation on output of this C program : <pre><code>#include &lt;stdio.h&gt; #define F1(X) ((X &gt; 0) ? X : -(X)) #define F2(X) (X &gt; 0) ? X : -X int main(){ int a=5, b=10; printf("F1=%d, F2=%d\n", F1(a-b), F2(a-b)); return 0; } </code></pre> <p>The output is: <code>F1=5, F2=-15</code></p> <p>Of course, I'd think that the output of F1 and F2 should be the same. What do the parentheses have anything to do with the output?</p>
0debug
Get Date As String and Remove Time in Javascript : <p>I have a simple problem. i need to get only the date as string and remove its time. How can i do this? I tried new Date() but its not working.</p> <pre><code>const value = '2018-04-09 00:00:00' </code></pre>
0debug
Even number count from an integer : How to get the even number count from an integer input. > var intInput = 10; Now i want the even count. In this case = 2+4+6+8+10 = 30 > var evenCount = 0; if (i % 2==0) { evenCount = evenCount + i; } How to achieve this?
0debug
To print the lines within some patterns when a searching pattern found in a file : I want to print the lines within **{** and **}** with **assign where "mango" in Hostgroups** object Host "os.google.com" { import "windows" address = "linux.google.com" groups = ["linux"] } object Host "mango.google.com" { import "windows" address = "mango.google.com" groups = ["linux"] assign where "mango" in Hostgroups } Desired output: object Host "mango.google.com" { import "windows" address = "mango.google.com" groups = ["linux"] assign where "mango" in Hostgroups }
0debug
int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transform, int ilv) { int i, t = 0; uint8_t *zero, *last, *cur; JLSState *state; int off = 0, stride = 1, width, shift, ret = 0; zero = av_mallocz(s->picture_ptr->linesize[0]); if (!zero) return AVERROR(ENOMEM); last = zero; cur = s->picture_ptr->data[0]; state = av_mallocz(sizeof(JLSState)); if (!state) { av_free(zero); return AVERROR(ENOMEM); } state->near = near; state->bpp = (s->bits < 2) ? 2 : s->bits; state->maxval = s->maxval; state->T1 = s->t1; state->T2 = s->t2; state->T3 = s->t3; state->reset = s->reset; ff_jpegls_reset_coding_parameters(state, 0); ff_jpegls_init_state(state); if (s->bits <= 8) shift = point_transform + (8 - s->bits); else shift = point_transform + (16 - s->bits); if (shift >= 16) { ret = AVERROR_INVALIDDATA; } if (s->avctx->debug & FF_DEBUG_PICT_INFO) { av_log(s->avctx, AV_LOG_DEBUG, "JPEG-LS params: %ix%i NEAR=%i MV=%i T(%i,%i,%i) " "RESET=%i, LIMIT=%i, qbpp=%i, RANGE=%i\n", s->width, s->height, state->near, state->maxval, state->T1, state->T2, state->T3, state->reset, state->limit, state->qbpp, state->range); av_log(s->avctx, AV_LOG_DEBUG, "JPEG params: ILV=%i Pt=%i BPP=%i, scan = %i\n", ilv, point_transform, s->bits, s->cur_scan); } if (get_bits_left(&s->gb) < s->height) { ret = AVERROR_INVALIDDATA; } if (ilv == 0) { if (s->cur_scan > s->nb_components) { ret = AVERROR_INVALIDDATA; } stride = (s->nb_components > 1) ? 3 : 1; off = av_clip(s->cur_scan - 1, 0, stride - 1); width = s->width * stride; cur += off; for (i = 0; i < s->height; i++) { if (s->bits <= 8) { ls_decode_line(state, s, last, cur, t, width, stride, off, 8); t = last[0]; } else { ls_decode_line(state, s, last, cur, t, width, stride, off, 16); t = *((uint16_t *)last); } last = cur; cur += s->picture_ptr->linesize[0]; if (s->restart_interval && !--s->restart_count) { align_get_bits(&s->gb); skip_bits(&s->gb, 16); } } } else if (ilv == 1) { int j; int Rc[3] = { 0, 0, 0 }; stride = (s->nb_components > 1) ? 3 : 1; memset(cur, 0, s->picture_ptr->linesize[0]); width = s->width * stride; for (i = 0; i < s->height; i++) { for (j = 0; j < stride; j++) { ls_decode_line(state, s, last + j, cur + j, Rc[j], width, stride, j, 8); Rc[j] = last[j]; if (s->restart_interval && !--s->restart_count) { align_get_bits(&s->gb); skip_bits(&s->gb, 16); } } last = cur; cur += s->picture_ptr->linesize[0]; } } else if (ilv == 2) { avpriv_report_missing_feature(s->avctx, "Sample interleaved images"); } if (s->xfrm && s->nb_components == 3) { int x, w; w = s->width * s->nb_components; if (s->bits <= 8) { uint8_t *src = s->picture_ptr->data[0]; for (i = 0; i < s->height; i++) { switch(s->xfrm) { case 1: for (x = off; x < w; x += 3) { src[x ] += src[x+1] + 128; src[x+2] += src[x+1] + 128; } break; case 2: for (x = off; x < w; x += 3) { src[x ] += src[x+1] + 128; src[x+2] += ((src[x ] + src[x+1])>>1) + 128; } break; case 3: for (x = off; x < w; x += 3) { int g = src[x+0] - ((src[x+2]+src[x+1])>>2) + 64; src[x+0] = src[x+2] + g + 128; src[x+2] = src[x+1] + g + 128; src[x+1] = g; } break; case 4: for (x = off; x < w; x += 3) { int r = src[x+0] - (( 359 * (src[x+2]-128) + 490) >> 8); int g = src[x+0] - (( 88 * (src[x+1]-128) - 183 * (src[x+2]-128) + 30) >> 8); int b = src[x+0] + ((454 * (src[x+1]-128) + 574) >> 8); src[x+0] = av_clip_uint8(r); src[x+1] = av_clip_uint8(g); src[x+2] = av_clip_uint8(b); } break; } src += s->picture_ptr->linesize[0]; } }else avpriv_report_missing_feature(s->avctx, "16bit xfrm"); } if (shift) { int x, w; w = s->width * s->nb_components; if (s->bits <= 8) { uint8_t *src = s->picture_ptr->data[0]; for (i = 0; i < s->height; i++) { for (x = off; x < w; x += stride) src[x] <<= shift; src += s->picture_ptr->linesize[0]; } } else { uint16_t *src = (uint16_t *)s->picture_ptr->data[0]; for (i = 0; i < s->height; i++) { for (x = 0; x < w; x++) src[x] <<= shift; src += s->picture_ptr->linesize[0] / 2; } } } end: av_free(state); av_free(zero); return ret; }
1threat
static int cmd_valid_while_locked(SDState *sd, SDRequest *req) { if (sd->expecting_acmd) { return req->cmd == 41 || req->cmd == 42; } if (req->cmd == 16 || req->cmd == 55) { return 1; } return sd_cmd_class[req->cmd] == 0 || sd_cmd_class[req->cmd] == 7; }
1threat
Pandoc convert docx to markdown with embedded images : <p>When converting .docx file to markdown, the embedded image is not extracted from the docx archive, yet the output contains <code>![](media/image1.png){width="6.291666666666667in" height="3.1083333333333334in"}</code> </p> <p>Is there a parameter that needs to be set in order to get the embedded pictures extracted?</p>
0debug
matching regex in awk/gawk : <p>Can someone make the <code>awk</code> line below work in awk please. The syntax uses the standard PCRE regex standard (and i need to expect that some non-numeric characters are preceded to the first number, that is the string can look like <code>"++3.59 ± 0.04* "</code>). (note that I tried <code>[0-9]</code> and <code>[:digit:]</code> instead of <code>\d</code>) also note that I did read <a href="https://www.gnu.org/software/gawk/manual/gawk.html#Regexp" rel="nofollow noreferrer">https://www.gnu.org/software/gawk/manual/gawk.html#Regexp</a></p> <pre><code>gawk 'BEGIN{test="3.59 ± 0.04";match(test, /^.*?(\d+?\.\d+?)\s*?±\s*?(\d+?\.\d+?)$/, arr);print arr[1];}' </code></pre>
0debug
static void mux_chr_read(void *opaque, const uint8_t *buf, int size) { CharDriverState *chr = opaque; MuxDriver *d = chr->opaque; int m = chr->focus; int i; mux_chr_accept_input (opaque); for(i = 0; i < size; i++) if (mux_proc_byte(chr, d, buf[i])) { if (d->prod == d->cons && d->chr_can_read[m] && d->chr_can_read[m](d->ext_opaque[m])) d->chr_read[m](d->ext_opaque[m], &buf[i], 1); else d->buffer[d->prod++ & MUX_BUFFER_MASK] = buf[i]; } }
1threat
Change fill color in boxplot of stat_summary : I want to change the fill color in boxplot with the follwing code, but the code color only change the color of the border. p=ggplot(data=concentration,aes(factor(status), con),ylim=c(0,0.15),cex.axis=1.5,cex.lab=15 ) + stat_summary(fun.data=f, geom="boxplot", position="dodge",color='blue')+ ylab(expression(paste("Formaldehyde concentration"," (",mu,"g/",m^3,")")))+ xlab("") +ylim(0,200)#+ geom_boxplot(aes(fill = Condition)) How can I change the fill color? thank you very much
0debug
How to edit a text file in my terminal : <p>I'm using Linux mint and using the vi command to create text files, now that I created a text file and saved it. How do I get back into to edit the text file again? </p> <pre><code>vi helloWorld.txt </code></pre>
0debug
static void kvm_client_set_memory(struct CPUPhysMemoryClient *client, target_phys_addr_t start_addr, ram_addr_t size, ram_addr_t phys_offset, bool log_dirty) { kvm_set_phys_mem(start_addr, size, phys_offset, log_dirty); }
1threat
Why do external functions get executed immediately? : <p>I have a declared function in my code. I want to call this function whenever I click on an item. When I bind it to this item, it gets executed immediately, and the on click event does not trigger.</p> <p>However, when I declare the function in the on click binding, it works fine.</p> <p>I want to declare the function somewhere else first, and then call it when the click event happens</p> <pre><code>function test2() { alert('test2'); } $('body').on('click', '#test1', function() { alert('test1'); }); $('body').on('click', '#test2', test2()); </code></pre> <p><a href="https://jsfiddle.net/ag66r950/" rel="nofollow">https://jsfiddle.net/ag66r950/</a></p>
0debug
Keras Conv2D: filters vs kernel_size : <p>What's the difference between those two? It would also help to explain in the more general context of convolutional networks.</p> <p>Also, as a side note, what is channels? In other words, please break down the 3 terms for me: channels vs filters vs kernel.</p>
0debug
how to disable google analytics on localhost : <p>I use this for google analytics, </p> <pre><code>&lt;noscript&gt; &lt;iframe src="//www.googletagmanager.com/ns.html?id=GTM-KCQGLT" height="0" width="0" style="display:none;visibility:hidden"&gt;&lt;/iframe&gt;&lt;/noscript&gt; </code></pre> <p>and this</p> <pre><code>&lt;script&gt;(function(w, d, s, l, i) { w[l] = w[l] || []; w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' }); var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' ? '&amp;l=' + l : ''; j.async = true; j.src = '//www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f);})(window, document, 'script', 'dataLayer', 'GTM-KCQGLT');&lt;/script&gt; </code></pre> <p>Can I disable this script when I run this code in localhost?</p>
0debug
static CharDriverState *qemu_chr_open_socket(QemuOpts *opts) { CharDriverState *chr = NULL; TCPCharDriver *s = NULL; int fd = -1; int is_listen; int is_waitconnect; int do_nodelay; int is_unix; int is_telnet; is_listen = qemu_opt_get_bool(opts, "server", 0); is_waitconnect = qemu_opt_get_bool(opts, "wait", 1); is_telnet = qemu_opt_get_bool(opts, "telnet", 0); do_nodelay = !qemu_opt_get_bool(opts, "delay", 1); is_unix = qemu_opt_get(opts, "path") != NULL; if (!is_listen) is_waitconnect = 0; chr = g_malloc0(sizeof(CharDriverState)); s = g_malloc0(sizeof(TCPCharDriver)); if (is_unix) { if (is_listen) { fd = unix_listen_opts(opts); } else { fd = unix_connect_opts(opts); } } else { if (is_listen) { fd = inet_listen_opts(opts, 0, NULL); } else { fd = inet_connect_opts(opts, NULL); } } if (fd < 0) { goto fail; } if (!is_waitconnect) socket_set_nonblock(fd); s->connected = 0; s->fd = -1; s->listen_fd = -1; s->msgfd = -1; s->is_unix = is_unix; s->do_nodelay = do_nodelay && !is_unix; chr->opaque = s; chr->chr_write = tcp_chr_write; chr->chr_close = tcp_chr_close; chr->get_msgfd = tcp_get_msgfd; chr->chr_add_client = tcp_chr_add_client; if (is_listen) { s->listen_fd = fd; qemu_set_fd_handler2(s->listen_fd, NULL, tcp_chr_accept, NULL, chr); if (is_telnet) s->do_telnetopt = 1; } else { s->connected = 1; s->fd = fd; socket_set_nodelay(fd); tcp_chr_connect(chr); } chr->filename = g_malloc(256); if (is_unix) { snprintf(chr->filename, 256, "unix:%s%s", qemu_opt_get(opts, "path"), qemu_opt_get_bool(opts, "server", 0) ? ",server" : ""); } else if (is_telnet) { snprintf(chr->filename, 256, "telnet:%s:%s%s", qemu_opt_get(opts, "host"), qemu_opt_get(opts, "port"), qemu_opt_get_bool(opts, "server", 0) ? ",server" : ""); } else { snprintf(chr->filename, 256, "tcp:%s:%s%s", qemu_opt_get(opts, "host"), qemu_opt_get(opts, "port"), qemu_opt_get_bool(opts, "server", 0) ? ",server" : ""); } if (is_listen && is_waitconnect) { printf("QEMU waiting for connection on: %s\n", chr->filename); tcp_chr_accept(chr); socket_set_nonblock(s->listen_fd); } return chr; fail: if (fd >= 0) closesocket(fd); g_free(s); g_free(chr); return NULL; }
1threat
void fifo_realloc(FifoBuffer *f, int new_size){ int old_size= f->end - f->buffer; if(old_size < new_size){ uint8_t *old= f->buffer; f->buffer= av_realloc(f->buffer, new_size); f->rptr += f->buffer - old; f->wptr += f->buffer - old; if(f->wptr < f->rptr){ memmove(f->rptr + new_size - old_size, f->rptr, f->buffer + old_size - f->rptr); f->rptr += new_size - old_size; } f->end= f->buffer + new_size; } }
1threat
In Python 3.0, how do I multiply one list by another in every possible combination? : For example: list1 = [1, 2, 3] list2 = [4, 5, 6] Wanted result: NewList = [4, 5, 6, 8, 10, 12, 12, 15, 18]
0debug
What does this mean? Why is it required? cur_row, cur_col = cur_path[-1] : <p>Im looking at some code for BFS traversal of maze in python. First time writing with python, I want to understand what the reason for cur_row, cur_col = cur_path[-1] is, specifically why [-1] is needed</p> <pre><code>def bfs(maze): queue = [] visited = set() queue.append([maze.getStart()]) while queue: cur_path = queue.pop(0) cur_row, cur_col = cur_path[-1] if (cur_row, cur_col) in visited: continue visited.add((cur_row, cur_col)) if maze.isObjective(cur_row, cur_col): return cur_path, len(visited) for item in maze.getNeighbors(cur_row, cur_col): if item not in visited: queue.append(cur_path + [item]) return [], 0 </code></pre>
0debug
static int gif_read_image(GifState *s, AVFrame *frame) { int left, top, width, height, bits_per_pixel, code_size, flags; int is_interleaved, has_local_palette, y, pass, y1, linesize, pal_size; uint32_t *ptr, *pal, *px, *pr, *ptr1; int ret; uint8_t *idx; if (bytestream2_get_bytes_left(&s->gb) < 9) return AVERROR_INVALIDDATA; left = bytestream2_get_le16u(&s->gb); top = bytestream2_get_le16u(&s->gb); width = bytestream2_get_le16u(&s->gb); height = bytestream2_get_le16u(&s->gb); flags = bytestream2_get_byteu(&s->gb); is_interleaved = flags & 0x40; has_local_palette = flags & 0x80; bits_per_pixel = (flags & 0x07) + 1; av_dlog(s->avctx, "image x=%d y=%d w=%d h=%d\n", left, top, width, height); if (has_local_palette) { pal_size = 1 << bits_per_pixel; if (bytestream2_get_bytes_left(&s->gb) < pal_size * 3) return AVERROR_INVALIDDATA; gif_read_palette(s, s->local_palette, pal_size); pal = s->local_palette; } else { if (!s->has_global_palette) { av_log(s->avctx, AV_LOG_ERROR, "picture doesn't have either global or local palette.\n"); return AVERROR_INVALIDDATA; } pal = s->global_palette; } if (s->keyframe) { if (s->transparent_color_index == -1 && s->has_global_palette) { gif_fill(frame, s->bg_color); } else { gif_fill(frame, s->trans_color); } } if (left + width > s->screen_width || top + height > s->screen_height) { av_log(s->avctx, AV_LOG_ERROR, "image is outside the screen dimensions.\n"); return AVERROR_INVALIDDATA; } if (width <= 0 || height <= 0) { av_log(s->avctx, AV_LOG_ERROR, "Invalid image dimensions.\n"); return AVERROR_INVALIDDATA; } if (s->gce_prev_disposal == GCE_DISPOSAL_BACKGROUND) { gif_fill_rect(frame, s->stored_bg_color, s->gce_l, s->gce_t, s->gce_w, s->gce_h); } else if (s->gce_prev_disposal == GCE_DISPOSAL_RESTORE) { gif_copy_img_rect(s->stored_img, (uint32_t *)frame->data[0], frame->linesize[0] / sizeof(uint32_t), s->gce_l, s->gce_t, s->gce_w, s->gce_h); } s->gce_prev_disposal = s->gce_disposal; if (s->gce_disposal != GCE_DISPOSAL_NONE) { s->gce_l = left; s->gce_t = top; s->gce_w = width; s->gce_h = height; if (s->gce_disposal == GCE_DISPOSAL_BACKGROUND) { if (s->transparent_color_index >= 0) s->stored_bg_color = s->trans_color; else s->stored_bg_color = s->bg_color; } else if (s->gce_disposal == GCE_DISPOSAL_RESTORE) { av_fast_malloc(&s->stored_img, &s->stored_img_size, frame->linesize[0] * frame->height); if (!s->stored_img) return AVERROR(ENOMEM); gif_copy_img_rect((uint32_t *)frame->data[0], s->stored_img, frame->linesize[0] / sizeof(uint32_t), left, top, width, height); } } if (bytestream2_get_bytes_left(&s->gb) < 2) return AVERROR_INVALIDDATA; code_size = bytestream2_get_byteu(&s->gb); if ((ret = ff_lzw_decode_init(s->lzw, code_size, s->gb.buffer, bytestream2_get_bytes_left(&s->gb), FF_LZW_GIF)) < 0) { av_log(s->avctx, AV_LOG_ERROR, "LZW init failed\n"); return ret; } linesize = frame->linesize[0] / sizeof(uint32_t); ptr1 = (uint32_t *)frame->data[0] + top * linesize + left; ptr = ptr1; pass = 0; y1 = 0; for (y = 0; y < height; y++) { int count = ff_lzw_decode(s->lzw, s->idx_line, width); if (count != width) { if (count) av_log(s->avctx, AV_LOG_ERROR, "LZW decode failed\n"); goto decode_tail; } pr = ptr + width; for (px = ptr, idx = s->idx_line; px < pr; px++, idx++) { if (*idx != s->transparent_color_index) *px = pal[*idx]; } if (is_interleaved) { switch(pass) { default: case 0: case 1: y1 += 8; ptr += linesize * 8; if (y1 >= height) { y1 = pass ? 2 : 4; ptr = ptr1 + linesize * y1; pass++; } break; case 2: y1 += 4; ptr += linesize * 4; if (y1 >= height) { y1 = 1; ptr = ptr1 + linesize; pass++; } break; case 3: y1 += 2; ptr += linesize * 2; break; } } else { ptr += linesize; } } decode_tail: ff_lzw_decode_tail(s->lzw); s->transparent_color_index = -1; s->gce_disposal = GCE_DISPOSAL_NONE; return 0; }
1threat
dyld: Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib : <p>Using electron-builder to build Windows app, When signing up, I got this error :</p> <pre><code>dyld: Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib Referenced from: /Users/puss/Library/Caches/electron-builder/winCodeSign/winCodeSign-1.7.0/darwin/osslsigncode Reason: image not found </code></pre>
0debug
components communication through <router-outlet> : <p>I have a root component that has a changing boolean and I want to subscribe to that changing boolean, with a component within my <code>&lt;router-outlet&gt;</code>. I understand I need to use a shared bidirectional service of some sort. However, the docs for shared services just arent making a whole lot of sense to me. (I guess I cant wrap my head around the astronaut example) <a href="https://angular.io/docs/ts/latest/cookbook/component-communication.html#!#bidirectional-service" rel="noreferrer">here</a>, any help would be greatly appreciated, here is a little bit of code to show what I am trying to do.</p> <p><strong>root component</strong></p> <pre><code>@Component({ selector: 'my-app', template: `&lt;nav [state]="boolshow" (show)="changeValue($event)" &gt;&lt;/nav&gt; &lt;article&gt;&lt;router-outlet&gt;&lt;/router-outlet&gt;&lt;/article&gt; &lt;-----component in router here &lt;footer&gt;&lt;/footer&gt; &lt;h3&gt;toggle state: {{boolshow}}&lt;/h3&gt;`, styleUrls: ['./Css/app.css'], }) export class AppComponent { boolshow: boolean; &lt;-----boolean that needs to be read } </code></pre>
0debug
casting void* to struct * in c : I have the following code. #include <iostream> using namespace std; typedef unsigned char byte; typedef struct { unsigned int a; unsigned int b; } Struct_A; void* malloc_(size_t s, byte* heap, int *next) { int old = *next; *next = *next + s; return heap + old; } void f(Struct_A *sa, byte* heap, int *next) { sa = (Struct_A*) malloc_(8, heap, next); sa->a = 10; sa->b = 20; } int main() { byte *heap = new byte[1000]; int next; next = 0; Struct_A *sa; sa = (Struct_A*) malloc_(8, heap, &next); sa->a = 100; sa->b = 200; cout << sa->a << endl; Struct_A *sb; f(sb, heap, &next); cout<< sb->a <<endl; return 0; } the code works well for sa but not for sb!!! function f() does exactly the same thing the three code lines after "Struct_A *sa;" does. Any idea what is wrong with function f()?
0debug
How can I add a String to a 2-dimensional array? : <p>I have a project I am working in in my comp sci class and I completely forgot how to add a String to a 2-dimensional array. Any help would be appreciated. </p>
0debug
int av_buffersrc_buffer(AVFilterContext *ctx, AVFilterBufferRef *buf) { BufferSourceContext *s = ctx->priv; AVFrame *frame = NULL; AVBufferRef *dummy_buf = NULL; int ret = 0, planes, i; if (!buf) { s->eof = 1; return 0; } else if (s->eof) return AVERROR(EINVAL); frame = av_frame_alloc(); if (!frame) return AVERROR(ENOMEM); dummy_buf = av_buffer_create(NULL, 0, compat_free_buffer, buf, 0); if (!dummy_buf) { ret = AVERROR(ENOMEM); goto fail; } if ((ret = avfilter_copy_buf_props(frame, buf)) < 0) goto fail; #define WRAP_PLANE(ref_out, data, data_size) \ do { \ AVBufferRef *dummy_ref = av_buffer_ref(dummy_buf); \ if (!dummy_ref) { \ ret = AVERROR(ENOMEM); \ goto fail; \ } \ ref_out = av_buffer_create(data, data_size, compat_unref_buffer, \ dummy_ref, 0); \ if (!ref_out) { \ av_frame_unref(frame); \ ret = AVERROR(ENOMEM); \ goto fail; \ } \ } while (0) if (ctx->outputs[0]->type == AVMEDIA_TYPE_VIDEO) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); planes = av_pix_fmt_count_planes(frame->format); if (!desc || planes <= 0) { ret = AVERROR(EINVAL); goto fail; } for (i = 0; i < planes; i++) { int v_shift = (i == 1 || i == 2) ? desc->log2_chroma_h : 0; int plane_size = (frame->height >> v_shift) * frame->linesize[i]; WRAP_PLANE(frame->buf[i], frame->data[i], plane_size); } } else { int planar = av_sample_fmt_is_planar(frame->format); int channels = av_get_channel_layout_nb_channels(frame->channel_layout); planes = planar ? channels : 1; if (planes > FF_ARRAY_ELEMS(frame->buf)) { frame->nb_extended_buf = planes - FF_ARRAY_ELEMS(frame->buf); frame->extended_buf = av_mallocz(sizeof(*frame->extended_buf) * frame->nb_extended_buf); if (!frame->extended_buf) { ret = AVERROR(ENOMEM); goto fail; } } for (i = 0; i < FFMIN(planes, FF_ARRAY_ELEMS(frame->buf)); i++) WRAP_PLANE(frame->buf[i], frame->extended_data[i], frame->linesize[0]); for (i = 0; i < planes - FF_ARRAY_ELEMS(frame->buf); i++) WRAP_PLANE(frame->extended_buf[i], frame->extended_data[i + FF_ARRAY_ELEMS(frame->buf)], frame->linesize[0]); } ret = av_buffersrc_add_frame(ctx, frame); fail: av_buffer_unref(&dummy_buf); av_frame_free(&frame); return ret; }
1threat
VncInfo2List *qmp_query_vnc_servers(Error **errp) { VncInfo2List *item, *prev = NULL; VncInfo2 *info; VncDisplay *vd; DeviceState *dev; QTAILQ_FOREACH(vd, &vnc_displays, next) { info = g_new0(VncInfo2, 1); info->id = g_strdup(vd->id); info->clients = qmp_query_client_list(vd); qmp_query_auth(vd, info); if (vd->dcl.con) { dev = DEVICE(object_property_get_link(OBJECT(vd->dcl.con), "device", NULL)); info->has_display = true; info->display = g_strdup(dev->id); } if (vd->lsock != NULL) { info->server = qmp_query_server_entry( vd->lsock, false, info->server); } if (vd->lwebsock != NULL) { info->server = qmp_query_server_entry( vd->lwebsock, true, info->server); } item = g_new0(VncInfo2List, 1); item->value = info; item->next = prev; prev = item; } return prev; }
1threat
Is it safe to store secret files in public AWS S3 bucket with random key? : Even if S3 bucket is public, it cannot be accessed without not knowing the key. This is what I know. So I have stored images that contain personal information of users with random keys like `/secret/F0EBAA71F7131E.jpg` in public S3 bucket. Is there a possibility of data leakage if stored in this way? How can it be leaked, if possible?
0debug
Could not get GOOGLE_APP_ID in Google Services file from build environment : <p>For setting up firebase i am using two config 1.GoogleService-Info-test.plist, 2.GoogleService-Info-prdn.plist for UAT and Production. For installing crashlytics using firebase i have followed firebase documentation <a href="https://firebase.google.com/docs/crashlytics/get-started?authuser=1#ios" rel="noreferrer">https://firebase.google.com/docs/crashlytics/get-started?authuser=1#ios</a>. But when i try to run, it throws error in build phase while running script.</p> <p>I tried without changing config file name and it worked.</p> <p>Error msg at build phase while running fabric run script "Could not get GOOGLE_APP_ID in Google Services file from build environment".</p> <p>Can anyone suggest better solution to achieve my requirement.</p>
0debug
The counter in the while loop is standing. It does not pass the other words : I try make a word counter. I fragmented using the split method for string but I can not count the words. The loop is stopping. Can you help me for word counter? Desired: To find out how many times a word in a article repeats. public static void main(String[] args) { int count = 0, i=0; int max,a; ArrayList<Integer> lastCount = new ArrayList<Integer>(); String yazi ="How ı can do that? I don't know. Can you help me? I need help for counter. Thanks in advance for all."; String yazi1 = yazi.replace(",",""); yazi1 = yazi1.replace(".", ""); yazi1 = yazi1.replace("?", ""); yazi1 = yazi1.replace("!", ""); yazi1 = yazi1.toLowerCase(); yazi1 = yazi1.replace("ı", "i"); String[] words = yazi1.split(" "); for(a=0; a<words.length;a++){ while(i<words.length){ if(words[a].equals(words[i])){ max = 0; lastCount.add(a,max+1); i++; } else i++; } System.out.println(a+1 +". Word: " + words[a] + " || Counter: "+lastCount.get(a)); } }
0debug
static int ass_decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr, AVPacket *avpkt) { const char *ptr = avpkt->data; int len, size = avpkt->size; ff_ass_init(data); while (size > 0) { len = ff_ass_add_rect(data, ptr, 0, 0, 1); if (len < 0) return len; ptr += len; size -= len; } *got_sub_ptr = avpkt->size > 0; return avpkt->size; }
1threat
Crashlytics issue when updated from com.crashlytics.sdk.android:crashlytics:2.9.8 to 2.9.9 : <p>During update of my android app, i updated all dependencies. When i tested the release build, i receive the following error:</p> <p>E/CrashlyticsCore: <b>The Crashlytics build ID is missing. This occurs when Crashlytics tooling is absent from your app's build configuration. Please review Crashlytics onboarding instructions and ensure you have a valid Crashlytics account.</b></p> <p>Crashlytics is working fine for my previous release that is currently available on the play store.</p> <p>Any help will be appreciated.</p>
0debug
Postman scripts : "pm is not defined" : <p>I try to write a Pre-request script in Postman. I want to to make a request so I try to use <a href="https://www.getpostman.com/docs/postman/scripts/postman_sandbox_api_reference#pmsendrequest" rel="noreferrer"><code>pm.sendRequest</code></a>. For example :</p> <pre><code>pm.sendRequest('http://example.com', function (err, res) { //... }); </code></pre> <p>But I get this error :</p> <p><code>There was an error in evaluating the Pre-request Script: pm is not defined</code></p> <p>I'm on Windows 10. I just updated the extension.</p> <p>How do I access <code>pm</code>?</p>
0debug
Secure active storage with devise : <p>Using devise gem to authenticate all users of an application. I'm trying to implement Active Storage. </p> <p>Let's say that all users must be authenticated as soon as they reach the app: </p> <pre><code>class ApplicationController &lt; ActionController::Base before_action :authenticate_user! ... end </code></pre> <p>How to secure the Active Storage generated routes? </p> <p>URL of an uploaded file can be accessed without having to authenticate first. The unauthenticated user can get the file url generated by Active Storage.</p>
0debug
how do i pause my code from inside a switch (java) : <p>I'm trying to make a small game inside a javafx application but the player(image) moves insanely fast so I tried using a Thread.sleep and TimeUnit.SECONDS.sleep but neither worked.</p> <p>is it bacause I'm missing an import or the fact that I'm doing this inside a switch statement please help me.</p> <pre><code> case W: imgView.setRotate(270); if (imgView.getY() &gt;= 50) { imgView.setY(imgView.getY() - 50); TimeUnit.SECONDS.sleep(1); } break; </code></pre>
0debug
How to find all the matching substrings in a particular line using Python? : I have several lines of text listing several instructions of a processor. I need to look for all the patterns of the form <x; y, z>. There could be two or more such patterns in each line. I want all the patterns in each set (the three digits within <> ) to be copied into a single list for further analysis. I have tried using entries = re.findall("<[0-9]; [0-9],[0-9]>", line) ? I want the output like this for each line: Output x, y, z, a, b, c (where all the entries are integer values) However, this is not sufficient, what is the best way to implement what I want ? Thansk
0debug