problem
stringlengths
26
131k
labels
class label
2 classes
How would I go about compiling code via a web app? : <p>So I'm looking to develop a online ide for Java with intellisense, but how would I go about producing a compiled class version of the source code?</p> <p>So essentially I want to click</p> <pre><code>(RUN) </code></pre> <p>then upon clicking '(RUN)' the source code in the textarea to be compiled into a class file and a download link provided for that class.</p> <p>The inner details/features don't require a explanation, but was just used as an example of what I'm trying to achieve, what I want to know overall is how I could run a Java compiler through a web based app/website</p>
0debug
Out of Memory Exception during serialization : <p>I am fetching 300k+ records in a object from database. I am trying to serialize the heavy object below:</p> <pre><code>List&lt;user&gt; allUsersList = businessProvider.GetAllUsers(); string json = JsonConvert.SerializeObject(allUsersList); </code></pre> <p>I am getting following exception while serializing the list - allUsersList.</p> <p><em>Out of memory exception</em></p> <p>i am using newtonsoft.json assembly to deserialize it.</p>
0debug
static int hls_probe(AVProbeData *p) { if (strncmp(p->buf, "#EXTM3U", 7)) return 0; if (p->filename && !av_match_ext(p->filename, "m3u8,m3u")) return 0; if (strstr(p->buf, "#EXT-X-STREAM-INF:") || strstr(p->buf, "#EXT-X-TARGETDURATION:") || strstr(p->buf, "#EXT-X-MEDIA-SEQUENCE:")) return AVPROBE_SCORE_MAX; return 0; }
1threat
what is the meaning of hibernate inverseJoinColumns? : <p>I understand hibernate @JoinTable annotation, but I don't understand the inverseJoinColumns. What is it used for?</p> <p>e.g.</p> <pre><code> @ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinTable(name = "stock_category", catalog = "mkyongdb", joinColumns = { @JoinColumn(name = "STOCK_ID", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "CATEGORY_ID", nullable = false, updatable = false) }) public Set&lt;Category&gt; getCategories() { return this.categories; } </code></pre>
0debug
How can I get the text at the bottom of a particular div using css? I have tried, but the text goes to main div : {<body> <div id="img1" style="background-color:red;width:100%;height:100%;"> <div id="abc"> <img id="image" src="punj.jpg" alt="PUNJ icon" style="width:5%; height:15%; float:left;"> </div> <div id="img1" style="background-color:#B1C7E8;width:95%;height:15%; float :left;"> <h1 id="head"> University </h1> </div>} this is code of html aaaaa
0debug
Module not found error in Pycharm , but it is installed as Anaconda package : <p>I have installed Anaconda 3 and pycharm CE after that. I am able to chose the interpreter to be conda environment. But when I try using certain packages such as matplotlib it throws "Module not found error". When I run pip it returns saying that matplotlib is available. </p> <pre><code>pip install matplotlib Requirement already satisfied: matplotlib in./anaconda3/lib/python3.6/site-packages </code></pre> <p>Clearly the package is there and for some reason it does not show up .</p> <p>Thanks in advance.</p>
0debug
local variable not defined from function A to function B : I am working with python functions to make a simple text based word guessing in python. But i am facing problems with local variables defined within a function and i don't know which is right way to get data of that particular local variable or perform action from another function to that local variable which is defined within another function, whether use of ```global``` keyword. i can use ```global``` but some experienced geeks advise to avoid. what is the right way to do the same. It sows ```ask``` is not defined. please suggest me some best practice to do the same. ``` import random def get_random(): random_word = random.choice(open('sowpods.txt', 'r').read().split()) return(random_word) def board(): hidden_word = get_random() print("Welcome to Hangman!") place = ["_" for i in list(hidden_word)] print(" ".join(place)) ask = input("Guess the letter. ").upper() return(ask) def assing_letters(ask): return(ask) get_random() board() assing_letters(ask) ``` P.S. I am a beginner and i have problem with OOP and functions.
0debug
Make login page with phone number and password android studio same android studio default login page : I am learning and making app for android platform, i want make login page with phone number and password without registration. How can i do that? Is there any template? The template of android studio default login activity is very beatiful, but i want login phone number and password. After the login i want intent other activity Please help me. Best Regards.
0debug
void *qemu_vmalloc(size_t size) { void *p; unsigned long addr; mmap_lock(); p = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); addr = (unsigned long)p; if (addr == (target_ulong) addr) { page_set_flags(addr & TARGET_PAGE_MASK, TARGET_PAGE_ALIGN(addr + size), PAGE_RESERVED); } mmap_unlock(); return p; }
1threat
Get the Left element of a Either function : <p>I have a function in Haskell <code>getCorError :: a -> b -> Either c [Error]</code>, being <code>Error = Expected c</code> <br> On another function, which returns <code>-> [Error]</code>, I want to return <code>[Expected (getCorError a b)]</code> if <code>getCorError</code> returns Left or [Error] otherwise.<br> I get a type error when doing <code>[Expected (getCorError a b)]</code>. I have tried many things, like writing Left before the parentesis and after, and many others, and I haven't been able of doing this. Appreciate any help. </p>
0debug
In MsBuild, what's the difference between PropertyGroup and ItemGroup : <p>I can compile a <code>.cs</code> file referenced by <code>PropertyGroup</code>:</p> <pre><code>&lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt; &lt;PropertyGroup&gt; &lt;AssemblyName&gt;MSBuildSample&lt;/AssemblyName&gt; &lt;OutputPath&gt;Bin\&lt;/OutputPath&gt; &lt;Compile&gt;helloConfig.cs&lt;/Compile&gt; &lt;/PropertyGroup&gt; &lt;Target Name="Build"&gt; &lt;MakeDir Directories="$(OutputPath)" Condition="!Exists('$(OutputPath)')" /&gt; &lt;Csc Sources="$(Compile)" OutputAssembly="$(OutputPath)$(AssemblyName).exe"/&gt; &lt;/Target&gt; &lt;/Project&gt; </code></pre> <p>or do the same thing using ItemGroup:</p> <pre><code>&lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt; &lt;ItemGroup&gt; &lt;Compile Include="helloConfig.cs" /&gt; &lt;/ItemGroup&gt; &lt;PropertyGroup&gt; &lt;AssemblyName&gt;MSBuildSample&lt;/AssemblyName&gt; &lt;OutputPath&gt;Bin\&lt;/OutputPath&gt; &lt;/PropertyGroup&gt; &lt;Target Name="Build"&gt; &lt;MakeDir Directories="$(OutputPath)" Condition="!Exists('$(OutputPath)')" /&gt; &lt;Csc Sources="@(Compile)" OutputAssembly="$(OutputPath)$(AssemblyName).exe"/&gt; &lt;/Target&gt; &lt;/Project&gt; </code></pre> <p>I know that using <code>ItemGroup</code> should be the preferred method, but what's when I should use each one of these properties?</p>
0debug
How can I check if a an array of strings is empty in MongoDB with java? : Imagine I have a DB with documents with the format: ``` { "id": "12345", "adress": "adress1,adress2,adress3" } ``` I have tried, after query the DB and get the document of the id I want, to turn *adress* into a list and get list.isEmpty(), but it's not empty. Can it be done using MongoDB?
0debug
static void copy_bits(PutBitContext *pb, UINT8 *src, int length) { #if 1 int bytes= length>>4; int bits= length&15; int i; for(i=0; i<bytes; i++) put_bits(pb, 16, be2me_16(((uint16_t*)src)[i])); put_bits(pb, bits, be2me_16(((uint16_t*)src)[i])>>(16-bits)); #else int bytes= length>>3; int bits= length&7; int i; for(i=0; i<bytes; i++) put_bits(pb, 8, src[i]); put_bits(pb, bits, src[i]>>(8-bits)); #endif }
1threat
static int virtio_net_can_receive(void *opaque) { VirtIONet *n = opaque; return do_virtio_net_can_receive(n, VIRTIO_NET_MAX_BUFSIZE); }
1threat
CMD asking for input when importing the webbrowser module : I'm having a small, yet quite annoying issue with python. When I import the webbrowser module in a python program, it works perfectly fine in the idle, but when I try to run the program outside the idle, it opens, runs the code before the import (which there normally isn't since I begin the program with the imports), and then, when it is time to import the webbrowser module, the program just stops and waits for me to input something. As an example, I made the most basic of program just to show what is happening step by step. Pastebin to the program : http://pastebin.com/8GsQZ1Ti . Here is what happens when I launch the program : http://imgur.com/a/lXtwV and finally, here is a screenshot of the program after I enter some text and press enter : * third link will be in a comment to this post since I need 10 rep to post more than 2 links in a single post * . Why is it that it stops when importing the webbrowser module? I only want the program to import the module and to continue normally.
0debug
python OpenCV jpeg compression in memory : <p>In OpenCV it is possible to save an image to disk with a certain jpeg compression. Is there also a way to do this in memory? Or should I write a function using <code>cv2.imsave()</code> that loads the file and removes it again from disk? If anyone knows a better way that is also fine.</p> <p>The use case is real-time data augmentation. Using something else than OpenCV would cause possibly unnecessary overhead. </p> <p>Example of desired function <code>im = cv2.imjpgcompress(90)</code> </p>
0debug
Creating CGI page, with div tags : I plan to add load a java applet from this page, and can add the code and anything else necessary to the page later. But for some reason I cannot get this page to load, I think it is the div tags. Can anyone explain to me why? !/usr/bin/perl require "/home/bob/public_html/cgi-bin/cookie.pl"; print "Content-type: text/html\n"; # Make sure the passed date is reasonable $theTime = $ENV{'QUERY_STRING'}; $theTime = time - $theTime; &Do_Cookies(); print "\n"; print "\n"; print "<html><head><title>Title</title><link rel=\"stylesheet\"type=\"text/css\" href=\"stylesheet.css\"></head><body>"; print "<div id=\"header\"></div>"; print "<div class=\"content\"><p>CENTER STUFF</p></div>"; print "<div id=\"copy\"><center>Copyright Notice HERE</center><br></div></center>"; print "<div id=\"navLeft\">LEFT STUFF</div>"; print "<div id=\"navRight\">RIGHT STUFF</div></body></html>"; exit 0;
0debug
bool virtio_is_big_endian(void) { #if defined(TARGET_WORDS_BIGENDIAN) return true; #else return false; #endif }
1threat
File Handling Calculation In C : <p>I want to calculate body mass index and write it to the file.I've tried to calculate it in a another function as you can see but output is just 0.Then I've tried different functions like int calculate returns to w/h*h but none of them give me the right answers.I couldn't find another way.</p> <pre><code>#include &lt;stdio.h&gt; struct person { int personId; double height; double weight; double BMI; }; void calculate (double h, double w) { struct person p1; p1.BMI = w / h*h ; } void write () { FILE *file; struct person p1; file = fopen("bmi.txt","w"); if (file == NULL) { printf("Error"); } else { printf("Person ID: "); scanf("%d",&amp;p1.personId); printf("Height: "); scanf("%lf",&amp;p1.height); printf("Weight: "); scanf("%lf",&amp;p1.weight); calculate(p1.height,p1.weight); fwrite(&amp;p1,sizeof(p1),1,file); } fclose(file); } void read() { FILE *file; struct person p1; file = fopen("bmi.txt","r"); if (file == NULL) { printf("Error"); } else { while (!feof(file)) { fread(&amp;p1,sizeof(p1),1,file); printf("Person ID: %d\n",p1.personId); printf("Height: %f\n",p1.height); printf("Weight: %f\n",p1.weight); printf ("BMI: %f\n",p1.BMI); } } fclose(file); } int main () { write(); read(); } </code></pre>
0debug
window.location.href = 'http://attack.com?user=' + user_input;
1threat
GList *g_list_insert_sorted_merged(GList *list, gpointer data, GCompareFunc func) { GList *l, *next = NULL; Range *r, *nextr; if (!list) { list = g_list_insert_sorted(list, data, func); return list; } nextr = data; l = list; while (l && l != next && nextr) { r = l->data; if (ranges_can_merge(r, nextr)) { range_merge(r, nextr); l = g_list_remove_link(l, next); next = g_list_next(l); if (next) { nextr = next->data; } else { nextr = NULL; } } else { l = g_list_next(l); } } if (!l) { list = g_list_insert_sorted(list, data, func); } return list; }
1threat
static int copy_sectors(BlockDriverState *bs, uint64_t start_sect, uint64_t cluster_offset, int n_start, int n_end) { BDRVQcowState *s = bs->opaque; int n, ret; void *buf; if (start_sect + n_end > bs->total_sectors) { n_end = bs->total_sectors - start_sect; } n = n_end - n_start; if (n <= 0) { return 0; } buf = qemu_blockalign(bs, n * BDRV_SECTOR_SIZE); BLKDBG_EVENT(bs->file, BLKDBG_COW_READ); ret = bdrv_read(bs, start_sect + n_start, buf, n); if (ret < 0) { goto out; } if (s->crypt_method) { qcow2_encrypt_sectors(s, start_sect + n_start, buf, buf, n, 1, &s->aes_encrypt_key); } BLKDBG_EVENT(bs->file, BLKDBG_COW_WRITE); ret = bdrv_write(bs->file, (cluster_offset >> 9) + n_start, buf, n); if (ret < 0) { goto out; } ret = 0; out: qemu_vfree(buf); return ret; }
1threat
Struct with optional members in modern C++ : <p>We have inherited old code which we are converting to modern C++ to gain better type safety, abstraction, and other goodies. We have a number of structs with many optional members, for example:</p> <pre><code>struct Location { int area; QPoint coarse_position; int layer; QVector3D fine_position; QQuaternion rotation; }; </code></pre> <p>The important point is that all of the members are optional. At least one will be present in any given instance of Location, but not necessarily all. More combinations are possible than the original designer apparently found convenient to express with separate structs for each.</p> <p>The structs are deserialized in this manner (pseudocode):</p> <pre><code>Location loc; // Bitfield expressing whether each member is present in this instance uchar flags = read_byte(); // If _area_ is present, read it from the stream, else it is filled with garbage if (flags &amp; area_is_present) loc.area = read_byte(); if (flags &amp; coarse_position_present) loc.coarse_position = read_QPoint(); etc. </code></pre> <p>In the old code, these flags are stored in the struct permanently, and getter functions for each struct member test these flags at runtime to ensure the requested member is present in the given instance of Location.</p> <p>We don't like this system of runtime checks. Requesting a member that isn't present is a serious logic error that we would like to find at compile time. This should be possible because whenever a Location is read, it is known which combination of member variables should be present.</p> <p>At first, we thought of using std::optional:</p> <pre><code>struct Location { std::optional&lt;int&gt; area; std::optional&lt;QPoint&gt; coarse_location; // etc. }; </code></pre> <p>This solution modernizes the design flaw rather than fixing it.</p> <p>We thought of using std::variant like this:</p> <pre><code>struct Location { struct Has_Area_and_Coarse { int area; QPoint coarse_location; }; struct Has_Area_and_Coarse_and_Fine { int area; QPoint coarse_location; QVector3D fine_location; }; // etc. std::variant&lt;Has_Area_and_Coarse, Has_Area_and_Coarse_and_Fine /*, etc.*/&gt; data; }; </code></pre> <p>This solution makes illegal states impossible to represent, but doesn't scale well, when more than a few combinations of member variables are possible. Furthermore, we would not want to access by specifying <strong>Has_Area_and_Coarse</strong>, but by something closer to <strong>loc.fine_position</strong>.</p> <p>Is there a standard solution to this problem that we haven't considered?</p>
0debug
Use php var in js file : <p>I've been looking, but found nothing similar to my case.</p> <p>I want my php variable $money , to pass onto my javascript file.</p> <p>Example :</p> <pre><code>** FILE index.php ** &lt;?php $money = 15; ?&gt; &lt;div id="div-test"&gt; Foo foo&lt;div&gt; &lt;script src="test.js"&gt;&lt;/script&gt; ** FILE test.js ** document.getElementById("div-test").innerHTML = $money; </code></pre> <p>How would i make this possible?</p>
0debug
static uint32_t esp_mem_readb(void *opaque, target_phys_addr_t addr) { ESPState *s = opaque; uint32_t saddr; saddr = (addr >> s->it_shift) & (ESP_REGS - 1); DPRINTF("read reg[%d]: 0x%2.2x\n", saddr, s->rregs[saddr]); switch (saddr) { case ESP_FIFO: if (s->ti_size > 0) { s->ti_size--; if ((s->rregs[ESP_RSTAT] & STAT_PIO_MASK) == 0) { fprintf(stderr, "esp: PIO data read not implemented\n"); s->rregs[ESP_FIFO] = 0; } else { s->rregs[ESP_FIFO] = s->ti_buf[s->ti_rptr++]; } esp_raise_irq(s); } if (s->ti_size == 0) { s->ti_rptr = 0; s->ti_wptr = 0; } break; case ESP_RINTR: s->rregs[ESP_RSTAT] &= ~(STAT_GE | STAT_PE); esp_lower_irq(s); break; default: break; } return s->rregs[saddr]; }
1threat
static void blkverify_err(BlkverifyAIOCB *acb, const char *fmt, ...) { va_list ap; va_start(ap, fmt); fprintf(stderr, "blkverify: %s sector_num=%ld nb_sectors=%d ", acb->is_write ? "write" : "read", acb->sector_num, acb->nb_sectors); vfprintf(stderr, fmt, ap); fprintf(stderr, "\n"); va_end(ap); exit(1); }
1threat
Sorting in descending order in SQL : <p>I have a table having customer name, and their 2 ids- id 1 and id 2. Id2 is distinct for all customers but id1 is same for some of them. I want to sort the table in descending order on the basis of id 1.</p> <p><code>SELECT * FROM table_name ORDER BY id1 DESC</code> works fine but same id1 should be sorted in descending order on the basis of their id2 value.</p> <p>someone please help me how to achieve this. thanks.</p>
0debug
JS Variable with IF ELSE : <p>I am struggling here. My JS is below. The objective here - user selects type for course - WS or AC. If Onsite is checked update the AC value to be 1.5 under course weight. </p> <p>Number of people has differing values depending if AC or WS was selected. Hence in Calculate Total function there is an if statement reviewing the course type value - AC or WS. </p> <p>JSHint is reporting on Line 257 - Expected a conditional expression and instead saw an assignment. </p> <pre><code> //Set up an associative array //The keys represent the size / weightof the course type //The values represent the weight of the course type var course_weight = []; course_weight["AC"]=1; course_weight["WS"]=1; //Set up an associative array //The keys represent the size / weightof the course type //The values represent the weight of the course type var course_type = new Array(); course_type["AC"]="AC"; course_type["WS"]="WS"; //Set up an associative array //The keys represent the number of days //The value represents the number of days //We use this this array when the user set the number of days from the form var number_days= new Array(); number_days["None"]=0 ; number_days["1"]=1 ; number_days["2"]=2 ; number_days["3"]=3 ; number_days["4"]=4 ; number_days["5"]=5 ; //Set up an associative array //The keys represent the number of AC people //The value represents thenumber of people //We use this this array when the user set number of people from the form var ACnumber_people= new Array(); ACnumber_people["None"]=0; ACnumber_people["1"]=1; ACnumber_people["2"]=2; ACnumber_people["3"]=3; ACnumber_people["4"]=4; ACnumber_people["5"]=5; ACnumber_people["6"]=6; ACnumber_people["7"]=7; ACnumber_people["8"]=8; //Set up an associative array Workshop //The keys represent the number of WS people //The value represents thenumber of people //We use this this array when the user set number of people from the form var WSnumber_people= new Array(); WSnumber_people["None"]=0; WSnumber_people["1"]=4; WSnumber_people["2"]=4; WSnumber_people["3"]=4; WSnumber_people["4"]=4; WSnumber_people["5"]=4; WSnumber_people["6"]=5; WSnumber_people["7"]=5; WSnumber_people["8"]=5; //Onsite course delivery //getTrainerExp finds the trainer expenses based on a check box selection function getOnsite() { var onsite="no"; //Get a reference to the form id="courseform" var theForm = document.forms["courseform"]; //Get a reference to the checkbox id="includeexp" var onSite = document.getElementById('onsite'); //If they checked the box set the course type value for Academy to 1.5 if(onSite.checked==true) { course_weight["AC"]=1.5; } //return the trainer expenses return onsite; } // getCourseWeight() finds the course weight for integer based on the slection. // take user's the selection from radio button selection function getCourseWeight() { var courseweight=0; //Get a reference to the form id="courseform" var theForm = document.forms["courseform"]; //Get a reference to the typre the user Chooses name=selectedcoursetype": var selectedCourseWeight = theForm.elements["selectedcoursetype"]; //Here since there are 4 radio buttons selectedCourseType.length = 4 //We loop through each radio buttons for(var i = 0; i &lt; selectedCourseWeight.length; i++) { //if the radio button is checked if(selectedCourseWeight[i].checked) { //we set coursetype to the value of the selected radio button //i.e. if the user choose the WS we set it to 1 //We get the selected Items value //For example course_prices["WS".value]" courseweight = course_weight[selectedCourseWeight[i].value]; //If we get a match then we break out of this loop //No reason to continue if we get a match break; } } //We return the coursetype return courseweight; } // getCourseType() finds the course type - AC or WS based on the selection. // take user's the selection from radio button selection function getCourseType() { var coursetype="none"; //Get a reference to the form id="courseform" var theForm = document.forms["courseform"]; //Get a reference to the typre the user Chooses name=selectedcoursetype": var selectedCourseType = theForm.elements["selectedcoursetype"]; //Here since there are 4 radio buttons selectedCourseType.length = 4 //We loop through each radio buttons for(var i = 0; i &lt; selectedCourseType.length; i++) { //if the radio button is checked if(selectedCourseType[i].checked) { //we set coursetype to the value of the selected radio button //i.e. if the user choose the WS we set it to 1 //We get the selected Items value //For example course_prices["WS".value]" coursetype = course_type[selectedCourseType[i].value]; //If we get a match then we break out of this loop //No reason to continue if we get a match break; } } if //We return the coursetype return coursetype; } //This function finds the number of days based on the //drop down selection function getNumberDays() { var numberdays=0; //Get a reference to the form id="courseform" var theForm = document.forms["courseform"]; //Get a reference to the select id="days" var selectedDays = theForm.elements["days"]; //set Days equal to value user chose //For example number_days["Lemon".value] would be equal to 5 numberdays = number_days[selectedDays.value]; //finally we return numberdays return numberdays; } //This function finds the number of AC people based on the //drop down selection function getACNumberPeople() { var ACnumberpeople=0; //Get a reference to the form id="courseform" var theForm = document.forms["courseform"]; //Get a reference to the select id="people" var selectedPeople = theForm.elements["people"]; //set AC People equal to value user chose //For example number_days["Lemon".value] would be equal to 5 ACnumberpeople = ACnumber_people[selectedPeople.value]; //finally we return numberdays return ACnumberpeople; } //This function finds the number of WS people based on the //drop down selection function getWSNumberPeople() { var WSnumberpeople=0; //Get a reference to the form id="courseform" var theForm = document.forms["courseform"]; //Get a reference to the select id="people" var selectedPeople = theForm.elements["people"]; //set WSPeople equal to value user chose WSnumberpeople = WSnumber_people[selectedPeople.value]; //finally we return numberdays return WSnumberpeople; } //getTrainerExp finds the trainer expenses based on a check box selection function getTrainerExp() { var trainerexp="None"; //Get a reference to the form id="courseform" var theForm = document.forms["courseform"]; //Get a reference to the checkbox id="includeexp" var includeExp = document.getElementById('includeexp'); //If they checked the box set trainerexp to ACMEEXP if(includeExp.checked==true) { trainerexp=" - ACM-EXP"; } //return the trainer expenses return trainerexp; } //getTrainerKit finds the kit shipping based on a check box selection function getTrainerKit() { var trainerkit="None"; //Get a reference to the form id="courseform" var theForm = document.forms["courseform"]; //Get a reference to the checkbox id="includekit" var includeKit = document.getElementById('includekit'); //If they checked the box set trainerexp to ACMEEXP if(includeKit.checked==true) { trainerkit=" ACM-SHP"; } //return the trainer expenses return trainerkit; } function calculateTotal() { //Here we get the total price by calling our function //Each function returns a number so by calling them we add the values they return together var pointstotal = if (course_type = AC) { getCourseWeight() * getNumberDays() * getACNumberPeople () } else if (course_type = WS) { getCourseWeight() * getNumberDays() * getWSNumberPeople () } else { } ; //display the result var divobj = document.getElementById('totalPoints'); divobj.style.display='block'; divobj.innerHTML = "Points Total = " +pointstotal; } function calculateExp() { var expense = getTrainerExp() ; var days = getNumberDays() ; document.getElementById("trainerexp").innerHTML = "Please include Qty " +days +expense; document.getElementById("trainertra").innerHTML = "Please include Qty 1 - ACM-TRA " } function calculateKit() { var kit = getTrainerKit() ; document.getElementById("trainerkit").innerHTML = "Please include Qty 1 - " +kit; } function hideTotal() { var divobj = document.getElementById('totalPrice'); divobj.style.display='none'; } function btns() { window.location.replace('http://btnsdownloads.co.uk/site/btns8/index08.html'); } </code></pre>
0debug
static inline void tcg_out_movi_imm32(TCGContext *s, int ret, uint32_t arg) { if (check_fit_tl(arg, 12)) tcg_out_movi_imm13(s, ret, arg); else { tcg_out_sethi(s, ret, arg); if (arg & 0x3ff) tcg_out_arithi(s, ret, ret, arg & 0x3ff, ARITH_OR); } }
1threat
How to launch a application the amount of times it says in a TextBox in C#? : <p>I tried looking on Google and no results came up for the <em><strong>specific</strong></em> thing I wanted. So, some applications let you run a application a certain amount of times you want. I am trying to make the user input the amount of times they want the application to run/launch. (The coding language I am using is C#). I spent around a half hour trying to find the answer but I couldn't, so I am asking stackoverflow.</p>
0debug
True Caller Search API for Android : <p>Is there is True Caller API for Android App exist, where I Can search Name against Mobile number?</p>
0debug
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
1threat
Access modifier in java with examples? : <p>Can anyone explain What are access modifiers in java <strong>in easy language</strong> ? With examples ?</p>
0debug
void *av_malloc(unsigned int size) { void *ptr; #if defined (HAVE_MEMALIGN) ptr = memalign(16,size); #else ptr = malloc(size); #endif return ptr; }
1threat
Android Espresso not working with Multidex gives "No tests found" : <p>My Espresso tests were running until I had to support multidex.</p> <p>My build.gradle, I have</p> <pre><code>minSdkVersion 14 targetSdkVersion 23 multiDexEnabled = true testInstrumentationRunner "com.android.test.runner.MultiDexTestRunner" androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1' androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.1' androidTestCompile 'com.android.support.test:runner:0.4.1' androidTestCompile 'com.android.support.test:rules:0.4.1' dexOptions { jumboMode true javaMaxHeapSize "4g" incremental true } </code></pre> <h2>Test1AuthenticationEspressoTest</h2> <pre><code>@RunWith(AndroidJUnit4.class) @SmallTest public class Test1AuthenticationEspressoTest { @Rule public ActivityTestRule&lt;WelcomeActivity&gt; mActivityRule = new ActivityTestRule(WelcomeActivity.class); } </code></pre> <p>Here is the Error I get</p> <blockquote> <p>junit.framework.AssertionFailedError: No tests found in com.livestrong.tracker.test.Test1AuthenticationEspressoTest</p> </blockquote> <p>Any help will be appreciated. Any one has espresso working with multidex ?</p>
0debug
def max_of_two( x, y ): if x > y: return x return y
0debug
static int decode_fctl_chunk(AVFormatContext *s, APNGDemuxContext *ctx, AVPacket *pkt) { uint32_t sequence_number, width, height, x_offset, y_offset; uint16_t delay_num, delay_den; uint8_t dispose_op, blend_op; sequence_number = avio_rb32(s->pb); width = avio_rb32(s->pb); height = avio_rb32(s->pb); x_offset = avio_rb32(s->pb); y_offset = avio_rb32(s->pb); delay_num = avio_rb16(s->pb); delay_den = avio_rb16(s->pb); dispose_op = avio_r8(s->pb); blend_op = avio_r8(s->pb); avio_skip(s->pb, 4); if (!delay_den) delay_den = 100; if (!delay_num || delay_den / delay_num > ctx->max_fps) { delay_num = 1; delay_den = ctx->default_fps; } ctx->pkt_duration = av_rescale_q(delay_num, (AVRational){ 1, delay_den }, s->streams[0]->time_base); av_log(s, AV_LOG_DEBUG, "%s: " "sequence_number: %"PRId32", " "width: %"PRIu32", " "height: %"PRIu32", " "x_offset: %"PRIu32", " "y_offset: %"PRIu32", " "delay_num: %"PRIu16", " "delay_den: %"PRIu16", " "dispose_op: %d, " "blend_op: %d\n", __FUNCTION__, sequence_number, width, height, x_offset, y_offset, delay_num, delay_den, dispose_op, blend_op); if (width != s->streams[0]->codecpar->width || height != s->streams[0]->codecpar->height || x_offset != 0 || y_offset != 0) { if (sequence_number == 0 || x_offset >= s->streams[0]->codecpar->width || width > s->streams[0]->codecpar->width - x_offset || y_offset >= s->streams[0]->codecpar->height || height > s->streams[0]->codecpar->height - y_offset) return AVERROR_INVALIDDATA; ctx->is_key_frame = 0; } else { if (sequence_number == 0 && dispose_op == APNG_DISPOSE_OP_PREVIOUS) dispose_op = APNG_DISPOSE_OP_BACKGROUND; ctx->is_key_frame = dispose_op == APNG_DISPOSE_OP_BACKGROUND || blend_op == APNG_BLEND_OP_SOURCE; } return 0; }
1threat
Check linux service status and start it if stopped using python script : I have a fixed list of services in a linux server. I want to check the status of these services and start the service if it's stopped. I'm able to get this done using shell script. But, am looking for a Python script to do this. Any help will be appreciated.
0debug
use java print binary tree from left to right fashion : like this 99 97 92 83 71 69 49 44 40 32 28 18 11 and it require Recursively call outputTree with the right subtree of the current node and totalSpaces + 5 Use a for statement to count from 1 to totalSpaces and output spaces Output the value in the current node
0debug
Css flexbox , try to keep chat in view : i'm tired with css flexbox, i want to implement a chat which stays in screen with a sticky footer. But i'm really stuck. [Something like that][1] Or at least , have the bottom of my chat at the bottom of the content or screen. I'm using bootstrap 4.1. If anyone have an idea, that would be very helpfull [1]: https://i.stack.imgur.com/ovwxK.png
0debug
static int rewrite_footer(BlockDriverState* bs) { int ret; BDRVVPCState *s = bs->opaque; int64_t offset = s->free_data_block_offset; ret = bdrv_pwrite(bs->file, offset, s->footer_buf, HEADER_SIZE); if (ret < 0) return ret; return 0; }
1threat
How to implement Material Design Choreographing surface animations : <p>I wonder how to implement the Choreographing surface animations (like <a href="https://material.google.com/motion/choreography.html#choreography-creation">https://material.google.com/motion/choreography.html#choreography-creation</a> in Choreographic surface section).</p> <p>I actually used both Alpha animation and Translate animation but it seems like it is not exactly what we can see on the material design site.</p> <p>Did someone have a good example of how to do this ?</p>
0debug
Can we add google and facebook login integration in websites for user login using JSP also? : <p>I want to integrate <strong>facebook</strong> and <strong>google</strong> login in my website (under construction) , can i do it using <strong>JSP</strong>? Because i've never seen any website using jsp for facebook login. I want to use JSP because my website back-end will be done using JSP? Also tell if there exists any way if i can use both <strong>JSP</strong> and <strong>PHP</strong> ?</p>
0debug
sum numbers in lines python : This is what I have to do: 1. Read content of a text file, where two numbers separated by comma are on each line (like 10, 5\n, 12, 8\n, …) 2. Make a sum of those two numbers 3. Write into new text file two original numbers and the result of summation = like 10 + 5 = 15\n, 12 + 8 = 20\n, … so far I have this: import os import sys relative_path = "Homework 2.txt" if not os.path.exists(relative_path): print "not found" sys.exit() read_file = open(relative_path, "r") lines = read_file.readlines() read_file.close() print lines path_output = "data_result4.txt" write_file = open(path_output, "w") for line in lines: line_array = line.split() print line_array
0debug
why runtime error in this function c++ depth first search? : <p>why this function get runtime error what is the wrong with it?</p> <pre><code>void dfs(int node){ visited[node]=true; for(int i=1;i&lt;=arr[node].size();i++){ int child=arr[node][i]; if(!visited[child]){ dfs(child); } } } </code></pre>
0debug
Java; looking for lowest Int : <p>Hi I need help with finding the the lowest income. Here is the link for the codeCheck </p> <p><a href="http://www.codecheck.it/files/18030103413ucpa6f7ev1gbmexv0tlv2av3" rel="nofollow noreferrer">http://www.codecheck.it/files/18030103413ucpa6f7ev1gbmexv0tlv2av3</a></p> <p>the code i have written is at the bottom. I Cannot figure out why its the output doesn't show. Thank you in advance. </p> <p>Companies report net income every quarter of the year. Some quarters Amazon's net income per share is positive, and some quarters it is negative. (It is always small because Amazon reinvests any profits in the business.)</p> <p>Write an application (A program that has a main methods) called AmazonNetIncome to read a collection of integers, each representing a positive, negative or 0 net income for the quarter for 100 shares of Amazon stock. The input will terminate when the user enters a non-integer.</p> <p>Use this prompt: System.out.print("Enter net income or Q to quit: ");</p> <p>Note: you will actually quit on any string that can not be converted to an int.</p> <p>Do the following:</p> <pre><code>find and print the number of profitable years (net income greater than 0.) find and print the lowest net income find and print the average net income </code></pre> <p>Only print the numbers if at least 1 integer was entered. Otherwise print "No values entered"</p> <p>You will read the inputs one at a time and do all the processing as you go. No Arrays for this</p> <p>The outputs should be on separate lines and in this order</p> <pre><code>number of profitable years lowest net income average net income </code></pre> <p>Do not initialize the minimum to 0 or some negative number. You can temporarily set it to 0 when you declare it but then initialize to the first input. You can use a boolean variable as a flag as discussed in the videos.</p> <pre><code>import java.util.*; public class AmazonNetIncome { public static void main(String[]args) { Scanner in = new Scanner (System.in); System.out.print("Enter net income or Q to quit: "); double profit= 0; int count = 0; int count2 = 0; int smalled =0; double average = 0; if(in.hasNextInt()) { while(in.hasNextInt()) { System.out.print("Enter net income or Q to quit: "); int num = in.nextInt(); profit= profit + num; count2++; average = profit/count2; if(num &gt; 0) { count++; } if (num &lt; smalled ) { smalled = num; } } System.out.println(count); System.out.println(smalled); System.out.println(average); } else { System.out.println("No values entered"); } } } </code></pre>
0debug
Does web scraping pull contents from a database (php) : <p>I don't know anything about web scraping so before I spend time toying with it I want to see if it will even work for what I'm trying to do. I want to be able to return all the pertinent information about a part using the part number (quantity, cost, etc.) I assume the contents of the website is stored in a database so my question is does web scraping have the ability to get to the contents on the database?</p> <p>Thanks for the help. </p>
0debug
Trouble with Inheritance c# : <p>I seem to be having some trouble with inheritance. I'm not exactly sure what is wrong, but I believe that it is calling the classes incorrectly. I'm still really new to inheritance so I'm sure there are areas that I got wrong in it. It's supposed to call something from each class and make a phrase at the end, but it dosen't seem to be working. It is also supposed to override the previous Show Address.</p> <pre><code>class DSC { private string schoolName { get; set; } string schoolName = "DSC"; public virtual string ShowAddress(); { return " 1420 W. Highway Blvd., Orlando, Florida 33268 "} } class Campus { private string campusName { get; set; } public string campusName { get { return campusName; } set { campusName = value; } public Campus(string cName); public virtual string ShowAddress() { return "1843 Bob Blvd., Orlando, Florida 33268"; } public string Departments() { return "Computer Scinece Department, Emergency Care Department, Police Academy"; } } class Program { static void Main(string[] args) { Campus atc = new Campus("Advanced Technology College"); Console.WriteLine(atc.ToString()); } } </code></pre> <p>What the Output is supposed to be</p> <pre><code>Daytona State College Advanced Technology College is located at 1843 Bob Blvd., Orlando, Florida 33268, it has Computer Scinece Department, Emergency Care Department, Police Academy </code></pre>
0debug
bool bdrv_chain_contains(BlockDriverState *top, BlockDriverState *base) { while (top && top != base) { top = top->backing_hd; } return top != NULL; }
1threat
Hi... can any one help me to write same query using regexp_like operator : can any one help me to write same query using regexp_like operator.(Please use hr.employees) Select last_name from employees where Last_name like '%a%' and Last_name like '%e%' and Last_name like '%s%' ; Thank you all for your valuable response.
0debug
static int os_host_main_loop_wait(int timeout) { int ret, i; PollingEntry *pe; WaitObjects *w = &wait_objects; static struct timeval tv0; ret = 0; for (pe = first_polling_entry; pe != NULL; pe = pe->next) { ret |= pe->func(pe->opaque); } if (ret != 0) { return ret; } if (nfds >= 0) { ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv0); if (ret != 0) { timeout = 0; } } for (i = 0; i < w->num; i++) { poll_fds[i].fd = (DWORD) w->events[i]; poll_fds[i].events = G_IO_IN; } qemu_mutex_unlock_iothread(); ret = g_poll(poll_fds, w->num, timeout); qemu_mutex_lock_iothread(); if (ret > 0) { for (i = 0; i < w->num; i++) { w->revents[i] = poll_fds[i].revents; } for (i = 0; i < w->num; i++) { if (w->revents[i] && w->func[i]) { w->func[i](w->opaque[i]); } } } return ret; }
1threat
`[(ngModel)]` vs `[(value)]` : <p>What is the difference between</p> <pre><code>&lt;input [(ngModel)]="name"&gt; </code></pre> <p>and</p> <pre><code>&lt;input [(value)]="name"&gt; </code></pre> <p>They appear to do the same thing.</p> <p>The angular docs are using <strong>NgModel</strong> but they also say that they replace all the angular1 directives with the "boxed banana" [()]. So why is <strong>NgModel</strong> still around?</p> <p>What am I missing?</p>
0debug
Xcode 8 can't archive "Command /usr/bin/codesign failed with exit code 1" : <p>I've got a serious problem on Xcode 8 on macOS Sierra. when I try to build my app, I get the following issue.</p> <pre><code>CodeSign /Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Products/Debug-iphonesimulator/MyApp.app cd /Users/me/Desktop/MyAppFolder1/MyAppFolder2/MyAppxcode export CODESIGN_ALLOCATE=/Users/me/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate export PATH="/Users/me/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Users/me/Downloads/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" Signing Identity: "-" /usr/bin/codesign --force --sign - --timestamp=none /Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Products/Debug-iphonesimulator/MyApp.app /Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Products/Debug-iphonesimulator/MyApp.app: resource fork, Finder information, or similar detritus not allowed Command /usr/bin/codesign failed with exit code 1 </code></pre> <p>then I did <a href="https://forums.developer.apple.com/thread/48905">https://forums.developer.apple.com/thread/48905</a> in the terminal as the following and it worked. but once I clean, the issue comes back.</p> <pre><code>cd /Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Products/Debug-iphonesimulator/MyApp ls -al@ * xattr -c * </code></pre> <p>and this solution doesn't work for archive with the following issue. is there any solution for it?</p> <pre><code>CodeSign /Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Intermediates/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app cd /Users/me/Desktop/MyAppFolder1/MyAppFolder2/MyAppxcode export CODESIGN_ALLOCATE=/Users/me/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate export PATH="/Users/me/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Users/me/Downloads/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" Signing Identity: "iPhone Developer: My Name (**********)" Provisioning Profile: "iOS Team Provisioning Profile: com.**********.*********" (********-****-****-****-************) /usr/bin/codesign --force --sign **************************************** --entitlements /Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Intermediates/ArchiveIntermediates/MyApp/IntermediateBuildFilesPath/MyApp.build/Release-iphoneos/MyApp.build/MyApp.app.xcent --timestamp=none /Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Intermediates/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app /Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Intermediates/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app: resource fork, Finder information, or similar detritus not allowed Command /usr/bin/codesign failed with exit code 1 </code></pre>
0debug
array.map does not change array values : <p>Why doesn't array.map work?</p> <p>My code is:</p> <pre><code>let myArray = [000,111,222,333,444,555,666,777,888,999]; myArray.map((value) =&gt; { return = 1000 - value; }); console.log(myArray); </code></pre> <p>The result is: [0, 111, 222, 333, 444, 555, 666, 777, 888, 999]</p>
0debug
Website doesnt scroll, no postition in css : <p>My website (skinstuff.nl) will not scroll. Could someone help me. I really can not find out why.</p> <p>There are no postions in my body or html. </p>
0debug
def Find_Min_Length(lst): minLength = min(len(x) for x in lst ) return minLength
0debug
Symfony4 - 'app/config/config.yml' is missing? : <p>I am new with Symfony4, and creating Login Form with <a href="https://symfony.com/doc/master/bundles/FOSUserBundle/index.html" rel="noreferrer">FOSUserBundle</a>. And I got stuck at step 5 mentioned in this article. When it says:</p> <blockquote> <p>Add the following configuration to your config.yml file according to which type of datastore you are using.</p> </blockquote> <pre><code># app/config/config.yml fos_user: db_driver: orm # other valid values are 'mongodb' and 'couchdb' firewall_name: main user_class: AppBundle\Entity\User from_email: address: "%mailer_user%" sender_name: "%mailer_user%" </code></pre> <p>The problem is that in symfony4, there is no <code>app</code> folder, and no simple <code>config.yml</code> file in config folder.</p> <p>I think this article might be working with older versions, but for Symfony4, it may need some amendments. </p> <p>Can any body suggest how to fix it?</p>
0debug
Java code will not print out answer or read int properly : <p>This is the whole project, it should work as far as I can see but i'm hoping that posting it here could let me see something I missed, I have a moderate amount of experience with java</p> <pre><code>package com.company; import java.util.Random; import java.util.Scanner; public class Main { public static void main(String[] args) { // write your code here Scanner input = new Scanner(System.in); int number1; int number2; int answer; String operator; </code></pre> <p>This figures out what numbers and operators the user wants</p> <pre><code> System.out.println("Please Enter your first number"); number1 = input.nextInt(); System.out.println("Please enter your second number"); number2 = input.nextInt(); System.out.println("Please enter your operator: + , - , * , / "); operator = input.next(); </code></pre> <p>The if Statement should determine which operator the user wants and applys it to the two numbers and then calls the randomEquation Method to make it the wrong answer</p> <pre><code> if (operator == "+") { answer = number1 + number2; System.out.println("Your answer is: " + randomEquation(answer)); } else if (operator == "-") { answer = number1 - number2; System.out.println("Your answer is: " + randomEquation(answer)); } else if (operator == "*") { answer = number1 * number2; System.out.println("Your answer is: " + randomEquation(answer)); } else if (operator == "/") { answer = number1 / number2; System.out.println("Your answer is: " + randomEquation(answer)); } } </code></pre> <p>This method randomly applies one of these to the answer to create the wrong answer</p> <pre><code> public static int randomEquation(int number) { Random rand = new Random(); int random = rand.nextInt(100) + 1; int answer = number; if (random &lt;= 100 &amp;&amp; random &gt;= 81) { answer = number * 25; return answer; } else if(random &lt;= 80 &amp;&amp; random &gt;= 61){ answer += 13; return answer; } else if(random &lt;= 60 &amp;&amp; random &gt;= 41){ answer /= 2; return answer; } else if(random &lt;= 40 &amp;&amp; random &gt;= 21){ answer -= 16; return answer; } else{ answer %= 4; return answer; } } } </code></pre>
0debug
Variable width textbox in Javascript : <p>I am wondering is this possible to do in JS: I want to make some text box with some width. But I want to add controls so user can simply change its width and position. I'm hoping to automatize diploma printing in my school, and I need tool for fast and simple adjustment during form filling. </p>
0debug
def is_samepatterns(colors, patterns): if len(colors) != len(patterns): return False sdict = {} pset = set() sset = set() for i in range(len(patterns)): pset.add(patterns[i]) sset.add(colors[i]) if patterns[i] not in sdict.keys(): sdict[patterns[i]] = [] keys = sdict[patterns[i]] keys.append(colors[i]) sdict[patterns[i]] = keys if len(pset) != len(sset): return False for values in sdict.values(): for i in range(len(values) - 1): if values[i] != values[i+1]: return False return True
0debug
static int decode_mb(H264Context *h){ MpegEncContext * const s = &h->s; const int mb_xy= s->mb_x + s->mb_y*s->mb_stride; int mb_type, partition_count, cbp; s->dsp.clear_blocks(h->mb); tprintf("pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y); cbp = 0; if(h->slice_type != I_TYPE && h->slice_type != SI_TYPE){ if(s->mb_skip_run==-1) s->mb_skip_run= get_ue_golomb(&s->gb); if (s->mb_skip_run--) { int mx, my; mb_type= MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P1L0; memset(h->non_zero_count[mb_xy], 0, 16+4+4); memset(h->non_zero_count_cache + 8, 0, 8*5); if(h->sps.mb_aff && s->mb_skip_run==0 && (s->mb_y&1)==0){ h->mb_field_decoding_flag= get_bits1(&s->gb); } if(h->mb_field_decoding_flag) mb_type|= MB_TYPE_INTERLACED; fill_caches(h, mb_type); pred_pskip_motion(h, &mx, &my); fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, 0, 1); fill_rectangle( h->mv_cache[0][scan8[0]], 4, 4, 8, pack16to32(mx,my), 4); write_back_motion(h, mb_type); s->current_picture.mb_type[mb_xy]= mb_type; s->current_picture.qscale_table[mb_xy]= s->qscale; h->slice_table[ mb_xy ]= h->slice_num; h->prev_mb_skiped= 1; return 0; } } if(h->sps.mb_aff ){ if((s->mb_y&1)==0) h->mb_field_decoding_flag = get_bits1(&s->gb); }else h->mb_field_decoding_flag=0; h->prev_mb_skiped= 0; mb_type= get_ue_golomb(&s->gb); if(h->slice_type == B_TYPE){ if(mb_type < 23){ partition_count= b_mb_type_info[mb_type].partition_count; mb_type= b_mb_type_info[mb_type].type; }else{ mb_type -= 23; goto decode_intra_mb; } }else if(h->slice_type == P_TYPE ){ if(mb_type < 5){ partition_count= p_mb_type_info[mb_type].partition_count; mb_type= p_mb_type_info[mb_type].type; }else{ mb_type -= 5; goto decode_intra_mb; } }else{ assert(h->slice_type == I_TYPE); decode_intra_mb: if(mb_type > 25){ av_log(h->s.avctx, AV_LOG_ERROR, "mb_type %d in %c slice to large at %d %d\n", mb_type, av_get_pict_type_char(h->slice_type), s->mb_x, s->mb_y); return -1; } partition_count=0; cbp= i_mb_type_info[mb_type].cbp; h->intra16x16_pred_mode= i_mb_type_info[mb_type].pred_mode; mb_type= i_mb_type_info[mb_type].type; } if(h->mb_field_decoding_flag) mb_type |= MB_TYPE_INTERLACED; s->current_picture.mb_type[mb_xy]= mb_type; h->slice_table[ mb_xy ]= h->slice_num; if(IS_INTRA_PCM(mb_type)){ const uint8_t *ptr; int x, y; align_get_bits(&s->gb); ptr= s->gb.buffer + get_bits_count(&s->gb); for(y=0; y<16; y++){ const int index= 4*(y&3) + 64*(y>>2); for(x=0; x<16; x++){ h->mb[index + (x&3) + 16*(x>>2)]= *(ptr++); } } for(y=0; y<8; y++){ const int index= 256 + 4*(y&3) + 32*(y>>2); for(x=0; x<8; x++){ h->mb[index + (x&3) + 16*(x>>2)]= *(ptr++); } } for(y=0; y<8; y++){ const int index= 256 + 64 + 4*(y&3) + 32*(y>>2); for(x=0; x<8; x++){ h->mb[index + (x&3) + 16*(x>>2)]= *(ptr++); } } skip_bits(&s->gb, 384); memset(h->non_zero_count[mb_xy], 16, 16+4+4); s->current_picture.qscale_table[mb_xy]= s->qscale; return 0; } fill_caches(h, mb_type); if(IS_INTRA(mb_type)){ if(IS_INTRA4x4(mb_type)){ int i; for(i=0; i<16; i++){ const int mode_coded= !get_bits1(&s->gb); const int predicted_mode= pred_intra_mode(h, i); int mode; if(mode_coded){ const int rem_mode= get_bits(&s->gb, 3); if(rem_mode<predicted_mode) mode= rem_mode; else mode= rem_mode + 1; }else{ mode= predicted_mode; } h->intra4x4_pred_mode_cache[ scan8[i] ] = mode; } write_back_intra_pred_mode(h); if( check_intra4x4_pred_mode(h) < 0) return -1; }else{ h->intra16x16_pred_mode= check_intra_pred_mode(h, h->intra16x16_pred_mode); if(h->intra16x16_pred_mode < 0) return -1; } h->chroma_pred_mode= get_ue_golomb(&s->gb); h->chroma_pred_mode= check_intra_pred_mode(h, h->chroma_pred_mode); if(h->chroma_pred_mode < 0) return -1; }else if(partition_count==4){ int i, j, sub_partition_count[4], list, ref[2][4]; if(h->slice_type == B_TYPE){ for(i=0; i<4; i++){ h->sub_mb_type[i]= get_ue_golomb(&s->gb); if(h->sub_mb_type[i] >=13){ av_log(h->s.avctx, AV_LOG_ERROR, "B sub_mb_type %d out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); return -1; } sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type; } }else{ assert(h->slice_type == P_TYPE || h->slice_type == SP_TYPE); for(i=0; i<4; i++){ h->sub_mb_type[i]= get_ue_golomb(&s->gb); if(h->sub_mb_type[i] >=4){ av_log(h->s.avctx, AV_LOG_ERROR, "P sub_mb_type %d out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); return -1; } sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].type; } } for(list=0; list<2; list++){ const int ref_count= IS_REF0(mb_type) ? 1 : h->ref_count[list]; if(ref_count == 0) continue; for(i=0; i<4; i++){ if(IS_DIR(h->sub_mb_type[i], 0, list) && !IS_DIRECT(h->sub_mb_type[i])){ ref[list][i] = get_te0_golomb(&s->gb, ref_count); }else{ ref[list][i] = -1; } } } for(list=0; list<2; list++){ const int ref_count= IS_REF0(mb_type) ? 1 : h->ref_count[list]; if(ref_count == 0) continue; for(i=0; i<4; i++){ h->ref_cache[list][ scan8[4*i] ]=h->ref_cache[list][ scan8[4*i]+1 ]= h->ref_cache[list][ scan8[4*i]+8 ]=h->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i]; if(IS_DIR(h->sub_mb_type[i], 0, list) && !IS_DIRECT(h->sub_mb_type[i])){ const int sub_mb_type= h->sub_mb_type[i]; const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1; for(j=0; j<sub_partition_count[i]; j++){ int mx, my; const int index= 4*i + block_width*j; int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ]; pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf("final mv:%d %d\n", mx, my); if(IS_SUB_8X8(sub_mb_type)){ mv_cache[ 0 ][0]= mv_cache[ 1 ][0]= mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx; mv_cache[ 0 ][1]= mv_cache[ 1 ][1]= mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= my; }else if(IS_SUB_8X4(sub_mb_type)){ mv_cache[ 0 ][0]= mv_cache[ 1 ][0]= mx; mv_cache[ 0 ][1]= mv_cache[ 1 ][1]= my; }else if(IS_SUB_4X8(sub_mb_type)){ mv_cache[ 0 ][0]= mv_cache[ 8 ][0]= mx; mv_cache[ 0 ][1]= mv_cache[ 8 ][1]= my; }else{ assert(IS_SUB_4X4(sub_mb_type)); mv_cache[ 0 ][0]= mx; mv_cache[ 0 ][1]= my; } } }else{ uint32_t *p= (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0]; p[0] = p[1]= p[8] = p[9]= 0; } } } }else if(!IS_DIRECT(mb_type)){ int list, mx, my, i; we should set ref_idx_l? to 0 if we use that later ... if(IS_16X16(mb_type)){ for(list=0; list<2; list++){ if(h->ref_count[0]>0){ if(IS_DIR(mb_type, 0, list)){ const int val= get_te0_golomb(&s->gb, h->ref_count[list]); fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, val, 1); } } } for(list=0; list<2; list++){ if(IS_DIR(mb_type, 0, list)){ pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf("final mv:%d %d\n", mx, my); fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4); } } } else if(IS_16X8(mb_type)){ for(list=0; list<2; list++){ if(h->ref_count[list]>0){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ const int val= get_te0_golomb(&s->gb, h->ref_count[list]); fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 1); } } } } for(list=0; list<2; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf("final mv:%d %d\n", mx, my); fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx,my), 4); } } } }else{ assert(IS_8X16(mb_type)); for(list=0; list<2; list++){ if(h->ref_count[list]>0){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ optimize const int val= get_te0_golomb(&s->gb, h->ref_count[list]); fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 1); } } } } for(list=0; list<2; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf("final mv:%d %d\n", mx, my); fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx,my), 4); } } } } } if(IS_INTER(mb_type)) write_back_motion(h, mb_type); if(!IS_INTRA16x16(mb_type)){ cbp= get_ue_golomb(&s->gb); if(cbp > 47){ av_log(h->s.avctx, AV_LOG_ERROR, "cbp too large (%d) at %d %d\n", cbp, s->mb_x, s->mb_y); return -1; } if(IS_INTRA4x4(mb_type)) cbp= golomb_to_intra4x4_cbp[cbp]; else cbp= golomb_to_inter_cbp[cbp]; } if(cbp || IS_INTRA16x16(mb_type)){ int i8x8, i4x4, chroma_idx; int chroma_qp, dquant; GetBitContext *gb= IS_INTRA(mb_type) ? h->intra_gb_ptr : h->inter_gb_ptr; const uint8_t *scan, *dc_scan; if(IS_INTERLACED(mb_type)){ scan= field_scan; dc_scan= luma_dc_field_scan; }else{ scan= zigzag_scan; dc_scan= luma_dc_zigzag_scan; } dquant= get_se_golomb(&s->gb); if( dquant > 25 || dquant < -26 ){ av_log(h->s.avctx, AV_LOG_ERROR, "dquant out of range (%d) at %d %d\n", dquant, s->mb_x, s->mb_y); return -1; } s->qscale += dquant; if(((unsigned)s->qscale) > 51){ if(s->qscale<0) s->qscale+= 52; else s->qscale-= 52; } h->chroma_qp= chroma_qp= get_chroma_qp(h, s->qscale); if(IS_INTRA16x16(mb_type)){ if( decode_residual(h, h->intra_gb_ptr, h->mb, LUMA_DC_BLOCK_INDEX, dc_scan, s->qscale, 16) < 0){ return -1; continue if partotioned and other retirn -1 too } assert((cbp&15) == 0 || (cbp&15) == 15); if(cbp&15){ for(i8x8=0; i8x8<4; i8x8++){ for(i4x4=0; i4x4<4; i4x4++){ const int index= i4x4 + 4*i8x8; if( decode_residual(h, h->intra_gb_ptr, h->mb + 16*index, index, scan + 1, s->qscale, 15) < 0 ){ return -1; } } } }else{ fill_rectangle(&h->non_zero_count_cache[scan8[0]], 4, 4, 8, 0, 1); } }else{ for(i8x8=0; i8x8<4; i8x8++){ if(cbp & (1<<i8x8)){ for(i4x4=0; i4x4<4; i4x4++){ const int index= i4x4 + 4*i8x8; if( decode_residual(h, gb, h->mb + 16*index, index, scan, s->qscale, 16) <0 ){ return -1; } } }else{ uint8_t * const nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ]; nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0; } } } if(cbp&0x30){ for(chroma_idx=0; chroma_idx<2; chroma_idx++) if( decode_residual(h, gb, h->mb + 256 + 16*4*chroma_idx, CHROMA_DC_BLOCK_INDEX, chroma_dc_scan, chroma_qp, 4) < 0){ return -1; } } if(cbp&0x20){ for(chroma_idx=0; chroma_idx<2; chroma_idx++){ for(i4x4=0; i4x4<4; i4x4++){ const int index= 16 + 4*chroma_idx + i4x4; if( decode_residual(h, gb, h->mb + 16*index, index, scan + 1, chroma_qp, 15) < 0){ return -1; } } } }else{ uint8_t * const nnz= &h->non_zero_count_cache[0]; nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] = nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0; } }else{ memset(&h->non_zero_count_cache[8], 0, 8*5); } s->current_picture.qscale_table[mb_xy]= s->qscale; write_back_non_zero_count(h); return 0; }
1threat
static int yuv4_write_header(AVFormatContext *s) { int* first_pkt = s->priv_data; if (s->nb_streams != 1) return AVERROR(EIO); if (s->streams[0]->codec->pix_fmt == PIX_FMT_YUV411P) { av_log(s, AV_LOG_ERROR, "Warning: generating rarely used 4:1:1 YUV stream, some mjpegtools might not work.\n"); else if ((s->streams[0]->codec->pix_fmt != PIX_FMT_YUV420P) && (s->streams[0]->codec->pix_fmt != PIX_FMT_YUV422P) && (s->streams[0]->codec->pix_fmt != PIX_FMT_GRAY8) && (s->streams[0]->codec->pix_fmt != PIX_FMT_YUV444P)) { av_log(s, AV_LOG_ERROR, "ERROR: yuv4mpeg only handles yuv444p, yuv422p, yuv420p, yuv411p and gray pixel formats. Use -pix_fmt to select one.\n"); return AVERROR(EIO); *first_pkt = 1; return 0;
1threat
Looking for a specified word in a DataBase Table : I have a DataBase called LogInData, where I have information about Usernames, Password, Email address stored in a table called LOGIN. When you register you can't use an already existing username because I am using this code: SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Mike\Documents\LogInData.mdf;Integrated Security=True;Connect Timeout=30"); SqlDataAdapter sda = new SqlDataAdapter("Select Count(*) From LOGIN where Username = '" + textBox1.Text + "' and Email = '" + textBox3.Text + "'", con); con.Open(); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows[0][0].ToString() == "1") { MessageBox.Show("Username already existing."); } And my question is : How does this code exactly work? I know that the first line creates a connection to the database. But what about the second row with the SqlDataAdapter and the row with the if? Thanks a lot for the help !
0debug
Can I use 2 or more Layout in 1 Activity? : ***Hello!*** I have ca. **30 Buttons** in an Activity (layout.xml (here are the buttons), mainActivity.java (here are the code). **So, my question is:** Can I use 30 different layout, for that 1 activity, or I have to make 30 different activity? I'd like to put all layout 2 gifs, and therefor I don't know how can I do this. Which option is the best, and if the first, how can I import to the layout or activity the gifs? Thanks for the answers! (Sorry for my bad English)
0debug
How to get mean of the values of one column in a pyspark dataframe based on the similarity of the corresponds values in another columns : I am new in pyspark, so I would be thankful if anyone can help to fix the problem. Suppose that I have a dataframe in pyspark as follows: col1 | col2 | col3 | col4 | col5 A | 2001 | 2 | 5 | 6 A | 2001 | 2 | 4 | 8 A | 2001 | 3 | 6 | 10 A | 2002 | 4 | 5 |2 B | 2001 | 2 | 9 |4 B | 2001 | 2 | 4 |3 B | 2001 | 2 | 3 |4 B | 2001 | 3 | 95 |7 I want to get the mean of the col4 if the corresponds values in col1, col2, and col3 are the same and then get rid of the rows with the repeated values in the first 3 columns. For example, the values of the col1, col2, col3 in the two first column are same, so, we want to eliminate one of them and update the value of col4 as the mean of 5 and 4. Te result should be: col1 |col2 col3 col4 A | 2001 | 2 | 4.5 | 7 A | 2001 | 3 | 6 | 10 A | 2002 | 4 | 5 | 2 B | 2001 | 2 | 5.33 | 3.67 B | 2001 | 3 | 95 |7 The similar question has been ask but in pandas dataframe. This question is asked in pyspark dataframe
0debug
Difference between Admob Ads and Firebase Ads : <p>I'm trying to migrate from Google analytics to the new Firebase analytics but I noticed there are libraries for ads too. Are firebase ads going to replace admob ads as well? Should I keep using admob via google play services? Or make a switch to the Firebase SDK? What's the difference anyways?</p>
0debug
Unable to Install Tensorflow (MemoryError) : <p>I tried to install Tensorflow on Linux Ubuntu 16.04 from source and using pip and I keep getting the following error <strong>return base64.b64encode(b).decode("ascii") MemoryError</strong>. I tried to google this problem but only found a website written in Chinese (probably) <a href="http://juncollin.hatenablog.com/entry/2017/03/05/025318" rel="noreferrer">http://juncollin.hatenablog.com/entry/2017/03/05/025318</a> that doesn't really help. </p>
0debug
Why is Oracle database tables getting deleted when i close the run sql command line prompt? : <p>All the tables data is getting deleted when shutting down the run sql and command line. Also there is only one user.</p>
0debug
Java - Reading specific words in a text file : <p>I am working on an exercise where I have multiple text file in a folder and I need to search for a specific keyword, eg.<em>Lorem</em> from the text file below.</p> <p>Text File Sample</p> <blockquote> <p>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. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> </blockquote> <p>Can anyone guide me how I should structure this. I am creating the I/O for a user to enter which keyword to search for, but since I consider myself a newbie to Java I am having some issues.</p> <p>I was thinking of adding the text files I need to search in an Array List, then read each file one by one.</p> <p>Thanks in advance.</p>
0debug
equalsIgnoreCase not working when value are different : <p>I have a method that compare the name of two products in an arraylist, this is the method:</p> <pre><code>public void compareNames(ArrayList&lt;Register&gt; register) { Register registerNew = null; Product productNew = null; int sumEqualProducts =0; for (int i = 0; i &lt;register.size() ; i++) { if ( register.get(i).getProduct().getNameOfProduct().equalsIgnoreCase(register.get(i+1).getProduct().getNameOfProduct())) { sumEqualProducts = register.get(i).getQuantity() + register.get(i + 1).getQuantity(); register.remove(i+1); productNew = new Product(register.get(i).getProduct().getNameOfProduct(), register.get(i).getProduto().getUnitValue()); registerNew = new Register(productNew, sumEqualProducts); register.set(i, registerNew); } } } </code></pre> <p>On the arraylist, I have 3 products, [Banana,baNANA,berry]. For the firts 2 index(Banana, baNANA), it's working as expected, the if is comparing the name of products and editing the value of index, with a new that have the sum of the 2 products with same name... But, when the comparison is between Banana and berry, the if is returning true, but should be false, because the values are not equal. Also, I'm getting this error:</p> <pre><code>java.lang.IndexOutOfBoundsException: Index: 2, Size: 2 </code></pre> <p><strong>How can I fix this comparison?</strong></p>
0debug
How to print boolean as string in php? : <p>I have a boolean in php. When I do something like :</p> <pre><code> sprintf('isTrue=%s', isTrue) Here isTrue is boolean </code></pre> <p>I get something like <code>isTrue=1</code> or <code>isTrue=</code>. Is there simple way to get <code>isTrue=True</code> or <code>isTrue=False</code></p>
0debug
automatically send mail birthday wishes in php without crone : i have a user table with date of birth and email address i want to send automatic email for there birthday wishes according date of birth in there email address. in php with mysql server please help me regrading this.
0debug
Can Java's Stream.collect() return null? : <p>The JavaDoc for Stream.collect() says that it returns <code>the result of the reduction</code>. That doesn't tell me if code like this can return null for filteredList:</p> <pre><code>List&lt;String&gt; filteredList = inputList.stream(). filter(c -&gt; c.getSomeBoolean()). flatMap(c -&gt; { List&lt;String&gt; l = new ArrayList&lt;String&gt;(); l.add(c.getSomething()); l.add(c.getSomethingElse()); return l.stream(); }). filter(s -&gt; StringUtils.isNotBlank(s)). collect(Collectors.toList()); </code></pre> <p>I would expect that if it could return null then it would return Optional, but it doesn't say that either.</p> <p>Is it documented anywhere whether Stream.collect() can return null?</p>
0debug
Convert Json String to List in andriod : strResponse = {"GetCitiesResult":["1-Vizag","2-Hyderbad","3-Pune","4-Chennai","9-123","11-Rohatash","12-gopi","13-Rohatash","14-Rohatash","10-123"]} JSONObject json = new JSONObject(strResponse); // get LL json object String json_LL = json.getJSONObject("GetCitiesResult").toString(); Now i want to convert the json string to List<Strings> in andriod
0debug
XCTests failing to launch app in simulator intermittently : <p>Has anyone experienced and fixed:</p> <p>XCtests failing intermittently to launch app in the simulator for UI testing (XCUI). I am running through fastlane, different tests appear to fail each test run.</p> <p>OSX: 10.12.3 iOS simulator: 10.0 XCode 8.2.1 Fastlane 2.11.0</p> <p>Attempted to fix it by adding a 3 second sleep between setup and launch in my tests, but it still appears, maybe not as often but still...</p> <blockquote> <p>UI Testing Failure - Failure attempting to launch : Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "no.something.bb.debug" failed." UserInfo={NSLocalizedDescription=The request to open "no.something.bb.debug" failed., NSLocalizedFailureReason=The request was denied by service delegate (SBMainWorkspace) for reason: Busy ("Application "no.something.bb.debug" is installing or uninstalling, and cannot be launched")., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0x6080002598f0 {Error Domain=FBSOpenApplicationErrorDomain Code=6 "Application "no.something.bb.debug" is installing or uninstalling, and cannot be launched." UserInfo={BSErrorCodeDescription=Busy, NSLocalizedFailureReason=Application "no.something.bb.debug" is installing or uninstalling, and cannot be launched.}}}</p> </blockquote>
0debug
integer expected got float(how to fix this issue ) : i am facing this problem in the code below. i couldn't understand how to fix it please give me a solution as am a beginner and don't know how to fix it i can just analyze where it arises w = curses.newwin(sh, sw, 0, 0) w.keypad(1) w.timeout(100) snk_x = sw/4 snk_y = sh/2 snake = [ [snk_y,snk_x], [snk_y,snk_x-1], [snk_y,snk_x-2] ] food = [sh/2,sw/2] w.addch(food[0], food[1],curses.ACS_PI)#here in this line i get error
0debug
static void ide_test_quit(void) { qtest_end(); }
1threat
Load a new package in ghci using stack : <p>Is there a way to load a package(s) using Stack in GHCI and play around with it ?</p> <p>So, that when the <code>ghci</code> is loaded, we can import the modules and see it's type signature, etc.</p>
0debug
could some one explain me how does sorting of a elements in java works? : i am beginner to java, i am confused about sorting of a elements in java, i am confused from the part "sorting begins"(commented section), could anyone kindly explain me. class endsly { public static void main(String[] args) { int num[]= {55,40,80,65,71}; int n= num.length; System.out.println("Given list: "); for(int i=0;i<n;i++) { System.out.println(" " + num[i]); } System.out.println("\n"); //sorting begins for(int i=0;i<n;i++) { for(int j=i+1;j<n;j++) { if(num[i]<num[j]) { int temp=num[i]; num[i]=num[j]; num[j]=temp; } } } System.out.println("Sorted list:"); for(int i=0;i<n;i++) { System.out.println(" " + num[i]); } System.out.println(" "); } }
0debug
Convert NSString to NSDate in objective c : <p>I am getting a NSString as @"27-Jan-2018 00:00".i just want to convert this string to NSDate class.Kindly suggest some methods to achieve this.Thanks in advance!</p>
0debug
PDO member function on Bolean : I was just simply trying to insert UTF8 data in database and retrieve but there is somethings really messing around ! It's just showing up one error. > Fatal error: Call to a member function fetchAll() on boolean Here is source codes. I did search about this problem but these are not working in this situation. Please don't mark this as duplicate because i tried all of and not working so that's why i posted. Thanks in advance. <?php error_reporting(E_ALL); ini_set('display_errors', true); header('Content-Type: text/html; charset=utf-8'); $pdo = new PDO('mysql:dbname=encoding_test;host=localhost', 'user', 'pass', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); if (!empty($_POST['text'])) { $stmt = $pdo->prepare('INSERT INTO `texts` (`text`) VALUES (:text)'); $stmt->execute(array('text' => $_POST['text'])); } $results = $pdo->query('SELECT * FROM `texts`')->fetchAll(PDO::FETCH_ASSOC); ?> <!DOCTYPE html> <html> <head> <title>UTF-8 encoding test</title> </head> <body> <h1>Display test</h1> <p> A good day, World!<br> Schönen Tag, Welt!<br> Une bonne journée, tout le monde!<br> يوم جيد، العالم<br> 좋은 일, 세계!<br> Một ngày tốt lành, thế giới!<br> こんにちは、世界!<br> </p> <h1>Submission test</h1> <form action="" method="post" accept-charset="utf-8"> <textarea name="text"></textarea> <input type="submit" value="Submit"> </form> <?php if (!empty($_POST['text'])) : ?> <h2>Last received data</h2> <pre><?php echo htmlspecialchars($_POST['text'], ENT_NOQUOTES, 'UTF-8'); ?></pre> <?php endif; ?> <h1>Output test</h1> <ul> <?php foreach ($results as $result) : ?> <li> <pre><?php echo htmlspecialchars($result['text'], ENT_NOQUOTES, 'UTF-8'); ?></pre> </li> <?php endforeach; ?> </ul> </body> </html>
0debug
I want Regular Expression For this Format(Years/M or Days/F) for ex:24Years/M or 24Days/F : <p>Any one please help me.</p> <p>the user enter age in textbox but the age format should be Years/M or Years/F or Days/M or Days/F </p>
0debug
static void residue_encode(vorbis_enc_context *venc, vorbis_enc_residue *rc, PutBitContext *pb, float *coeffs, int samples, int real_ch) { int pass, i, j, p, k; int psize = rc->partition_size; int partitions = (rc->end - rc->begin) / psize; int channels = (rc->type == 2) ? 1 : real_ch; int classes[MAX_CHANNELS][NUM_RESIDUE_PARTITIONS]; int classwords = venc->codebooks[rc->classbook].ndimentions; assert(rc->type == 2); assert(real_ch == 2); for (p = 0; p < partitions; p++) { float max1 = 0., max2 = 0.; int s = rc->begin + p * psize; for (k = s; k < s + psize; k += 2) { max1 = FFMAX(max1, fabs(coeffs[ k / real_ch])); max2 = FFMAX(max2, fabs(coeffs[samples + k / real_ch])); } for (i = 0; i < rc->classifications - 1; i++) if (max1 < rc->maxes[i][0] && max2 < rc->maxes[i][1]) break; classes[0][p] = i; } for (pass = 0; pass < 8; pass++) { p = 0; while (p < partitions) { if (pass == 0) for (j = 0; j < channels; j++) { vorbis_enc_codebook * book = &venc->codebooks[rc->classbook]; int entry = 0; for (i = 0; i < classwords; i++) { entry *= rc->classifications; entry += classes[j][p + i]; } put_codeword(pb, book, entry); } for (i = 0; i < classwords && p < partitions; i++, p++) { for (j = 0; j < channels; j++) { int nbook = rc->books[classes[j][p]][pass]; vorbis_enc_codebook * book = &venc->codebooks[nbook]; float *buf = coeffs + samples*j + rc->begin + p*psize; if (nbook == -1) continue; assert(rc->type == 0 || rc->type == 2); assert(!(psize % book->ndimentions)); if (rc->type == 0) { for (k = 0; k < psize; k += book->ndimentions) { float *a = put_vector(book, pb, &buf[k]); int l; for (l = 0; l < book->ndimentions; l++) buf[k + l] -= a[l]; } } else { int s = rc->begin + p * psize, a1, b1; a1 = (s % real_ch) * samples; b1 = s / real_ch; s = real_ch * samples; for (k = 0; k < psize; k += book->ndimentions) { int dim, a2 = a1, b2 = b1; float vec[MAX_CODEBOOK_DIM], *pv = vec; for (dim = book->ndimentions; dim--; ) { *pv++ = coeffs[a2 + b2]; if ((a2 += samples) == s) { a2 = 0; b2++; } } pv = put_vector(book, pb, vec); for (dim = book->ndimentions; dim--; ) { coeffs[a1 + b1] -= *pv++; if ((a1 += samples) == s) { a1 = 0; b1++; } } } } } } } } }
1threat
static void test_keyval_visit_alternate(void) { Error *err = NULL; Visitor *v; QDict *qdict; AltNumStr *ans; AltNumInt *ani; qdict = keyval_parse("a=1,b=2", NULL, &error_abort); v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); QDECREF(qdict); visit_start_struct(v, NULL, NULL, 0, &error_abort); visit_type_AltNumStr(v, "a", &ans, &error_abort); g_assert_cmpint(ans->type, ==, QTYPE_QSTRING); g_assert_cmpstr(ans->u.s, ==, "1"); qapi_free_AltNumStr(ans); visit_type_AltNumInt(v, "a", &ani, &err); error_free_or_abort(&err); visit_end_struct(v, NULL); visit_free(v); }
1threat
As i have 3 div how i can change the color of specific div without using class id and inline css : <div></div> <div> paragraph</div> <div>paragraph1</div> I want to change the background color of blank div without changes in Html part. and it should be change only through css Can any one help me out?
0debug
Why is the return type of the function not consistent with the actual sentence? : <p>In the program, it has:</p> <pre><code>EnergyFunctional* ef; ef-&gt;insertFrame(fh, &amp;Hcalib); </code></pre> <p>The function is defined as follows:</p> <pre><code>EFFrame* EnergyFunctional::insertFrame(FrameHessian* fh, CalibHessian* Hcalib) { EFFrame* eff = new EFFrame(fh); eff-&gt;idx = frames.size(); frames.push_back(eff); nFrames++; fh-&gt;efFrame = eff; assert(HM.cols() == 8*nFrames+CPARS-8); /// CPARS = 4 bM.conservativeResize(8*nFrames+CPARS); HM.conservativeResize(8*nFrames+CPARS,8*nFrames+CPARS); bM.tail&lt;8&gt;().setZero(); HM.rightCols&lt;8&gt;().setZero(); HM.bottomRows&lt;8&gt;().setZero(); EFIndicesValid = false; EFAdjointsValid=false; EFDeltaValid=false; setAdjointsF(Hcalib); makeIDX(); for(EFFrame* fh2 : frames) { connectivityMap[(((uint64_t)eff-&gt;frameID) &lt;&lt; 32) + ((uint64_t)fh2-&gt;frameID)] = Eigen::Vector2i(0,0); /// move left 32 bits if(fh2 != eff) connectivityMap[(((uint64_t)fh2-&gt;frameID) &lt;&lt; 32) + ((uint64_t)eff-&gt;frameID)] = Eigen::Vector2i(0,0); /// index is totally 64 bits, front 32 bits for each frame, rear 32 bits for current frame } return eff; } </code></pre> <p>It seems like the return type should be void so that it can be consistent with last sentence...</p> <p>I also checked if there is other same name "inserFrame" functions, but there is not. </p> <p>This program can be compiled successfully, but why can it be no problem?</p>
0debug
Mssql to server synchronization : I want to synchronize my local MSSQL database to the shared hosting mssql database from Mochahost.com what i will be required to do this ? or is there any easy way to synchronize this mssql database with mysql database please give me suggestions.
0debug
BlockDriverAIOCB *bdrv_aio_flush(BlockDriverState *bs, BlockDriverCompletionFunc *cb, void *opaque) { BlockDriver *drv = bs->drv; if (!drv) return NULL; return drv->bdrv_aio_flush(bs, cb, opaque);
1threat
static CharDriverState *qmp_chardev_open_socket(const char *id, ChardevBackend *backend, ChardevReturn *ret, Error **errp) { CharDriverState *chr; TCPCharDriver *s; ChardevSocket *sock = backend->u.socket; SocketAddress *addr = sock->addr; bool do_nodelay = sock->has_nodelay ? sock->nodelay : false; bool is_listen = sock->has_server ? sock->server : true; bool is_telnet = sock->has_telnet ? sock->telnet : false; bool is_waitconnect = sock->has_wait ? sock->wait : false; int64_t reconnect = sock->has_reconnect ? sock->reconnect : 0; ChardevCommon *common = qapi_ChardevSocket_base(backend->u.socket); chr = qemu_chr_alloc(common, errp); if (!chr) { return NULL; } s = g_new0(TCPCharDriver, 1); s->is_unix = addr->type == SOCKET_ADDRESS_KIND_UNIX; s->is_listen = is_listen; s->is_telnet = is_telnet; s->do_nodelay = do_nodelay; qapi_copy_SocketAddress(&s->addr, sock->addr); chr->opaque = s; chr->chr_write = tcp_chr_write; chr->chr_sync_read = tcp_chr_sync_read; chr->chr_close = tcp_chr_close; chr->get_msgfds = tcp_get_msgfds; chr->set_msgfds = tcp_set_msgfds; chr->chr_add_client = tcp_chr_add_client; chr->chr_add_watch = tcp_chr_add_watch; chr->chr_update_read_handler = tcp_chr_update_read_handler; chr->explicit_be_open = true; chr->filename = SocketAddress_to_str("disconnected:", addr, is_listen, is_telnet); if (is_listen) { if (is_telnet) { s->do_telnetopt = 1; } } else if (reconnect > 0) { s->reconnect_time = reconnect; } if (s->reconnect_time) { socket_try_connect(chr); } else if (!qemu_chr_open_socket_fd(chr, errp)) { g_free(s); qemu_chr_free_common(chr); return NULL; } if (is_listen && is_waitconnect) { fprintf(stderr, "QEMU waiting for connection on: %s\n", chr->filename); tcp_chr_accept(QIO_CHANNEL(s->listen_ioc), G_IO_IN, chr); qio_channel_set_blocking(QIO_CHANNEL(s->listen_ioc), false, NULL); } return chr; }
1threat
How to write less code : I have a simple question. Is it possible to rewrite this code below in less lines? $(document).ready(function(){ $("#clickShow").click(function(){ $("#cw1").toggleClass("showLess"); if($("#clickShow").text() === "Show more"){ $("#clickShow").text("Show less"); } else { $("#clickShow").text("Show more"); } }); $("#clickShow1").click(function(){ $("#cw2").toggleClass("showLess"); if($("#clickShow1").text() === "Show more"){ $("#clickShow1").text("Show less"); } else { $("#clickShow1").text("Show more"); } }); }); Thanks
0debug
Import data using query and group it by row values : Good day, I have a table with data which is structured like this: [table1][1] Is it possible to transform my table to table like this using query? [table2][2] [1]: https://i.stack.imgur.com/bOZOe.png [2]: https://i.stack.imgur.com/pWUtD.png
0debug
import math def fourth_Power_Sum(n): sum = 0 for i in range(1,n+1) : sum = sum + (i*i*i*i) return sum
0debug
VSCode :: How can I duplicate directories and files from within the file explorer? : <p>Ideally, I would right-click on the folder/directory or file I want to duplicate, choose "Duplicate" and, hopefully, would be asked in the same step to give the new duplicated file or directory a new name.</p> <p>Looking at the current options, I couldn't find a way to do this on latest VSCode 1.19.1 (macOS):</p> <p><a href="https://i.stack.imgur.com/1Mz4z.png" rel="noreferrer"><img src="https://i.stack.imgur.com/1Mz4z.png" alt="enter image description here"></a></p> <p><a href="https://i.stack.imgur.com/D8V0f.png" rel="noreferrer"><img src="https://i.stack.imgur.com/D8V0f.png" alt="enter image description here"></a></p> <p>Am I missing something? Is there other way to do this?</p> <p>The more I use VSCode, the more I get used to it and, lately, I found myself barely needing to use the terminal provided in the Panel, or switching to a terminal app, for simple stuff like this.</p>
0debug
While loops help countinng : I am having a hard time making a code for a while loop that asks a user to enter two numbers then displays the first number and all the numbers inbetween the second number. Please help!
0debug
rdt_new_context (void) { PayloadContext *rdt = av_mallocz(sizeof(PayloadContext)); avformat_open_input(&rdt->rmctx, "", &ff_rdt_demuxer, NULL); return rdt; }
1threat
static void http_log(char *fmt, ...) { va_list ap; va_start(ap, fmt); if (logfile) vfprintf(logfile, fmt, ap); va_end(ap); }
1threat
Parsing a .json column in Power BI : <p>I want to parse a .json column through Power BI. I have imported the data directly from the server and have a .json column in the data along with other columns. Is there a way to parse this json column?</p> <p>Example:</p> <pre><code> Key IDNumber Module JsonResult 012 200 Dine {"CategoryType":"dining","City":"mumbai"',"Location":"all"} 97 303 Fly {"JourneyType":"Return","Origin":"Mumbai (BOM)","Destination":"Chennai (MAA)","DepartureDate":"20-Oct-2016","ReturnDate":"21-Oct-2016","FlyAdult":"1","FlyChildren":"0","FlyInfant":"0","PromoCode":""} 276 6303 Stay {"Destination":"Clarion Chennai","CheckInDate":"14-Oct-2016","CheckOutDate":"15-Oct-2016","Rooms":"1","NoOfPax":"2","NoOfAdult":"2","NoOfChildren":"0"} </code></pre> <p>I wish to retain the other columns and also get the simplified parsed columns.</p>
0debug
Proper way to install pip on Ubuntu : <p>I'm trying to install the latest version of pip (currently 8.1.2) on the official ubuntu/trusty64 Vagrant box. The box comes with Python 2.7.6 and 3.4.3 pre-installed with apt-get.</p> <p>I read the <a href="https://pip.pypa.io/en/stable/installing/" rel="noreferrer">pip installation doc</a> and it contains the following warning:</p> <blockquote> <p>Be cautious if you're using a Python install that's managed by your operating system or another package manager. get-pip.py does not coordinate with those tools, and may leave your system in an inconsistent state.</p> </blockquote> <p>Does that mean I cannot install pip using get-pip.py and I am limited to install an older version of it from apt-get?</p> <p>If there is a better way of installing it, what would it be?</p> <p>Thanks</p>
0debug
.NET Standard Library vs. .NET Standard : <p>Reading some blogs and the official <a href="https://docs.microsoft.com/en-us/dotnet/articles/standard/library">documentation for .NET Core 1.0</a>, I'm still quite confused (like many others).<br> Don't get me wrong, I've literally read dozens of posts on the web trying to understand the architecture and terms for this new platform.</p> <p>Reading the docs and blogs, this is what they say about <strong>.NET Standard Library</strong>:</p> <blockquote> <p>The .NET Standard Library is a formal specification of .NET APIs that are intended to be available on all .NET runtimes.</p> </blockquote> <p>But they also use this term: <strong>.NET Standard</strong> and <strong>netstandard</strong> as you can see on the <a href="https://docs.microsoft.com/en-us/dotnet/articles/standard/library#net-platforms-support">Platform Support table</a>.</p> <p>Question: <strong>.NET Standard Library</strong> <code>==</code> <strong>.NET Standard</strong>? If not, what's difference?</p>
0debug
static void vmxnet3_net_init(VMXNET3State *s) { DeviceState *d = DEVICE(s); VMW_CBPRN("vmxnet3_net_init called..."); qemu_macaddr_default_if_unset(&s->conf.macaddr); memcpy(&s->perm_mac.a, &s->conf.macaddr.a, sizeof(s->perm_mac.a)); s->mcast_list = NULL; s->mcast_list_len = 0; s->link_status_and_speed = VMXNET3_LINK_SPEED | VMXNET3_LINK_STATUS_UP; VMW_CFPRN("Permanent MAC: " MAC_FMT, MAC_ARG(s->perm_mac.a)); s->nic = qemu_new_nic(&net_vmxnet3_info, &s->conf, object_get_typename(OBJECT(s)), d->id, s); s->peer_has_vhdr = vmxnet3_peer_has_vnet_hdr(s); s->tx_sop = true; s->skip_current_tx_pkt = false; s->tx_pkt = NULL; s->rx_pkt = NULL; s->rx_vlan_stripping = false; s->lro_supported = false; if (s->peer_has_vhdr) { qemu_peer_set_vnet_hdr_len(qemu_get_queue(s->nic), sizeof(struct virtio_net_hdr)); qemu_peer_using_vnet_hdr(qemu_get_queue(s->nic), 1); } qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a); }
1threat