problem
stringlengths
26
131k
labels
class label
2 classes
Differences between Visual Studio Build step and MSBuild Build step : <p>I'm creating some build definitions and the only difference I see between the Visual Studio Build Step and MSBuild Build Step is that the VS Build Step adds the visual studio version to the build. </p> <p>Somebody can explain maybe more differences?</p>
0debug
int hw_device_setup_for_encode(OutputStream *ost) { enum AVHWDeviceType type; HWDevice *dev; type = hw_device_match_type_in_name(ost->enc->name); if (type != AV_HWDEVICE_TYPE_NONE) { dev = hw_device_get_by_type(type); if (!dev) { av_log(ost->enc_ctx, AV_LOG_WARNING, "No device available " "for encoder (device type %s for codec %s).\n", av_hwdevice_get_type_name(type), ost->enc->name); return 0; } ost->enc_ctx->hw_device_ctx = av_buffer_ref(dev->device_ref); if (!ost->enc_ctx->hw_device_ctx) return AVERROR(ENOMEM); return 0; } else { return 0; } }
1threat
collect2: error: ld returned 1 exit status in c++ : <p>I have just switched to elementary os and installed sublime text editor. i wrote a basic hello world program in c++ to check the working. And I get this error.</p> <pre><code>/tmp/cc3Pmvft.o: In function `main': source.cpp:(.text+0xa): undefined reference to `std::cout' source.cpp:(.text+0xf): undefined reference to `std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; std::operator&lt;&lt; &lt;std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, char const*)' source.cpp:(.text+0x14): undefined reference to `std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; std::endl&lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;)' source.cpp:(.text+0x1c): undefined reference to `std::ostream::operator&lt;&lt;(std::ostream&amp; (*)(std::ostream&amp;))' /tmp/cc3Pmvft.o: In function `__static_initialization_and_destruction_0(int, int)': source.cpp:(.text+0x4a): undefined reference to `std::ios_base::Init::Init()' source.cpp:(.text+0x59): undefined reference to `std::ios_base::Init::~Init()' collect2: error: ld returned 1 exit status </code></pre> <p>The hello world program was,</p> <pre><code>#include &lt;iostream&gt; using namespace std; int main(){ cout &lt;&lt; "Hello World!" &lt;&lt; endl; return 0; } </code></pre> <p>I have searched for answer in google and stackoverflow but couldn't find a solution. </p>
0debug
Keycloak behind apache reverse proxy : <p>I have surfed through google without finding any <strong>concrete</strong> answers or <strong>examples</strong>, so again trying my luck here (often get lucky).</p> <p><strong>The problem</strong></p> <ul> <li><p>I have a single spring boot RESTful service running behind an apache reverse proxy. This RESTful service is running HTTP only. Say it's running on local ip 172.s port 8080.</p></li> <li><p>I have also configured an apache reverse proxy. Say it's running on local ip 172.a and public ip 55.a. This proxy responds to both port 80, but all the HTTP traffic is automatically redirected to 443.</p></li> <li><p>I have another server running a standalone Keycloak server. Also this server is configured to be public accessible through the reverse proxy. Say it's running on local ip 172.k. This Keycloak server is running on HTTP-only. The HTTP requests are handled using SSL over the reverse proxy.</p></li> <li><p>Last, I have another frontend-webapp running on local ip 172.f. This frontend-webapp is running under Nodejs, and is also configured through the reverse proxy. It's also running only HTTP, but client(browser) is using SSL through the reverse proxy, just as for the Keycloak and RESTful service. This frontend is consuming the RESTful service, and is also configured to authenticate using the keycloak javascript adapter.</p></li> <li><p>The RESTful service is configured as bearer-only using Spring Boot Keycloak adapter, while the frontend app is configured with access type public.</p></li> </ul> <p>The RESTful service server, Keycloak server, and the frontend server are not public accessible; they are accessible only through the reverse proxy. But they can communicate with each other (since they are in the same private network).</p> <p>In the frontend keycloak.json file, the <code>auth-server-url</code> is set to the proxy url <code>https://example.com/auth</code>, and the frontend is able to successfully get a valid token. Now when I try to consume the RESTful service, I get a error in RESTful adapter that the token issuer is invalid. In the http-header I am, of course, sending the <code>Authorization: Bearer &lt;token&gt;</code>. The reason I am getting this error is that in RESTful keycloak configuation, I have configured the <code>auth-server-url</code> to use the local url <code>http://172.k:9080/auth</code>, so this url is different from the one in the token (which is <code>https://example.com/auth</code>).</p> <p><strong>Question</strong></p> <p>I cannot include the same <code>auth-server-url</code> in the RESTful service as for the frontend, because that will require me to also setup HTTPs on the RESTful service (because that url is https), and that will complicate stuff a lot, including the need to setup certificates and stuff like that. Also I think it's inefficient and not practical to setup SSL on local only servers.</p> <p>So my question is how I can make the adapter talk to the Keycloak without going through the reverse proxy. I want the RESTful adapter to talk to the Keyclok server for token verification through <code>auth-server-url: http://172.k:9080/auth</code>.</p> <p>Earlier there was a different url for backend, that got removed: <a href="https://issues.jboss.org/browse/KEYCLOAK-2623" rel="noreferrer">https://issues.jboss.org/browse/KEYCLOAK-2623</a></p>
0debug
Stack Initialization : I'm still fairly new to C programming so sorry for this really basic question, but can anyone tell me what this particular code does part by part? What does "->" after the stack do? int StackInit(struct Stack *stack) { stack->currentItemIndex = -1; stack->initialized = true; return SUCCESS; }
0debug
Can you write if ( (x && y) || y || z) { do this;}? : <p>Newbie question: In C#, how do I put a set of conditions, and one of them must be two values or conditions that are true together, not just one of them. For example, is the following valid syntax:</p> <pre><code>if ( (x &amp;&amp; y) || y || z) { do this;} </code></pre>
0debug
static void rtas_system_reboot(sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { if (nargs != 0 || nret != 1) { rtas_st(rets, 0, -3); return; } qemu_system_reset_request(); rtas_st(rets, 0, 0); }
1threat
What is the fastest way to write a lot of documents to Firestore? : <p>I need to write a large number of documents to Firestore. </p> <p>What is the fastest way to do this in Node.js?</p>
0debug
size_t v9fs_pack(struct iovec *in_sg, int in_num, size_t offset, const void *src, size_t size) { return v9fs_packunpack((void *)src, in_sg, in_num, offset, size, 1); }
1threat
React.js - Can't read property of undefined : <p>I'm making very simple react app. Yet as I try to invoke method of parent (actually grandparent) component via onChange event, I keep getting <code>Uncaught TypeError: Cannot read property 'props' of undefined</code>.</p> <p>Here is the component/form that is triggering the event (thus invoking method on binded parent component... Yes I used .bound(this) on the method as I passed it down from parent component via props.).</p> <pre><code>class MonthsTable extends Component { handleChangeOnMonth(e){ this.props.setMonth(e.target.id, e.target.value); // here the method is not found, causing error. } render(){ console.log(this.props.setMonth) // here the method is present alright return (&lt;form&gt; {this.props.months.map((e, i) =&gt; &lt;input type='number' id={i} key={i} // yes I know, bad habit, but in this case it doesn't matter value={this.props.months[i]} onChange={this.handleChangeOnMonth} /&gt;)} &lt;/form&gt;) } } </code></pre> <p>Here is how I pass the method as props from most parent (grandparent) component.</p> <pre><code>&lt;Months setMonth={this.setMonth.bind(this)} /&gt; </code></pre> <p>Here is how I pass the method as props in the parent (the component that is between method owner and method invoker)</p> <pre><code>&lt;MonthsTable setMonth={this.props.setMonth} /&gt; </code></pre> <p>And finally passed to component (MonthsTable) that you saw first. Wheter it is relevant or not, final (most child) components is displayed depending of if statement which works just fine (Might somehow be relevant, I don't know).</p> <p>Question is... Why is the (setMonth) method 'invisible' inside of (handleChangeOnMonth) method.</p> <p>Thanks for any advice. </p>
0debug
alert('Hello ' + user_input);
1threat
static int load_option_rom(const char *oprom, target_phys_addr_t start, target_phys_addr_t end) { int size; char *filename; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, oprom); if (filename) { size = get_image_size(filename); if (size > 0 && start + size > end) { fprintf(stderr, "Not enough space to load option rom '%s'\n", oprom); exit(1); } size = load_image_targphys(filename, start, end - start); qemu_free(filename); } else { size = -1; } if (size < 0) { fprintf(stderr, "Could not load option rom '%s'\n", oprom); exit(1); } size = (size + 2047) & ~2047; option_rom_setup_reset(start, size); return size; }
1threat
C# name from string : <p>I can't find information about this. I need to make a lot of items, and it looks like this:</p> <pre><code>Bar01.Value = data[0]; Bar02.Value = data[1]; Bar03.Value = data[2]; Bar04.Value = data[3]; Bar05.Value = data[4]; Bar06.Value = data[5]; ... Bar99999.Value = data[99998] etc. </code></pre> <p>Is there a way to make a string for it like</p> <pre><code>for(int i=0;i&lt;max;i++) string s = "Bar"+i; //do stuff </code></pre> <p>So that it would be shorter ?</p>
0debug
Math.random starts to generate negatives while shouldn't : I have an issue with Math.random(); I've made an AI for game "Guessing number game" and it works just fine until the Player hit number **lower** than searched number. After that Math.random(); **may** and it is very likely to generate negative numbers. If player hit the number lower than searched number. (Range of numbers gessing by AI is defined by two nums (the highest from array of nums **lower[];** than searched and lowest from array **higher[];** than searched). Here is whole code on GitHub since its too large to put it in here and i really don't know where issue can be located: https://github.com/lkobylanski/Guessing-number-game-1P-AI/blob/master/PvAv1.2.js Function starts to generate negatvies during executting this part of code: else if(higher_l > 0 && lower_l > 0) { //losuje od 0 (ZERA) do (max-min+1) i dodaje + min; guessed = Math.floor(Math.random()*((higher[0])-((lower[0]+1)+1))+(lower[0]+1)); if(guessed > drawn) { c2--; document.getElementById("notes2").innerHTML = p2 + " remaining chances: " + c2; higher.push(guessed); higher_l = higher.length; higher.sort(function(a, b) {return a-b;}); resultH = resultH + guessed + " "; document.getElementById("higher").innerHTML = "Proper number is lower than: " + resultH; counter = setTimeout(checkCounters, 100); switch_trigger = setTimeout(switchPlayers, 2000); return; } else if(guessed < drawn) { c2--; document.getElementById("notes2").innerHTML = p2 + " remaining chances: " + c2; lower.push(guessed); lower_l = lower.length; lower.sort(function(a, b) {return b-a}); resultL = resultL + guessed+ " "; document.getElementById("lower").innerHTML = "Proper number is higher than: " + resultL; counter = setTimeout(checkCounters, 100); switch_trigger = setTimeout(switchPlayers, 2000); return; } else if(guessed == drawn) { p2w++; document.getElementById("all_wins").innerHTML = p1 + " wins: " + p1w + "/" + wins + "<br/>" + p2 + " wins " + p2w + "/" + wins; if(p2w < wins) { document.getElementById("msg").innerHTML = "AI found the number: " + guessed + "first!<br/>" + currentp + " and gets a point!"; document.getElementById("next").disabled = false; } else if(p2w == wins) { alert("Winner is " + currentp + "!"); document.getElementById("msg").innerHTML = "AI found the number: " + guessed + " <br/> Player: " + currentp + " reached required number of: " + wins + " wins first!"; } end = setTimeout(endMatch, 100); return; } } I know that the code itself could be a way better than this but i want to improve it when the whole thing will be working. I'll be very greatful for any help. Regards
0debug
RouterLink does not work : <p>My routing in the angular2 apps works well. But i am going to make some routeLink based on <a href="https://angular.io/docs/ts/latest/guide/router.html" rel="noreferrer">this</a>:</p> <p>Here is my routing:</p> <pre><code>const routes: RouterConfig = [ { path:'home' , component: FormComponent }, { path:'about', component: AboutComponent }, { path:'**' , component: FormComponent } ]; </code></pre> <p>And here is the links that i made:</p> <pre><code>&lt;ul class="nav navbar-nav item"&gt; &lt;li&gt; &lt;a routerLink='/home' routerLinkActive="active"&gt;Home&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a routerLink='/about' routerLinkActive="active"&gt;About this&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>I expect that, when i click on them it navigates to the respected component, but they do not perform anything?</p>
0debug
Why node *left,*right and not node* left,right? : <p>The type of left and right is node* so like other types they should be declared as node* left,right; Example int a,b; </p>
0debug
Could you explain the solution to front_back google python exercise : <p>I am looking for an explanation to the solution to the front_back google python exercise. Specifically, I do not understand why the % symbol (placeholder?) is used. I also do not understand why the length of the strings are divided by 2. Especially since 2 does not equal 1 (2==1??)</p> <p>The problem/solution is as follows:</p> <pre><code># F. front_back # Consider dividing a string into two halves. # If the length is even, the front and back halves are the same length. # If the length is odd, we'll say that the extra char goes in the front half. # e.g. 'abcde', the front half is 'abc', the back half 'de'. # Given 2 strings, a and b, return a string of the form # a-front + b-front + a-back + b-back def front_back(a, b): # +++your code here+++ # LAB(begin solution) # Figure out the middle position of each string. a_middle = len(a) / 2 b_middle = len(b) / 2 if len(a) % 2 == 1: # add 1 if length is odd a_middle = a_middle + 1 if len(b) % 2 == 1: b_middle = b_middle + 1 return a[:a_middle] + b[:b_middle] + a[a_middle:] + b[b_middle:] # LAB(replace solution) # return # LAB(end solution) </code></pre> <p>THANK YOU!</p>
0debug
possible help me again to get a percentage of the result also of the total number of bills : possible help me again to get a percentage of the result also of the total number of bills this code is calc number of order SELECT COUNT(*) FROM ( SELECT id FROM OrderDetails WHERE Product IN ('p1','p9') GROUP BY id HAVING COUNT(DISTINCT Product) = 2) AS t you can understand me if read it : http://stackoverflow.com/questions/35781468/how-to-select-two-products-where-it-is-in-same-orderdetails
0debug
static void contextidr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { ARMCPU *cpu = arm_env_get_cpu(env); if (env->cp15.contextidr_el1 != value && !arm_feature(env, ARM_FEATURE_MPU) && !extended_addresses_enabled(env)) { tlb_flush(CPU(cpu), 1); } env->cp15.contextidr_el1 = value; }
1threat
Is canva website used Backbone js..? : <p>I am going to do a web app which is relatively same as <a href="https://www.canva.com/" rel="nofollow noreferrer">canva</a>. I am very eager to know which js framework they used.</p> <h2>My question:</h2> <p>They used Backbone js..?</p> <ul> <li><p>If yes, why they used for it..? </p></li> <li><p>If no, what js they used..?</p></li> </ul> <p>I searched for the js framework they used in their <a href="https://engineering.canva.com/2015/10/01/tech-talks-august-2015/" rel="nofollow noreferrer">canva engineering site</a>, but can't able to retrieve the details.</p>
0debug
Java Multiple Input in a Single row : <p>Enter any number of integer values in a single row separated by space and the calculate and print the sum to next line.</p> <p>EX: input: 1 2 3 4 output: 10</p>
0debug
static av_always_inline av_flatten void FUNCC(h264_loop_filter_luma)(uint8_t *p_pix, int xstride, int ystride, int inner_iters, int alpha, int beta, int8_t *tc0) { pixel *pix = (pixel*)p_pix; int i, d; xstride >>= sizeof(pixel)-1; ystride >>= sizeof(pixel)-1; alpha <<= BIT_DEPTH - 8; beta <<= BIT_DEPTH - 8; for( i = 0; i < 4; i++ ) { const int tc_orig = tc0[i] << (BIT_DEPTH - 8); if( tc_orig < 0 ) { pix += inner_iters*ystride; continue; } for( d = 0; d < inner_iters; d++ ) { const int p0 = pix[-1*xstride]; const int p1 = pix[-2*xstride]; const int p2 = pix[-3*xstride]; const int q0 = pix[0]; const int q1 = pix[1*xstride]; const int q2 = pix[2*xstride]; if( FFABS( p0 - q0 ) < alpha && FFABS( p1 - p0 ) < beta && FFABS( q1 - q0 ) < beta ) { int tc = tc_orig; int i_delta; if( FFABS( p2 - p0 ) < beta ) { if(tc_orig) pix[-2*xstride] = p1 + av_clip( (( p2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - p1, -tc_orig, tc_orig ); tc++; } if( FFABS( q2 - q0 ) < beta ) { if(tc_orig) pix[ xstride] = q1 + av_clip( (( q2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - q1, -tc_orig, tc_orig ); tc++; } i_delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); pix[-xstride] = av_clip_pixel( p0 + i_delta ); pix[0] = av_clip_pixel( q0 - i_delta ); } pix += ystride; } } }
1threat
static int mov_probe(AVProbeData *p) { int64_t offset; uint32_t tag; int score = 0; offset = 0; for (;;) { if ((offset + 8) > (unsigned int)p->buf_size) return score; tag = AV_RL32(p->buf + offset + 4); switch(tag) { case MKTAG('j','P',' ',' '): case MKTAG('m','o','o','v'): case MKTAG('m','d','a','t'): case MKTAG('p','n','o','t'): case MKTAG('u','d','t','a'): case MKTAG('f','t','y','p'): return AVPROBE_SCORE_MAX; case MKTAG('e','d','i','w'): case MKTAG('w','i','d','e'): case MKTAG('f','r','e','e'): case MKTAG('j','u','n','k'): case MKTAG('p','i','c','t'): return AVPROBE_SCORE_MAX - 5; case MKTAG(0x82,0x82,0x7f,0x7d): case MKTAG('s','k','i','p'): case MKTAG('u','u','i','d'): case MKTAG('p','r','f','l'): offset = AV_RB32(p->buf+offset) + offset; score = AVPROBE_SCORE_MAX - 50; break; default: return score; } } }
1threat
PHP Collect class instances : I'm developing a WordPress plugin where I want to connect different apps. I created a class 'App' and I'm extending the 'App' class with different classes. Now I would like to collect all the objects of those instances so I can list them out. Anyone who can help me out? If interested I'm even willing to pay a good developer who can teach me this for future development. Looking forward to your replies. This is my current code: class App { public function __construct( $id, $name, $label, $description, $subscription_id ) { $this->id = $id; $this->name = $name; $this->label = $label; $this->description = $description; $this->subscription_id = $subscription_id; } } class App_Vimeo extends App { public function __construct( $id, $name, $label, $description, $subscription_id ) { $this->id = $id; $this->name = $name; $this->label = $label; $this->description = $description; $this->subscription_id = $subscription_id; } } class App_Facebook extends App { public function __construct( $id, $name, $label, $description, $subscription_id ) { $this->id = $id; $this->name = $name; $this->label = $label; $this->description = $description; $this->subscription_id = $subscription_id; } } class Get_Apps { public function __construct() { $this->get_apps(); } public static function get_apps() { $apps = array(); $apps[] = new App_Vimeo( 1, 'vimeo', 'Vimeo', 'Vimeo app description', 1 ); $apps[] = new App_Facebook( 1, 'facebook', 'Facebook', 'Facebook app description', 1 ); return $apps; } } $apps = Get_Apps::get_apps(); var_dump( $apps ); `
0debug
How to count the longest number of sequence that does not contain 3 in x=[1,2,3,4,5,6,5,4,3,3,4,5,2,3,7] with loop : I am answering possible questions related to python data structure and algorithm.
0debug
checking room availability for hotel booking system : hello i'm trying to check available rooms in booking system so i have two tables : table of rooms called chambre (`id`,`name`) and table reservation_client(`id`,`start`,`end`,`id_chambre`) the start and end are the check in and checkout dates. my query is : ``` $sql = "SELECT * FROM chambre WHERE id NOT IN (SELECT id_chambre FROM reservation_client WHERE end < '2019-07-20' AND start > '2019-07-19 ')"; ``` but its not give me any result .
0debug
static void memory_dump(int count, int format, int wsize, target_phys_addr_t addr, int is_physical) { CPUState *env; int nb_per_line, l, line_size, i, max_digits, len; uint8_t buf[16]; uint64_t v; if (format == 'i') { int flags; flags = 0; env = mon_get_cpu(); if (!env && !is_physical) return; #ifdef TARGET_I386 if (wsize == 2) { flags = 1; } else if (wsize == 4) { flags = 0; } else { flags = 0; if (env) { #ifdef TARGET_X86_64 if ((env->efer & MSR_EFER_LMA) && (env->segs[R_CS].flags & DESC_L_MASK)) flags = 2; else #endif if (!(env->segs[R_CS].flags & DESC_B_MASK)) flags = 1; } } #endif monitor_disas(env, addr, count, is_physical, flags); return; } len = wsize * count; if (wsize == 1) line_size = 8; else line_size = 16; nb_per_line = line_size / wsize; max_digits = 0; switch(format) { case 'o': max_digits = (wsize * 8 + 2) / 3; break; default: case 'x': max_digits = (wsize * 8) / 4; break; case 'u': case 'd': max_digits = (wsize * 8 * 10 + 32) / 33; break; case 'c': wsize = 1; break; } while (len > 0) { if (is_physical) term_printf(TARGET_FMT_plx ":", addr); else term_printf(TARGET_FMT_lx ":", (target_ulong)addr); l = len; if (l > line_size) l = line_size; if (is_physical) { cpu_physical_memory_rw(addr, buf, l, 0); } else { env = mon_get_cpu(); if (!env) break; cpu_memory_rw_debug(env, addr, buf, l, 0); } i = 0; while (i < l) { switch(wsize) { default: case 1: v = ldub_raw(buf + i); break; case 2: v = lduw_raw(buf + i); break; case 4: v = (uint32_t)ldl_raw(buf + i); break; case 8: v = ldq_raw(buf + i); break; } term_printf(" "); switch(format) { case 'o': term_printf("%#*" PRIo64, max_digits, v); break; case 'x': term_printf("0x%0*" PRIx64, max_digits, v); break; case 'u': term_printf("%*" PRIu64, max_digits, v); break; case 'd': term_printf("%*" PRId64, max_digits, v); break; case 'c': term_printc(v); break; } i += wsize; } term_printf("\n"); addr += l; len -= l; } }
1threat
SQLite3 UNIQUE constraint failed error : <p>I am trying to create a database which allows users to create 'to do' lists and fill them with items to complete. However, when inserting data into the tables it gives me a UNIQUE constraint failed error and I don't know how to solve it. This is my code for creating the database and inserting data.</p> <pre><code>CREATE TABLE user ( user_id integer NOT NULL PRIMARY KEY, first_name varchar(15) NOT NULL, title varchar(5) NOT NULL, username varchar(15) NOT NULL, password varchar(20) NOT NULL, email varchar(50) NOT NULL, bio text NOT NULL ); CREATE TABLE list ( list_id integer NOT NULL PRIMARY KEY, list_name varchar(10) NOT NULL, user_user_id integer NOT NULL, FOREIGN KEY (user_user_id) REFERENCES user(user_id) ); CREATE TABLE item ( item_id integer NOT NULL PRIMARY KEY, item text NOT NULL, completed boolean NOT NULL, list_list_id integer NOT NULL, FOREIGN KEY (list_list_id) REFERENCES list(list_id) ); -- Data: INSERT INTO user VALUES (1, "Name1", "Title1", "Username1", "Password1", "Email1", "Bio1"); INSERT INTO user VALUES (2, "Name2", "Title2", "Username2", "Password2", "Email2", "Bio2"); INSERT INTO user VALUES (3, "Name3", "Title3", "Username3", "Password3", "Email3", "Bio3"); INSERT INTO list VALUES (1, "user1-list1", 1); INSERT INTO list VALUES (2, "user1-list2", 1); INSERT INTO list VALUES (3, "user1-list3", 1); INSERT INTO list VALUES (1, "user2-list1", 2); INSERT INTO list VALUES (1, "user3-list1", 3); INSERT INTO list VALUES (2, "user3-list2", 3); INSERT INTO item VALUES (1, "user1-list1-item1", "FALSE", 1); INSERT INTO item VALUES (2, "user1-list1-item2", "FALSE", 1); INSERT INTO item VALUES (1, "user1-list2-item1", "FALSE", 2); INSERT INTO item VALUES (1, "user1-list3-item1", "FALSE", 3); INSERT INTO item VALUES (2, "user1-list3-item2", "FALSE", 3); INSERT INTO item VALUES (1, "user2-list1-item1", "FALSE", 1); INSERT INTO item VALUES (2, "user2-list1-item1", "FALSE", 1); INSERT INTO item VALUES (1, "user3-list1-item1", "FALSE", 1); INSERT INTO item VALUES (1, "user3-list3-item1", "FALSE", 2); </code></pre> <p>I have copied the errors I receive below:</p> <pre><code>Error: near line 43: UNIQUE constraint failed: list.list_id Error: near line 44: UNIQUE constraint failed: list.list_id Error: near line 45: UNIQUE constraint failed: list.list_id Error: near line 49: UNIQUE constraint failed: item.item_id Error: near line 50: UNIQUE constraint failed: item.item_id Error: near line 51: UNIQUE constraint failed: item.item_id Error: near line 52: UNIQUE constraint failed: item.item_id Error: near line 53: UNIQUE constraint failed: item.item_id Error: near line 54: UNIQUE constraint failed: item.item_id Error: near line 55: UNIQUE constraint failed: item.item_id </code></pre> <p>Any help would be appreciated!</p>
0debug
How set a notification every saturday in Android Studio? : I need to send a notification to the user evey saturday remainding an event. I am using android studio
0debug
Unable to save data in database using php : I am using the following code to save data in php. The data I want to save is: Latitudes:"[47.99267886541119,47.81223227508317]" Longitudes:"[19.403228759765625,19.015960693359375]" Please help me rectifyany error in the code. Thank you. <?php $con = mysqli_connect('localhost','root',''); if(!$con) { echo 'Not Connected To Server'; } if (!mysqli_select_db ($con,'test')) { echo 'Database Not Selected'; } for ($i=0;$i<count($_POST['Latitudes']);$i=$i+1) { $Latitude = $_POST['Latitudes'][$i]; } for ($i=0;$i<count($_POST['Longitudes']);$i=$i+1) { $Longitude= $_POST['Longitudes'][$i]; } $sql = "insert into polyline (lat,lng) values ('$Latitude','$Longitude')"; if (!mysqli_query($con,$sql)) { echo 'Not Inserted'; } else { echo 'Inserted Successfully'; } header("refresh:100; url=Final edited copy.html"); ?>
0debug
static SocketAddress *nbd_config(BDRVNBDState *s, QDict *options, Error **errp) { SocketAddress *saddr = NULL; QDict *addr = NULL; QObject *crumpled_addr = NULL; Visitor *iv = NULL; Error *local_err = NULL; qdict_extract_subqdict(options, &addr, "server."); if (!qdict_size(addr)) { error_setg(errp, "NBD server address missing"); goto done; } crumpled_addr = qdict_crumple(addr, errp); if (!crumpled_addr) { goto done; } iv = qobject_input_visitor_new(crumpled_addr); visit_type_SocketAddress(iv, NULL, &saddr, &local_err); if (local_err) { error_propagate(errp, local_err); goto done; } done: QDECREF(addr); qobject_decref(crumpled_addr); visit_free(iv); return saddr; }
1threat
Can we develop a Python API which wraps R code : <p>I have a working R script. Can this be wrapped in a Python code so it can be deployed as an API ? </p>
0debug
static av_cold int encode_init_ls(AVCodecContext *ctx) { ctx->coded_frame = av_frame_alloc(); if (!ctx->coded_frame) return AVERROR(ENOMEM); ctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; ctx->coded_frame->key_frame = 1; if (ctx->pix_fmt != AV_PIX_FMT_GRAY8 && ctx->pix_fmt != AV_PIX_FMT_GRAY16 && ctx->pix_fmt != AV_PIX_FMT_RGB24 && ctx->pix_fmt != AV_PIX_FMT_BGR24) { av_log(ctx, AV_LOG_ERROR, "Only grayscale and RGB24/BGR24 images are supported\n"); return -1; } return 0; }
1threat
Parse to FireBase Database MIgeration : Still my app uses Parse for storing user details for my existing application, since Parse announced that shutdown date for their service, we planned to use Firebase, Shall we import parse users into my firebase framework, if yes please suggest way to migrate parse to firebase
0debug
static void *qpa_thread_out (void *arg) { PAVoiceOut *pa = arg; HWVoiceOut *hw = &pa->hw; int threshold; threshold = conf.divisor ? hw->samples / conf.divisor : 0; if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { return NULL; } for (;;) { int decr, to_mix, rpos; for (;;) { if (pa->done) { goto exit; } if (pa->live > threshold) { break; } if (audio_pt_wait (&pa->pt, AUDIO_FUNC)) { goto exit; } } decr = to_mix = pa->live; rpos = hw->rpos; if (audio_pt_unlock (&pa->pt, AUDIO_FUNC)) { return NULL; } while (to_mix) { int error; int chunk = audio_MIN (to_mix, hw->samples - rpos); struct st_sample *src = hw->mix_buf + rpos; hw->clip (pa->pcm_buf, src, chunk); if (pa_simple_write (pa->s, pa->pcm_buf, chunk << hw->info.shift, &error) < 0) { qpa_logerr (error, "pa_simple_write failed\n"); return NULL; } rpos = (rpos + chunk) % hw->samples; to_mix -= chunk; } if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { return NULL; } pa->rpos = rpos; pa->live -= decr; pa->decr += decr; } exit: audio_pt_unlock (&pa->pt, AUDIO_FUNC); return NULL; }
1threat
static void gen_eob(DisasContext *s) { gen_eob_inhibit_irq(s, false); }
1threat
def add_consecutive_nums(nums): result = [b+a for a, b in zip(nums[:-1], nums[1:])] return result
0debug
uint64_t HELPER(neon_abdl_s16)(uint32_t a, uint32_t b) { uint64_t tmp; uint64_t result; DO_ABD(result, a, b, int8_t); DO_ABD(tmp, a >> 8, b >> 8, int8_t); result |= tmp << 16; DO_ABD(tmp, a >> 16, b >> 16, int8_t); result |= tmp << 32; DO_ABD(tmp, a >> 24, b >> 24, int8_t); result |= tmp << 48; return result; }
1threat
Python:How To Run A Python Script Inside Another Script And Close Itself Immediately : I Have a login frame and a main frame that made from pyqt, I want to run the main command after i clicked the button and when the main code runs close the login frame I wrote a def for clicking button but when the command executed the main frame still waits till i close the main window. this is the function of clicking button : def ButtonClicked(self): os.system('py Main.py') self.os.exit() How can i make the closing part immediately and not waiting for main.py to exit
0debug
How do I save a decimal number as hexadecimal on a single byte? : <pre><code>#include &lt;stdio.h&gt; int main() { int x = 255; char hex[4] = {0}; hex[0] = 0x02; hex[1] = 0x20; hex[2] = 0xef; hex[3] = x; for(int i = 0; i &lt; 4; i++) printf("%X ", hex[i]); } </code></pre> <p>This outputs " 2 20 FFFFFFEF FFFFFFFF". What should be changed so that it would output "02 20 EF FF"?</p>
0debug
I am getting an error "Uncaught Reference Error: jsf is not defined at HTMLAnchorElement.onclick".Please help me to resolve this issue : I am using JSF2.2 with RichFaces4.5. I have an xhtml page with a custom defined jsf tag for pdf pop up.But when i click on the pdf link in the page,i am getting the error "**Uncaught Reference Error: jsf is not defined at HTMLAnchorElement.onclick**" in the browser javascript console.I saw few questions which have been already posted related to this issue and the answers provided were to include <h:head> or <h:body> tags in the xhtml page.I tried those but still I am getting the same error.Could anyone please help me in resolving this out?
0debug
I'm trying to find the sum of each row, and then print them out from largest to smallest : `enter code here`import java.util.Arrays; `enter code here`import java.util.Scanner; `enter code here`import java.util.Collections; `enter code here`public class array_PA3{ `enter code here`public static void main(String[] args){ `enter code here`int[][] hoursArray = { `enter code here`{2,3,3,4,5,8,8,0}, `enter code here`{7,4,4,3,3,4,4,0}, `enter code here`{3,4,3,3,3,2,2,0}, `enter code here`{9,4,7,7,3,4,1,0}, `enter code here`{3,4,3,3,6,3,8,0}, `enter code here`{3,4,6,3,3,4,4,0}, `enter code here`{3,4,8,8,3,8,4,0}, `enter code here`{6,5,9,9,2,7,9,0}}; `enter code here`int maxRow = 0; `enter code here`int indexRow = 0; `enter code here`int [] totalRow = new int[8]; `enter code here`for (int row = 0; row <= 7; row++) { `enter code here`for (int column = 0; column <= 7; column++){ `enter code here`totalRow[row] += hoursArray[row][column]; `enter code here`} `enter code here`System.out.println("The sum of row " + row + " is " + totalRow[row] + "."); `enter code here`} `enter code here`Arrays.sort(totalRow, Collections.reverseOrder()); } }
0debug
Spring pagination - request parameters : <p>My REST contorller:</p> <pre><code> @GetMapping("/test") public Page&lt;MyObject&gt; pathParamTest(Pageable pageable) { return myService.getPage(pageable); } </code></pre> <p>I send a request like following:</p> <pre><code>localhost:8091/endpoint/test?page=0&amp;size=3&amp;sort=id&amp;direction=DESC </code></pre> <p>It's my response from server:</p> <pre><code>{ "content": [ { "id": 1 }, { "id": 2 }, { "id": 3 } ], "last": true, "totalPages": 1, "totalElements": 3, "first": true, "sort": [ { "direction": "ASC", "property": "id", "ignoreCase": false, "nullHandling": "NATIVE", "descending": false, "ascending": true } ], "numberOfElements": 3, "size": 3, "number": 0 } </code></pre> <p>but the request has still direction = ASC.</p> <p>How can I send to server direction = DESC?</p> <p>And why response has a field "last" = true, because next page has one element more?</p>
0debug
Disable eslint rules for folder : <p>Is there a way to disable specific rules for a folder? For example, I don't want to have required JSDoc comments for all my test files in the <code>test</code> folder. Is there a way to do this?</p>
0debug
Get value from Bottom Sheet Dialog Fragment : <p>I'm starting bottomSheetDialogFragment from a fragment A. I want to select the date from that bottomSheetDialogFragment then set it in the fragment A.</p> <p>The select date is already done, I just want to get it in the fragment A to set it in some fields.</p> <p>How can I get the value? Any suggestions how to do it?</p>
0debug
SwiftUI HStack fill whole width with equal spacing : <p>I have an HStack:</p> <pre><code>struct BottomList: View { var body: some View { HStack() { ForEach(navData) { item in NavItem(image: item.icon, title: item.title) } } } } </code></pre> <p><strong>How do I perfectly center its content with equal spacing automatically filling the whole width?</strong> </p> <p>FYI just like Bootstraps CSS class <code>.justify-content-around</code></p>
0debug
Make "Selected Context Only" persist in Chrome DevTools console settings : <p>I get a ton of misc errors from misc Chrome Extensions in my console. If I go to settings and check "Selected Context Only" then they go away and everything is good.</p> <p>If I ever close that tab, or open a fresh Chrome window, "Selected Context Only" is unchecked again.</p> <p>Is it possible to get this setting persisted forever and ever?</p>
0debug
connection.query('SELECT * FROM users WHERE username = ' + input_string)
1threat
static void test_submit(void) { WorkerTestData data = { .n = 0 }; thread_pool_submit(pool, worker_cb, &data); qemu_aio_wait_all(); g_assert_cmpint(data.n, ==, 1); }
1threat
Invalid date is populated when we use yyyy-MM-dd'T'HH:mm:ssXXX format in java : <p>When we convert the date from yyyy-MM-dd'T'HH:mm:ssXXX to YYMMDD date is invalid.</p> <p>Say.. If the date is 2019-02-27T12:52:58.249Z then the converted date is generated as "190258"</p>
0debug
php json decode special characters : <p>I wan't decode json string from file, but there is problem with special characters(for ex. '™', '★'..). My code from PHP</p> <pre><code>$price_string = file_get_contents("/var/www/bot/price.json"); $price = json_decode($price_string, true); echo $price["StatTrak™ P250 | Mehndi (Field-Tested)"]; </code></pre> <p>Result should be 12.01, but the result is this:</p> <pre><code>Notice: Undefined index: StatTrak� P250 | Mehndi (Minimal Wear) in /var/www/html/menu.php on line .. </code></pre> <p>And the JSON string is for example:</p> <pre><code>{ "★ Huntsman Knife | Boreal Forest (Well-Worn)": 62.84, "StatTrak™ P250 | Mehndi (Field-Tested)": 12.01 } </code></pre>
0debug
Replace period character (".") from an entire data.table column in R : <p>I am trying to remove all the period characters (<code>.</code>) from a data.table using <code>gsub</code>. Unfortunately, it isn't working. How do you propperly express the pattern to describe the periods to then replace them by nothing?</p> <p>My code:</p> <pre><code>dt[, Address := gsub(".", "", Address)] </code></pre> <p>Result:</p> <pre><code>head(dt$Address) [1] "" "" "" "" "" "" </code></pre> <p>I'm guessing that when <code>pattern = "."</code> R thinks I'm refering to the entire content of the object in question. What am I doing wrong?</p>
0debug
static void virtio_rng_initfn(Object *obj) { VirtIORNG *vrng = VIRTIO_RNG(obj); object_property_add_link(obj, "rng", TYPE_RNG_BACKEND, (Object **)&vrng->conf.rng, NULL); }
1threat
How can i load an activity when user connection error? : I want to load an activity when no connection - loadurl("#") not working. I tried to solve this problem but i can't so please if you can help me! [1] [1]: https://i.stack.imgur.com/xbkFn.png
0debug
A probleme with the gardle : > I used this tutorial https://developers.google.com/maps/documentation/android-api/start > This is my gardle : apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.3" defaultConfig { applicationId "com.example.amine.myapplicationmapamine" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.3.0' compile 'com.google.android.gms:play-services:9.8.00' } > Error : Error:Execution failed for task > ':app:transformClassesWithDexForDebug'. > com.android.build.api.transform.TransformException: > com.android.ide.common.process.ProcessException: > org.gradle.process.internal.ExecException: Process 'command > 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with > non-zero exit value 2
0debug
static uint32_t mb_add_cmdline(MultibootState *s, const char *cmdline) { target_phys_addr_t p = s->offset_cmdlines; char *b = (char *)s->mb_buf + p; get_opt_value(b, strlen(cmdline) + 1, cmdline); s->offset_cmdlines += strlen(b) + 1; return s->mb_buf_phys + p; }
1threat
static int vt82c686b_ide_initfn(PCIDevice *dev) { PCIIDEState *d = DO_UPCAST(PCIIDEState, dev, dev);; uint8_t *pci_conf = d->dev.config; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_VIA); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_VIA_IDE); pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_IDE); pci_config_set_prog_interface(pci_conf, 0x8a); pci_config_set_revision(pci_conf,0x06); pci_set_long(pci_conf + PCI_CAPABILITY_LIST, 0x000000c0); qemu_register_reset(via_reset, d); pci_register_bar(&d->dev, 4, 0x10, PCI_BASE_ADDRESS_SPACE_IO, bmdma_map); vmstate_register(&dev->qdev, 0, &vmstate_ide_pci, d); vt82c686b_init_ports(d); return 0; }
1threat
What is wrong with my Syntax here? (SQLite) : <p>Well I make some changes in my Table and now is showing me this error. I am try to Debug but with no luck. Any idea?</p> <p>"android.database.sqlite.SQLiteException: no such table: tablename (code 1): , while compiling: select * from tablename"</p> <pre><code> import java.util.ArrayList; import java.util.HashMap; import java.util.Hashtable; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.DatabaseUtils; import android.database.sqlite.SQLiteOpenHelper; import android.database.sqlite.SQLiteDatabase; public class DBHelper extends SQLiteOpenHelper { public static final String DATABASE_NAME = "MyDBName.db"; public static final String CONT_TABLE_NAME = "tablename"; public static final String CONT_COLUMN_ID = "id"; public static final String CONT_COLUMN_CONDUCTIVITY = "conductivity"; public static final String CONT_COLUMN_MOISTURE = "moisture"; public static final String CONT_COLUMN_OXYGEN = "oxygen"; public static final String CONT_COLUMN_PH = "ph"; private HashMap hp; public DBHelper(Context context) { super(context, DATABASE_NAME , null, 1); } @Override public void onCreate(SQLiteDatabase db) { // TODO Auto-generated method stub db.execSQL( "create table tablename " + "(id integer primary key, conductivity text,ph text,oxygen text, moisture text)" ); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // TODO Auto-generated method stub db.execSQL("DROP TABLE IF EXISTS tablename"); onCreate(db); } public boolean insertContact (String conductivity, String ph, String oxygen, String moisture) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues contentValues = new ContentValues(); contentValues.put("conductivity", conductivity); contentValues.put("ph", ph); contentValues.put("oxygen", oxygen); contentValues.put("moisture", moisture); db.insert("tablename", null, contentValues); return true; } public Cursor getData(int id){ SQLiteDatabase db = this.getReadableDatabase(); Cursor res = db.rawQuery( "select * from tablename where id="+id+"", null ); return res; } public int numberOfRows(){ SQLiteDatabase db = this.getReadableDatabase(); int numRows = (int) DatabaseUtils.queryNumEntries(db, CONT_TABLE_NAME); return numRows; } public boolean updateContact (Integer id, String conductivity, String ph, String oxygen, String moisture) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues contentValues = new ContentValues(); contentValues.put("conductivity", conductivity); contentValues.put("ph", ph); contentValues.put("oxygen", oxygen); contentValues.put("moisture", moisture); db.update("tablename", contentValues, "id = ? ", new String[] { Integer.toString(id) } ); return true; } public Integer deleteContact (Integer id) { SQLiteDatabase db = this.getWritableDatabase(); return db.delete("tablename", "id = ? ", new String[] { Integer.toString(id) }); } public ArrayList&lt;String&gt; getAllCotacts() { ArrayList&lt;String&gt; array_list = new ArrayList&lt;String&gt;(); //hp = new HashMap(); SQLiteDatabase db = this.getReadableDatabase(); Cursor res = db.rawQuery( "select * from tablename", null ); res.moveToFirst(); while(res.isAfterLast() == false){ array_list.add(res.getString(res.getColumnIndex(CONT_COLUMN_CONDUCTIVITY))); res.moveToNext(); } return array_list; } } </code></pre>
0debug
yuv2rgb48_2_c_template(SwsContext *c, const uint16_t *buf0, const uint16_t *buf1, const uint16_t *ubuf0, const uint16_t *ubuf1, const uint16_t *vbuf0, const uint16_t *vbuf1, const uint16_t *abuf0, const uint16_t *abuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, enum PixelFormat target) { int yalpha1 = 4095 - yalpha; int uvalpha1 = 4095 - uvalpha; int i; for (i = 0; i < (dstW >> 1); i++) { int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19; int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 19; int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19; int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19; const uint8_t *r = (const uint8_t *) c->table_rV[V], *g = (const uint8_t *)(c->table_gU[U] + c->table_gV[V]), *b = (const uint8_t *) c->table_bU[U]; dest[ 0] = dest[ 1] = r_b[Y1]; dest[ 2] = dest[ 3] = g[Y1]; dest[ 4] = dest[ 5] = b_r[Y1]; dest[ 6] = dest[ 7] = r_b[Y2]; dest[ 8] = dest[ 9] = g[Y2]; dest[10] = dest[11] = b_r[Y2]; dest += 12; } }
1threat
static int tcp_set_msgfds(CharDriverState *chr, int *fds, int num) { TCPCharDriver *s = chr->opaque; if (s->write_msgfds) { g_free(s->write_msgfds); } if (num) { s->write_msgfds = g_malloc(num * sizeof(int)); memcpy(s->write_msgfds, fds, num * sizeof(int)); } s->write_msgfds_num = num; return 0; }
1threat
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
Download pdf file inside WebView using AdvancedWebview : I'm struggling a lot on getting to download files inside an webView when link is clicked within it. I searched many forums and mostly they work when I run application in Bluestacks emulater but when I installed it in device, only Downloading file appears and nothing happens after that. Then I came across Advancced webView but I have no clue what to write inside if and else statement to get what I desires Here is the code from library to initiate download public void onDownloadRequested(String url, String suggestedFilename, String mimeType, long contentLength, String contentDisposition, String userAgent) { // some file is available for download // either handle the download yourself or use the code below if (AdvancedWebView.handleDownload(this, url, suggestedFilename)) { // download successfully handled } else { // download couldn't be handled because user has disabled download manager app on the device // TODO show some notice to the user } } and my manifest file is <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.faraksoch.sagar.eroutine"> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <application android:allowBackup="true" android:icon="@mipmap/icon" android:label="@string/app_name" android:roundIcon="@mipmap/icon" android:supportsRtl="true" android:theme="@style/Theme.AppCompat.NoActionBar"> <activity android:name=".MainActivity" android:configChanges="orientation" android:screenOrientation="portrait" android:theme="@style/AppTheme.TransNav"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".UpdateDialog" android:theme="@style/Theme.AppCompat.Dialog" /> <service android:name=".MyFirebaseMessagingService"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT" /> </intent-filter> </service> <service android:name=".MyFirebaseInstanceIDService"> <intent-filter> <action android:name="com.google.firebase.INSTANCE_ID_EVENT" /> </intent-filter> </service> <service android:name=".UpdateService" android:enabled="true" android:exported="true" /> </application> </manifest> Any help would be largely appreciated. And for the records , Download link are generated from Google drive and my main activity file is public class MainActivity extends AppCompatActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final WebView webView = (WebView) findViewById(webView); webView.loadUrl("file:///android_asset/C.html");
0debug
INLINE bits32 extractFloat32Frac( float32 a ) { return a & 0x007FFFFF; }
1threat
Warning: Added non-passive event listener to a scroll-blocking 'touchstart' event : <p>I am getting a weird warning while opening the application in chrome.I don't know how to get rid of this warning</p> <blockquote> <p>[Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive.</p> </blockquote> <p>any one pls help me put on this.Thanks in advance</p>
0debug
How to calculate this answer? : <p>Can you please tell me why in below code answer is 1610612736? How to calculate this answer? </p> <pre><code> #include &lt;stdio.h&gt; int main() { float h=4.1; printf("\n%d\n",h); return 0; } </code></pre>
0debug
int armv7m_nvic_acknowledge_irq(void *opaque) { nvic_state *s = (nvic_state *)opaque; uint32_t irq; irq = gic_acknowledge_irq(&s->gic, 0); if (irq == 1023) hw_error("Interrupt but no vector\n"); if (irq >= 32) irq -= 16; return irq; }
1threat
cap vs len of slice in golang : <p>What is the difference between cap and len of a slice in golang?</p> <p>According to definition:</p> <p>A slice has both a length and a capacity.</p> <p>The length of a slice is the number of elements it contains.</p> <p>The capacity of a slice is the number of elements in the underlying array, counting from the first element in the slice.</p> <pre><code>x := make([]int, 0, 5) // len(b)=0, cap(b)=5 </code></pre> <p>Does the len mean non null values only?</p>
0debug
void *virtqueue_alloc_element(size_t sz, unsigned out_num, unsigned in_num) { VirtQueueElement *elem; size_t in_addr_ofs = QEMU_ALIGN_UP(sz, __alignof__(elem->in_addr[0])); size_t out_addr_ofs = in_addr_ofs + in_num * sizeof(elem->in_addr[0]); size_t out_addr_end = out_addr_ofs + out_num * sizeof(elem->out_addr[0]); size_t in_sg_ofs = QEMU_ALIGN_UP(out_addr_end, __alignof__(elem->in_sg[0])); size_t out_sg_ofs = in_sg_ofs + in_num * sizeof(elem->in_sg[0]); size_t out_sg_end = out_sg_ofs + out_num * sizeof(elem->out_sg[0]); assert(sz >= sizeof(VirtQueueElement)); elem = g_malloc(out_sg_end); elem->out_num = out_num; elem->in_num = in_num; elem->in_addr = (void *)elem + in_addr_ofs; elem->out_addr = (void *)elem + out_addr_ofs; elem->in_sg = (void *)elem + in_sg_ofs; elem->out_sg = (void *)elem + out_sg_ofs; return elem; }
1threat
rebase vs reset vs revert? I just want to roll back : <p>Let's say I make a number of commits, let's call them 1, 2, 3, 4, 5, and 6 (hashes).</p> <p>Let's say I'm on a commit with hash 6. All I want to do is go back to hash 3, make it so the state of my codebase was as it was when I commited to hash 3 as if the other commit's never happened.</p> <p>When I look at answers like <a href="https://stackoverflow.com/questions/1895059/revert-to-a-commit-by-a-sha-hash-in-git">this</a>, it seems like everybody has a different answer. <code>reset</code>, <code>revert</code>, <code>rebase</code>? I'm not even sure I know the difference between those three words in english.</p> <p>I just want to be at a previous commit. Can someone tell me how to do this?</p>
0debug
Android App crashes upon creating Sqlite DB : I'm trying to use a database in my android app but when I start the activity that would use the DB helper/ Contract it crashes. I've tried some query validators and I don't seem to find any errors. The following I use to use my dbhelper but the second line causes the crash. DBhelper dbHelper = new DBhelper(this); mDatabase = dbHelper.getWritableDatabase(); Code for my dbcontract is: public final class DBcontract { private DBcontract(){} public static class DB_table1 implements BaseColumns { public static final String TABLE_Name = "Timer_table"; public static final String COL_1 = "id"; public static final String COL_2 = "Title"; public static final String COL_3 = "Startvalue"; public static final String COL_4 = "Endvalue"; public static final String COL_5 = "Timer"; } } and the dbhelper is: public class DBhelper extends SQLiteOpenHelper { public static final int DATABASE_VERSION = 1; public static final String DATABASE_NAME = "archeage.db"; //Create table query public static final String CREATE_TABLE = "" + "CREATE TABLE " + TABLE_Name + " ( " + DBcontract.DB_table1.COL_1 + " INTEGER PRIMARY KEY AUTO_INCREMENT, " + DBcontract.DB_table1.COL_2 + " TEXT NOT NULL, " + DBcontract.DB_table1.COL_3 + " INTEGER NOT NULL, " + DBcontract.DB_table1.COL_4 + " INTEGER NOT NULL, " + DBcontract.DB_table1.COL_5 + " INTEGER NOT NULL" + ");"; //delete table query public static final String DELETE_TABLE = "DROP TABLE IF EXISTS " + TABLE_Name; public DBhelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL(CREATE_TABLE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL(DELETE_TABLE); onCreate(db); } }
0debug
Kotlin and idiomatic way to write, 'if not null, else...' based around mutable value : <p>Suppose we have this code:</p> <pre><code>class QuickExample { fun function(argument: SomeOtherClass) { if (argument.mutableProperty != null ) { doSomething(argument.mutableProperty) } else { doOtherThing() } } fun doSomething(argument: Object) {} fun doOtherThing() {} } class SomeOtherClass { var mutableProperty: Object? = null } </code></pre> <p>Unlike in Java, where you could be left alone to worry about null dereferencing at runtime, this doesn't compile - quite rightly. Of course, <code>mutableProperty</code> may no longer be null once within the 'if'.</p> <p>My question is what's the best way to handle this?</p> <p>A few options are apparent. Without using any new Kotlin language features, the simplest way is obviously to copy the value to a method-scope one that won't subsequently change.</p> <p>There's this:</p> <pre><code>fun function(argument: SomeOtherClass) { argument.mutableProperty?.let { doSomething(it) return } doOtherThing() } </code></pre> <p>This has the obvious disadvantage that you need to return early or otherwise avoid executing the subsequent code - OK in certain, small contexts, but has a smell to it.</p> <p>Then there's this possibility:</p> <pre><code>fun function(argument: SomeOtherClass) { argument.mutableProperty.let { when { it != null -&gt; { doSomething(it) } else -&gt; { doOtherThing() } } } } </code></pre> <p>but whilst it has greater clarity of purpose, arguably it's more unwieldy and verbose than the Java-style way of dealing with this.</p> <p>Am I missing anything, and is there a preferred idiom with which to achieve this?</p>
0debug
Share a list between different processes in python : <p>I have the following problem. I have written a function that takes a list as input and creates a dictionary for each element in the list. I then want to append this dictionary to a new list, so I get a list of dictionaries. I am trying to spawn multiple processes for this. My problem here is that I want the different processes to access the list of dictionaries as it is updated by other processes, for example to print something once the has reached a certain length. My example would be like this:</p> <pre><code>import multiprocessing list=['A', 'B', 'C', 'D', 'E', 'F'] def do_stuff(element): element_dict={} element_dict['name']=element new_list=[] new_list.append(element_dict) if len(new_list)&gt;3: print 'list &gt; 3' ###Main### pool=multiprocessing.Pool(processes=6) pool.map(do_stuff, list) pool.close() </code></pre> <p>Right now my problem is that each process creates its own <code>new_list</code>. Is there a way to share the list between processes, such that all dictionaries are appended to the same list? Or is the only way to define the <code>new_list</code> outside of the function?</p>
0debug
Kotlin how to stop in init : following the code, in init function I create a Person object,and have an exception,now I want to stop the progress in catch like java return.how can I do it? class Person { val age: String = "10" private lateinit var person: Person init { try { person = get(2) } catch (exception: Throwable) { } println("----------------do it $person.age") } fun get(i: Int): Person { when (i) { 1 -> { return Person() } else -> { throw MyException("aaaaaaaaa") } } } }
0debug
PHP Notice: Undefined variable: str in : <p>My code</p> <pre><code>function rand_string($length) { $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; $size = strlen( $chars ); for( $i = 0; $i &lt; $length; $i++ ) { $str .= $chars[ rand( 0, $size - 1 ) ]; // this line error } return $str; } </code></pre> <p>Error</p> <blockquote> <p>PHP Notice: Undefined variable: str in ... on line 5 </p> </blockquote>
0debug
Generate a pandas dataframe from ordereddict? : <p>I am trying to create a pandas dataframe from an ordereddict to preserve the order of the values. But for some reason after creating the dataframe the fields are messed up again.</p> <p>Here's the list of ordereddicts:</p> <pre><code>[OrderedDict([ ('key_a', 'value_a'), ('key_b', 'value_b'), ]), OrderedDict([ ('key_a', 'value_c'), ('key_b', 'value_d'), ]) ] </code></pre> <p>Now how should I create a pandas DataFrame from these? What I am looking for is something like that (the important thing is the key_a and key_b etc column name order):</p> <pre><code> key_a key_b 0 value_a value_b 1 value_c value_d </code></pre> <p>I have tried:</p> <pre><code>pd.DataFrame.from_records(orderedDictList) pd.DataFrame.from_dict(orderedDictList) </code></pre> <p>Feel free to ask any additional questions.</p>
0debug
static void usb_mouse_class_initfn(ObjectClass *klass, void *data) { USBDeviceClass *uc = USB_DEVICE_CLASS(klass); uc->init = usb_mouse_initfn; uc->product_desc = "QEMU USB Mouse"; uc->usb_desc = &desc_mouse; uc->handle_packet = usb_generic_handle_packet; uc->handle_reset = usb_hid_handle_reset; uc->handle_control = usb_hid_handle_control; uc->handle_data = usb_hid_handle_data; uc->handle_destroy = usb_hid_handle_destroy; }
1threat
Use attributes for value tuples : <p>In C# 7.0, .NET introduces a new return value tuple types (functional programming), so instead of:</p> <pre><code>[NotNull] WrapperUser Lookup(int id) </code></pre> <p>I'd like to use value tuples:</p> <pre><code>(User, Info) Lookup(int id) </code></pre> <p>And I want to use attributes for these return types:</p> <pre><code>([NotNull] User, [CanBeNull] Info) Lookup(int id) </code></pre> <p>But VS2017 doesn't allow me to do it. How can I use attributes without using a wrapper class?</p>
0debug
Why gradle jars are written in `build/libs`? : <p>According to the <a href="https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html" rel="noreferrer">documentation of the Jar plugin</a>, the output directory is controlled by the <code>destinationDir</code> property:</p> <blockquote> <ul> <li><p><strong>File</strong> <code>destinationDir</code></p> <p>The directory where the archive is generated into.</p> <p>Default with java plugin: <code>project.distsDir</code></p></li> </ul> </blockquote> <p>Looking at the <a href="https://docs.gradle.org/current/dsl/org.gradle.api.Project.html" rel="noreferrer">documentation of the Project class</a> the same property is mentioned:</p> <blockquote> <p><strong>Properties added by the <code>java</code> plugin</strong></p> <ul> <li><code>distsDir</code>: The directory to generate TAR and ZIP archives into.</li> <li><code>distsDirName</code>: The name for the distributions directory. This in interpreted relative to the project' build directory.</li> </ul> </blockquote> <p>And Googling a bit I find <a href="https://docs.gradle.org/current/dsl/org.gradle.api.plugins.BasePluginConvention.html#org.gradle.api.plugins.BasePluginConvention:distsDirName" rel="noreferrer">a document specifying their defaults</a>:</p> <blockquote> <ul> <li><p><strong>File</strong> <code>distsDir</code> (read-only)</p> <p>The directory to generate TAR and ZIP archives into.</p> <p>Default with java plugin: <code>${project.buildDir}/${project.distsDirName}</code></p></li> <li><p><strong>String</strong> <code>distsDirName</code></p> <p>The name for the distributions directory. This in interpreted relative to the project' build directory.</p> <p>Default with java plugin: <code>'distributions'</code></p></li> </ul> </blockquote> <p>All these documents point to the same Gradle version, that matches the one I have installed.</p> <p>I add this in my <code>build.gradle</code> to check the real values of these properties:</p> <pre><code>println("distsDirName = " + project.distsDirName) println("distsDir = " + project.distsDir.toString()) jar { println("jar.destinationDir = " + destinationDir) } </code></pre> <p>And finally, I run <code>./gradlew</code> and check the output:</p> <pre><code>distsDirName = distributions distsDir = /home/ntrrgc/myProject/build/distributions jar.destinationDir = /home/ntrrgc/myProject/build/libs </code></pre> <p>Why does <code>jar.destinationDir</code> not respect its documented default?</p>
0debug
av_cold int ff_vaapi_encode_init(AVCodecContext *avctx, const VAAPIEncodeType *type) { VAAPIEncodeContext *ctx = avctx->priv_data; AVVAAPIFramesContext *recon_hwctx = NULL; AVVAAPIHWConfig *hwconfig = NULL; AVHWFramesConstraints *constraints = NULL; enum AVPixelFormat recon_format; VAStatus vas; int err, i; if (!avctx->hw_frames_ctx) { av_log(avctx, AV_LOG_ERROR, "A hardware frames reference is " "required to associate the encoding device.\n"); return AVERROR(EINVAL); } ctx->codec = type; ctx->codec_options = ctx->codec_options_data; ctx->va_config = VA_INVALID_ID; ctx->va_context = VA_INVALID_ID; ctx->priv_data = av_mallocz(type->priv_data_size); if (!ctx->priv_data) { err = AVERROR(ENOMEM); goto fail; } ctx->input_frames_ref = av_buffer_ref(avctx->hw_frames_ctx); if (!ctx->input_frames_ref) { err = AVERROR(ENOMEM); goto fail; } ctx->input_frames = (AVHWFramesContext*)ctx->input_frames_ref->data; ctx->device_ref = av_buffer_ref(ctx->input_frames->device_ref); if (!ctx->device_ref) { err = AVERROR(ENOMEM); goto fail; } ctx->device = (AVHWDeviceContext*)ctx->device_ref->data; ctx->hwctx = ctx->device->hwctx; err = ctx->codec->init(avctx); if (err < 0) goto fail; err = vaapi_encode_check_config(avctx); if (err < 0) goto fail; vas = vaCreateConfig(ctx->hwctx->display, ctx->va_profile, ctx->va_entrypoint, ctx->config_attributes, ctx->nb_config_attributes, &ctx->va_config); if (vas != VA_STATUS_SUCCESS) { av_log(avctx, AV_LOG_ERROR, "Failed to create encode pipeline " "configuration: %d (%s).\n", vas, vaErrorStr(vas)); err = AVERROR(EIO); goto fail; } hwconfig = av_hwdevice_hwconfig_alloc(ctx->device_ref); if (!hwconfig) { err = AVERROR(ENOMEM); goto fail; } hwconfig->config_id = ctx->va_config; constraints = av_hwdevice_get_hwframe_constraints(ctx->device_ref, hwconfig); if (!constraints) { err = AVERROR(ENOMEM); goto fail; } recon_format = AV_PIX_FMT_NONE; if (constraints->valid_sw_formats) { for (i = 0; constraints->valid_sw_formats[i] != AV_PIX_FMT_NONE; i++) { if (ctx->input_frames->sw_format == constraints->valid_sw_formats[i]) { recon_format = ctx->input_frames->sw_format; break; } } if (recon_format == AV_PIX_FMT_NONE) { recon_format = constraints->valid_sw_formats[0]; } } else { recon_format = ctx->input_frames->sw_format; } av_log(avctx, AV_LOG_DEBUG, "Using %s as format of " "reconstructed frames.\n", av_get_pix_fmt_name(recon_format)); if (ctx->aligned_width < constraints->min_width || ctx->aligned_height < constraints->min_height || ctx->aligned_width > constraints->max_width || ctx->aligned_height > constraints->max_height) { av_log(avctx, AV_LOG_ERROR, "Hardware does not support encoding at " "size %dx%d (constraints: width %d-%d height %d-%d).\n", ctx->aligned_width, ctx->aligned_height, constraints->min_width, constraints->max_width, constraints->min_height, constraints->max_height); err = AVERROR(EINVAL); goto fail; } av_freep(&hwconfig); av_hwframe_constraints_free(&constraints); ctx->recon_frames_ref = av_hwframe_ctx_alloc(ctx->device_ref); if (!ctx->recon_frames_ref) { err = AVERROR(ENOMEM); goto fail; } ctx->recon_frames = (AVHWFramesContext*)ctx->recon_frames_ref->data; ctx->recon_frames->format = AV_PIX_FMT_VAAPI; ctx->recon_frames->sw_format = recon_format; ctx->recon_frames->width = ctx->aligned_width; ctx->recon_frames->height = ctx->aligned_height; ctx->recon_frames->initial_pool_size = ctx->nb_recon_frames; err = av_hwframe_ctx_init(ctx->recon_frames_ref); if (err < 0) { av_log(avctx, AV_LOG_ERROR, "Failed to initialise reconstructed " "frame context: %d.\n", err); goto fail; } recon_hwctx = ctx->recon_frames->hwctx; vas = vaCreateContext(ctx->hwctx->display, ctx->va_config, ctx->aligned_width, ctx->aligned_height, VA_PROGRESSIVE, recon_hwctx->surface_ids, recon_hwctx->nb_surfaces, &ctx->va_context); if (vas != VA_STATUS_SUCCESS) { av_log(avctx, AV_LOG_ERROR, "Failed to create encode pipeline " "context: %d (%s).\n", vas, vaErrorStr(vas)); err = AVERROR(EIO); goto fail; } ctx->input_order = 0; ctx->output_delay = avctx->max_b_frames; ctx->decode_delay = 1; ctx->output_order = - ctx->output_delay - 1; if (ctx->codec->sequence_params_size > 0) { ctx->codec_sequence_params = av_mallocz(ctx->codec->sequence_params_size); if (!ctx->codec_sequence_params) { err = AVERROR(ENOMEM); goto fail; } } if (ctx->codec->picture_params_size > 0) { ctx->codec_picture_params = av_mallocz(ctx->codec->picture_params_size); if (!ctx->codec_picture_params) { err = AVERROR(ENOMEM); goto fail; } } if (ctx->codec->init_sequence_params) { err = ctx->codec->init_sequence_params(avctx); if (err < 0) { av_log(avctx, AV_LOG_ERROR, "Codec sequence initialisation " "failed: %d.\n", err); goto fail; } } ctx->output_buffer_pool = av_buffer_pool_init2(sizeof(VABufferID), avctx, &vaapi_encode_alloc_output_buffer, NULL); if (!ctx->output_buffer_pool) { err = AVERROR(ENOMEM); goto fail; } ctx->i_per_idr = 0; ctx->p_per_i = ((avctx->gop_size + avctx->max_b_frames) / (avctx->max_b_frames + 1)); ctx->b_per_p = avctx->max_b_frames; ctx->issue_mode = ISSUE_MODE_MAXIMISE_THROUGHPUT; return 0; fail: av_freep(&hwconfig); av_hwframe_constraints_free(&constraints); ff_vaapi_encode_close(avctx); return err; }
1threat
S390CPU *cpu_s390x_init(const char *cpu_model) { S390CPU *cpu; cpu = S390_CPU(object_new(TYPE_S390_CPU)); object_property_set_bool(OBJECT(cpu), true, "realized", NULL); return cpu; }
1threat
Sum values from array Javascript : <p>I have defined a variable called Total which is a Array like this:</p> <pre><code>Var Total[{"SubTotal":9000},{"SubTotal":20000},{"SubTotal":14000}] </code></pre> <p>I want to sum values 9000, 20000, 14000</p>
0debug
html css3 how to center multiple divs in other div vertically and horizonally with multiple lines of divs made by clear: both : I have such a html: <div id="content"> <div id="letter1">T</div> <div id="letter2">H</div> <div id="letter3">A</div> <div id="letter4">T</div> <div id="letter5" style="clear: both;">W</div> <div id="letter6">O</div> <div id="letter7">R</div> <div id="letter8">K</div> <div id="letter9">S</div> </div> As you can see I have a string divided on chars, each char in another div. **I want to have each word in separate line, each centered horizontally. Take under consideration `clear: both;` to start new line.** Vertical alignment woudl be nice but is not necessity. Number of words (lines) and letters vary depeneding on situation. All the guides i have found about centering tell about centering multiple divs but they are in one line or are centered after free break line (there is no space for next div in line so it takes next line with remaining divs and center the line). Can anybody help me?
0debug
Checking if the Password and Username boxes are present and default text in them, Using Selenium Java Testng : Below is the code that i wrote for verifying that the username and password fileds are present on the login page and the default text (Username in username box and Password in password box). I have also pasted the error that I am getting while executing this test. Any help would be appreicated. I did look around did find a few things but nothing fits excatly in my case. Thats why came here to ask experts. public void VerifyUserNamePassFieldPresence() { assertElementPresent("//input[@name='name-of-this-field' and @type='text']"); driver.findElement(By.xpath(".//*[@id='LoginForm_username']")).getText(); System.out.println(driver.findElement(By.xpath(".//*[@id='LoginForm_username']"))); System.out.println("------------------------------------------------------------------------------------"); Assert.assertTrue(driver.findElement(By.xpath(".//*[@id='LoginForm_password']")).getText().matches("Password")); } Error - FAILED: VerifyUserNamePassFieldPresence java.lang.AssertionError: expected [true] but found [false] at org.testng.Assert.fail(Assert.java:93) at org.testng.Assert.failNotEquals(Assert.java:512) at org.testng.Assert.assertTrue(Assert.java:41) at org.testng.Assert.assertTrue(Assert.java:51) at pages.LoginPage.VerifyUserNamePassFieldPresence(LoginPage.java:36) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108) at org.testng.internal.Invoker.invokeMethod(Invoker.java:661) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:869) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1193) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) at org.testng.TestRunner.privateRun(TestRunner.java:744) at org.testng.TestRunner.run(TestRunner.java:602) at org.testng.SuiteRunner.runTest(SuiteRunner.java:380) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340) at org.testng.SuiteRunner.run(SuiteRunner.java:289) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301) at org.testng.TestNG.runSuitesLocally(TestNG.java:1226) at org.testng.TestNG.runSuites(TestNG.java:1144) at org.testng.TestNG.run(TestNG.java:1115) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)
0debug
static void e1000e_macreg_write(e1000e_device *d, uint32_t reg, uint32_t val) { qpci_io_writel(d->pci_dev, d->mac_regs + reg, val); }
1threat
static int qio_channel_websock_handshake_process(QIOChannelWebsock *ioc, const char *line, size_t size, Error **errp) { int ret = -1; char *protocols = qio_channel_websock_handshake_entry( line, size, QIO_CHANNEL_WEBSOCK_HEADER_PROTOCOL); char *version = qio_channel_websock_handshake_entry( line, size, QIO_CHANNEL_WEBSOCK_HEADER_VERSION); char *key = qio_channel_websock_handshake_entry( line, size, QIO_CHANNEL_WEBSOCK_HEADER_KEY); if (!protocols) { error_setg(errp, "Missing websocket protocol header data"); goto cleanup; } if (!version) { error_setg(errp, "Missing websocket version header data"); goto cleanup; } if (!key) { error_setg(errp, "Missing websocket key header data"); goto cleanup; } if (!g_strrstr(protocols, QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY)) { error_setg(errp, "No '%s' protocol is supported by client '%s'", QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY, protocols); goto cleanup; } if (!g_str_equal(version, QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION)) { error_setg(errp, "Version '%s' is not supported by client '%s'", QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION, version); goto cleanup; } if (strlen(key) != QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN) { error_setg(errp, "Key length '%zu' was not as expected '%d'", strlen(key), QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN); goto cleanup; } ret = qio_channel_websock_handshake_send_response(ioc, key, errp); cleanup: g_free(protocols); g_free(version); g_free(key); return ret; }
1threat
void ff_mpeg_set_erpic(ERPicture *dst, Picture *src) { int i; if (!src) return; dst->f = &src->f; dst->tf = &src->tf; for (i = 0; i < 2; i++) { dst->motion_val[i] = src->motion_val[i]; dst->ref_index[i] = src->ref_index[i]; } dst->mb_type = src->mb_type; dst->field_picture = src->field_picture; }
1threat
static int idcin_probe(AVProbeData *p) { unsigned int number; if (p->buf_size < 20) return 0; number = AV_RL32(&p->buf[0]); if ((number == 0) || (number > 1024)) return 0; number = AV_RL32(&p->buf[4]); if ((number == 0) || (number > 1024)) return 0; number = AV_RL32(&p->buf[8]); if ((number != 0) && ((number < 8000) | (number > 48000))) return 0; number = AV_RL32(&p->buf[12]); if (number > 2) return 0; number = AV_RL32(&p->buf[16]); if (number > 2) return 0; return AVPROBE_SCORE_MAX / 2; }
1threat
The type org.springframework.context.ConfigurableApplicationContext cannot be resolved. It is indirectly referenced from required .class files : <p>I am following the tutorial at <a href="https://spring.io/guides/gs/actuator-service/" rel="noreferrer">spring.io</a> to build a spring app using spring boot.</p> <p>I can get the program to run perfectly on one computer. When I try on a different computer I get the following error</p> <blockquote> <p>The type org.springframework.context.ConfigurableApplicationContext cannot be resolved. It is indirectly referenced from required .class files</p> </blockquote> <p>I have tried deleting and adding my JRE Systems Library (JDK 1.8), as well as cleaning and updating the project using maven, and even deleting and re-importing the entire project. All of these methods have shown no success.</p> <p>My pom file is</p> <pre><code>&lt;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/maven-v4_0_0.xsd"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;parent&gt; &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt; &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt; &lt;version&gt;1.4.1.RELEASE&lt;/version&gt; &lt;/parent&gt; &lt;groupId&gt;test.api&lt;/groupId&gt; &lt;artifactId&gt;api.test&lt;/artifactId&gt; &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt; &lt;name&gt;api.test Maven Webapp&lt;/name&gt; &lt;url&gt;http://maven.apache.org&lt;/url&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt; &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt; &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt; &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt; &lt;scope&gt;test&lt;/scope&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;properties&gt; &lt;java.version&gt;1.8&lt;/java.version&gt; &lt;/properties&gt; &lt;build&gt; &lt;finalName&gt;api.test&lt;/finalName&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt; &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;/project&gt; </code></pre> <p>The class that is giving me the error is the HelloWorldConfiguration.java class</p> <pre><code>package hello; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class HelloWorldConfiguration { public static void main(String[] args) { SpringApplication.run(HelloWorldConfiguration.class, args); } } </code></pre> <p>Any help would be greatly appreciated. Thank you.</p>
0debug
How do I code a program that will create drop down lists from input and populate columns in another sheet with drop downs : <p>I am new to VBA and currently know how to create Macros using the "Record Macro" option. I need to code something that does multiple steps in VBA.</p> <p>I will have an unknown number of columns that I need the program to go through and check if the second row has a value in it.(These columns and rows will be input from a user so the number of columns or entries per row is unknown). </p> <p>The values under each column are the possible categories a user will later choose from for that specific variable. So in Sheet 1 there is a variable "Sex" there will be one row under it saying "female" and another row under that saying "male". These have to be made into a drop down list and pasted under another sheet (Sheet2) in which the same column names (Sex) will now have drop downs under them.</p> <p>Steps to take: </p> <p>1) IF Column(i)'s Row 2 is not empty</p> <p>2) Then define all rows below it as a list and make a drop down of this list</p> <p>3) Then paste this drop down under a column that matches the name of the Column(i) in another sheet</p> <h1>SHEET 1 (what i have)</h1> <pre><code>Age | Sex | Race | Height ------------------------------------ [EMPTY] |Female |Asian |[EMPTY] [EMPTY] |Male |Black |[EMPTY] [EMPTY] |[EMPTY] |Hispanic|[EMPTY] [EMPTY] |[EMPTY] |Native A|[EMPTY] [EMPTY] |[EMPTY] |White |[EMPTY] [EMPTY] |[EMPTY] |Other |[EMPTY] </code></pre> <hr> <h1>SHEET 2 (what I want)</h1> <pre><code>AGE | Sex | Race | Height ------------------------------------------------------------ [EMPTY] | [dropdown of sex] | [dropdown of race] |[EMPTY] </code></pre>
0debug
static void hls_prediction_unit(HEVCContext *s, int x0, int y0, int nPbW, int nPbH, int log2_cb_size, int partIdx) { #define POS(c_idx, x, y) \ &s->frame->data[c_idx][((y) >> s->sps->vshift[c_idx]) * s->frame->linesize[c_idx] + \ (((x) >> s->sps->hshift[c_idx]) << s->sps->pixel_shift)] HEVCLocalContext *lc = &s->HEVClc; int merge_idx = 0; struct MvField current_mv = {{{ 0 }}}; int min_pu_width = s->sps->min_pu_width; MvField *tab_mvf = s->ref->tab_mvf; RefPicList *refPicList = s->ref->refPicList; HEVCFrame *ref0, *ref1; int tmpstride = MAX_PB_SIZE; uint8_t *dst0 = POS(0, x0, y0); uint8_t *dst1 = POS(1, x0, y0); uint8_t *dst2 = POS(2, x0, y0); int log2_min_cb_size = s->sps->log2_min_cb_size; int min_cb_width = s->sps->min_cb_width; int x_cb = x0 >> log2_min_cb_size; int y_cb = y0 >> log2_min_cb_size; int x_pu, y_pu; int i, j; int skip_flag = SAMPLE_CTB(s->skip_flag, x_cb, y_cb); if (!skip_flag) lc->pu.merge_flag = ff_hevc_merge_flag_decode(s); if (skip_flag || lc->pu.merge_flag) { if (s->sh.max_num_merge_cand > 1) merge_idx = ff_hevc_merge_idx_decode(s); else merge_idx = 0; ff_hevc_luma_mv_merge_mode(s, x0, y0, nPbW, nPbH, log2_cb_size, partIdx, merge_idx, &current_mv); } else { enum InterPredIdc inter_pred_idc = PRED_L0; int mvp_flag; ff_hevc_set_neighbour_available(s, x0, y0, nPbW, nPbH); if (s->sh.slice_type == B_SLICE) inter_pred_idc = ff_hevc_inter_pred_idc_decode(s, nPbW, nPbH); if (inter_pred_idc != PRED_L1) { if (s->sh.nb_refs[L0]) { current_mv.ref_idx[0]= ff_hevc_ref_idx_lx_decode(s, s->sh.nb_refs[L0]); } current_mv.pred_flag[0] = 1; hls_mvd_coding(s, x0, y0, 0); mvp_flag = ff_hevc_mvp_lx_flag_decode(s); ff_hevc_luma_mv_mvp_mode(s, x0, y0, nPbW, nPbH, log2_cb_size, partIdx, merge_idx, &current_mv, mvp_flag, 0); current_mv.mv[0].x += lc->pu.mvd.x; current_mv.mv[0].y += lc->pu.mvd.y; } if (inter_pred_idc != PRED_L0) { if (s->sh.nb_refs[L1]) { current_mv.ref_idx[1]= ff_hevc_ref_idx_lx_decode(s, s->sh.nb_refs[L1]); } if (s->sh.mvd_l1_zero_flag == 1 && inter_pred_idc == PRED_BI) { AV_ZERO32(&lc->pu.mvd); } else { hls_mvd_coding(s, x0, y0, 1); } current_mv.pred_flag[1] = 1; mvp_flag = ff_hevc_mvp_lx_flag_decode(s); ff_hevc_luma_mv_mvp_mode(s, x0, y0, nPbW, nPbH, log2_cb_size, partIdx, merge_idx, &current_mv, mvp_flag, 1); current_mv.mv[1].x += lc->pu.mvd.x; current_mv.mv[1].y += lc->pu.mvd.y; } } x_pu = x0 >> s->sps->log2_min_pu_size; y_pu = y0 >> s->sps->log2_min_pu_size; for (j = 0; j < nPbH >> s->sps->log2_min_pu_size; j++) for (i = 0; i < nPbW >> s->sps->log2_min_pu_size; i++) tab_mvf[(y_pu + j) * min_pu_width + x_pu + i] = current_mv; if (current_mv.pred_flag[0]) { ref0 = refPicList[0].ref[current_mv.ref_idx[0]]; if (!ref0) return; hevc_await_progress(s, ref0, &current_mv.mv[0], y0, nPbH); } if (current_mv.pred_flag[1]) { ref1 = refPicList[1].ref[current_mv.ref_idx[1]]; if (!ref1) return; hevc_await_progress(s, ref1, &current_mv.mv[1], y0, nPbH); } if (current_mv.pred_flag[0] && !current_mv.pred_flag[1]) { DECLARE_ALIGNED(16, int16_t, tmp[MAX_PB_SIZE * MAX_PB_SIZE]); DECLARE_ALIGNED(16, int16_t, tmp2[MAX_PB_SIZE * MAX_PB_SIZE]); luma_mc(s, tmp, tmpstride, ref0->frame, &current_mv.mv[0], x0, y0, nPbW, nPbH); if ((s->sh.slice_type == P_SLICE && s->pps->weighted_pred_flag) || (s->sh.slice_type == B_SLICE && s->pps->weighted_bipred_flag)) { s->hevcdsp.weighted_pred(s->sh.luma_log2_weight_denom, s->sh.luma_weight_l0[current_mv.ref_idx[0]], s->sh.luma_offset_l0[current_mv.ref_idx[0]], dst0, s->frame->linesize[0], tmp, tmpstride, nPbW, nPbH); } else { s->hevcdsp.put_unweighted_pred(dst0, s->frame->linesize[0], tmp, tmpstride, nPbW, nPbH); } chroma_mc(s, tmp, tmp2, tmpstride, ref0->frame, &current_mv.mv[0], x0 / 2, y0 / 2, nPbW / 2, nPbH / 2); if ((s->sh.slice_type == P_SLICE && s->pps->weighted_pred_flag) || (s->sh.slice_type == B_SLICE && s->pps->weighted_bipred_flag)) { s->hevcdsp.weighted_pred(s->sh.chroma_log2_weight_denom, s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0], dst1, s->frame->linesize[1], tmp, tmpstride, nPbW / 2, nPbH / 2); s->hevcdsp.weighted_pred(s->sh.chroma_log2_weight_denom, s->sh.chroma_weight_l0[current_mv.ref_idx[0]][1], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][1], dst2, s->frame->linesize[2], tmp2, tmpstride, nPbW / 2, nPbH / 2); } else { s->hevcdsp.put_unweighted_pred(dst1, s->frame->linesize[1], tmp, tmpstride, nPbW/2, nPbH/2); s->hevcdsp.put_unweighted_pred(dst2, s->frame->linesize[2], tmp2, tmpstride, nPbW/2, nPbH/2); } } else if (!current_mv.pred_flag[0] && current_mv.pred_flag[1]) { DECLARE_ALIGNED(16, int16_t, tmp [MAX_PB_SIZE * MAX_PB_SIZE]); DECLARE_ALIGNED(16, int16_t, tmp2[MAX_PB_SIZE * MAX_PB_SIZE]); if (!ref1) return; luma_mc(s, tmp, tmpstride, ref1->frame, &current_mv.mv[1], x0, y0, nPbW, nPbH); if ((s->sh.slice_type == P_SLICE && s->pps->weighted_pred_flag) || (s->sh.slice_type == B_SLICE && s->pps->weighted_bipred_flag)) { s->hevcdsp.weighted_pred(s->sh.luma_log2_weight_denom, s->sh.luma_weight_l1[current_mv.ref_idx[1]], s->sh.luma_offset_l1[current_mv.ref_idx[1]], dst0, s->frame->linesize[0], tmp, tmpstride, nPbW, nPbH); } else { s->hevcdsp.put_unweighted_pred(dst0, s->frame->linesize[0], tmp, tmpstride, nPbW, nPbH); } chroma_mc(s, tmp, tmp2, tmpstride, ref1->frame, &current_mv.mv[1], x0/2, y0/2, nPbW/2, nPbH/2); if ((s->sh.slice_type == P_SLICE && s->pps->weighted_pred_flag) || (s->sh.slice_type == B_SLICE && s->pps->weighted_bipred_flag)) { s->hevcdsp.weighted_pred(s->sh.chroma_log2_weight_denom, s->sh.chroma_weight_l1[current_mv.ref_idx[1]][0], s->sh.chroma_offset_l1[current_mv.ref_idx[1]][0], dst1, s->frame->linesize[1], tmp, tmpstride, nPbW/2, nPbH/2); s->hevcdsp.weighted_pred(s->sh.chroma_log2_weight_denom, s->sh.chroma_weight_l1[current_mv.ref_idx[1]][1], s->sh.chroma_offset_l1[current_mv.ref_idx[1]][1], dst2, s->frame->linesize[2], tmp2, tmpstride, nPbW/2, nPbH/2); } else { s->hevcdsp.put_unweighted_pred(dst1, s->frame->linesize[1], tmp, tmpstride, nPbW/2, nPbH/2); s->hevcdsp.put_unweighted_pred(dst2, s->frame->linesize[2], tmp2, tmpstride, nPbW/2, nPbH/2); } } else if (current_mv.pred_flag[0] && current_mv.pred_flag[1]) { DECLARE_ALIGNED(16, int16_t, tmp [MAX_PB_SIZE * MAX_PB_SIZE]); DECLARE_ALIGNED(16, int16_t, tmp2[MAX_PB_SIZE * MAX_PB_SIZE]); DECLARE_ALIGNED(16, int16_t, tmp3[MAX_PB_SIZE * MAX_PB_SIZE]); DECLARE_ALIGNED(16, int16_t, tmp4[MAX_PB_SIZE * MAX_PB_SIZE]); HEVCFrame *ref0 = refPicList[0].ref[current_mv.ref_idx[0]]; HEVCFrame *ref1 = refPicList[1].ref[current_mv.ref_idx[1]]; if (!ref0 || !ref1) return; luma_mc(s, tmp, tmpstride, ref0->frame, &current_mv.mv[0], x0, y0, nPbW, nPbH); luma_mc(s, tmp2, tmpstride, ref1->frame, &current_mv.mv[1], x0, y0, nPbW, nPbH); if ((s->sh.slice_type == P_SLICE && s->pps->weighted_pred_flag) || (s->sh.slice_type == B_SLICE && s->pps->weighted_bipred_flag)) { s->hevcdsp.weighted_pred_avg(s->sh.luma_log2_weight_denom, s->sh.luma_weight_l0[current_mv.ref_idx[0]], s->sh.luma_weight_l1[current_mv.ref_idx[1]], s->sh.luma_offset_l0[current_mv.ref_idx[0]], s->sh.luma_offset_l1[current_mv.ref_idx[1]], dst0, s->frame->linesize[0], tmp, tmp2, tmpstride, nPbW, nPbH); } else { s->hevcdsp.put_weighted_pred_avg(dst0, s->frame->linesize[0], tmp, tmp2, tmpstride, nPbW, nPbH); } chroma_mc(s, tmp, tmp2, tmpstride, ref0->frame, &current_mv.mv[0], x0 / 2, y0 / 2, nPbW / 2, nPbH / 2); chroma_mc(s, tmp3, tmp4, tmpstride, ref1->frame, &current_mv.mv[1], x0 / 2, y0 / 2, nPbW / 2, nPbH / 2); if ((s->sh.slice_type == P_SLICE && s->pps->weighted_pred_flag) || (s->sh.slice_type == B_SLICE && s->pps->weighted_bipred_flag)) { s->hevcdsp.weighted_pred_avg(s->sh.chroma_log2_weight_denom, s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_weight_l1[current_mv.ref_idx[1]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l1[current_mv.ref_idx[1]][0], dst1, s->frame->linesize[1], tmp, tmp3, tmpstride, nPbW / 2, nPbH / 2); s->hevcdsp.weighted_pred_avg(s->sh.chroma_log2_weight_denom, s->sh.chroma_weight_l0[current_mv.ref_idx[0]][1], s->sh.chroma_weight_l1[current_mv.ref_idx[1]][1], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][1], s->sh.chroma_offset_l1[current_mv.ref_idx[1]][1], dst2, s->frame->linesize[2], tmp2, tmp4, tmpstride, nPbW / 2, nPbH / 2); } else { s->hevcdsp.put_weighted_pred_avg(dst1, s->frame->linesize[1], tmp, tmp3, tmpstride, nPbW/2, nPbH/2); s->hevcdsp.put_weighted_pred_avg(dst2, s->frame->linesize[2], tmp2, tmp4, tmpstride, nPbW/2, nPbH/2); } } }
1threat
"Address already in use" error upon docker-compose up : <p>I'm trying to start up several docker containers using <code>docker-compose up</code>, but I'm getting the following (partial) error message:</p> <pre><code>Recreating 1faf02f5d67e_1faf02f5d67e_1faf02f5d67e_1faf02f5d67e_1faf02f5d67e_ipercroncompose_rabbitmq_1 ERROR: for rabbitmq Cannot start service rabbitmq: driver failed programming external connectivity on endpoint ipercroncompose_rabbitmq_1 (a8ded956e30b922289614bbbc4e4fb773c58688d395895b575a88b638592df94): Error starting userland proxy: listen tcp 0.0.0.0:5672: bind: address already in use ERROR: Encountered errors while bringing up the project. </code></pre> <p>Following a suggestion at <a href="https://github.com/docker/docker/issues/8714" rel="noreferrer">https://github.com/docker/docker/issues/8714</a>, I've tried the command</p> <pre><code>netstat -pna | grep 5672 </code></pre> <p>resulting in </p> <pre><code>(Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) tcp 0 0 0.0.0.0:25672 0.0.0.0:* LISTEN - tcp6 0 0 :::5672 :::* LISTEN - unix 2 [ ] DGRAM 15672 - </code></pre> <p>However, I don't see any process IDs here that I could kill. Any ideas what is causing this error?</p>
0debug
REGEX notepad ++; "Http: //www.abc.jpg", "http: //www.xyz.jpg", "http: //www.123.gif" extension of Internet addresses to separate the links? : REGEX notepad ++; "Http: //www.abc.jpg", "http: //www.xyz.jpg", "http: //www.123.gif" extension of Internet addresses to separate the links !?
0debug
preg_match meta name OR property : <p>How to impliment an OR here to match <code>meta</code> with both <code>name</code> and <code>property</code></p> <pre><code>$html = '&lt;meta name="title" content="title here.."&gt; &lt;meta name="keywords" content="keywords here.."&gt; &lt;meta property="og:title" content="og title here.."&gt;' preg_match_all('/&lt;[\s]*meta[\s]*name="?' . '([^&gt;"]*)"?[\s]*' . 'content="?([^&gt;"]*)"?[\s]*[\/]?[\s]*&gt;/si', $html, $match); </code></pre> <p>output</p> <pre><code>Array ( [0] =&gt; Array ( [0] =&gt; &lt;meta name="title" content="title here.."&gt; [1] =&gt; &lt;meta name="keywords" content="keywords here.."&gt; // [2] &lt;meta property="og:title" content="og title here.."&gt; ) [1] =&gt; Array ( [0] =&gt; title [1] =&gt; keywords // [2] =&gt; og:title ) [2] =&gt; Array ( [0] =&gt; title here.. [1] =&gt; keywords here.. // [2] =&gt; og title here.. ) ) </code></pre>
0debug
ssize_t qemu_sendv_packet(VLANClientState *vc1, const struct iovec *iov, int iovcnt) { VLANState *vlan = vc1->vlan; VLANClientState *vc; ssize_t max_len = 0; if (vc1->link_down) return calc_iov_length(iov, iovcnt); for (vc = vlan->first_client; vc != NULL; vc = vc->next) { ssize_t len = 0; if (vc == vc1) continue; if (vc->link_down) len = calc_iov_length(iov, iovcnt); else if (vc->fd_readv) len = vc->fd_readv(vc->opaque, iov, iovcnt); else if (vc->fd_read) len = vc_sendv_compat(vc, iov, iovcnt); max_len = MAX(max_len, len); } return max_len; }
1threat
How to Get Windows 10 Insider Preview Build Faster? : <p>I have turned on the <em>fast</em> way of getting insider preview builds. However, it is too slow. I want the build <em>14316</em> or newer. </p> <hr> <p>How can you get Windows 10 insider preview builds faster? </p>
0debug
IF statment not functioning - R : I have a variable sleptim, conatins number of hours slept which ranges from 2 hrs to 19 hrs. The result of the new categorical variable is not functioning well . Help plz for (i in 500: 1500) { if(question4$sleptim1[i]<6) {question4$sleptim1[i] <- "Below Normal"} else if(question4$sleptim1[i]>9) {question4$sleptim1[i] <- "Above Normal"} else {question4$sleptim1[i] <- "Normal"} }
0debug
c#Error ORA 00907: Missing Right Paranthesis, Please Review My Code : CREATE TABLE TBL_TD_USER ( USER_ID INTEGER(10) NOT NULL , USER_NAME VARCHAR2(20) NOT NULL, PASSWORD VARCHAR2(20) NOT NULL, CREATED_BY VARCHAR2(20) NOT NULL, CREATED_DATE DATE NOT NULL, MODIFIED_BY VARCHAR2(20) NOT NULL, MODIFIED_DATE DATE NOT NULL, IS_ACTIVE CHARACTER(1) NOT NULL, DESCRIPTION VARCHAR2(200) NOT NULL, CONSTRAINT TBL_TD_USER PRIMARY KEY (USER_ID) );
0debug
apply 1 css class which applies more than 1 class to an element : <p>Lets say I use multiple bootstrap classes to achieve my desired button effect.</p> <pre><code>styleClass="btn btn-lg btn-block btn-success my_wrap" </code></pre> <p>Can I do something like this with css that allows me to have a single style defined in my html but in my css defining multiple bootstrap classes, utilising bootstrap and custom styling, to effectively wrapper them into a single super class?</p> <pre><code>styleClass="my-button-ultimate" </code></pre> <p>e.g. maybe css like this (my_wrap is my custom class the others are std bootstrap):</p> <pre><code>.my-button-ultimate{ .btn, .btn-lg, .btn-block, .btn-success, .my_wrap } .my_wrap{ white-space: normal; } </code></pre> <p>I could possibly do this:</p> <pre><code>&lt;style&gt; .my-button-ultimate{ width:100%; height:60px; white-space: normal; } &lt;/style&gt; ... ... &lt;div styleClass="btn my-button-ultimate"&gt;My Button&lt;/div&gt; </code></pre> <p>But it does not take full advantage of bootstrap, and still does not give me a single class in my element.</p> <p>I checked out this answer without success. LESS seems like what I want but I do not know how to implement it just yet, and I want to find out if there is a simple answer to combine classes into 1. <a href="https://stackoverflow.com/q/1065435/7012749">Can a CSS class inherit one or more other classes?</a></p>
0debug
How does react-router persist location state over page refreshes? : <p>I am just so very confused.</p> <p>I have a workflow where someone can start to fill out a form for a product. It is a long form and I want to save progress to the server as they type (but not until they fill it out for a bit). So we start at a url for creating the form, after they've typed for a bit, we POST to create a resource on the server, and after the request finishes, we update the url to the edit route with the new id.</p> <p>In other words, you start filling out the form at url <code>/product</code> then after you've filled it out for a bit the url shifts to <code>/product/123</code>. After that, loading that URL gives you your form.</p> <p>So basically I have</p> <pre><code>&lt;Route path={`/product`} exact component={CreateProduct} /&gt; </code></pre> <p>and</p> <pre><code>&lt;Route exact={true} path="/product/:productId" render={({ match: {params: {productId}}, location: {state: {data}={}} }) =&gt; ( &lt;EditProduct productId={productId} initialData={data} )} /&gt; </code></pre> <p>See that state? That's because the way I do the switch over from create to edit mode is something like this</p> <pre><code>const id = await apiFetch(`/api/product`, data, {method: `POST`}) this.props.history.push({pathname: `/product/${id}`, state: {data} }) </code></pre> <p>in the constructor of my <code>&lt;EditProduct&gt;</code> component I have</p> <pre><code>constructor({productId, initialData}) { this.super() this.state = {} if(initialData) this.setState({data: initialData}) else getProduct(productId).then(({data}) =&gt; this.setState({data})) } </code></pre> <p>By doing that, the initial data into the <code>&lt;EditProduct&gt;</code> is seeded from the <code>&lt;CreateProduct&gt;</code> component and I don't need to reload it from the server or anything.</p> <p>This works, the transition is smooth, the url updates, and everything is hunky dory.</p> <p>I can now continue editing the <code>&lt;EditProduct&gt;</code> component and it saves properly. I can open a new tab to the same url and it loads everything up and I can continue. This happens because in that situation <code>initialData</code> is <code>undefined</code> so its loaded from the server. yay!</p> <p><strong>BUT</strong></p> <p>If I instead <em>refresh <strong>the original</strong> tab</em> things get weird. Any changes that have accumulated since the save are lost. Drilling down in the debugger I see the issue is that <code>initialData</code> passed from the <code>location.state.data</code> object is not empty - it is the initial object from when the product was first created. </p> <p>So where on earth does it come from? I just did a full page refresh (even a "hard" refresh with no cache and devtools open). That data isn't in the URL (and in fact copy pasting the url into another tab in the same window doesn't have this issue).</p> <p>The only mechanism I'm aware of that can persist data across refreshes but not to new tabs like this is <code>sessionStorage</code>, yet when I check it in the console, I am told</p> <pre><code>&gt; sessionStorage &lt; Storage {length: 0} </code></pre> <p>I've even thought that maybe react router is manipulating session storage just before the page unloads and just after it loads, but breaking on the first line of my javascript bundle shows the exact same thing.</p> <p>So how on earth is this persistence happening!?</p>
0debug
Why I cant get previous url in controller? : I work on my single page application project I use angujarjs 1.5. At some point in my controller I need to get previous url. I tried to use this row to get previous url: var prevUrl = $document[0].referrer; and this: var prevUrl2 = document.referrer; But `prevUrl` and `prevUrl2` are always empty. When I use this row to go back: $window.history.back(); It works fine. Any idea why 'prevUrl' and 'prevUrl2' is empty? Please help me!
0debug