problem
stringlengths
26
131k
labels
class label
2 classes
Pointer in c++for scanning an array : <p>How to scan an array in c++ using pointer?</p> <p>I have learned c programming .so i tried that way.</p> <pre><code>include&lt;iostream&gt; using namespace std; main() { int a[5],*p,i; p=&amp;a[5]; for(i=0;i&lt;5;i++) { cout&lt;&lt;"enter"&lt;&lt;i+1&lt;&lt;endl; cin&gt;&gt;(p+i); } for(i=0;i&lt;5;i++) { cout&lt;&lt;*(p+i)&lt;&lt;endl; } } </code></pre> <p>I am expecting to scan using pointer just like in c programming</p>
0debug
Linechart Data Not Being Displayed : <p>I am loading data points from core-data, and using it for x, y values in a line chart using the Charts Cocoapods module. For some reason, the data and lines do not get drawn sometimes, even though I am getting good data from core data every time.</p>
0debug
Confusion about void main() in C : <p>In <code>int main()</code>, <code>return</code> value should indicate how the program exited. Generally, We represented by a <code>0</code> return value for normal termination and <code>1</code> for abnormal termination.</p> <p>Then, I'm just curious to know, If <code>void main()</code> function not return any return value, then <strong>How to operating System know that program normal terminate or not in C?</strong></p>
0debug
d3.js v4 d3.layout.tree has been removed? : <p>After upgrading to d3.js v4.1.1, this line:</p> <pre><code>d3.layout.tree() </code></pre> <p>produces an error:</p> <pre><code>Cannot read property 'tree' of undefined </code></pre> <p>It seems like the tree layout has been removed from v4? <a href="https://github.com/d3/d3/blob/master/API.md" rel="noreferrer">https://github.com/d3/d3/blob/master/API.md</a></p> <p>The examples still use the v3 API: <a href="http://bl.ocks.org/mbostock/1093025" rel="noreferrer">http://bl.ocks.org/mbostock/1093025</a></p> <p>Is the layout really gone or has it been renamed?</p>
0debug
How do you make an array range between numbers : **Hello guys, this is to do with my GCSE case study** I want to make numbers range in an array for example (in pheusocode) **StudentNames** [1:30] <---- numbers from 1 to 30 If anyone understands what I am trying to say please reply Thanks,
0debug
implement executeusingpath() in c : I have one question which is as follows can someone explain me Consider environment variables used in Unix-based operating systems. A frequently seen environment variable is named PATH, and is used by command interpreters, or shells, to identify the names of directories to be searched to find executable programs. For example, a typical value of PATH may be: "/Users/chris/bin:/usr/local/bin:/usr/bin:/bin:." which provides a colon-separated list of directories to search for a required program. Write a C99 function, named executeUsingPATH(), which accepts the name of a program to execute and a NULL-pointer terminated vector of arguments to be passed to that program. The requested program may be specified using just its name, or with either an absolute or a relative pathname. int executeUsingPATH(char *programName, char *arguments[]); Function executeUsingPATH() should attempt to execute programName from each directory provided via PATH, in order. If programName is found and may be executed (passing to it the indicated program arguments), the function should wait for its execution to terminate, and then return the exit status of the terminated process. If the function cannot find and execute programName then it should simply return the integer -1. Your function should not simply call the similar library function named execvp(). I have no idea about it
0debug
How can i add padding vector file in android : <p>How can i add paddingleft,Right,Top and bottom veriable in my vector file.</p> <p>I changed </p> <blockquote> <p>android:viewportWidth</p> </blockquote> <p>and </p> <blockquote> <p>android:viewportHeight</p> </blockquote> <p>But Nothing change</p> <p><strong>My Vector</strong></p> <pre><code>&lt;vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="31.416dp" android:height="31.416dp" android:viewportWidth="31.416" android:viewportHeight="31.416"&gt; &lt;path android:fillColor="#fff" android:pathData="M28.755,6.968l-0.47,0.149L25.782,7.34l-0.707,1.129l-0.513-0.163L22.57,6.51l-0.289-0.934L21.894,4.58l-1.252-1.123 l-1.477-0.289l-0.034,0.676l1.447,1.412l0.708,0.834L20.49,6.506l-0.648-0.191L18.871,5.91l0.033-0.783l-1.274-0.524l-0.423,1.841 l-1.284,0.291l0.127,1.027l1.673,0.322l0.289-1.641l1.381,0.204l0.642,0.376h1.03l0.705,1.412l1.869,1.896l-0.137,0.737 l-1.507-0.192l-2.604,1.315l-1.875,2.249l-0.244,0.996h-0.673l-1.254-0.578l-1.218,0.578l0.303,1.285l0.53-0.611l0.932-0.029 l-0.065,1.154l0.772,0.226l0.771,0.866l1.259-0.354l1.438,0.227l1.67,0.449l0.834,0.098l1.414,1.605l2.729,1.605l-1.765,3.372 l-1.863,0.866l-0.707,1.927l-2.696,1.8l-0.287,1.038c6.892-1.66,12.019-7.851,12.019-15.253 C31.413,12.474,30.433,9.465,28.755,6.968z" /&gt; &lt;path android:fillColor="#fff" android:pathData="M17.515,23.917l-1.144-2.121l1.05-2.188l-1.05-0.314l-1.179-1.184l-2.612-0.586l-0.867-1.814v1.077h-0.382l-2.251-3.052 v-2.507L7.43,8.545L4.81,9.012H3.045L2.157,8.43L3.29,7.532L2.16,7.793c-1.362,2.326-2.156,5.025-2.156,7.916 c0,8.673,7.031,15.707,15.705,15.707c0.668,0,1.323-0.059,1.971-0.137l-0.164-1.903c0,0,0.721-2.826,0.721-2.922 C18.236,26.357,17.515,23.917,17.515,23.917z" /&gt; &lt;path android:fillColor="#fff" android:pathData="M5.84,5.065l2.79-0.389l1.286-0.705l1.447,0.417l2.312-0.128l0.792-1.245l1.155,0.19l2.805-0.263L19.2,2.09l1.09-0.728 l1.542,0.232l0.562-0.085C20.363,0.553,18.103,0,15.708,0C10.833,0,6.474,2.222,3.596,5.711h0.008L5.84,5.065z M16.372,1.562 l1.604-0.883l1.03,0.595l-1.491,1.135l-1.424,0.143l-0.641-0.416L16.372,1.562z M11.621,1.691l0.708,0.295l0.927-0.295 l0.505,0.875l-2.14,0.562l-1.029-0.602C10.591,2.526,11.598,1.878,11.621,1.691z" /&gt; &lt;/vector&gt; </code></pre> <p><strong>Like that</strong></p> <p><a href="https://i.stack.imgur.com/Shk9w.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Shk9w.png" alt="enter image description here"></a></p> <p>is it possible? </p>
0debug
oracle function error pls-00103 Encountered the symbol "SELECT" when expecting one of the following : I receive the following error when I compile this function: Compilation errors for PROCEDURE INV.USP_MSC_MODIFICA_ESTADO Error: PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:( - + case mod new not null <an identifier> <a double-quoted delimited-identifier> <a bind variable> continue avg count current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date <a string literal with character set specification> <a number> <a single-quoted SQL string> pipe <an alternatively-quoted string literal with character set specification> <an alternat Line: 14 Text: IF SELECT TRUNC((SYSDATE) -TO_DATE(@FCH_GRABACION, 'DD/MM/YYYY HH24:MI:SS')) From DUAL=1 THEN CREATE OR REPLACE PROCEDURE "USP_MSC_MODIFICA_ESTADO" AS BEGIN DECLARE CURSOR RESERVAR IS SELECT ID_RESERVA,FCH_GRABACION FROM tb_msc_reserva WHERE to_date(to_char(FCH_GRABACION,'dd/mm/yyyy')) = to_date(to_char(SYSDATE,'dd/mm/yyyy')) - 1; id_reserva VARCHAR2(50); fch_grabacion DATE; BEGIN OPEN RESERVAR; FETCH RESERVAR INTO id_reserva, fch_grabacion; IF SELECT TRUNC((SYSDATE) -TO_DATE(@FCH_GRABACION, 'DD/MM/YYYY HH24:MI:SS')) From DUAL=1 THEN UPDATE inv.tb_msc_reserva t SET t.flg_estado='C' WHERE ID_Reserva=@ID_RESERVA; COMMIT; END IF ; WHILE (@@FETCH_STATUS = 0) CLOSE RESERVAR; END; Please help me Thanks
0debug
static void virtio_pci_reset(DeviceState *qdev) { VirtIOPCIProxy *proxy = VIRTIO_PCI(qdev); VirtioBusState *bus = VIRTIO_BUS(&proxy->bus); virtio_pci_stop_ioeventfd(proxy); virtio_bus_reset(bus); msix_unuse_all_vectors(&proxy->pci_dev); proxy->flags &= ~VIRTIO_PCI_FLAG_BUS_MASTER_BUG; }
1threat
NSUserActivity not getting indexed on osx : <p>I'm trying to add my own activity to Spotlight search results on osx 10.11. But after a lot of tries I couldn't got to be in Spotlight search results not by keywords search, not by title search.</p> <pre><code>{ self.userActivity = [[NSUserActivity alloc] initWithActivityType:@"Reverse DNS keyword"]; self.userActivity.title = @"Some title"; self.userActivity.keywords = [NSSet setWithArray: @[@"Some keywords"]]; self.userActivity.eligibleForSearch = YES; self.userActivity.eligibleForHandoff = YES; self.userActivity.eligibleForPublicIndexing = YES; self.userActivity.userInfo = @{@"name" : @"Some name"}; self.userActivity.delegate = self; self.userActivity.requiredUserInfoKeys =[NSSet setWithArray: @[@"name"]]; self.userActivity.needsSave = YES; [self.userActivity becomeCurrent]; NSApp.userActivity = self.userActivity; } - (void)userActivityWillSave:(NSUserActivity *)userActivity { userActivity.userInfo = @{@"name" : @"Some name"}; } </code></pre> <p>Also I've updated Info.plist with NSUserActivityTypes array and item from the initWithActivityType: argument</p> <p>Also I've noticed that in Console sometime appears messages:</p> <pre><code>16/09/2016 13:14:49.731 Caching encoded userInfo to use until we are marked dirty again (UAUserActivity.m #1567) 16/09/2016 13:14:49.731 Returning cached encoded userInfo (UAUserActivity.m #1508) </code></pre>
0debug
static USBDevice *usb_braille_init(USBBus *bus, const char *unused) { USBDevice *dev; CharDriverState *cdrv; cdrv = qemu_chr_new("braille", "braille", NULL); if (!cdrv) return NULL; dev = usb_create(bus, "usb-braille"); qdev_prop_set_chr(&dev->qdev, "chardev", cdrv); qdev_init_nofail(&dev->qdev); return dev; }
1threat
static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MPADecodeContext *s = avctx->priv_data; uint32_t header; int ret; int skipped = 0; while(buf_size && !*buf){ buf++; buf_size--; skipped++; } if (buf_size < HEADER_SIZE) return AVERROR_INVALIDDATA; header = AV_RB32(buf); if (header>>8 == AV_RB32("TAG")>>8) { av_log(avctx, AV_LOG_DEBUG, "discarding ID3 tag\n"); return buf_size; } ret = avpriv_mpegaudio_decode_header((MPADecodeHeader *)s, header); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Header missing\n"); return AVERROR_INVALIDDATA; } else if (ret == 1) { s->frame_size = -1; return AVERROR_INVALIDDATA; } avctx->channels = s->nb_channels; avctx->channel_layout = s->nb_channels == 1 ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; if (!avctx->bit_rate) avctx->bit_rate = s->bit_rate; if (s->frame_size <= 0) { av_log(avctx, AV_LOG_ERROR, "incomplete frame\n"); return AVERROR_INVALIDDATA; } else if (s->frame_size < buf_size) { av_log(avctx, AV_LOG_DEBUG, "incorrect frame size - multiple frames in buffer?\n"); buf_size= s->frame_size; } s->frame = data; ret = mp_decode_frame(s, NULL, buf, buf_size); if (ret >= 0) { s->frame->nb_samples = avctx->frame_size; *got_frame_ptr = 1; avctx->sample_rate = s->sample_rate; } else { av_log(avctx, AV_LOG_ERROR, "Error while decoding MPEG audio frame.\n"); *got_frame_ptr = 0; if (buf_size == avpkt->size || ret != AVERROR_INVALIDDATA) return ret; } s->frame_size = 0; return buf_size + skipped; }
1threat
Why ternary operator in swift is so picky? : <p>The question is very simple, but I just could not find the answer!</p> <p>Why doesn't</p> <pre><code>return x == 0? "" : "Hello" </code></pre> <p>compile but</p> <pre><code>return x == 0 ? "" : "Hello" </code></pre> <p>does?</p> <p>This is really weird because all the other operators don't need an extra white space. e.g.</p> <pre><code>let x = 1+1 let y = 1 + 1 </code></pre> <p>are the same.</p> <p>I think it has something to do with optionals. But when you use a <code>?</code> operator on a variable, it must be used like this:</p> <pre><code>let s: String? = nil let x = s?.startIndex </code></pre> <p>I mean it must follow another operator, right?</p>
0debug
kernel module problem in commercial software : <p>The security software I'm building contains a kernel module. because the kernel must process the packet.</p> <p>Do not use DKMS because it is commercial software.</p> <p>If the kernel version goes up, insmod doesn't work.</p> <p>What should I do? Do you have a good idea?</p>
0debug
how to insert value into key json c#? : <p>Must enter values in a key of a Json but I can not implement, how I do?</p> <p>Example:</p> <pre><code>{ "name": "Allan", "lastname": "Zé Store", "type": "J", "street": "Rua Abdon Batista, 121", "emails": [ { "email": "jose@zestore.com.br" }, { "email": "marcos@zestore.com.br" } ], "phone": [ { "number": "(11) 98765-4321" }, { "number": "(47) 9876-5432" } ] } </code></pre> <p>I need to assemble an array inside the key?</p>
0debug
How to implement method swizzling swift 3.0? : <p>How can I implement method swizzling in <strong>Swift 3.0</strong> ?</p> <p>I've read <a href="http://nshipster.com/swift-objc-runtime/" rel="noreferrer">nshipster article</a> about it, but in this code's chunk </p> <pre><code>struct Static { static var token: dispatch_once_t = 0 } </code></pre> <p>the compiler gives me an error</p> <blockquote> <p>dispatch_once_t is unavailable in Swift: Use lazily initialized globals instead</p> </blockquote>
0debug
How can I prevent a TextView in a ConstraintLayout Chain from pushing other TextViews beyond their constraints while using layout_constrainedWidth? : <p>My end goal is to have two single-line TextViews in a left-aligned, packed horizontal chain that allows both of them to grow to fill the remaining space, splitting it evenly if necessary, ellipsizing when there's not space. </p> <p>Visual Aid: <a href="https://i.stack.imgur.com/qNO9t.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qNO9t.png" alt="enter image description here"></a></p> <p>And here's the layout code that I've tried to accomplish this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp"&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" android:maxLines="1" tools:text="@tools:sample/lorem" app:layout_constrainedWidth="true" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toStartOf="@id/textView2" app:layout_constraintHorizontal_chainStyle="packed" app:layout_constraintHorizontal_bias="0" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" /&gt; &lt;TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="4dp" android:ellipsize="end" android:maxLines="1" tools:text="@tools:sample/lorem" app:layout_constrainedWidth="true" app:layout_constraintStart_toEndOf="@id/textView1" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" /&gt; &lt;/android.support.constraint.ConstraintLayout&gt; </code></pre> <p>As you can see, I've laid out two textviews in a horizontal chain. I've got the chain style set to packed so that they stay together. I've got the horizontal bias set to 0 so that the chain is left aligned. I've got the width set to wrap_content so that they don't stretch when the text is short, and I've also set <code>app:layout_constrainedWidth="true"</code> so that they don't go past their bounds when the text is long. This works <em>almost</em> exactly how I want <strong>except</strong> when the text in textView2 grows. As textView1 grows, it pushes textView2 to the right until it hits its constraint, at which point it ellipsizes (as expected/desired), but the same is not true for textview2. As textView2 grows, it stretches to fill the room to its right, but once it hits its constraint, instead of ellipsizing, it keeps stretching and starts to push textView1 to the left until it is no longer visible at all.</p> <p>Visual aid (actual behavior):</p> <p><a href="https://i.stack.imgur.com/AsZKF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/AsZKF.png" alt="enter image description here"></a></p> <p>I've tried to use things like setting <code>layout_constraintHorizontal_weight</code> to .5 on each view but that has no effect unless I change both view widths to 0dp (match_constraints) which breaks the scenario where both views have short text (it adds extra space between the two text views).</p> <p>What it feels like is that when you combine <code>width=wrap_content</code> with <code>layout_constrainedWidth=true</code>, the weight values are ignored. Is this just a limitation of ConstraintLayout? I've spent a lot of time trying to figure out a way to make this work and right now it doesn't seem like it's possible. I've fallen back to using a LinearLayout and making some design compromises, but I'd really like to get this working if anyone has any ideas. Thanks!</p>
0debug
C++ Verschiedene Typen in Vektor lesen und schreiben : Hallihallo liebe Community :) Wir sollen seit heute ein paar Übungsaufgaben zu C++ machen, um uns auf die Vorlesung nächste Woche vorzubereiten. Kleinere Aufgaben wie einen Vektor (mit ints als Inhalt) sortieren waren kein Problem. Gelernt haben wir nun ein Jahr lang Java 7 - 8. Heute habe ich mit C++ angefangen und mir soeben Vektoren beigebracht. Zumindest rudimentär. Nun zu meiner Frage: Wie kann ich in einen Vektor mehrere verschiedene primitive Datentypen sowie Strings packen um die Inhalte dann zu untersuchen? (In Java ging das ja ueber Object[] objects = {1.0,"Hallo",-42,'b'}) Die Aufgabe dazu lautet wie folgt: Gegeben sei folgendes Array: [3.0,42,"Affe",7.2,b] dieses Array soll an eine Methode uebergeben werden, welche die Inhalte des Arrays auf der Konsole ausgibt. Sollte es sich um einen String handeln, soll jeder Buchstabe des Strings als ASCII-Wert in ein und derselben Variable addiert und schließlich als int auf der Konsole zurueckgegeben werden. Mit char genau dasselbe. Ich weiß ab heute wie ich einen Vektor anlege also mit std::vector<double> numbers = {1.0,2.0}; nur zum Beispiel Wie man Funktionen schreibt und wie man auf die Indizes zugreift also numbers[i]; sowie auf die Laenge des Vektors numbers.size(). Wie kann ich diese Aufgabe nun lösen? Da ich leider keine einfache<- Loesung fuer die mutliplen Typen in einem Vektor gefunden habe. Lieben Dank vorab :)
0debug
Generate set of unique 16 digits number/codes like recharge card/voucher using algorithm : <p>I have a task, where i need to Generate set of unique 16 digits number/codes like recharge card/voucher using algorithm.(like recharge scratch cards)</p> <p>I have no idea on how to do this or which algorithm to use.</p> <p>Please help/guide me in achieving this task.</p> <p>Thanks in advance.</p>
0debug
What is the difference between new Date() and Date() when used as variable? : <p>For eg-</p> <pre><code>&lt;body&gt; &lt;p id="demo"&gt;&lt;/p&gt; &lt;script&gt; var x = new Date(); document.getElementById("demo").innerHTML=x; &lt;/script&gt; &lt;/body&gt; </code></pre> <p>And,</p> <pre><code>&lt;body&gt; &lt;p id="demo"&gt;&lt;/p&gt; &lt;script&gt; var x = Date(); document.getElementById("demo").innerHTML=x; &lt;/script&gt; &lt;/body&gt; </code></pre> <p>The result is same.But what it means when we use 'new'?</p>
0debug
How to change param in url with preg_replace : <p>i have list tag li</p> <pre><code>&lt;li data-src="http://localhost/project/?coupon=asKSawe&amp;type=1"&gt;&lt;/li&gt; &lt;li data-src="http://localhost/project/?coupon=adTeLw&amp;type=1"&gt;&lt;/li&gt; &lt;li class="item-li" data-src="http://localhost/project/?coupon=12Dffr&amp;type=1"&gt;&lt;/li&gt; &lt;li class="item-li" data-src="http://localhost/project/?coupon=dldpOO2&amp;type=1"&gt;&lt;/li&gt; &lt;li class="item-li" data-src="http://localhost/project/?coupon=MMok231&amp;type=1"&gt;&lt;/li&gt; &lt;li data-src="http://localhost/project/?coupon=xC41k23&amp;type=1"&gt;&lt;/li&gt; </code></pre> <p>how to use preg_replace to change coupon to strtoupper, with only coupon, result i hope</p> <pre><code>&lt;li data-src="http://localhost/project/?coupon=ASKSAWE&amp;type=1"&gt;&lt;/li&gt; &lt;li data-src="http://localhost/project/?coupon=ADTELW&amp;type=1"&gt;&lt;/li&gt; &lt;li class="item-li" data-src="http://localhost/project/?coupon=12DFFR&amp;type=1"&gt;&lt;/li&gt; &lt;li class="item-li" data-src="http://localhost/project/?coupon=DLDPOO2&amp;type=1"&gt;&lt;/li&gt; &lt;li class="item-li" data-src="http://localhost/project/?coupon=MMOK231&amp;type=1"&gt;&lt;/li&gt; &lt;li data-src="http://localhost/project/?coupon=xC41K23&amp;type=1"&gt;&lt;/li&gt; </code></pre> <p>thank you!</p>
0debug
long do_sigreturn(CPUAlphaState *env) { struct target_sigcontext *sc; abi_ulong sc_addr = env->ir[IR_A0]; target_sigset_t target_set; sigset_t set; if (!lock_user_struct(VERIFY_READ, sc, sc_addr, 1)) { goto badframe; } target_sigemptyset(&target_set); if (__get_user(target_set.sig[0], &sc->sc_mask)) { goto badframe; } target_to_host_sigset_internal(&set, &target_set); do_sigprocmask(SIG_SETMASK, &set, NULL); if (restore_sigcontext(env, sc)) { goto badframe; } unlock_user_struct(sc, sc_addr, 0); return env->ir[IR_V0]; badframe: unlock_user_struct(sc, sc_addr, 0); force_sig(TARGET_SIGSEGV); }
1threat
Using classes , parametars, objects with Scanner input : I have a class City.java and State.java with automatically generated constructors, getters and setters(if needed i can reupload the question with them ).In Main.java my task is to get informations with Scanner as input and make objects when all the informations are written in. Data input for each object is needed to be taken out in separate methods that will be eventually called from main method . Each of these methods must return the object that fills . Its allowed to only one object of class Scenner . public Class City { private String name; private Bigdecimal surface; //+constructor , + getters and setters } public Class State { private String name; private City city; //+constructor , + getters and setters } public class Main { public static City city (Scanner scanner) { System.out.println("Store City name : "); String cityName = scanner.nextLine(); System.out.println("Store City surface : "); BigDecimal citySurface = scanner.nextBigDecimal(); return new City(cityName,citySurface); } public static State state (Scanner scanner){ System.out.println("Store State name : "); String stateName = scanner.nextLine(); *********************** Im lost at this point , the task is that i should return new State with parametars (stateName,City) but cant figure it out how to pass previously entered City here as a parametar. *********************** } public static void main(String[] args) { Scanner mainScanner = new Scanner (System.in); } }
0debug
static int archipelago_aio_segmented_rw(BDRVArchipelagoState *s, size_t count, off_t offset, ArchipelagoAIOCB *aio_cb, int op) { int i, ret, segments_nr, last_segment_size; ArchipelagoSegmentedRequest *segreq; segreq = g_malloc(sizeof(ArchipelagoSegmentedRequest)); if (op == ARCHIP_OP_FLUSH) { segments_nr = 1; segreq->ref = segments_nr; segreq->total = count; segreq->count = 0; segreq->failed = 0; ret = archipelago_submit_request(s, 0, count, offset, aio_cb, segreq, ARCHIP_OP_FLUSH); if (ret < 0) { goto err_exit; } return 0; } segments_nr = (int)(count / MAX_REQUEST_SIZE) + \ ((count % MAX_REQUEST_SIZE) ? 1 : 0); last_segment_size = (int)(count % MAX_REQUEST_SIZE); segreq->ref = segments_nr; segreq->total = count; segreq->count = 0; segreq->failed = 0; for (i = 0; i < segments_nr - 1; i++) { ret = archipelago_submit_request(s, i * MAX_REQUEST_SIZE, MAX_REQUEST_SIZE, offset + i * MAX_REQUEST_SIZE, aio_cb, segreq, op); if (ret < 0) { goto err_exit; } } if ((segments_nr > 1) && last_segment_size) { ret = archipelago_submit_request(s, i * MAX_REQUEST_SIZE, last_segment_size, offset + i * MAX_REQUEST_SIZE, aio_cb, segreq, op); } else if ((segments_nr > 1) && !last_segment_size) { ret = archipelago_submit_request(s, i * MAX_REQUEST_SIZE, MAX_REQUEST_SIZE, offset + i * MAX_REQUEST_SIZE, aio_cb, segreq, op); } else if (segments_nr == 1) { ret = archipelago_submit_request(s, 0, count, offset, aio_cb, segreq, op); } if (ret < 0) { goto err_exit; } return 0; err_exit: __sync_add_and_fetch(&segreq->failed, 1); if (segments_nr == 1) { if (__sync_add_and_fetch(&segreq->ref, -1) == 0) { g_free(segreq); } } else { if ((__sync_add_and_fetch(&segreq->ref, -segments_nr + i)) == 0) { g_free(segreq); } } return ret; }
1threat
how to do this on bootstrap : <p>I am new in using bootstrap and I want to know how to do this in desktop size:</p> <pre><code> ----------------------- | table1 | table2 | ----------- | | table3 | | ----------- | | table4 | | ----------------------- </code></pre> <p>Glad if you would help me.</p>
0debug
static av_cold int twin_decode_close(AVCodecContext *avctx) { TwinContext *tctx = avctx->priv_data; int i; for (i = 0; i < 3; i++) { ff_mdct_end(&tctx->mdct_ctx[i]); av_free(tctx->cos_tabs[i]); } av_free(tctx->curr_frame); av_free(tctx->spectrum); av_free(tctx->prev_frame); av_free(tctx->tmp_buf); return 0; }
1threat
static inline int mpeg1_decode_block_inter(MpegEncContext *s, int16_t *block, int n) { int level, i, j, run; RLTable *rl = &ff_rl_mpeg1; uint8_t * const scantable = s->intra_scantable.permutated; const uint16_t *quant_matrix = s->inter_matrix; const int qscale = s->qscale; { OPEN_READER(re, &s->gb); i = -1; UPDATE_CACHE(re, &s->gb); if (((int32_t)GET_CACHE(re, &s->gb)) < 0) { level = (3 * qscale * quant_matrix[0]) >> 5; level = (level - 1) | 1; if (GET_CACHE(re, &s->gb) & 0x40000000) level = -level; block[0] = level; i++; SKIP_BITS(re, &s->gb, 2); if (((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF) goto end; } for (;;) { GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); if (level != 0) { i += run; j = scantable[i]; level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5; level = (level - 1) | 1; level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1); } else { run = SHOW_UBITS(re, &s->gb, 6) + 1; LAST_SKIP_BITS(re, &s->gb, 6); UPDATE_CACHE(re, &s->gb); level = SHOW_SBITS(re, &s->gb, 8); SKIP_BITS(re, &s->gb, 8); if (level == -128) { level = SHOW_UBITS(re, &s->gb, 8) - 256; SKIP_BITS(re, &s->gb, 8); } else if (level == 0) { level = SHOW_UBITS(re, &s->gb, 8) ; SKIP_BITS(re, &s->gb, 8); } i += run; j = scantable[i]; if (level < 0) { level = -level; level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5; level = (level - 1) | 1; level = -level; } else { level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5; level = (level - 1) | 1; } } if (i > 63) { av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y); return -1; } block[j] = level; if (((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF) break; UPDATE_CACHE(re, &s->gb); } end: LAST_SKIP_BITS(re, &s->gb, 2); CLOSE_READER(re, &s->gb); } s->block_last_index[n] = i; return 0; }
1threat
void ff_generate_sliding_window_mmcos(H264Context *h) { MpegEncContext * const s = &h->s; assert(h->long_ref_count + h->short_ref_count <= h->sps.ref_frame_count); h->mmco_index= 0; if(h->short_ref_count && h->long_ref_count + h->short_ref_count == h->sps.ref_frame_count && !(FIELD_PICTURE && !s->first_field && s->current_picture_ptr->f.reference)) { h->mmco[0].opcode= MMCO_SHORT2UNUSED; h->mmco[0].short_pic_num= h->short_ref[ h->short_ref_count - 1 ]->frame_num; h->mmco_index= 1; if (FIELD_PICTURE) { h->mmco[0].short_pic_num *= 2; h->mmco[1].opcode= MMCO_SHORT2UNUSED; h->mmco[1].short_pic_num= h->mmco[0].short_pic_num + 1; h->mmco_index= 2; } } }
1threat
Websites not prompting for saving login credentials : <p>Currently having an issue where websites are not asking to save my credentials. I kept the type="button" because we are calling a function in js. Any ideas as to why it may not be working?</p> <pre><code> &lt;form&gt; &lt;div class="card card-default p-4"&gt; &lt;div class="form-group"&gt; &lt;label class="m-0 text-bold"&gt;Username&lt;/label&gt; &lt;input required type="text" class="form-control" placeholder="example@domain.com" data-bind="value: username"&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;label class="m-0 text-bold"&gt;Password&lt;/label&gt; &lt;input required type="password" class="form-control" placeholder="" data-bind="value: password" autocomplete="on"&gt; &lt;/div&gt; &lt;div class="form-group mt-2"&gt; &lt;div class="row"&gt; &lt;div class="col-md-6 col-lg-5"&gt; &lt;button class="btn btn-block btn-outline-primary m-0" type="button" data-bind="click: signin"&gt;LOGIN&lt;/button&gt; &lt;/div&gt; &lt;div class="col-md-6 col-lg-7 mt-2 mt-md-0 d-flex align-items-center"&gt; &lt;a class="forgot-password" href="#forgotpassword"&gt;Forgot password?&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; </code></pre>
0debug
int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt) { RTSPState *rt = s->priv_data; int ret, len; RTSPStream *rtsp_st, *first_queue_st = NULL; int64_t wait_end = 0; if (rt->nb_byes == rt->nb_rtsp_streams) return AVERROR_EOF; if (rt->cur_transport_priv) { if (rt->transport == RTSP_TRANSPORT_RDT) { ret = ff_rdt_parse_packet(rt->cur_transport_priv, pkt, NULL, 0); } else if (rt->transport == RTSP_TRANSPORT_RTP) { ret = ff_rtp_parse_packet(rt->cur_transport_priv, pkt, NULL, 0); } else if (rt->ts && CONFIG_RTPDEC) { ret = ff_mpegts_parse_packet(rt->ts, pkt, rt->recvbuf + rt->recvbuf_pos, rt->recvbuf_len - rt->recvbuf_pos); if (ret >= 0) { rt->recvbuf_pos += ret; ret = rt->recvbuf_pos < rt->recvbuf_len; } } else ret = -1; if (ret == 0) { rt->cur_transport_priv = NULL; return 0; } else if (ret == 1) { return 0; } else rt->cur_transport_priv = NULL; } redo: if (rt->transport == RTSP_TRANSPORT_RTP) { int i; int64_t first_queue_time = 0; for (i = 0; i < rt->nb_rtsp_streams; i++) { RTPDemuxContext *rtpctx = rt->rtsp_streams[i]->transport_priv; int64_t queue_time; if (!rtpctx) continue; queue_time = ff_rtp_queued_packet_time(rtpctx); if (queue_time && (queue_time - first_queue_time < 0 || !first_queue_time)) { first_queue_time = queue_time; first_queue_st = rt->rtsp_streams[i]; } } if (first_queue_time) { wait_end = first_queue_time + s->max_delay; } else { wait_end = 0; first_queue_st = NULL; } } if (!rt->recvbuf) { rt->recvbuf = av_malloc(RECVBUF_SIZE); if (!rt->recvbuf) return AVERROR(ENOMEM); } switch(rt->lower_transport) { default: #if CONFIG_RTSP_DEMUXER case RTSP_LOWER_TRANSPORT_TCP: len = ff_rtsp_tcp_read_packet(s, &rtsp_st, rt->recvbuf, RECVBUF_SIZE); break; #endif case RTSP_LOWER_TRANSPORT_UDP: case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: len = udp_read_packet(s, &rtsp_st, rt->recvbuf, RECVBUF_SIZE, wait_end); if (len > 0 && rtsp_st->transport_priv && rt->transport == RTSP_TRANSPORT_RTP) ff_rtp_check_and_send_back_rr(rtsp_st->transport_priv, rtsp_st->rtp_handle, NULL, len); break; case RTSP_LOWER_TRANSPORT_CUSTOM: if (first_queue_st && rt->transport == RTSP_TRANSPORT_RTP && wait_end && wait_end < av_gettime_relative()) len = AVERROR(EAGAIN); else len = ffio_read_partial(s->pb, rt->recvbuf, RECVBUF_SIZE); len = pick_stream(s, &rtsp_st, rt->recvbuf, len); if (len > 0 && rtsp_st->transport_priv && rt->transport == RTSP_TRANSPORT_RTP) ff_rtp_check_and_send_back_rr(rtsp_st->transport_priv, NULL, s->pb, len); break; } if (len == AVERROR(EAGAIN) && first_queue_st && rt->transport == RTSP_TRANSPORT_RTP) { rtsp_st = first_queue_st; ret = ff_rtp_parse_packet(rtsp_st->transport_priv, pkt, NULL, 0); goto end; } if (len < 0) return len; if (len == 0) return AVERROR_EOF; if (rt->transport == RTSP_TRANSPORT_RDT) { ret = ff_rdt_parse_packet(rtsp_st->transport_priv, pkt, &rt->recvbuf, len); } else if (rt->transport == RTSP_TRANSPORT_RTP) { ret = ff_rtp_parse_packet(rtsp_st->transport_priv, pkt, &rt->recvbuf, len); if (rtsp_st->feedback) { AVIOContext *pb = NULL; if (rt->lower_transport == RTSP_LOWER_TRANSPORT_CUSTOM) pb = s->pb; ff_rtp_send_rtcp_feedback(rtsp_st->transport_priv, rtsp_st->rtp_handle, pb); } if (ret < 0) { RTPDemuxContext *rtpctx = rtsp_st->transport_priv; if (rtpctx->first_rtcp_ntp_time != AV_NOPTS_VALUE) { int i; AVStream *st = NULL; if (rtsp_st->stream_index >= 0) st = s->streams[rtsp_st->stream_index]; for (i = 0; i < rt->nb_rtsp_streams; i++) { RTPDemuxContext *rtpctx2 = rt->rtsp_streams[i]->transport_priv; AVStream *st2 = NULL; if (rt->rtsp_streams[i]->stream_index >= 0) st2 = s->streams[rt->rtsp_streams[i]->stream_index]; if (rtpctx2 && st && st2 && rtpctx2->first_rtcp_ntp_time == AV_NOPTS_VALUE) { rtpctx2->first_rtcp_ntp_time = rtpctx->first_rtcp_ntp_time; rtpctx2->rtcp_ts_offset = av_rescale_q( rtpctx->rtcp_ts_offset, st->time_base, st2->time_base); } } } if (ret == -RTCP_BYE) { rt->nb_byes++; av_log(s, AV_LOG_DEBUG, "Received BYE for stream %d (%d/%d)\n", rtsp_st->stream_index, rt->nb_byes, rt->nb_rtsp_streams); if (rt->nb_byes == rt->nb_rtsp_streams) return AVERROR_EOF; } } } else if (rt->ts && CONFIG_RTPDEC) { ret = ff_mpegts_parse_packet(rt->ts, pkt, rt->recvbuf, len); if (ret >= 0) { if (ret < len) { rt->recvbuf_len = len; rt->recvbuf_pos = ret; rt->cur_transport_priv = rt->ts; return 1; } else { ret = 0; } } } else { return AVERROR_INVALIDDATA; } end: if (ret < 0) goto redo; if (ret == 1) rt->cur_transport_priv = rtsp_st->transport_priv; return ret; }
1threat
SQL query: updating/inserting data in C# application : I created 3 tables Clients: Client_ID, Client_Name, Client_Status, Employees:Emp_ID, Emp_Name, Emp_Role EmpJobs:EmpJob_ID, Emp_ID, Client_ID, Hours_Spent, Job_Date now I need a function where the user enters data (Hours_Spent, Job_Date) to EmpJobs based on Client_Name and Emp_Name. This is what I tried string constring = "Data Source=baker-pc;Initial Catalog=BakodahDB;Integrated Security=True"; string sqlQuery = (@"INSERT INTO EmpJobs (Hours_Spent, Job_Date) values (@Hours_Spent,@Job_Date) INNER JOIN Clients ON EmpJobs.Client_ID=Clients.Client_ID INNER JOIN Employees ON EmpJobs.Emp_ID=Employees.Emp_ID WHERE Clients.Client_Name=@Client_Name AND Employees.Emp_Name=@Emp_Name"); SqlConnection conDataBase = new SqlConnection(constring); SqlCommand sqlCommand = new SqlCommand(sqlQuery, conDataBase); conDataBase.Open(); sqlCommand.CommandText = sqlQuery; sqlCommand.Parameters.Add("@Hours_Spent",SqlDbType.Int).Value = comboBox3.SelectedItem; sqlCommand.Parameters.Add("@Job_Date",SqlDbType.Date).Value = Convert.ToDateTime(dateTimePicker1.Text); sqlCommand.Parameters.Add("@Client_Name", SqlDbType.VarChar).Value = comboBox1.SelectedItem; sqlCommand.Parameters.Add("@Emp_Name", SqlDbType.VarChar).Value = comboBox2.SelectedItem; sqlCommand.ExecuteNonQuery(); conDataBase.Close(); MessageBox.Show("Saved!"); What am i doing wrong? what's the correct way to do it?
0debug
C++ non-static data member initializers, just a little bit confused : <p>I am a little bit confused about why the following code does what it does:</p> <pre><code>class Base { public: Base() = default; Base(const Base &amp;) =delete; Base &amp;operator=(const Base &amp;) = delete; Base(const char*) {} }; class Holder { public: Holder() = default; private: // Base b = Base(); Base b2 = {}; }; int main() { Holder h; } </code></pre> <p>in this incarnation, it compiles, however if I un-comment <code>Base b = Base();</code> it gives the following error:</p> <pre><code>main.cpp:15:17: error: use of deleted function 'Base::Base(const Base&amp;)' Base b = Base(); ^ main.cpp:5:6: note: declared here Base(const Base &amp;) =delete; ^ </code></pre> <p>and I am just unable to find in the standard why it tries to call the copy constructor for the <code>Base b = Base()</code> initializer, and why doesn't it call for the <code>Base b2 = {}</code> ... or is this just one of those little obscurities that is hidden in a few words in a paragraph somewhere?</p> <p>Can you please give a (short) explanation why this happens?</p> <p>(coliru: <a href="http://coliru.stacked-crooked.com/a/c02ba0293eab2ce5">http://coliru.stacked-crooked.com/a/c02ba0293eab2ce5</a> )</p>
0debug
How to use Material Design Icons In Angular 4? : <p>I want to use the icons from <a href="https://materialdesignicons.com/" rel="noreferrer">https://materialdesignicons.com/</a> in my angular 4 project. The instructions on the website are only covering how to include it in <code>Angular 1.x</code> (<a href="https://materialdesignicons.com/getting-started" rel="noreferrer">https://materialdesignicons.com/getting-started</a>)</p> <p>How can I include the Material design icons so I can use them like <code>&lt;md-icon svgIcon="source"&gt;&lt;/md-icon&gt;</code> using <code>Angular Material</code> and <code>ng serve</code>? </p> <p><strong>NOTE: I already Included the <code>google material icons</code> which are different!</strong></p>
0debug
Combine first and last name into full name c# : <p>So here is what I have </p> <pre><code> txtFull.Text = txtFirst.Text + “\n” + txtSecond.Text; </code></pre> <p>not sure why its not working</p>
0debug
jersey RESTful api replies 415 unsupported media type : I am new to Jersey Framework. i am building the Rest APIs in Jersey. But in API of file uploading i got response as HTTP Status 415 - Unsupported Media Type.
0debug
Is it possible to start Mono's in parallel and aggregate the result : <p>I know it is possible to chain Mono's, for ex,...</p> <pre><code>Mono&lt;String&gt; resultAMono = loadA(); Mono&lt;String&gt; resultBMono = resultA.flatMap(resultA -&gt; loadB()); </code></pre> <p>This will chain and resultBMono will run when resultAMono returns....</p> <p>So my question is, is it possible to start 2 Mono's in parallel and when both returns continue with another Mono?</p> <p>I think it will look something like this...</p> <pre><code>Mono&lt;String&gt; resultAMono = loadA(); Mono&lt;String&gt; resuktBMono = loadB(); Mono&lt;Tuple2&lt;Stirng, String&gt; tupleMono = Mono.zip(resultAMono, resultBMono); </code></pre> <p>but I have no idea this will run in Parallel or what can I do this to run in parallel...</p> <p>Thx for answers....</p>
0debug
Need to find 3 small errors - memory bugs : <p>As part of a college assignment, we were tasked with analyzing some code in an effort to identify memory issues. There's 3 we are to find. As I am quite new to the concept of pointers, I am drawing a blank. I do know main() should be returning an int and that the use of the "unsigned" means non-negative integers in this case.</p> <p><a href="https://imgur.com/hxqdNdt" rel="nofollow noreferrer">Compiler Errors</a></p> <p>Tried searching for similar problems.</p> <pre><code>void main() { double* d = new double; for (unsigned int i = 0; i &lt; 3; i++) { d[i] = 1.5 + i; } for (unsigned int i = 2; i &gt;= 0; i--) { cout &lt;&lt; d[i] &lt;&lt; endl; } } The program results in an infinite loop of memory addresses. </code></pre>
0debug
You gave us a visitor for the node type "ForAwaitStatement" but it's not a valid type : <p>I'm getting the following error from a few different libraries in my project, after adding the <code>"stage-2"</code> preset to my <code>.babelrc</code>. (Thats my assumption atm)</p> <p>e.g. from the DatePicker class in React Native: </p> <pre><code>node_modules/react-native/Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js: You gave us a visitor for the node type "ForAwaitStatement" but it's not a valid type </code></pre> <p>How can I resolve this error? </p> <p>I'm using React Native 0.31 and </p> <pre><code> "devDependencies": { "babel-preset-react-native-stage-0": "^1.0.1", "babel-preset-stage-2": "^6.17.0" }, </code></pre>
0debug
static void add_ptimer_tests(uint8_t policy) { uint8_t *ppolicy = g_malloc(1); char *policy_name = g_malloc0(256); *ppolicy = policy; if (policy == PTIMER_POLICY_DEFAULT) { g_sprintf(policy_name, "default"); } if (policy & PTIMER_POLICY_WRAP_AFTER_ONE_PERIOD) { g_strlcat(policy_name, "wrap_after_one_period,", 256); } if (policy & PTIMER_POLICY_CONTINUOUS_TRIGGER) { g_strlcat(policy_name, "continuous_trigger,", 256); } if (policy & PTIMER_POLICY_NO_IMMEDIATE_TRIGGER) { g_strlcat(policy_name, "no_immediate_trigger,", 256); } if (policy & PTIMER_POLICY_NO_IMMEDIATE_RELOAD) { g_strlcat(policy_name, "no_immediate_reload,", 256); } if (policy & PTIMER_POLICY_NO_COUNTER_ROUND_DOWN) { g_strlcat(policy_name, "no_counter_rounddown,", 256); } g_test_add_data_func( g_strdup_printf("/ptimer/set_count policy=%s", policy_name), ppolicy, check_set_count); g_test_add_data_func( g_strdup_printf("/ptimer/set_limit policy=%s", policy_name), ppolicy, check_set_limit); g_test_add_data_func( g_strdup_printf("/ptimer/oneshot policy=%s", policy_name), ppolicy, check_oneshot); g_test_add_data_func( g_strdup_printf("/ptimer/periodic policy=%s", policy_name), ppolicy, check_periodic); g_test_add_data_func( g_strdup_printf("/ptimer/on_the_fly_mode_change policy=%s", policy_name), ppolicy, check_on_the_fly_mode_change); g_test_add_data_func( g_strdup_printf("/ptimer/on_the_fly_period_change policy=%s", policy_name), ppolicy, check_on_the_fly_period_change); g_test_add_data_func( g_strdup_printf("/ptimer/on_the_fly_freq_change policy=%s", policy_name), ppolicy, check_on_the_fly_freq_change); g_test_add_data_func( g_strdup_printf("/ptimer/run_with_period_0 policy=%s", policy_name), ppolicy, check_run_with_period_0); g_test_add_data_func( g_strdup_printf("/ptimer/run_with_delta_0 policy=%s", policy_name), ppolicy, check_run_with_delta_0); g_test_add_data_func( g_strdup_printf("/ptimer/periodic_with_load_0 policy=%s", policy_name), ppolicy, check_periodic_with_load_0); g_test_add_data_func( g_strdup_printf("/ptimer/oneshot_with_load_0 policy=%s", policy_name), ppolicy, check_oneshot_with_load_0); }
1threat
static void nabm_writew (void *opaque, uint32_t addr, uint32_t val) { PCIAC97LinkState *d = opaque; AC97LinkState *s = &d->ac97; AC97BusMasterRegs *r = NULL; uint32_t index = addr - s->base[1]; switch (index) { case PI_SR: case PO_SR: case MC_SR: r = &s->bm_regs[GET_BM (index)]; r->sr |= val & ~(SR_RO_MASK | SR_WCLEAR_MASK); update_sr (s, r, r->sr & ~(val & SR_WCLEAR_MASK)); dolog ("SR[%d] <- %#x (sr %#x)\n", GET_BM (index), val, r->sr); break; default: dolog ("U nabm writew %#x <- %#x\n", addr, val); break; } }
1threat
int av_buffersrc_add_ref(AVFilterContext *buffer_filter, AVFilterBufferRef *picref, int flags) { BufferSourceContext *c = buffer_filter->priv; AVFilterLink *outlink = buffer_filter->outputs[0]; AVFilterBufferRef *buf; int ret; if (!picref) { c->eof = 1; return 0; } else if (c->eof) return AVERROR(EINVAL); if (!av_fifo_space(c->fifo) && (ret = av_fifo_realloc2(c->fifo, av_fifo_size(c->fifo) + sizeof(buf))) < 0) return ret; if (!(flags & AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT)) { if (picref->video->w != c->w || picref->video->h != c->h || picref->format != c->pix_fmt) { AVFilterContext *scale = buffer_filter->outputs[0]->dst; AVFilterLink *link; char scale_param[1024]; av_log(buffer_filter, AV_LOG_INFO, "Buffer video input changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n", c->w, c->h, av_pix_fmt_descriptors[c->pix_fmt].name, picref->video->w, picref->video->h, av_pix_fmt_descriptors[picref->format].name); if (!scale || strcmp(scale->filter->name, "scale")) { AVFilter *f = avfilter_get_by_name("scale"); av_log(buffer_filter, AV_LOG_INFO, "Inserting scaler filter\n"); if ((ret = avfilter_open(&scale, f, "Input equalizer")) < 0) return ret; c->scale = scale; snprintf(scale_param, sizeof(scale_param)-1, "%d:%d:%s", c->w, c->h, c->sws_param); if ((ret = avfilter_init_filter(scale, scale_param, NULL)) < 0) { return ret; } if ((ret = avfilter_insert_filter(buffer_filter->outputs[0], scale, 0, 0)) < 0) { return ret; } scale->outputs[0]->time_base = scale->inputs[0]->time_base; scale->outputs[0]->format= c->pix_fmt; } else if (!strcmp(scale->filter->name, "scale")) { snprintf(scale_param, sizeof(scale_param)-1, "%d:%d:%s", scale->outputs[0]->w, scale->outputs[0]->h, c->sws_param); scale->filter->init(scale, scale_param, NULL); } c->pix_fmt = scale->inputs[0]->format = picref->format; c->w = scale->inputs[0]->w = picref->video->w; c->h = scale->inputs[0]->h = picref->video->h; link = scale->outputs[0]; if ((ret = link->srcpad->config_props(link)) < 0) return ret; } } if (flags & AV_BUFFERSRC_FLAG_NO_COPY) { buf = picref; } else { buf = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, picref->video->w, picref->video->h); av_image_copy(buf->data, buf->linesize, (void*)picref->data, picref->linesize, picref->format, picref->video->w, picref->video->h); avfilter_copy_buffer_ref_props(buf, picref); } if ((ret = av_fifo_generic_write(c->fifo, &buf, sizeof(buf), NULL)) < 0) { if (buf != picref) avfilter_unref_buffer(buf); return ret; } c->nb_failed_requests = 0; return 0; }
1threat
Angular 2 How to Apply Multiple Guards with Or-Relationship on the Same Path : <p>My application allows access to contents based on user roles. I wrote a Router Guard for each role. Some contents allow access for role1 or role2 or role3. How should I write that canActivate declaration in the feature-routing.module.ts file? As I understand, if I write </p> <pre><code>canActivate:[Role1Guard, Role2Guard, Role3Guard] </code></pre> <p>The access will be denied if any of the guards returns false. But in my case, I should allow access if any of the guards returns true. How to do it? Many thanks in advance!</p>
0debug
List comprehension variable not defined? (Python) : <p>I have a list of dicts sortd, i want to add the first three dicts in the list to a new list. </p> <p>I tried using a list comp for the first time but when doing:</p> <pre><code>new_dict = [pair for pair[0:3] in sortd] </code></pre> <p>i get the error "pair is not defined", what am i doing wrong here? </p>
0debug
cac_delete_pki_applet_private(VCardAppletPrivate *applet_private) { CACPKIAppletData *pki_applet_data = NULL; if (applet_private == NULL) { return; } pki_applet_data = &(applet_private->u.pki_data); if (pki_applet_data->cert != NULL) { g_free(pki_applet_data->cert); } if (pki_applet_data->sign_buffer != NULL) { g_free(pki_applet_data->sign_buffer); } if (pki_applet_data->key != NULL) { vcard_emul_delete_key(pki_applet_data->key); } g_free(applet_private); }
1threat
'utf-8' codec can't decode byte 0xa0 in position 4276: invalid start byte : <p>I try to read and print the following file: txt.tsv (<a href="https://www.sec.gov/files/dera/data/financial-statement-and-notes-data-sets/2017q3_notes.zip" rel="noreferrer">https://www.sec.gov/files/dera/data/financial-statement-and-notes-data-sets/2017q3_notes.zip</a>)</p> <p>According to the SEC the data set is provided in a single encoding, as follows:</p> <blockquote> <p>Tab Delimited Value (.txt): utf-8, tab-delimited, \n- terminated lines, with the first line containing the field names in lowercase.</p> </blockquote> <p>My current code:</p> <pre><code>import csv with open('txt.tsv') as tsvfile: reader = csv.DictReader(tsvfile, dialect='excel-tab') for row in reader: print(row) </code></pre> <p>All attempts ended with the following error message:</p> <blockquote> <p>'utf-8' codec can't decode byte 0xa0 in position 4276: invalid start byte</p> </blockquote> <p>I am a bit lost. Can anyone help me? Many thanks in advance.</p>
0debug
From an IF statement how to run a php script AND provide a variable : As per the title, in php how can you run /execute another php file on the same domain, whilst sending a variable such a POST etc?
0debug
Simple client - server application via REST : <p>How can one build Java application which consists of a client and a server that communicate using REST. I've been thinking to build client using Java FX(because it looks simple) and server as a Java servlet. I am fresh with Java but I am sitting with PHP everyday so I am well awared of MVC pattern but the real question is how to get this done simply in Java? Would you recommend me some framework? The app will be really simple because it will just have only few screens. There sould also be authentication using login and password for users, but thats all! Should I look into Spring maybe? Wouldn't it be overkill?</p>
0debug
static int write_trailer(AVFormatContext *s) { WVMuxContext *wc = s->priv_data; AVIOContext *pb = s->pb; ff_ape_write(s); if (pb->seekable) { avio_seek(pb, 12, SEEK_SET); avio_wl32(pb, wc->duration); avio_flush(pb); } return 0; }
1threat
iteration in javascript, nodejs : <p>I have data like : - </p> <pre><code>[ {"title": "A Hug Is Warm","id": "69","level": "4","act_title": "Alphabet","act_id": "69_1d"}, {"title": "A Hug Is Warm","id": "69","level": "4","act_title": "Recording","act_id": "69_rec"}, {"title": "A Hug Is Warm","level": "4","id": "69","act_title": "Print","act_id": "69_pr_1"}, ......... ]; </code></pre> <p>and want to return back : ......</p> <pre><code>[{ "title": "A Hug Is Warm", "id": "69", "level": "4", "activities": [{"act_title": "Alphabet",act_id": "69_1d"}, {"act_title": "Recording","act_id": "69_rec"}, {"act_title": "Print","act_id": "69_pr_1"} ] }, .......... ] </code></pre> <p>In php it is very easy to achieve using a multidimensional array.</p>
0debug
Macro to fill blank cells whitin a range : Let's say i have the range of cells A1:C3 and i need to fill in any empty cells from the range with the value that is in cells A4:C4, the emplty cells in column A will be filled with the value of A4, those in column B with the value from B4 and so on.
0debug
static int write_option(void *optctx, const OptionDef *po, const char *opt, const char *arg) { void *dst = po->flags & (OPT_OFFSET | OPT_SPEC) ? (uint8_t *)optctx + po->u.off : po->u.dst_ptr; int *dstcount; if (po->flags & OPT_SPEC) { SpecifierOpt **so = dst; char *p = strchr(opt, ':'); dstcount = (int *)(so + 1); *so = grow_array(*so, sizeof(**so), dstcount, *dstcount + 1); (*so)[*dstcount - 1].specifier = av_strdup(p ? p + 1 : ""); dst = &(*so)[*dstcount - 1].u; } if (po->flags & OPT_STRING) { char *str; str = av_strdup(arg); av_freep(dst); *(char **)dst = str; } else if (po->flags & OPT_BOOL || po->flags & OPT_INT) { *(int *)dst = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX); } else if (po->flags & OPT_INT64) { *(int64_t *)dst = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX); } else if (po->flags & OPT_TIME) { *(int64_t *)dst = parse_time_or_die(opt, arg, 1); } else if (po->flags & OPT_FLOAT) { *(float *)dst = parse_number_or_die(opt, arg, OPT_FLOAT, -INFINITY, INFINITY); } else if (po->flags & OPT_DOUBLE) { *(double *)dst = parse_number_or_die(opt, arg, OPT_DOUBLE, -INFINITY, INFINITY); } else if (po->u.func_arg) { int ret = po->u.func_arg(optctx, opt, arg); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Failed to set value '%s' for option '%s'\n", arg, opt); return ret; } } if (po->flags & OPT_EXIT) exit(0); return 0; }
1threat
This application is modifying the autolayout engine from a background thread, which can lead to engine corruption : <p>I am getting this error <strong>This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes.This will cause an exception in a future release.</strong> I don't know what is causing this error. Can anybody help me.</p> <pre><code>func getUserDataFromTwitterWithUser(user : PFUser) { //NRLoader.showLoader() let strTwURL = "https://api.twitter.com/1.1/users/show.json? screen_name="+PFTwitterUtils.twitter()!.screenName! + "&amp;access_token="+PFTwitterUtils.twitter()!.authToken! let twURL = NSURL (string: strTwURL) let request = NSMutableURLRequest(URL: twURL!, cachePolicy: NSURLRequestCachePolicy.UseProtocolCachePolicy, timeoutInterval: 2.0) as NSMutableURLRequest PFTwitterUtils.twitter()?.signRequest(request) let session = NSURLSession.sharedSession() session.dataTaskWithRequest(request, completionHandler: {(data, response, error) in if error == nil { var jsonOptional = Dictionary&lt;String, AnyObject&gt;() do { jsonOptional = try NSJSONSerialization.JSONObjectWithData(data!, options:NSJSONReadingOptions.MutableContainers ) as! Dictionary&lt;String, AnyObject&gt; // use jsonData } catch { // report error } var userName = "" if let screenName = jsonOptional["screen_name"] as? String{ userName = screenName } else if let name = jsonOptional["name"] as? String{ userName = name } var profilePicUrl = "" if let picUrl = jsonOptional["profile_image_url"] as? String{ profilePicUrl = picUrl } AppUser.currentUser()?.username = userName AppUser.currentUser()?.profileAwsURL = profilePicUrl //NRLoader.hideLoader() //if ParseUtils.isLoggedInUserIsAnonymous() { let signUpVC:SignMeUpViewController = self.storyboard!.instantiateViewControllerWithIdentifier("SignMeUpViewController") as! SignMeUpViewController signUpVC.isFromLogin = true self.navigationController!.pushViewController(signUpVC, animated: true) //} else { // self.pushToSubmitDreamViewController() //} } else { //NRLoader.hideLoader() NRToast.showToastWithMessage(error!.description) } }).resume() } </code></pre>
0debug
static void gen_dmfc0(DisasContext *ctx, TCGv arg, int reg, int sel) { const char *rn = "invalid"; if (sel != 0) check_insn(ctx, ISA_MIPS64); switch (reg) { case 0: switch (sel) { case 0: gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Index)); rn = "Index"; case 1: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mfc0_mvpcontrol(arg, cpu_env); rn = "MVPControl"; CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mfc0_mvpconf0(arg, cpu_env); rn = "MVPConf0"; CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mfc0_mvpconf1(arg, cpu_env); rn = "MVPConf1"; CP0_CHECK(ctx->vp); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_VPControl)); rn = "VPControl"; default: goto cp0_unimplemented; } case 1: switch (sel) { case 0: CP0_CHECK(!(ctx->insn_flags & ISA_MIPS32R6)); gen_helper_mfc0_random(arg, cpu_env); rn = "Random"; case 1: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_VPEControl)); rn = "VPEControl"; CP0_CHECK(ctx->insn_flags & ASE_MT); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_VPEConf0)); rn = "VPEConf0"; CP0_CHECK(ctx->insn_flags & ASE_MT); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_VPEConf1)); rn = "VPEConf1"; CP0_CHECK(ctx->insn_flags & ASE_MT); tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_YQMask)); rn = "YQMask"; case 5: CP0_CHECK(ctx->insn_flags & ASE_MT); tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_VPESchedule)); rn = "VPESchedule"; case 6: CP0_CHECK(ctx->insn_flags & ASE_MT); tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_VPEScheFBack)); rn = "VPEScheFBack"; case 7: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_VPEOpt)); rn = "VPEOpt"; default: goto cp0_unimplemented; } switch (sel) { case 0: tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_EntryLo0)); rn = "EntryLo0"; case 1: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mfc0_tcstatus(arg, cpu_env); rn = "TCStatus"; CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mfc0_tcbind(arg, cpu_env); rn = "TCBind"; CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_dmfc0_tcrestart(arg, cpu_env); rn = "TCRestart"; CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_dmfc0_tchalt(arg, cpu_env); rn = "TCHalt"; case 5: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_dmfc0_tccontext(arg, cpu_env); rn = "TCContext"; case 6: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_dmfc0_tcschedule(arg, cpu_env); rn = "TCSchedule"; case 7: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_dmfc0_tcschefback(arg, cpu_env); rn = "TCScheFBack"; default: goto cp0_unimplemented; } switch (sel) { case 0: tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_EntryLo1)); rn = "EntryLo1"; case 1: CP0_CHECK(ctx->vp); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_GlobalNumber)); rn = "GlobalNumber"; default: goto cp0_unimplemented; } switch (sel) { case 0: tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_Context)); rn = "Context"; case 1: rn = "ContextConfig"; goto cp0_unimplemented; CP0_CHECK(ctx->ulri); tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, active_tc.CP0_UserLocal)); rn = "UserLocal"; default: goto cp0_unimplemented; } case 5: switch (sel) { case 0: gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_PageMask)); rn = "PageMask"; case 1: check_insn(ctx, ISA_MIPS32R2); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_PageGrain)); rn = "PageGrain"; default: goto cp0_unimplemented; } case 6: switch (sel) { case 0: gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Wired)); rn = "Wired"; case 1: check_insn(ctx, ISA_MIPS32R2); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_SRSConf0)); rn = "SRSConf0"; check_insn(ctx, ISA_MIPS32R2); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_SRSConf1)); rn = "SRSConf1"; check_insn(ctx, ISA_MIPS32R2); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_SRSConf2)); rn = "SRSConf2"; check_insn(ctx, ISA_MIPS32R2); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_SRSConf3)); rn = "SRSConf3"; case 5: check_insn(ctx, ISA_MIPS32R2); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_SRSConf4)); rn = "SRSConf4"; default: goto cp0_unimplemented; } case 7: switch (sel) { case 0: check_insn(ctx, ISA_MIPS32R2); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_HWREna)); rn = "HWREna"; default: goto cp0_unimplemented; } case 8: switch (sel) { case 0: tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_BadVAddr)); rn = "BadVAddr"; case 1: CP0_CHECK(ctx->bi); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_BadInstr)); rn = "BadInstr"; CP0_CHECK(ctx->bp); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_BadInstrP)); rn = "BadInstrP"; default: goto cp0_unimplemented; } case 9: switch (sel) { case 0: if (ctx->tb->cflags & CF_USE_ICOUNT) { gen_io_start(); } gen_helper_mfc0_count(arg, cpu_env); if (ctx->tb->cflags & CF_USE_ICOUNT) { gen_io_end(); } ctx->bstate = BS_STOP; rn = "Count"; default: goto cp0_unimplemented; } case 10: switch (sel) { case 0: tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_EntryHi)); rn = "EntryHi"; default: goto cp0_unimplemented; } case 11: switch (sel) { case 0: gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Compare)); rn = "Compare"; default: goto cp0_unimplemented; } case 12: switch (sel) { case 0: gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Status)); rn = "Status"; case 1: check_insn(ctx, ISA_MIPS32R2); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_IntCtl)); rn = "IntCtl"; check_insn(ctx, ISA_MIPS32R2); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_SRSCtl)); rn = "SRSCtl"; check_insn(ctx, ISA_MIPS32R2); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_SRSMap)); rn = "SRSMap"; default: goto cp0_unimplemented; } case 13: switch (sel) { case 0: gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Cause)); rn = "Cause"; default: goto cp0_unimplemented; } case 14: switch (sel) { case 0: tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_EPC)); rn = "EPC"; default: goto cp0_unimplemented; } case 15: switch (sel) { case 0: gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_PRid)); rn = "PRid"; case 1: check_insn(ctx, ISA_MIPS32R2); tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_EBase)); rn = "EBase"; check_insn(ctx, ISA_MIPS32R2); CP0_CHECK(ctx->cmgcr); tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_CMGCRBase)); rn = "CMGCRBase"; default: goto cp0_unimplemented; } case 16: switch (sel) { case 0: gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Config0)); rn = "Config"; case 1: gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Config1)); rn = "Config1"; gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Config2)); rn = "Config2"; gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Config3)); rn = "Config3"; gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Config4)); rn = "Config4"; case 5: gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Config5)); rn = "Config5"; case 6: gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Config6)); rn = "Config6"; case 7: gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Config7)); rn = "Config7"; default: goto cp0_unimplemented; } case 17: switch (sel) { case 0: gen_helper_dmfc0_lladdr(arg, cpu_env); rn = "LLAddr"; case 1: CP0_CHECK(ctx->mrp); gen_helper_dmfc0_maar(arg, cpu_env); rn = "MAAR"; CP0_CHECK(ctx->mrp); gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_MAARI)); rn = "MAARI"; default: goto cp0_unimplemented; } case 18: switch (sel) { case 0 ... 7: gen_helper_1e0i(dmfc0_watchlo, arg, sel); rn = "WatchLo"; default: goto cp0_unimplemented; } case 19: switch (sel) { case 0 ... 7: gen_helper_1e0i(mfc0_watchhi, arg, sel); rn = "WatchHi"; default: goto cp0_unimplemented; } case 20: switch (sel) { case 0: check_insn(ctx, ISA_MIPS3); tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_XContext)); rn = "XContext"; default: goto cp0_unimplemented; } case 21: CP0_CHECK(!(ctx->insn_flags & ISA_MIPS32R6)); switch (sel) { case 0: gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Framemask)); rn = "Framemask"; default: goto cp0_unimplemented; } case 22: tcg_gen_movi_tl(arg, 0); rn = "'Diagnostic"; case 23: switch (sel) { case 0: gen_helper_mfc0_debug(arg, cpu_env); rn = "Debug"; case 1: rn = "TraceControl"; goto cp0_unimplemented; rn = "TraceControl2"; goto cp0_unimplemented; rn = "UserTraceData"; goto cp0_unimplemented; rn = "TraceBPC"; goto cp0_unimplemented; default: goto cp0_unimplemented; } case 24: switch (sel) { case 0: tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_DEPC)); rn = "DEPC"; default: goto cp0_unimplemented; } case 25: switch (sel) { case 0: gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Performance0)); rn = "Performance0"; case 1: rn = "Performance1"; goto cp0_unimplemented; rn = "Performance2"; goto cp0_unimplemented; rn = "Performance3"; goto cp0_unimplemented; rn = "Performance4"; goto cp0_unimplemented; case 5: rn = "Performance5"; goto cp0_unimplemented; case 6: rn = "Performance6"; goto cp0_unimplemented; case 7: rn = "Performance7"; goto cp0_unimplemented; default: goto cp0_unimplemented; } case 26: switch (sel) { case 0: gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_ErrCtl)); rn = "ErrCtl"; default: goto cp0_unimplemented; } case 27: switch (sel) { case 0 ... 3: tcg_gen_movi_tl(arg, 0); rn = "CacheErr"; default: goto cp0_unimplemented; } case 28: switch (sel) { case 0: case 6: gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_TagLo)); rn = "TagLo"; case 1: case 5: case 7: gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_DataLo)); rn = "DataLo"; default: goto cp0_unimplemented; } case 29: switch (sel) { case 0: case 6: gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_TagHi)); rn = "TagHi"; case 1: case 5: case 7: gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_DataHi)); rn = "DataHi"; default: goto cp0_unimplemented; } case 30: switch (sel) { case 0: tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_ErrorEPC)); rn = "ErrorEPC"; default: goto cp0_unimplemented; } case 31: switch (sel) { case 0: gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_DESAVE)); rn = "DESAVE"; case 2 ... 7: CP0_CHECK(ctx->kscrexist & (1 << sel)); tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_KScratch[sel-2])); rn = "KScratch"; default: goto cp0_unimplemented; } default: goto cp0_unimplemented; } trace_mips_translate_c0("dmfc0", rn, reg, sel); return; cp0_unimplemented: qemu_log_mask(LOG_UNIMP, "dmfc0 %s (reg %d sel %d)\n", rn, reg, sel); gen_mfc0_unimplemented(ctx, arg); }
1threat
How to recover my website page ranking, after using google analytics? : <p>My website was ranking in the fifth page when searching company name on google. But after i added key words with meta tag and google analytics code for better seo i lost my website name presence in entire google search results.Now google analytics showing i have more than page visitors than before. But bounce rate is 82%. If you can suggest me what i can do to bring my website name in search results , that would be a great help for me.</p> <p>thanks,<a href="https://i.stack.imgur.com/rFYmD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rFYmD.png" alt="enter image description here"></a></p>
0debug
How to set linear gradient to background of LaunchScreen.xib in iOS : <p>Is there any way to set linear gradient to background of LaunchScreen.xib in iOS? Something like <code>background="linear-gradient(#000000, #123456)"</code>?</p> <pre><code>&lt;view contentMode="scaleToFill" background="..."&gt; &lt;rect key="frame" width="753" height="867"/&gt; &lt;/view&gt; </code></pre>
0debug
How to do a single row query with Android Room : <p>How do I make a single row query with Android Room with RxJava? I am able to query for List of items, no issues. Here, I want to find if a specific row exists. According to the docs, looks like I can return Single and check for EmptyResultSetException exception if no row exists.</p> <p>I can have something like:</p> <pre><code>@Query("SELECT * FROM Users WHERE userId = :id LIMIT 1") Single&lt;User&gt; findByUserId(String userId); </code></pre> <p>How do I use this call? Looks like there is some onError / onSuccess but cannot find those methods on Single&lt;>.</p> <pre><code>usersDao.findByUserId("xxx").??? </code></pre> <p>Any working example will be great!</p>
0debug
How can i select same name Radio button with java script? : I have multiple radio button with same name and id and want to select radio button with javascirpt . <input type="radio" name="Custom.SELECTED_INDEX" id="Custom.SELECTED_INDEX" value="1" class="middle"> <input type="radio" name="Custom.SELECTED_INDEX" id="Custom.SELECTED_INDEX" value="2" class="middle"> <input type="radio" name="Custom.SELECTED_INDEX" id="Custom.SELECTED_INDEX" value="3" class="middle"> I am trying with below code but that is not working (function() { document.getElementById('Custom.SELECTED_INDEX')[2].checked = true; return 'success'; })();
0debug
static int vnc_update_client(VncState *vs, int has_dirty, bool sync) { if (vs->need_update && vs->csock != -1) { VncDisplay *vd = vs->vd; VncJob *job; int y; int height; int n = 0; if (vs->output.offset && !vs->audio_cap && !vs->force_update) return 0; if (!has_dirty && !vs->audio_cap && !vs->force_update) return 0; job = vnc_job_new(vs); height = MIN(pixman_image_get_height(vd->server), vs->client_height); y = 0; for (;;) { int x, h; unsigned long x2; unsigned long offset = find_next_bit((unsigned long *) &vs->dirty, height * VNC_DIRTY_BPL(vs), y * VNC_DIRTY_BPL(vs)); if (offset == height * VNC_DIRTY_BPL(vs)) { break; } y = offset / VNC_DIRTY_BPL(vs); x = offset % VNC_DIRTY_BPL(vs); x2 = find_next_zero_bit((unsigned long *) &vs->dirty[y], VNC_DIRTY_BPL(vs), x); bitmap_clear(vs->dirty[y], x, x2 - x); h = find_and_clear_dirty_height(vs, y, x, x2, height); n += vnc_job_add_rect(job, x * VNC_DIRTY_PIXELS_PER_BIT, y, (x2 - x) * VNC_DIRTY_PIXELS_PER_BIT, h); } vnc_job_push(job); vs->force_update = 0; return n; } if (vs->csock == -1) { vnc_disconnect_finish(vs); } else if (sync) { vnc_jobs_join(vs); } return 0; }
1threat
static void bdrv_drain_poll(BlockDriverState *bs) { while (bdrv_requests_pending(bs)) { aio_poll(bdrv_get_aio_context(bs), true); } }
1threat
Keep getting matching error in haskell when testing function : <blockquote> <p>this is the function</p> </blockquote> <pre><code>toRevDigits :: Integer -&gt; [Integer] toRevDigits 0 = [] toRevDigits x | x&lt;0 = [] | otherwise = lastDigit x:(toRevDigits (dropLastDigit x)) </code></pre> <blockquote> <p>this is the test</p> </blockquote> <pre><code>testRevDigits :: (Integer, [Integer]) -&gt; Bool testRevDigits (n, [d]) = toRevDigits n ==[n] ex2Tests :: [Test] ex2Tests = [Test "toRevDigits test" testRevDigits [(321,[1,2,3]), (0,[]), ((-17),[])] ] </code></pre> <blockquote> <p>this is the error</p> </blockquote> <pre><code>*** Exception: LAB8Tests.hs:27:1-44: Non-exhaustive patterns in function testRevDigits </code></pre> <blockquote> <p>how can i fix the tester to function to make it work?</p> </blockquote>
0debug
static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr, TCGArg *args, TCGOpDef *tcg_op_defs) { int i, nb_ops, op_index, nb_temps, nb_globals, nb_call_args; TCGOpcode op; const TCGOpDef *def; TCGArg *gen_args; TCGArg tmp; TCGCond cond; nb_temps = s->nb_temps; nb_globals = s->nb_globals; memset(temps, 0, nb_temps * sizeof(struct tcg_temp_info)); nb_ops = tcg_opc_ptr - gen_opc_buf; gen_args = args; for (op_index = 0; op_index < nb_ops; op_index++) { op = gen_opc_buf[op_index]; def = &tcg_op_defs[op]; if (!(def->flags & (TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS))) { assert(op != INDEX_op_call); for (i = def->nb_oargs; i < def->nb_oargs + def->nb_iargs; i++) { if (temps[args[i]].state == TCG_TEMP_COPY) { args[i] = temps[args[i]].val; } } } switch (op) { CASE_OP_32_64(add): CASE_OP_32_64(mul): CASE_OP_32_64(and): CASE_OP_32_64(or): CASE_OP_32_64(xor): CASE_OP_32_64(eqv): CASE_OP_32_64(nand): CASE_OP_32_64(nor): if (temps[args[1]].state == TCG_TEMP_CONST) { tmp = args[1]; args[1] = args[2]; args[2] = tmp; } break; CASE_OP_32_64(brcond): if (temps[args[0]].state == TCG_TEMP_CONST && temps[args[1]].state != TCG_TEMP_CONST) { tmp = args[0]; args[0] = args[1]; args[1] = tmp; args[2] = tcg_swap_cond(args[2]); } break; CASE_OP_32_64(setcond): if (temps[args[1]].state == TCG_TEMP_CONST && temps[args[2]].state != TCG_TEMP_CONST) { tmp = args[1]; args[1] = args[2]; args[2] = tmp; args[3] = tcg_swap_cond(args[3]); } break; CASE_OP_32_64(movcond): cond = args[5]; if (temps[args[1]].state == TCG_TEMP_CONST && temps[args[2]].state != TCG_TEMP_CONST) { tmp = args[1]; args[1] = args[2]; args[2] = tmp; cond = tcg_swap_cond(cond); } if (args[0] == args[3]) { tmp = args[3]; args[3] = args[4]; args[4] = tmp; cond = tcg_invert_cond(cond); } args[5] = cond; default: break; } switch (op) { CASE_OP_32_64(shl): CASE_OP_32_64(shr): CASE_OP_32_64(sar): CASE_OP_32_64(rotl): CASE_OP_32_64(rotr): if (temps[args[1]].state == TCG_TEMP_CONST && temps[args[1]].val == 0) { gen_opc_buf[op_index] = op_to_movi(op); tcg_opt_gen_movi(gen_args, args[0], 0, nb_temps, nb_globals); args += 3; gen_args += 2; continue; } break; default: break; } switch (op) { CASE_OP_32_64(add): CASE_OP_32_64(sub): CASE_OP_32_64(shl): CASE_OP_32_64(shr): CASE_OP_32_64(sar): CASE_OP_32_64(rotl): CASE_OP_32_64(rotr): CASE_OP_32_64(or): CASE_OP_32_64(xor): if (temps[args[1]].state == TCG_TEMP_CONST) { break; } if (temps[args[2]].state == TCG_TEMP_CONST && temps[args[2]].val == 0) { if ((temps[args[0]].state == TCG_TEMP_COPY && temps[args[0]].val == args[1]) || args[0] == args[1]) { gen_opc_buf[op_index] = INDEX_op_nop; } else { gen_opc_buf[op_index] = op_to_mov(op); tcg_opt_gen_mov(gen_args, args[0], args[1], nb_temps, nb_globals); gen_args += 2; } args += 3; continue; } break; default: break; } switch (op) { CASE_OP_32_64(and): CASE_OP_32_64(mul): if ((temps[args[2]].state == TCG_TEMP_CONST && temps[args[2]].val == 0)) { gen_opc_buf[op_index] = op_to_movi(op); tcg_opt_gen_movi(gen_args, args[0], 0, nb_temps, nb_globals); args += 3; gen_args += 2; continue; } break; default: break; } switch (op) { CASE_OP_32_64(or): CASE_OP_32_64(and): if (args[1] == args[2]) { if (args[1] == args[0]) { gen_opc_buf[op_index] = INDEX_op_nop; } else { gen_opc_buf[op_index] = op_to_mov(op); tcg_opt_gen_mov(gen_args, args[0], args[1], nb_temps, nb_globals); gen_args += 2; } args += 3; continue; } break; default: break; } switch (op) { CASE_OP_32_64(mov): if ((temps[args[1]].state == TCG_TEMP_COPY && temps[args[1]].val == args[0]) || args[0] == args[1]) { args += 2; gen_opc_buf[op_index] = INDEX_op_nop; break; } if (temps[args[1]].state != TCG_TEMP_CONST) { tcg_opt_gen_mov(gen_args, args[0], args[1], nb_temps, nb_globals); gen_args += 2; args += 2; break; } op = op_to_movi(op); gen_opc_buf[op_index] = op; args[1] = temps[args[1]].val; CASE_OP_32_64(movi): tcg_opt_gen_movi(gen_args, args[0], args[1], nb_temps, nb_globals); gen_args += 2; args += 2; break; CASE_OP_32_64(not): CASE_OP_32_64(neg): CASE_OP_32_64(ext8s): CASE_OP_32_64(ext8u): CASE_OP_32_64(ext16s): CASE_OP_32_64(ext16u): case INDEX_op_ext32s_i64: case INDEX_op_ext32u_i64: if (temps[args[1]].state == TCG_TEMP_CONST) { gen_opc_buf[op_index] = op_to_movi(op); tmp = do_constant_folding(op, temps[args[1]].val, 0); tcg_opt_gen_movi(gen_args, args[0], tmp, nb_temps, nb_globals); } else { reset_temp(args[0], nb_temps, nb_globals); gen_args[0] = args[0]; gen_args[1] = args[1]; } gen_args += 2; args += 2; break; CASE_OP_32_64(add): CASE_OP_32_64(sub): CASE_OP_32_64(mul): CASE_OP_32_64(or): CASE_OP_32_64(and): CASE_OP_32_64(xor): CASE_OP_32_64(shl): CASE_OP_32_64(shr): CASE_OP_32_64(sar): CASE_OP_32_64(rotl): CASE_OP_32_64(rotr): CASE_OP_32_64(andc): CASE_OP_32_64(orc): CASE_OP_32_64(eqv): CASE_OP_32_64(nand): CASE_OP_32_64(nor): if (temps[args[1]].state == TCG_TEMP_CONST && temps[args[2]].state == TCG_TEMP_CONST) { gen_opc_buf[op_index] = op_to_movi(op); tmp = do_constant_folding(op, temps[args[1]].val, temps[args[2]].val); tcg_opt_gen_movi(gen_args, args[0], tmp, nb_temps, nb_globals); gen_args += 2; } else { reset_temp(args[0], nb_temps, nb_globals); gen_args[0] = args[0]; gen_args[1] = args[1]; gen_args[2] = args[2]; gen_args += 3; } args += 3; break; CASE_OP_32_64(setcond): if (temps[args[1]].state == TCG_TEMP_CONST && temps[args[2]].state == TCG_TEMP_CONST) { gen_opc_buf[op_index] = op_to_movi(op); tmp = do_constant_folding_cond(op, temps[args[1]].val, temps[args[2]].val, args[3]); tcg_opt_gen_movi(gen_args, args[0], tmp, nb_temps, nb_globals); gen_args += 2; } else { reset_temp(args[0], nb_temps, nb_globals); gen_args[0] = args[0]; gen_args[1] = args[1]; gen_args[2] = args[2]; gen_args[3] = args[3]; gen_args += 4; } args += 4; break; CASE_OP_32_64(brcond): if (temps[args[0]].state == TCG_TEMP_CONST && temps[args[1]].state == TCG_TEMP_CONST) { if (do_constant_folding_cond(op, temps[args[0]].val, temps[args[1]].val, args[2])) { memset(temps, 0, nb_temps * sizeof(struct tcg_temp_info)); gen_opc_buf[op_index] = INDEX_op_br; gen_args[0] = args[3]; gen_args += 1; } else { gen_opc_buf[op_index] = INDEX_op_nop; } } else { memset(temps, 0, nb_temps * sizeof(struct tcg_temp_info)); reset_temp(args[0], nb_temps, nb_globals); gen_args[0] = args[0]; gen_args[1] = args[1]; gen_args[2] = args[2]; gen_args[3] = args[3]; gen_args += 4; } args += 4; break; CASE_OP_32_64(movcond): if (temps[args[1]].state == TCG_TEMP_CONST && temps[args[2]].state == TCG_TEMP_CONST) { tmp = do_constant_folding_cond(op, temps[args[1]].val, temps[args[2]].val, args[5]); if (args[0] == args[4-tmp] || (temps[args[4-tmp]].state == TCG_TEMP_COPY && temps[args[4-tmp]].val == args[0])) { gen_opc_buf[op_index] = INDEX_op_nop; } else if (temps[args[4-tmp]].state == TCG_TEMP_CONST) { gen_opc_buf[op_index] = op_to_movi(op); tcg_opt_gen_movi(gen_args, args[0], temps[args[4-tmp]].val, nb_temps, nb_globals); gen_args += 2; } else { gen_opc_buf[op_index] = op_to_mov(op); tcg_opt_gen_mov(gen_args, args[0], args[4-tmp], nb_temps, nb_globals); gen_args += 2; } } else { reset_temp(args[0], nb_temps, nb_globals); gen_args[0] = args[0]; gen_args[1] = args[1]; gen_args[2] = args[2]; gen_args[3] = args[3]; gen_args[4] = args[4]; gen_args[5] = args[5]; gen_args += 6; } args += 6; break; case INDEX_op_call: nb_call_args = (args[0] >> 16) + (args[0] & 0xffff); if (!(args[nb_call_args + 1] & (TCG_CALL_CONST | TCG_CALL_PURE))) { for (i = 0; i < nb_globals; i++) { reset_temp(i, nb_temps, nb_globals); } } for (i = 0; i < (args[0] >> 16); i++) { reset_temp(args[i + 1], nb_temps, nb_globals); } i = nb_call_args + 3; while (i) { *gen_args = *args; args++; gen_args++; i--; } break; default: if (def->flags & TCG_OPF_BB_END) { memset(temps, 0, nb_temps * sizeof(struct tcg_temp_info)); } else { for (i = 0; i < def->nb_oargs; i++) { reset_temp(args[i], nb_temps, nb_globals); } } for (i = 0; i < def->nb_args; i++) { gen_args[i] = args[i]; } args += def->nb_args; gen_args += def->nb_args; break; } } return gen_args; }
1threat
Localising a UILabel with attributed string from a Storyboard : <p>I have a UILabel with text set as "attributed" in a storyboard. When I generate the Main.strings file for translating into a different language the text for this label does not appear.</p> <p>I tried to add manually an entry into the Main.strings file by copying the object id. I tried setting the "text" property and the "attributedText" property but when I run the app the translated string is not used.</p> <p>So, how do I localise an UILabel set as "attributed" on a storyboard?</p>
0debug
using conditional operation in for loop : <p>I need to skip certain part of the code if condition is true, How to do it in php</p> <pre><code> if ($a==0 &amp;&amp; $b==0) { //skip this part of the code and exit loop } </code></pre>
0debug
get_sigframe(struct emulated_sigaction *ka, CPUX86State *env, size_t frame_size) { unsigned long esp; esp = env->regs[R_ESP]; #if 0 if (ka->sa.sa_flags & SA_ONSTACK) { if (sas_ss_flags(esp) == 0) esp = current->sas_ss_sp + current->sas_ss_size; } else if ((regs->xss & 0xffff) != __USER_DS && !(ka->sa.sa_flags & SA_RESTORER) && ka->sa.sa_restorer) { esp = (unsigned long) ka->sa.sa_restorer; } #endif return (void *)((esp - frame_size) & -8ul); }
1threat
def check_distinct(test_tup): res = True temp = set() for ele in test_tup: if ele in temp: res = False break temp.add(ele) return (res)
0debug
static int guest_get_network_stats(const char *name, GuestNetworkInterfaceStat *stats) { DWORD if_index = 0; MIB_IFROW a_mid_ifrow; memset(&a_mid_ifrow, 0, sizeof(a_mid_ifrow)); if_index = get_interface_index(name); a_mid_ifrow.dwIndex = if_index; if (NO_ERROR == GetIfEntry(&a_mid_ifrow)) { stats->rx_bytes = a_mid_ifrow.dwInOctets; stats->rx_packets = a_mid_ifrow.dwInUcastPkts; stats->rx_errs = a_mid_ifrow.dwInErrors; stats->rx_dropped = a_mid_ifrow.dwInDiscards; stats->tx_bytes = a_mid_ifrow.dwOutOctets; stats->tx_packets = a_mid_ifrow.dwOutUcastPkts; stats->tx_errs = a_mid_ifrow.dwOutErrors; stats->tx_dropped = a_mid_ifrow.dwOutDiscards; return 0; } return -1; }
1threat
What is the purpose of setImageResource() in Android Studio? : If an image is already defined in xml and, when I run the app, it pops of on the screen of the emulator without any problem, what's the purpose of setImageResource() method in Java code?
0debug
what does this mean "public static ImageResource makeGray(ImageResource inImage)" : <p>public static ImageResource makeGray(ImageResource inImage){}</p> <p>ImageResource is a class.</p> <p>makeGray is a method.</p> <p>why put a class in front of method?</p>
0debug
Convert np.array of type float64 to type uint8 scaling values : <p>I have a particular np.array <em>data</em> which represents a particular grayscale image. I need to use SimpleBlobDetector() that unfortunately only accepts 8bit images, so I need to convert this image, obviously having a quality-loss.</p> <p>I've already tried:</p> <pre><code>import numpy as np import cv2 [...] data = data / data.max() #normalizes data in range 0 - 255 data = 255 * data img = data.astype(np.uint8) cv2.imshow("Window", img) </code></pre> <p>But <em>cv2.imshow</em> is not giving the image as expected, but with strange distortion...</p> <p>In the end, I only need to convert a np.float64 to np.uint8 scaling all the values and truncating the rest, eg. 65535 becomes 255, 65534 becomes 254 and so on.... Any help?</p> <p>Thanks.</p>
0debug
Who can explain this code ? Why it shows 1 : <p>How does this work?</p> <pre><code>int a=5&lt;=5; cout&lt;&lt;a; // output : 1 </code></pre> <p>Who can explain why output is 1?</p>
0debug
static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is64) { TCGReg datalo, datahi, addrlo; TCGReg addrhi __attribute__((unused)); TCGMemOpIdx oi; TCGMemOp opc; #if defined(CONFIG_SOFTMMU) int mem_index; TCGMemOp s_bits; tcg_insn_unit *label_ptr[2]; #endif datalo = *args++; datahi = (TCG_TARGET_REG_BITS == 32 && is64 ? *args++ : 0); addrlo = *args++; addrhi = (TARGET_LONG_BITS > TCG_TARGET_REG_BITS ? *args++ : 0); oi = *args++; opc = get_memop(oi); #if defined(CONFIG_SOFTMMU) mem_index = get_mmuidx(oi); s_bits = opc & MO_SIZE; tcg_out_tlb_load(s, addrlo, addrhi, mem_index, s_bits, label_ptr, offsetof(CPUTLBEntry, addr_write)); tcg_out_qemu_st_direct(s, datalo, datahi, TCG_REG_L1, 0, 0, opc); add_qemu_ldst_label(s, false, oi, datalo, datahi, addrlo, addrhi, s->code_ptr, label_ptr); #else { int32_t offset = GUEST_BASE; TCGReg base = addrlo; int seg = 0; if (GUEST_BASE == 0 || guest_base_flags) { seg = guest_base_flags; offset = 0; if (TCG_TARGET_REG_BITS > TARGET_LONG_BITS) { seg |= P_ADDR32; } } else if (TCG_TARGET_REG_BITS == 64) { if (offset != GUEST_BASE) { if (TARGET_LONG_BITS == 32) { tcg_out_ext32u(s, TCG_REG_L0, base); base = TCG_REG_L0; } tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_L1, GUEST_BASE); tgen_arithr(s, ARITH_ADD + P_REXW, TCG_REG_L1, base); base = TCG_REG_L1; offset = 0; } else if (TARGET_LONG_BITS == 32) { tcg_out_ext32u(s, TCG_REG_L1, base); base = TCG_REG_L1; } } tcg_out_qemu_st_direct(s, datalo, datahi, base, offset, seg, opc); } #endif }
1threat
How to downgrade tensorflow, multiple versions possible? : <p>I have tensorflow 1.2.1 installed, and I need to downgrade it to version 1.1 to run a specific tutorial. What is the safe way to do it? I am using windows 10, python 3.5. Tensorflow was installed with pip3, but "pip3 show tensorflow" returns blank.</p> <p>Is it possible to have multiple version of tensorflow on the same OS? </p>
0debug
data not display when i call my php api in ionic3 : hey i cant show my data on page in ionic3 when i call php api when i do console.log then its show complete data but when i am trying to show it on my page its cant display <b>can any one help me to get out of this </b> <b> this is my feed.ts file code of ionic </b> posts: any; constructor(public navCtrl: NavController, public navParams: NavParams,public loadingCtrl: LoadingController, public http: Http) { // this.questioncontent =[ // {questionasked:"Question Asked. Computer Programming",question:"how can i learn Ionic Framework?",time:"22 min",follow:"1"}, // {questionasked:"Question Asked. human behaviour",question:"what is the real life example of deadlock",time:"justnow",follow:"101"} // ]; this.http.get('https://schoolinformation.000webhostapp.com/phpapi.php').map(res => res.json()) .subscribe( data => { this.posts = data.data console.log(this.posts); }, err => { console.log("Oops!"); } ); <b>this is my feed.html</b> <div id="question" *ngFor="let post of posts"> <div id="questionaksedby"></div> <br> <div id="Question"><b>{{post.data.question}}</b></div> <br> <div id="questiontime">Last asked:</div> <br> <div id="answerbtn"><button class="btn-lg">Answer</button> Follow:</div> </div>
0debug
static void init_coef_vlc(VLC *vlc, uint16_t **prun_table, uint16_t **plevel_table, const CoefVLCTable *vlc_table) { int n = vlc_table->n; const uint8_t *table_bits = vlc_table->huffbits; const uint32_t *table_codes = vlc_table->huffcodes; const uint16_t *levels_table = vlc_table->levels; uint16_t *run_table, *level_table; const uint16_t *p; int i, l, j, level; init_vlc(vlc, 9, n, table_bits, 1, 1, table_codes, 4, 4); run_table = av_malloc(n * sizeof(uint16_t)); level_table = av_malloc(n * sizeof(uint16_t)); p = levels_table; i = 2; level = 1; while (i < n) { l = *p++; for(j=0;j<l;j++) { run_table[i] = j; level_table[i] = level; i++; } level++; } *prun_table = run_table; *plevel_table = level_table; }
1threat
Check if FormGroup has been submitted : <p>In template-driven form, we can check that with the <code>submitted</code> property from <code>NgForm</code>. But how to achieve that in Model-driven form?</p>
0debug
JSon to ListView With setOnItemClickListener In ANdroid : *Some One Can Help Me Please Told Me How To Show Room Id In Toast Below Is The Code. Below Code Working But I am Not Able To Show RoomId in Toast.* **MainActivity.java** <!-- begin snippet: js hide: false --> <!-- language: lang-js --> package com.android.listviewexample; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.android.volley.AuthFailureError; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import android.support.v7.app.ActionBarActivity; import android.view.View; import android.view.Window; import android.content.Intent; import android.os.Bundle; import android.widget.ListView; import android.widget.AdapterView; import android.widget.SimpleAdapter; import android.widget.Toast; import android.widget.AdapterView.OnItemClickListener; public class MainActivity extends ActionBarActivity { private RequestQueue requestQueue; private static final String URL = "http://192.168.0.1/api/enter.php"; private StringRequest request; @Override protected void onCreate(Bundle savedInstanceState) { this.requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); requestQueue = Volley.newRequestQueue(this); request = new StringRequest(Request.Method.POST, URL, new Response.Listener<String>() { @Override public void onResponse(String response) { try { JSONObject jsonObject = new JSONObject(response); if(jsonObject.names().get(0).equals("success")){ JSONArray success = jsonObject.getJSONArray("success"); for (int i = 0; i < success.length(); i++) { JSONObject succes = success.getJSONObject(i); System.out.println(succes.toString()); } JSONArray rooms = jsonObject.getJSONArray("rooms"); for (int i = 0; i < rooms.length(); i++) { JSONObject room = rooms.getJSONObject(i); String name = room.optString("room"); String roomid = room.optString("roomid"); String outPut = name; roomList.add(createRoom("chatroom", outPut)); ListView listView = (ListView) findViewById(R.id.examplelistView); SimpleAdapter simpleAdapter = new SimpleAdapter(MainActivity.this, roomList, android.R.layout.simple_list_item_1, new String[] {"chatroom"}, new int[] {android.R.id.text1}); listView.setAdapter(simpleAdapter); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent intent = new Intent(getApplicationContext(), FstActivity.class); Bundle b = new Bundle(); int itemPosition = position; b.putString("roomposition", "Position :"+itemPosition); //b.putString("roomid", roomid.toString()); intent.putExtras(b); startActivity(intent); Toast.makeText(getApplicationContext(),"Position :"+itemPosition, Toast.LENGTH_LONG) .show(); } }); } }else { } } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { } }){ @Override protected Map<String, String> getParams() throws AuthFailureError { HashMap<String,String> hashMap = new HashMap<String, String>(); hashMap.put("s","e0c93d9bb49efd89f9b70225bd65f157".toString()); return hashMap; } }; requestQueue.add(request); } List<Map<String,String>> roomList = new ArrayList<Map<String,String>>(); private HashMap<String, String>createRoom(String name,String number){ HashMap<String, String> roomName = new HashMap<String, String>(); roomName.put(name, number); return roomName;} } <!-- end snippet --> **activity_main.xml** <!-- begin snippet: js hide: false --> <!-- language: lang-js --> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.android.listviewexample.MainActivity" > <ListView android:id="@+id/examplelistView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" > </ListView> </RelativeLayout> <!-- end snippet --> **192.168.0.1/enter.php** <!-- begin snippet: js hide: false --> <!-- language: lang-js --> {"success":[{"sid":"e0c93d9bb49efd89f9b70225bd65f157","login":"saeed"}],"rooms":[{"roomid":"room12","room":".~=cAsiNo-RooM=~."},{"roomid":"room24","room":".~=MusiC-Masti=~."},{"roomid":"room29","room":".~&quot;LoVeRs_RoOM&quot;~."},{"roomid":"room30","room":".PunjaBi_RocK."},{"roomid":"room31","room":".~&quot;FrienDs_RoOM&quot;~."},{"roomid":"room33","room":".~&quot;Party_All_NiGhT&quot;~."},{"roomid":"room13","room":".~=HuNtEd-RooM=~."}]} <!-- end snippet --> Please Please Help Me How to Show Room Id In TOast And OnItemClickListener :(
0debug
NoSuchMethodError when using RESTEasyClient on Android : <p>I am developing an Android app and using a library that in turn depends on <code>RESTEasyClient</code>. When using the library at runtime, I get a <code>NoSuchMethodError</code>:</p> <pre><code>java.lang.NoSuchMethodError: No direct method &lt;init&gt;(Ljavax/net/ssl/SSLContext;Lorg/apache/http/conn/ssl/X509HostnameVerifier;)V in class Lorg/apache/http/conn/ssl/SSLSocketFactory; or its super classes (declaration of 'org.apache.http.conn.ssl.SSLSocketFactory' appears in /system/framework/ext.jar) at org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.initDefaultEngine(ResteasyClientBuilder.java:418) at org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.build(ResteasyClientBuilder.java:333) </code></pre> <p>As I understand it, this is because of an incompatibility with Android's implementation of Apache HttpClient. Searching online, I have found various solutions revolving around including <code>org.apache.httpconnections:httpclient</code> in the gradle dependencies and adding <code>compile.exclude module: httpclient</code> (to resolve the resulting conflict) in several variations. I have tried all these and invariably run into either an error from gradle or the <code>NoSuchMethodError</code>mentioned above.</p> <p>Is it possible to successfully use <code>RESTEasyClient</code> on Android? What steps do I need to take to enable this?</p>
0debug
Problem Checking Username in CS50 Finance : <p>For some reason, the check route does not return false when the username is unavailable. Does anyone have an idea of what I am doing wrong?</p> <p>I have tried various different notations for the javascript code, but I have not altered the check code because it seems correct to me.</p> <p>Here is the python code:</p> <pre><code>@app.route("/check", methods=["GET"]) def check(): # Return true if username available, else false, in JSON format username = request.form.get("username") taken_usernames = db.execute("SELECT username FROM users") if not len(str(username)) &gt; 0: return jsonify(False) for taken_username in taken_usernames: if username == taken_username["username"]: return jsonify(False) return jsonify(True) </code></pre> <p>Here is the html code using the above route:</p> <pre><code>{% extends "layout.html" %} {% block title %} Register {% endblock %} {% block main %} &lt;form action="/register" method="post" onsubmit="function(event) { event.preventDefault(); }"&gt; &lt;div class="form-group"&gt; &lt;input autocomplete="off" autofocus class="form-control" name="username" placeholder="Username" type="text"&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;input class="form-control" name="password" placeholder="Password" type="password"&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;input class="form-control" name="confirmation" placeholder="Confirm Password" type="password"&gt; &lt;/div&gt; &lt;button class="btn btn-primary" type="submit"&gt;Register&lt;/button&gt; &lt;/form&gt; {% endblock %} {% if get_flashed_messages() %} &lt;script&gt; var username = document.querySelector('input.username'); var register = document.querySelector('form'); register.onsubmit = function(success) { $.get('/check?username=' + username, function() { if (success == false) { document.getElement('form').addEventListener("submit", function(event){ event.preventDefault(); }); alert('Username already taken'); } else { register.submit(); } }); }; &lt;/script&gt; {% endif %} </code></pre> <p>The route is supposed to return "false" when the username is unavailable, but it returns "true".</p>
0debug
static void dss_sp_scale_vector(int32_t *vec, int bits, int size) { int i; if (bits < 0) for (i = 0; i < size; i++) vec[i] = vec[i] >> -bits; else for (i = 0; i < size; i++) vec[i] = vec[i] << bits; }
1threat
Objecive C - how to play animated gif image : i am trying to display animated gif but it does't work they stay still. UIView * tak = [[UIView alloc] initWithFrame:CGRectMake(-10, 0, 560, 685)]; UIImage *image = [UIImage imageNamed:@"animated-f.gif"]; UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; imageView.frame = tak.bounds; [tak addSubview:imageView]; [self.view addSubview:tak]; thanks
0debug
static BlockDriverState *bdrv_new_open(const char *filename, const char *fmt, int flags) { BlockDriverState *bs; BlockDriver *drv; char password[256]; bs = bdrv_new(""); if (!bs) { error_report("Not enough memory"); goto fail; } if (fmt) { drv = bdrv_find_format(fmt); if (!drv) { error_report("Unknown file format '%s'", fmt); goto fail; } } else { drv = NULL; } if (bdrv_open(bs, filename, flags, drv) < 0) { error_report("Could not open '%s'", filename); goto fail; } if (bdrv_is_encrypted(bs)) { printf("Disk image '%s' is encrypted.\n", filename); if (read_password(password, sizeof(password)) < 0) { error_report("No password given"); goto fail; } if (bdrv_set_key(bs, password) < 0) { error_report("invalid password"); goto fail; } } return bs; fail: if (bs) { bdrv_delete(bs); } return NULL; }
1threat
How to create calendar event that comes with Microsoft Teams link to online meeting : <p>Using Microsoft Graph API 1.0, how to create a calendar event that comes with link to Microsoft Teams (online meeting)?</p> <p>Reference: <a href="https://docs.microsoft.com/en-us/graph/api/team-post?view=graph-rest-beta&amp;viewFallbackFrom=graph-rest-1.0" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/graph/api/team-post?view=graph-rest-beta&amp;viewFallbackFrom=graph-rest-1.0</a></p>
0debug
connection.query('SELECT * FROM users WHERE username = ' + input_string)
1threat
Change of Activity with Intent on Android Studio that doesn't work and don't know why : Studying and learning Android with a Youtube tutorial, i went to change between activities, followed it step by step and it just doesn't work. Tried the only way i find, with the Intent, some codes may vary but at the end uses Intent. This is what i have. -The Button at activity_main.xml: <Button android:id="@+id/btnNext" android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_constraintTop_toBottomOf="@+id/lvFood" android:text="@string/btnNext" /> -The Button at MainActivity.java: Button btnNext; btnNext = findViewById(R.id.btnNext); -The Listener of the Button: btnNext.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent toSecond = new Intent(MainActivity.this, SecondActivity.class); startActivity(toSecond); } }); Also tried this, but the same result. Intent toSecond = new Intent (v.getContext(), SecondActivity.class); startActivityForResult(toSecond, 0); My manifest file: <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/hello" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".SecondActivity"></activity> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> -The Run Log: E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.helloworld, PID: 11503 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.helloworld/com.example.helloworld.SecondActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference at com.example.helloworld.SecondActivity.onCreate(SecondActivity.java:19) at android.app.Activity.performCreate(Activity.java:7136) at android.app.Activity.performCreate(Activity.java:7127) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)  at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)  at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)  at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loop(Looper.java:193)  at android.app.ActivityThread.main(ActivityThread.java:6669)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) It should take me to the activity SecondActivity, wich only have two buttons, one for back to the MainActivity and one for close the app. BUT...the app just stop and close... And just don't know why at this point...
0debug
Regular expression to find string inside curly brackets while keeping curly brackets : <p>Hi I am only starting out with Regexs, and am trying to write a regular expression to find string inside curly brackets while keeping curly brackets</p> <pre><code>Text: "This is a {nice} text to search for a {cool} substring". Answer I want: {nice} and {cool} </code></pre> <p>I have already looked through the answer here: <a href="https://stackoverflow.com/questions/30483613/regular-expression-to-find-string-inside-curly-brackets-javascript">Regular expression to find string inside curly brackets Javascript</a></p> <p>This almost does what I want, except that it only returns what's inside the curly brackets. I want to keep the curl brackets.</p>
0debug
Angular2 - http Post not executing to ASP.NET. GET executs : I'm trying to make a post request in Angular2. For some reason I cant make POST request. I changed both the client and server to GET request and left everything else the same, and it works fine. So im wondering if i can to configure the header a different way to be able to make the POST request. Client let headers = new Headers(); headers.append('Content-Type', 'application/json') let body = latitude+','+longitude ; this.http.post('/api/SampleData/CurrentForecasts',body, { headers: headers }) .map(response => response.json()) .subscribe( data => this.Debug(data), err => console.log("Error: \n"+err), () => console.log('Get Complete') ); Server [HttpPost] public async Task<IActionResult> CurrentForecasts(string location) { using (var client = new HttpClient()) { client.BaseAddress = new Uri(" https://api.forecast.io/"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // HTTP GET HttpResponseMessage response = await client.GetAsync("forecast/APIKEY/"+location); if (response.IsSuccessStatusCode) { var forecast = await response.Content.ReadAsStringAsync(); return Content(forecast, "application/json"); } } return Json("Failed");
0debug
static int ast_read_packet(AVFormatContext *s, AVPacket *pkt) { uint32_t type, size; int64_t pos; int ret; if (avio_feof(s->pb)) return AVERROR_EOF; pos = avio_tell(s->pb); type = avio_rl32(s->pb); size = avio_rb32(s->pb); if (size > INT_MAX / s->streams[0]->codecpar->channels) return AVERROR_INVALIDDATA; size *= s->streams[0]->codecpar->channels; if ((ret = avio_skip(s->pb, 24)) < 0) return ret; if (type == MKTAG('B','L','C','K')) { ret = av_get_packet(s->pb, pkt, size); pkt->stream_index = 0; pkt->pos = pos; } else { av_log(s, AV_LOG_ERROR, "unknown chunk %x\n", type); avio_skip(s->pb, size); ret = AVERROR_INVALIDDATA; } return ret; }
1threat
static void virtio_scsi_hotplug(SCSIBus *bus, SCSIDevice *dev) { VirtIOSCSI *s = container_of(bus, VirtIOSCSI, bus); if (((s->vdev.guest_features >> VIRTIO_SCSI_F_HOTPLUG) & 1) && (s->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK)) { virtio_scsi_push_event(s, dev, VIRTIO_SCSI_T_TRANSPORT_RESET, VIRTIO_SCSI_EVT_RESET_RESCAN); } }
1threat
int ff_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { uint8_t *src[4], *dst[4]; int i, j, vsub, ret; int (*draw_slice)(AVFilterLink *, int, int, int); FF_TPRINTF_START(NULL, draw_slice); ff_tlog_link(NULL, link, 0); ff_tlog(NULL, " y:%d h:%d dir:%d\n", y, h, slice_dir); if (link->src_buf) { vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h; for (i = 0; i < 4; i++) { if (link->src_buf->data[i]) { src[i] = link->src_buf-> data[i] + (y >> (i==1 || i==2 ? vsub : 0)) * link->src_buf-> linesize[i]; dst[i] = link->cur_buf->data[i] + (y >> (i==1 || i==2 ? vsub : 0)) * link->cur_buf->linesize[i]; } else src[i] = dst[i] = NULL; } for (i = 0; i < 4; i++) { int planew = av_image_get_linesize(link->format, link->cur_buf->video->w, i); if (!src[i]) continue; for (j = 0; j < h >> (i==1 || i==2 ? vsub : 0); j++) { memcpy(dst[i], src[i], planew); src[i] += link->src_buf->linesize[i]; dst[i] += link->cur_buf->linesize[i]; } } } if (!(draw_slice = link->dstpad->draw_slice)) draw_slice = default_draw_slice; ret = draw_slice(link, y, h, slice_dir); if (ret < 0) clear_link(link); return ret; }
1threat
C: Can anyone recommend a way to write a function that counts the number of fields in a struct? i.e. - sudocode- 'for field in struct' : I want a C function that I can pass a structure to and it will return the number of fields/members within the structure. At the moment I've found the easiest way is to just make a table and add to the table anytime I add a struct to any of the programs.
0debug
static int fifo_put(SerialState *s, int fifo, uint8_t chr) { SerialFIFO *f = (fifo) ? &s->recv_fifo : &s->xmit_fifo; f->data[f->head++] = chr; if (f->head == UART_FIFO_LENGTH) f->head = 0; f->count++; return 1; }
1threat
Create the version in JIRA using jira-rest-java-client java library in gradle/groovy? : I have gradle script which is creating the version in JIRA using the REST API. But there is jira-rest-java-client also available. I want to use the java library of jira-rest-java-client and wants to do the same stuff in gradle. Can someone provide an example how could I try this. How to use the jira-rest-java-client library to make connection with JIRA through example?
0debug
Display percentage values on a pie chart : <p>I am trying to draw a pie chart with ggplot2. My code is shown below.</p> <pre><code>df &lt;- data.frame( variable = c("australia","hungary","germany","france","canada"), value = c(632,20,491,991,20) ) ggplot(df, aes(x = "", y = value, fill = variable)) + geom_bar(width = 1, stat = "identity") + scale_fill_manual(values = c("red", "yellow","blue", "green", "cyan")) + coord_polar(theta = "y") + labs(title = "pie chart") </code></pre> <p>I would like to display percentage values. How can I do that? </p>
0debug
how to move element from one point to another with animation? : <p>I have a div with position absolute. I want to move it from one point to another say from (50,50) to (400,500). the points are change every time I click the button to move the element. I want to use animation for the transition. </p> <p>How to do it in general solution or is there npm packages does that? </p>
0debug
CentOS 6.7 fails to start due to changes in /etc/fstab : <p>Apart from the main disk, I used to have another disk attached to the host which is /dev/vdb. In order to mount it automatically, I made changes in the /etc/fstab file.</p> <p>While after I removed /dev/vdb, my CentOS 6.7 fails to start, and always stops with an error saying /dev/vdb is unavailable.</p> <p>At this point, I can type the root password to enter into the command prompt, while when I trying to edit /etc/fstab file, it shows it is in read-only mode. I can't understand why it's read-only since I'm already the "root".</p> <p>I'm sure removing the problematic line from fstab file would resolve my problem, but no idea of how to override the file. Can somebody help me out?</p>
0debug
int qed_write_l2_table_sync(BDRVQEDState *s, QEDRequest *request, unsigned int index, unsigned int n, bool flush) { int ret = -EINPROGRESS; qed_write_l2_table(s, request, index, n, flush, qed_sync_cb, &ret); while (ret == -EINPROGRESS) { aio_poll(bdrv_get_aio_context(s->bs), true); } return ret; }
1threat
JWT authentication with Vue.js : <p>I'm working on an SPA with Vue.js and vue-router and I'm now dealing with authorization/authentication using JWT. I have the back end (API endpoint) sorted out, such that it will issue a token in response to a login and check for the requisite header on subsequent requests. I now want to implement the client (Vue.js) side.</p> <p>As I understand it, fundamentally what I need to do is to require authentication for all routes apart from '/' and '/login'. If authentication is present then I submit the token (which is stored in localStorage after a successful login) in an Authorization header. If it fails to validate successfully on the server, then the user will be redirected to '/login' as a result of the error response. </p> <p>So, I have a couple of questions about what I need to do to implement this:</p> <ol> <li><p>How do I best submit a header with every request, apart from to the login endpoint? I know with JQuery, which I'm using for AJAX, I can configure a global 'ajaxSetup' which will cause the header to be submitted with each request, but how can I specify exceptions? It's cumbersome to individually add the header to each API endpoint request.</p></li> <li><p>Similarly, how to I set up an authentication pre-check which applies to all routes apart from the 2 mentioned ('/' and '/login')?</p></li> <li><p>Given that I'm using the presence or otherwise of apparently valid authentication (apparently because it still has to be validated on the API endpoint) to determine whether or not to show certain menu items, etc., is it feasible to make this more granular and show different things for different permission levels, as determined by the 'scope' field in the token payload? Clearly the simplest way of dealing with a JWT token is purely to determine whether it is present or not, so no parsing of content is required at the client end. But given that JWT does allow meaningful content, is it a bad idea to try to make use of that meaning on the client side as well as server? Obviously this becomes less practical if the token is itself encrypted, so my idea would be to use unencrypted tokens (and ensure nothing of any consequence is exposed in the payload). </p></li> </ol>
0debug
how to build subpage with the same header.php? : <p><strong>my goal:</strong> is when i click the sign up link it will move me to the signup.php and it will show the page!</p> <p>i am trying to build asub page with the same login form header with php, but when i start using the</p> <pre><code> &lt;?php include_once 'header.php'; ?&gt; </code></pre> <p>it dosent work and it dosent move me to the subapge!</p> <p>here is the code : </p> <p><strong>index.php</strong></p> <pre><code>&lt;?php include_once 'header.php'; ?&gt; &lt;section class="main-container"&gt; &lt;div class="main-warrper"&gt; &lt;h2&gt; signup &lt;/h2&gt; &lt;/div&gt; &lt;/section&gt; &lt;?php include_once 'footer.php'; ?&gt; </code></pre> <p><strong>header.php</strong></p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt; login form &lt;/title&gt; &lt;link rel="stylesheet" type="text/css" href="style22.css"&gt; &lt;/head&gt; &lt;body&gt; &lt;header&gt; &lt;nav&gt; &lt;div class= "main-warrper"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="index.php"&gt;home &lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class="nav-login"&gt; &lt;form&gt; &lt;input type = "text" name="uid" placeholder="email"&gt; &lt;input type = "password" name="pwd" placeholder="password"&gt; &lt;button type="submit" name="submit"&gt; login &lt;/button&gt; &lt;/form&gt; &lt;a href="signup.php"&gt;sign up &lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;/nav&gt; &lt;/header&gt; </code></pre> <p><strong>signup.php</strong></p> <pre><code>&lt;?php include_once 'header.php'; ?&gt; &lt;section class="main-container"&gt; &lt;div class="main-warrper"&gt; &lt;h2&gt; signup &lt;/h2&gt; &lt;/div&gt; &lt;/section&gt; &lt;?php include_once 'footer.php'; ?&gt; </code></pre>
0debug
How to see contributor's email address on Git commit chain? : <p>I can't see how to email a contributor on github after lengthy attempts, and google searches. Why does every beginners guide encourage us to immediately configure our user.email such that it is sent with every commit if its so difficult to view the contributors' email addresses on the commit chain in GitHub?</p>
0debug
How do I create an enum from a Int in Kotlin? : <p>I have this <code>enum</code>:</p> <pre><code>enum class Types(val value: Int) { FOO(1) BAR(2) FOO_BAR(3) } </code></pre> <p>How do I create an instance of that <code>enum</code> using an <code>Int</code>?</p> <p>I tried doing something like this:</p> <pre><code>val type = Types.valueOf(1) </code></pre> <p>And I get the error:</p> <blockquote> <p>Integer literal does not conform to the expected type String</p> </blockquote>
0debug