problem
stringlengths
26
131k
labels
class label
2 classes
Copy/move elision requires explicit definition of copy/move constructors : <p>Consider the following program:</p> <pre><code>#include &lt;iostream&gt; #include &lt;utility&gt; class T { public: T() { printf("address at construction: %zx\n", (uintptr_t)this); } // T(const T&amp;) { printf("copy-constructed\n"); } // helps // T(T&amp;&amp;) { printf("move-constructed\n"); } // helps // T(const T&amp;) = default; // does not help // T(T&amp;&amp;) = default; // does not help }; T f() { return T(); } int main() { T x = f(); printf("address after construction: %zx\n", (uintptr_t)&amp;x); return 0; } </code></pre> <p>Compiling with <code>g++ -std=c++17 test.cpp</code> gives the following output (same with <code>clang++</code>):</p> <pre><code>address at construction: 7ffcc7626857 address after construction: 7ffcc7626887 </code></pre> <p>Based on the <a href="http://en.cppreference.com/w/cpp/language/copy_elision" rel="noreferrer">C++ reference</a> I would expect the program to output two equal addresses because the copy/move should be guaranteed to be elided (at least in C++17).</p> <p>If I explicitly define either the copy or the move constructor or both (see commented out lines in the example), the program gives the expected output (even with C++11):</p> <pre><code>address at construction: 7ffff4be4547 address after construction: 7ffff4be4547 </code></pre> <p>Simply setting the copy/move constructors to <code>default</code> does not help.</p> <p>The reference explicitly states</p> <blockquote> <p>[The copy/move constructors] need not be present or accessible</p> </blockquote> <p>So what am I missing here?</p>
0debug
var not receiving correct value inside a function - Javascript : <p>I have this function called <strong>getQuotes()</strong>, and a <strong>console.log()</strong> at the end of it that shows the correct value of <strong>currentQuote</strong>.</p> <pre><code>function getQuote() { $.ajax({ headers: { "X-Mashape-Key": "xxx", Accept: "application/json", "Content-Type": "application/x-www-form-urlencoded" }, url: 'https://andruxnet-random-famous-quotes.p.mashape.com/?cat=movies', success: function(response) { var r = JSON.parse(response); currentQuote = r.quote; currentAuthor = r.author; console.log(currentQuote); } }); }; </code></pre> <p>The point is: when I call <strong>getFunction()</strong> (like code below), then show a <strong>console.log</strong> of my variable <strong>currentQuote</strong>, it is not receiving the correct value, it still an empty string as declarated. What am I doing wrong ? </p> <pre><code>$(document).ready(function() { var currentQuote=''; var currentAuthor=''; getQuote(); console.log(currentQuote); }); </code></pre>
0debug
Hi i got this error in Laravel, please help me out : ErrorException thrown with message "syntax error, unexpected '"', expecting :: (T_PAAMAYIM_NEKUDOTAYIM) (View: C:\xampp\htdocs\blog\resources\views\posts\view.blade.php)" Stacktrace: #0 Symfony\Component\Debug\Exception\FatalThrowableError in C:\xampp\htdocs\blog\storage\framework\views\84082f7931aeac789ccd4bfb975980dd81818f2a.php:16
0debug
College Swift Xcode game : I need help with the fact that I try to add two variables together and it says this: ''' Cannot convert value of type 'CGFloat' to expected argument type 'CGPoint' ''' I would appreciate it if someone would help me to understand ow to fix this problem with my game application. the code that has the error is: ''' let moveBullet = SKAction.moveTo(self.size.height + bullet.size.height, duration: 1) '''
0debug
How to use both google+ and facebook login in same appdelegate.swift : <p>My app use google+ signin and in my appdelegate.swift i have:</p> <pre><code>func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -&gt; Bool { // Override point for customization after application launch. var configureError: NSError? GGLContext.sharedInstance().configureWithError(&amp;configureError) assert(configureError == nil, "Error configuring Google services: \(configureError)") GIDSignIn.sharedInstance().delegate = self return true } func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -&gt; Bool { return GIDSignIn.sharedInstance().handleURL(url, sourceApplication: sourceApplication, annotation: annotation) } </code></pre> <p>Now i would like to insert also facebook login, but i have to add in appdelegate.swift this code:</p> <pre><code>func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -&gt; Bool { // Override point for customization after application launch. return FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions) } func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -&gt; Bool { return FBSDKApplicationDelegate.sharedInstance().application( application, openURL: url, sourceApplication: sourceApplication, annotation: annotation) } </code></pre> <p>But this return error because the functions 'application' already exist, how can I perform both google+ and facebook same appdelegate.swift Thank you.</p>
0debug
Who wants to be a millionaire (special help option) : I have wrote a very very simple quiz c++ program (who wants to be a millionaire) which reads the questions from the file, I would like to include a special help option which will skip the answer when used. The problem is that I do not want the user to use that option more than once, how can I do that. #include <iostream> #include <fstream> using namespace std; int main() { string a[15]; //Array which will take answers string print, print2; //Strings for printing questions ifstream answers("q&a.txt"); cout << "Welcome to who wants to be a millionaire\n"; while (answers) //Read questions from the file { getline(answers, print); auto position = print.find( "01." ); if(position <= print.size()) { print2 = print.substr(position + 1 ); cout << print2 << endl << "A. Blackburn Losers\nB. Blackburn Rovers\nC. Blackburn Lovers\nD. BlackburnWanderers\n"; } cin >> a[0]; if (a[0] == "b") //If correct, proceed to next question { getline(answers, print); position = print.find("02."); } //If the answer is wrong, terminate the program if (a[0] != "b") { cerr << "We are sorry, you are wrong!\n"; break; } if (position <= print.size()) { print2 = print.substr(position + 1); cout << print2 << endl << "A. Fridge\nB. Bank\nC. Market\nD. Shoe\n"; } cin >> a[1]; if (a[1] == "b") { getline(answers, print); position = print.find("03"); } if (a[1] != "b") { cerr << "We are sorry, you are wrong!\n"; break; } if (position <= print.size()) { print2 = print.substr(position + 1); cout << print2 << endl << "A. Bassey\nB. Kwesi\nC. Abiodun\nD. Ejima\n"; } cin >> a[2]; if (a[2] == "b") { getline(answers, print); position = print.find("04."); } if (a[2] != "b") { cerr << "We are sorry, you are wrong!\n"; break; } if (position <= print.size()) { print2 = print.substr(position + 1); cout << print2 << endl << "A. Inferno\nB. Domino\nC. Stiletto\nD. Tornado\n"; } cin >> a[3]; if (a[3] == "a") { getline(answers, print); position = print.find("05."); } if (a[3] != "a") { cerr << "We are sorry, you are wrong!\n"; break; } if (position <= print.size()) { print2 = print.substr(position + 1); cout << print2 << endl << "A. Marry a wife\nB. Bury a dead parent\nC. Have thanksgiving in church\nD. Accept gifts or favour in kind\n"; } cin >> a[4]; if (a[4] == "d") { getline(answers, print); position = print.find("06."); } if (a[4] != "d") { cerr << "We are sorry, you are wrong!\n"; break; } if (position <= print.size()) { print2 = print.substr(position + 1); cout << print2 << endl << "A. Tenacity\nB. Verifiability\nC. Hereditary\nD. Validation\n"; } cin >> a[5]; if (a[5] == "c") { getline(answers, print); position = print.find("07."); } if (a[5] != "c") { cerr << "We are sorry, you are wrong!\n"; break; } if (position <= print.size()) { print2 = print.substr(position + 1); cout << print2 << endl << "A. Paris\nB. Copenhagen\nC. New York\nD. Madrid\n"; } cin >> a[6]; if (a[6] == "a") { getline(answers, print); position = print.find("08"); } if (a[6] != "a") { cerr << "We are sorry, you are wrong!\n"; break; } if (position <= print.size()) { print2 = print.substr(position +1); cout << print2 << endl << "A. Mumbai\nB. Beijing\nC. Rio de Janeiro\nD. Seville\n"; } cin >> a[7]; if (a[7] == "b") { getline(answers, print); position = print.find("09"); } if (a[7] != "b") { cerr << "We are sorry, you are wrong!\n"; break; } if (position <= print.size()) { print2 = print.substr(position + 1); cout << print2 << endl << "A. A speed equal to that of sound\nB. A speed greater than that of sound\nC. A speed equal to that of light\nD. A speed greater than that of light\n"; } cin >> a[8]; if (a[8] == "b") { getline(answers, print); position = print.find("10."); } if (a[8] != "b") { cerr << "We are sorry, you are wrong!\n"; break; } if (position <= print.size()) { print2 = print.substr(position + 1); cout << print2 << endl << "A. Nephrons\nB. Nerves\nC. Ligaments\nD. Stitches\n"; } cin >> a[9]; if (a[9] == "c") { getline(answers, print); position = print.find("11."); } if (a[9] != "c") { cerr << "We are sorry, you are wrong!\n"; break; } if (position <= print.size()) { print2 = print.substr(position + 1); cout << print2 << endl << "A. Swimmer\nB. Referee\nC. Football Fan\nD. Judoka\n"; } cin >> a[10]; if (a[10] == "b") { getline(answers, print); position = print.find("12."); } if (a[10] != "b") { cerr << "We are sorry, you are wrong!\n"; break; } if (position <= print.size()) { print2 = print.substr(position + 1); cout << print2 << endl << "A. France\nB. United States\nC. Germany\nD. India\n"; } cin >> a[11]; if (a[11] == "c") { getline(answers, print); position = print.find("13."); } if (a[11] != "c") { cerr << "We are sorry, you are wrong!\n"; break; } if (position <= print.size()) { print2 = print.substr(position + 1); cout << print2 << endl << "A. Clint Eastwood\nB. Oliver Stone\nC. Peter Jackson\nD. Morgan Freeman\n"; } cin >> a[12]; if (a[12] == "a") { getline(answers, print); position = print.find("14."); } if (a[12] != "a") { cerr << "We are sorry, you are wrong!\n"; break; } if (position <= print.size()) { print2 = print.substr(position + 1); cout << print2 << endl << "A. Lebanon\nB. Columbia\nC. Japan\nD. Eritrea\n"; } cin >> a[13]; if (a[13] == "b") { getline(answers, print); position = print.find("15."); } if (a[13] != "b") { cerr << "We are sorry, you are wrong!\n"; break; } if (position <= print.size()) { print2 = print.substr(position + 1); cout << print2 << endl << "A. Literature\nB. Economics\nC. Peace\nD. Medicine\n"; cin >> a[14]; } if (a[14] == "c") { cout << "Congratulations!\nYou won a million dollars!\n"; break; } if (a[14] != "c") cerr << "We are sorry, you are wrong!\n"; break; } return 0; } Questions: 01. Which of these is the name of a British Football Club? 02. An establishment where money can be deposited or withdrawn is called what? 03 Name given to a boy born on Sunday in Ghana is what? 04. Which of the following refer to the word fire? 05. According to the constitution a public officer is not allowed to do which of these? 06. The process by which genetic traits are transmitted from parents to offspring is called what? 07. Roland Garros stadium is in which city? 08. Where is Tiananmen Square? 09. The word supersonic denotes which of these? 10. Which of these holds bones together at the joints of the body? 11. Linus Mbah achieved fame in Nigerian sporting circles as what? 12. DAX refers to the stock market of which country? 13. Who won the Academy Award for directing the movie ‘Million Dollar Baby’? 14. In which country is the Galeras Volcano? 15. Professor Maathai Wangari won the Nobel Prize for which of these? Answers: 1 (B) 2 (B) 3 (B) 4 (A) 5 (D) 6 (C) 7 (A) 8 (B) 9 (B) 10 (C) 11 (B) 12 (C) 13 (A) 14 (B) I15 (C)
0debug
static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadFunc *read_child, int ctx_size, enum MXFMetadataSetType type) { AVIOContext *pb = mxf->fc->pb; MXFMetadataSet *ctx = ctx_size ? av_mallocz(ctx_size) : mxf; uint64_t klv_end = avio_tell(pb) + klv->length; if (!ctx) return AVERROR(ENOMEM); mxf_metadataset_init(ctx, type); while (avio_tell(pb) + 4 < klv_end && !avio_feof(pb)) { int ret; int tag = avio_rb16(pb); int size = avio_rb16(pb); uint64_t next = avio_tell(pb) + size; UID uid = {0}; av_dlog(mxf->fc, "local tag %#04x size %d\n", tag, size); if (!size) { av_log(mxf->fc, AV_LOG_ERROR, "local tag %#04x with 0 size\n", tag); continue; } if (tag > 0x7FFF) { int i; for (i = 0; i < mxf->local_tags_count; i++) { int local_tag = AV_RB16(mxf->local_tags+i*18); if (local_tag == tag) { memcpy(uid, mxf->local_tags+i*18+2, 16); av_dlog(mxf->fc, "local tag %#04x\n", local_tag); PRINT_KEY(mxf->fc, "uid", uid); } } } if (ctx_size && tag == 0x3C0A) avio_read(pb, ctx->uid, 16); else if ((ret = read_child(ctx, pb, tag, size, uid, -1)) < 0) return ret; if (avio_tell(pb) > klv_end) { if (ctx_size) av_free(ctx); av_log(mxf->fc, AV_LOG_ERROR, "local tag %#04x extends past end of local set @ %#"PRIx64"\n", tag, klv->offset); return AVERROR_INVALIDDATA; } else if (avio_tell(pb) <= next) avio_seek(pb, next, SEEK_SET); } if (ctx_size) ctx->type = type; return ctx_size ? mxf_add_metadata_set(mxf, ctx) : 0; }
1threat
Add Reference to dll vs. adding a NuGet package in .NET Standard project : <p>I have a .NET Standard 2.0 project in my solution and I am using the IConfiguration interface. When I write the name VS suggest that I reference Microsoft.Extensions.Configuration.Abstractions.dll. If I do it is added under the reference node. However I can also add it as a NuGet package. Both ways seems to work. I assume that the reference VS suggests is added via the .NET Standard SDK that is referenced in the project.</p> <p>Which is the recommended way to add that reference? What are the advantages and the disadvantages of each approach?</p>
0debug
static av_cold void common_init(H264Context *h){ MpegEncContext * const s = &h->s; s->width = s->avctx->width; s->height = s->avctx->height; s->codec_id= s->avctx->codec->id; ff_h264dsp_init(&h->h264dsp, 8, 1); ff_h264_pred_init(&h->hpc, s->codec_id, 8, 1); h->dequant_coeff_pps= -1; s->unrestricted_mv=1; s->decode=1; dsputil_init(&s->dsp, s->avctx); memset(h->pps.scaling_matrix4, 16, 6*16*sizeof(uint8_t)); memset(h->pps.scaling_matrix8, 16, 2*64*sizeof(uint8_t)); }
1threat
int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const char *command, const char *arg, int flags, double ts) { int i; if(!graph) return 0; for (i = 0; i < graph->nb_filters; i++) { AVFilterContext *filter = graph->filters[i]; if(filter && (!strcmp(target, "all") || !strcmp(target, filter->name) || !strcmp(target, filter->filter->name))){ AVFilterCommand **queue = &filter->command_queue, *next; while (*queue && (*queue)->time <= ts) queue = &(*queue)->next; next = *queue; *queue = av_mallocz(sizeof(AVFilterCommand)); (*queue)->command = av_strdup(command); (*queue)->arg = av_strdup(arg); (*queue)->time = ts; (*queue)->flags = flags; (*queue)->next = next; if(flags & AVFILTER_CMD_FLAG_ONE) return 0; } } return 0; }
1threat
Easiest way to change code in a laverel and angular project : i want to make changes in a new script. This is based on laverel and angularjs. With both in have no experience. So it seems that this work completely differet as i normaly work with standalone php and js files. So could somebody explain me, what is the easiest way to make changes in this project? exactly i want to change a loginform and the informations wich are stored in the session... Thanks for helping and find the first steps on it.
0debug
Why does printf function ignore the latter \0? : <p>I am stuck with some features that \0 has.</p> <p>I know that \0 is a null character and it is a term to indicate that the formal is a string. </p> <pre><code>int j; j = printf("abcdef\0abcdefg\0"); printf("%d", j); return 0; </code></pre> <p>When I tried to print "abcdef\0abcdefg\0" out, C would only print string 'abcdef' and '6' instead of both 'abcdef' and 'abcdefg' which would sum up to 13. Why does this happen?</p>
0debug
Unable to reproduce WebKitLegacy -[_WebSafeForwarder forwardInvocation:] crash : <p>I am Getting [_WebSafeForwarder forwardInvocation:] and crash report as following on crashlytics. Unable to reproduce the same condition in my code. I added <code>webview.delegate = nil</code> and <code>[webview stopLoading]</code> in each and every <code>-(void)dealloc</code> method where ever <code>UIWebview</code> is present still getting following crash.</p> <pre><code>#0. Crashed: com.apple.main-thread 0 libobjc.A.dylib 0x24deba86 objc_msgSend + 5 1 WebKitLegacy 0x29945e17 -[_WebSafeForwarder forwardInvocation:] + 190 2 CoreFoundation 0x25624f4d ___forwarding___ + 352 3 CoreFoundation 0x2554f298 _CF_forwarding_prep_0 + 24 4 CoreFoundation 0x25626664 __invoking___ + 68 5 CoreFoundation 0x2554b8bd -[NSInvocation invoke] + 292 6 WebCore 0x28d6b84b HandleDelegateSource(void*) + 90 7 CoreFoundation 0x255e39e7 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14 8 CoreFoundation 0x255e3569 __CFRunLoopDoSources0 + 344 9 CoreFoundation 0x255e193f __CFRunLoopRun + 806 10 CoreFoundation 0x255301c9 CFRunLoopRunSpecific + 516 11 CoreFoundation 0x2552ffbd CFRunLoopRunInMode + 108 12 UIFoundation 0x29bb5837 -[NSHTMLReader _loadUsingWebKit] + 2038 13 Foundation 0x25e4e887 __NSThreadPerformPerform + 386 14 CoreFoundation 0x255e39e7 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14 15 CoreFoundation 0x255e3569 __CFRunLoopDoSources0 + 344 16 CoreFoundation 0x255e193f __CFRunLoopRun + 806 17 CoreFoundation 0x255301c9 CFRunLoopRunSpecific + 516 18 CoreFoundation 0x2552ffbd CFRunLoopRunInMode + 108 19 GraphicsServices 0x26b4caf9 GSEventRunModal + 160 20 UIKit 0x29c68435 UIApplicationMain + 144 21 MyProjectName 0x1446e5 main (main.m:14) 22 libdispatch.dylib 0x251dc873 (Missing) -- #0. Crashed: com.apple.main-thread 0 libobjc.A.dylib 0x24deba86 objc_msgSend + 5 1 WebKitLegacy 0x29945e17 -[_WebSafeForwarder forwardInvocation:] + 190 2 CoreFoundation 0x25624f4d ___forwarding___ + 352 3 CoreFoundation 0x2554f298 _CF_forwarding_prep_0 + 24 4 CoreFoundation 0x25626664 __invoking___ + 68 5 CoreFoundation 0x2554b8bd -[NSInvocation invoke] + 292 6 WebCore 0x28d6b84b HandleDelegateSource(void*) + 90 7 CoreFoundation 0x255e39e7 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14 8 CoreFoundation 0x255e3569 __CFRunLoopDoSources0 + 344 9 CoreFoundation 0x255e193f __CFRunLoopRun + 806 10 CoreFoundation 0x255301c9 CFRunLoopRunSpecific + 516 11 CoreFoundation 0x2552ffbd CFRunLoopRunInMode + 108 12 UIFoundation 0x29bb5837 -[NSHTMLReader _loadUsingWebKit] + 2038 13 Foundation 0x25e4e887 __NSThreadPerformPerform + 386 14 CoreFoundation 0x255e39e7 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14 15 CoreFoundation 0x255e3569 __CFRunLoopDoSources0 + 344 16 CoreFoundation 0x255e193f __CFRunLoopRun + 806 17 CoreFoundation 0x255301c9 CFRunLoopRunSpecific + 516 18 CoreFoundation 0x2552ffbd CFRunLoopRunInMode + 108 19 GraphicsServices 0x26b4caf9 GSEventRunModal + 160 20 UIKit 0x29c68435 UIApplicationMain + 144 21 MyProjectName 0x1446e5 main (main.m:14) 22 libdispatch.dylib 0x251dc873 (Missing) #2. com.twitter.crashlytics.ios.MachExceptionServer 0 MyProjectName 0x157cdd CLSProcessRecordAllThreads + 1015005 1 MyProjectName 0x157cdd CLSProcessRecordAllThreads + 1015005 2 MyProjectName 0x157ef5 CLSProcessRecordAllThreads + 1015541 3 MyProjectName 0x14c52b CLSHandler + 967979 4 MyProjectName 0x148249 CLSMachExceptionServer + 950857 5 libsystem_pthread.dylib 0x25354c7f _pthread_body + 138 6 libsystem_pthread.dylib 0x25354bf3 _pthread_start + 110 7 libsystem_pthread.dylib 0x25352a08 thread_start + 8 #3. GAIThread 0 libsystem_kernel.dylib 0x2529b8a8 mach_msg_trap + 20 1 libsystem_kernel.dylib 0x2529b6a9 mach_msg + 40 2 CoreFoundation 0x255e36ad __CFRunLoopServiceMachPort + 136 3 CoreFoundation 0x255e1a33 __CFRunLoopRun + 1050 4 CoreFoundation 0x255301c9 CFRunLoopRunSpecific + 516 5 CoreFoundation 0x2552ffbd CFRunLoopRunInMode + 108 6 Foundation 0x25d7d42d -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 268 7 Foundation 0x25dcbd75 -[NSRunLoop(NSRunLoop) run] + 80 8 MyProjectName 0x1d58c5 +[GAI threadMain:] + 1530053 9 Foundation 0x25e4e64d __NSThread__start__ + 1144 10 libsystem_pthread.dylib 0x25354c7f _pthread_body + 138 11 libsystem_pthread.dylib 0x25354bf3 _pthread_start + 110 12 libsystem_pthread.dylib 0x25352a08 thread_start + 8 #4. com.apple.NSURLConnectionLoader 0 libsystem_kernel.dylib 0x2529b8a8 mach_msg_trap + 20 1 libsystem_kernel.dylib 0x2529b6a9 mach_msg + 40 2 CoreFoundation 0x255e36ad __CFRunLoopServiceMachPort + 136 3 CoreFoundation 0x255e1a33 __CFRunLoopRun + 1050 4 CoreFoundation 0x255301c9 CFRunLoopRunSpecific + 516 5 CoreFoundation 0x2552ffbd CFRunLoopRunInMode + 108 6 CFNetwork 0x25b85c47 +[NSURLConnection(Loader) _resourceLoadLoop:] + 486 7 Foundation 0x25e4e64d __NSThread__start__ + 1144 8 libsystem_pthread.dylib 0x25354c7f _pthread_body + 138 9 libsystem_pthread.dylib 0x25354bf3 _pthread_start + 110 10 libsystem_pthread.dylib 0x25352a08 thread_start + 8 #5. com.apple.CFSocket.private 0 libsystem_kernel.dylib 0x252afeec __select + 20 1 CoreFoundation 0x255e8b51 __CFSocketManager + 572 2 libsystem_pthread.dylib 0x25354c7f _pthread_body + 138 3 libsystem_pthread.dylib 0x25354bf3 _pthread_start + 110 4 libsystem_pthread.dylib 0x25352a08 thread_start + 8 #6. AFNetworking 0 libsystem_kernel.dylib 0x2529b8a8 mach_msg_trap + 20 1 libsystem_kernel.dylib 0x2529b6a9 mach_msg + 40 2 CoreFoundation 0x255e36ad __CFRunLoopServiceMachPort + 136 3 CoreFoundation 0x255e1a33 __CFRunLoopRun + 1050 4 CoreFoundation 0x255301c9 CFRunLoopRunSpecific + 516 5 CoreFoundation 0x2552ffbd CFRunLoopRunInMode + 108 6 Foundation 0x25d7d42d -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 268 7 Foundation 0x25dcbd75 -[NSRunLoop(NSRunLoop) run] + 80 8 MyProjectName 0x29d30f +[AFURLConnectionOperation networkRequestThreadEntryPoint:] (AFURLConnectionOperation.m:168) 9 Foundation 0x25e4e64d __NSThread__start__ + 1144 10 libsystem_pthread.dylib 0x25354c7f _pthread_body + 138 11 libsystem_pthread.dylib 0x25354bf3 _pthread_start + 110 12 libsystem_pthread.dylib 0x25352a08 thread_start + 8 #7. WebThread 0 libsystem_kernel.dylib 0x252af998 __psynch_cvwait + 24 1 libsystem_pthread.dylib 0x253541a5 _pthread_cond_wait + 536 2 libsystem_pthread.dylib 0x253550f9 pthread_cond_timedwait + 44 3 WebCore 0x28d57f57 SendDelegateMessage(NSInvocation*) + 678 4 WebKitLegacy 0x29978265 CallFrameLoadDelegate(void (*)(), WebView*, objc_selector*, objc_object*) + 172 5 WebKitLegacy 0x29947877 WebFrameLoaderClient::dispatchDidFinishLoad() + 158 6 WebCore 0x28d290af WebCore::FrameLoader::checkLoadCompleteForThisFrame() + 382 7 WebCore 0x28d28e75 WebCore::FrameLoader::checkLoadComplete() + 280 8 WebCore 0x28d55bf1 WebCore::FrameLoader::checkCompleted() + 316 9 WebCore 0x28d5504b WebCore::FrameLoader::finishedParsing() + 102 10 WebCore 0x28d54f59 WebCore::Document::finishedParsing() + 312 11 WebCore 0x28d5270b WebCore::HTMLDocumentParser::prepareToStopParsing() + 118 12 WebCore 0x28dddbcb WebCore::HTMLDocumentParser::resumeParsingAfterYield() + 102 13 WebCore 0x28cff4a1 WebCore::ThreadTimers::sharedTimerFiredInternal() + 136 14 WebCore 0x28cff3f5 WebCore::timerFired(__CFRunLoopTimer*, void*) + 28 15 CoreFoundation 0x255e4177 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 14 16 CoreFoundation 0x255e3da9 __CFRunLoopDoTimer + 936 17 CoreFoundation 0x255e1bf5 __CFRunLoopRun + 1500 18 CoreFoundation 0x255301c9 CFRunLoopRunSpecific + 516 19 CoreFoundation 0x2552ffbd CFRunLoopRunInMode + 108 20 WebCore 0x28d457b7 RunWebThread(void*) + 422 21 libsystem_pthread.dylib 0x25354c7f _pthread_body + 138 22 libsystem_pthread.dylib 0x25354bf3 _pthread_start + 110 23 libsystem_pthread.dylib 0x25352a08 thread_start + 8 #8. JavaScriptCore::Marking 0 libsystem_kernel.dylib 0x252af998 __psynch_cvwait + 24 1 libsystem_pthread.dylib 0x253541a5 _pthread_cond_wait + 536 2 libsystem_pthread.dylib 0x253550b9 pthread_cond_wait + 40 3 libc++.1.dylib 0x24d7469d std::__1::condition_variable::wait(std::__1::unique_lock&lt;std::__1::mutex&gt;&amp;) + 36 4 JavaScriptCore 0x2891a781 JSC::GCThread::waitForNextPhase() + 104 5 JavaScriptCore 0x2891a7ef JSC::GCThread::gcThreadMain() + 62 6 JavaScriptCore 0x287269e1 WTF::threadEntryPoint(void*) + 148 7 JavaScriptCore 0x2872693f WTF::wtfThreadEntryPoint(void*) + 14 8 libsystem_pthread.dylib 0x25354c7f _pthread_body + 138 9 libsystem_pthread.dylib 0x25354bf3 _pthread_start + 110 10 libsystem_pthread.dylib 0x25352a08 thread_start + 8 #9. NSOperationQueue 0x15e6cc20 :: NSOperation 0x15d230e0 (QOS: USER_INTERACTIVE) 0 libsystem_kernel.dylib 0x2529b8f8 semaphore_wait_trap + 8 1 libsystem_platform.dylib 0x2534f289 _os_semaphore_wait + 12 2 libdispatch.dylib 0x251bcc6d _dispatch_barrier_sync_f_slow + 372 3 MyProjectName 0x27dd8f __69-[SDWebImageManager downloadImageWithURL:options:progress:completed:]_block_invoke98 (SDWebImageManager.m:189) 4 MyProjectName 0x275e71 __72-[SDWebImageDownloader downloadImageWithURL:options:progress:completed:]_block_invoke93 (SDWebImageDownloader.m:163) 5 MyProjectName 0x27a8fb -[SDWebImageDownloaderOperation connection:didFailWithError:] (SDWebImageDownloaderOperation.m:419) 6 CFNetwork 0x25c683a1 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 56 7 CFNetwork 0x25c68359 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 184 8 CFNetwork 0x25c6847d -[NSURLConnectionInternal _withConnectionAndDelegate:] + 36 9 CFNetwork 0x25c44125 _NSURLConnectionDidFail(_CFURLConnection*, __CFError*, void const*) + 84 10 CFNetwork 0x25be3203 ___ZN27URLConnectionClient_Classic17_delegate_didFailEP9__CFErrorU13block_pointerFvvE_block_invoke + 86 11 CFNetwork 0x25be1a83 ___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 70 12 libdispatch.dylib 0x251b3cab _dispatch_client_callout + 22 13 libdispatch.dylib 0x251bb543 _dispatch_block_invoke + 450 14 CFNetwork 0x25b13e83 RunloopBlockContext::_invoke_block(void const*, void*) + 18 15 CoreFoundation 0x2552fc09 CFArrayApplyFunction + 36 16 CFNetwork 0x25b13d6b RunloopBlockContext::perform() + 182 17 CFNetwork 0x25b13c35 MultiplexerSource::perform() + 216 18 CFNetwork 0x25b13ac9 MultiplexerSource::_perform(void*) + 48 19 CoreFoundation 0x255e39e7 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14 20 CoreFoundation 0x255e35d7 __CFRunLoopDoSources0 + 454 21 CoreFoundation 0x255e193f __CFRunLoopRun + 806 22 CoreFoundation 0x255301c9 CFRunLoopRunSpecific + 516 23 CoreFoundation 0x25570f23 CFRunLoopRun + 98 24 MyProjectName 0x27779b -[SDWebImageDownloaderOperation start] (SDWebImageDownloaderOperation.m:117) 25 Foundation 0x25e38b0d __NSOQSchedule_f + 192 26 libdispatch.dylib 0x251bde7f _dispatch_queue_drain + 1762 27 libdispatch.dylib 0x251b6e17 _dispatch_queue_invoke + 282 28 libdispatch.dylib 0x251bf20d _dispatch_root_queue_drain + 400 29 libdispatch.dylib 0x251bf07b _dispatch_worker_thread3 + 94 30 libsystem_pthread.dylib 0x25352e0d _pthread_wqthread + 1024 31 libsystem_pthread.dylib 0x253529fc start_wqthread + 8 #10. com.apple.root.default-qos 0 libsystem_kernel.dylib 0x252af998 __psynch_cvwait + 24 1 libsystem_pthread.dylib 0x253541a5 _pthread_cond_wait + 536 2 libsystem_pthread.dylib 0x253550b9 pthread_cond_wait + 40 3 Foundation 0x25dc840f -[NSCondition wait] + 194 4 Foundation 0x25d8f40b -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 850 5 Foundation 0x25d92be1 -[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:] + 136 6 UIFoundation 0x29bb611f -[NSHTMLReader _load] + 386 7 UIFoundation 0x29bb6b21 -[NSHTMLReader attributedString] + 24 8 UIFoundation 0x29b5ac35 _NSReadAttributedStringFromURLOrData + 5304 9 UIFoundation 0x29b596f5 -[NSAttributedString(NSAttributedStringUIFoundationAdditions) initWithData:options:documentAttributes:error:] + 116 10 MyProjectName 0x19cecf -[MyStaticLibrary handleHTMLCharactersForTitle:] (MyStaticLibrary.m:3132) 11 MyProjectName 0x1a8905 __47-[MyNetworkRequest onHTTPSuccessWithResponse:]_block_invoke143 (MyNetworkRequest.m:484) 12 libdispatch.dylib 0x251b3cbf _dispatch_call_block_and_release + 10 13 libdispatch.dylib 0x251bf6a1 _dispatch_root_queue_drain + 1572 14 libdispatch.dylib 0x251bf07b _dispatch_worker_thread3 + 94 15 libsystem_pthread.dylib 0x25352e0d _pthread_wqthread + 1024 16 libsystem_pthread.dylib 0x253529fc start_wqthread + 8 #11. Thread 0 libsystem_kernel.dylib 0x252afffc __semwait_signal + 24 1 libsystem_c.dylib 0x25203bcd nanosleep + 172 2 libc++.1.dylib 0x24db38f5 std::__1::this_thread::sleep_for(std::__1::chrono::duration&lt;long long, std::__1::ratio&lt;1ll, 1000000000ll&gt; &gt; const&amp;) + 136 3 JavaScriptCore 0x28ad9b01 bmalloc::Heap::scavenge(std::__1::unique_lock&lt;bmalloc::StaticMutex&gt;&amp;, std::__1::chrono::duration&lt;long long, std::__1::ratio&lt;1ll, 1000ll&gt; &gt;) + 256 4 JavaScriptCore 0x28ad98eb bmalloc::Heap::concurrentScavenge() + 78 5 JavaScriptCore 0x28adb7b7 bmalloc::AsyncTask&lt;bmalloc::Heap, void (bmalloc::Heap::*)()&gt;::entryPoint() + 98 6 JavaScriptCore 0x28adb751 bmalloc::AsyncTask&lt;bmalloc::Heap, void (bmalloc::Heap::*)()&gt;::pthreadEntryPoint(void*) + 8 7 libsystem_pthread.dylib 0x25354c7f _pthread_body + 138 8 libsystem_pthread.dylib 0x25354bf3 _pthread_start + 110 9 libsystem_pthread.dylib 0x25352a08 thread_start + 8 #12. Thread 0 libsystem_pthread.dylib 0x253529f4 start_wqthread + 14 #13. Thread 0 libsystem_kernel.dylib 0x252b0864 __workq_kernreturn + 8 1 libsystem_pthread.dylib 0x25352e19 _pthread_wqthread + 1036 2 libsystem_pthread.dylib 0x253529fc start_wqthread + 8 #14. Thread 0 libsystem_kernel.dylib 0x252b0864 __workq_kernreturn + 8 1 libsystem_pthread.dylib 0x25352e19 _pthread_wqthread + 1036 2 libsystem_pthread.dylib 0x253529fc start_wqthread + 8 #15. PLClientLoggingFlushQueue 0 libsystem_platform.dylib 0x2534e96a _platform_memmove + 105 1 CoreFoundation 0x2553f0c7 CFStringGetBytes + 634 2 CoreFoundation 0x2553f0c7 CFStringGetBytes + 634 3 CoreFoundation 0x25677ab9 __writeObject15 + 324 4 CoreFoundation 0x2567841d __writeObject15 + 2728 5 CoreFoundation 0x2567841d __writeObject15 + 2728 6 CoreFoundation 0x2567841d __writeObject15 + 2728 7 CoreFoundation 0x2567841d __writeObject15 + 2728 8 CoreFoundation 0x2567841d __writeObject15 + 2728 9 CoreFoundation 0x256777ad __CFBinaryPlistWrite15 + 152 10 CoreFoundation 0x255729cf _CFXPCCreateXPCMessageWithCFObject + 118 11 PowerLog 0x2707ab4f -[PLClientLogger xpcSendMessage:withClientID:withKey:withPayload:] + 86 12 PowerLog 0x2707bd85 -[PLClientLogger batchTasksCacheFlush] + 500 13 libdispatch.dylib 0x251b3cbf _dispatch_call_block_and_release + 10 14 libdispatch.dylib 0x251bd3cf _dispatch_after_timer_callback + 66 15 libdispatch.dylib 0x251c65bb _dispatch_source_latch_and_call + 2042 16 libdispatch.dylib 0x251b5bff _dispatch_source_invoke + 738 17 libdispatch.dylib 0x251bd9ed _dispatch_queue_drain + 592 18 libdispatch.dylib 0x251b6e17 _dispatch_queue_invoke + 282 19 libdispatch.dylib 0x251bf20d _dispatch_root_queue_drain + 400 20 libdispatch.dylib 0x251bf07b _dispatch_worker_thread3 + 94 21 libsystem_pthread.dylib 0x25352e0d _pthread_wqthread + 1024 22 libsystem_pthread.dylib 0x253529fc start_wqthread + 8 </code></pre>
0debug
Google API javacript : I am doing a custom google map with API I put the URL link : https://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=13&size=600x300&maptype=roadmap&markers=color:blue|label:S|40.702147,-74.015794&markers=color:green|label:G|40.711614,-74.012318&markers=color:red|label:C|40.718217,-73.998284&key=AIzaSyCTFUKmdIRSSod5v1oqhIXJOmkOPMsdFp0 I received this error: The Google Maps Platform server rejected your request. This API project is not authorized to use this API. Please ensure this API is activated in the Google Developers Console: https://console.developers.google.com/apis/api/static_maps_backend?project=_ I enabled API AND THE error still exist Can you please help me find the solituion for my problem
0debug
static void new_video_stream(AVFormatContext *oc, int file_idx) { AVStream *st; AVOutputStream *ost; AVCodecContext *video_enc; enum CodecID codec_id; AVCodec *codec= NULL; st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); if (!st) { fprintf(stderr, "Could not alloc stream\n"); ffmpeg_exit(1); } ost = new_output_stream(oc, file_idx); output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); if(!video_stream_copy){ if (video_codec_name) { codec_id = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1, avcodec_opts[AVMEDIA_TYPE_VIDEO]->strict_std_compliance); codec = avcodec_find_encoder_by_name(video_codec_name); output_codecs[nb_output_codecs-1] = codec; } else { codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO); codec = avcodec_find_encoder(codec_id); } } avcodec_get_context_defaults3(st->codec, codec); ost->bitstream_filters = video_bitstream_filters; video_bitstream_filters= NULL; avcodec_thread_init(st->codec, thread_count); video_enc = st->codec; if(video_codec_tag) video_enc->codec_tag= video_codec_tag; if( (video_global_header&1) || (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER))){ video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER; avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER; } if(video_global_header&2){ video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER; avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER; } if (video_stream_copy) { st->stream_copy = 1; video_enc->codec_type = AVMEDIA_TYPE_VIDEO; video_enc->sample_aspect_ratio = st->sample_aspect_ratio = av_d2q(frame_aspect_ratio*frame_height/frame_width, 255); } else { const char *p; int i; AVRational fps= frame_rate.num ? frame_rate : (AVRational){25,1}; video_enc->codec_id = codec_id; set_context_opts(video_enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec); if (codec && codec->supported_framerates && !force_fps) fps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)]; video_enc->time_base.den = fps.num; video_enc->time_base.num = fps.den; video_enc->width = frame_width; video_enc->height = frame_height; video_enc->sample_aspect_ratio = av_d2q(frame_aspect_ratio*video_enc->height/video_enc->width, 255); video_enc->pix_fmt = frame_pix_fmt; st->sample_aspect_ratio = video_enc->sample_aspect_ratio; choose_pixel_fmt(st, codec); if (intra_only) video_enc->gop_size = 0; if (video_qscale || same_quality) { video_enc->flags |= CODEC_FLAG_QSCALE; video_enc->global_quality= st->quality = FF_QP2LAMBDA * video_qscale; } if(intra_matrix) video_enc->intra_matrix = intra_matrix; if(inter_matrix) video_enc->inter_matrix = inter_matrix; p= video_rc_override_string; for(i=0; p; i++){ int start, end, q; int e=sscanf(p, "%d,%d,%d", &start, &end, &q); if(e!=3){ fprintf(stderr, "error parsing rc_override\n"); ffmpeg_exit(1); } video_enc->rc_override= av_realloc(video_enc->rc_override, sizeof(RcOverride)*(i+1)); video_enc->rc_override[i].start_frame= start; video_enc->rc_override[i].end_frame = end; if(q>0){ video_enc->rc_override[i].qscale= q; video_enc->rc_override[i].quality_factor= 1.0; } else{ video_enc->rc_override[i].qscale= 0; video_enc->rc_override[i].quality_factor= -q/100.0; } p= strchr(p, '/'); if(p) p++; } video_enc->rc_override_count=i; if (!video_enc->rc_initial_buffer_occupancy) video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size*3/4; video_enc->me_threshold= me_threshold; video_enc->intra_dc_precision= intra_dc_precision - 8; if (do_psnr) video_enc->flags|= CODEC_FLAG_PSNR; if (do_pass) { if (do_pass == 1) { video_enc->flags |= CODEC_FLAG_PASS1; } else { video_enc->flags |= CODEC_FLAG_PASS2; } } if (forced_key_frames) parse_forced_key_frames(forced_key_frames, ost, video_enc); } if (video_language) { av_metadata_set2(&st->metadata, "language", video_language, 0); av_freep(&video_language); } video_disable = 0; av_freep(&video_codec_name); av_freep(&forced_key_frames); video_stream_copy = 0; frame_pix_fmt = PIX_FMT_NONE; }
1threat
How to convert the string to methods(like .Sendkeys) in Java? : Need to convert variable contains String to method call. Example: Variable: //Enter the name and value of the locator public String[] LoginID_Button = {"name","Log in"}; In my another class: exact code: driver.findElement(By.**name**(loc1.LoginID_Button[1])).isDisplayed(); But I need to write as: driver.findElement(By.**loc1.LoginID_Button[0]**(loc1.LoginID_Button[1])).isDisplayed(); The name is in variable string but should be changed as Method. How to use it? Please help.
0debug
What's the difference between shouldBe vs shouldEqual in Scala? : <p>When should I be using shouldBe and when should I be using shouldEqual?</p> <pre><code>port shouldEqual 8000 port shouldBe 8000 </code></pre>
0debug
static int ram_decompress_open(RamDecompressState *s, QEMUFile *f) { int ret; memset(s, 0, sizeof(*s)); s->f = f; ret = inflateInit(&s->zstream); if (ret != Z_OK) return -1; return 0; }
1threat
Create a rectangle around a binary image mask : <p>From a given image i'm able to create a binary mask that detect certain objects, how i can draw multiple rectangles a round those detected objects so that i're draw it to the original image also if it possible to obtain the corrdinates of those rectangle so i can plot them in the original image <a href="https://i.stack.imgur.com/wYujS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wYujS.png" alt="enter image description here"></a></p>
0debug
how can I merge an asp.net mvc app with android app : <p>I am working an E-commerce buy sale online asp.net mvc website. I am working in a group. we are beginners. we are confused about the fact that how we will be connecting an asp.net mvc app with java based android app? For example how android app will connect to the database which website is using. to be more specific how the same database will be synchronized with both platforms. kindly share the approach(s) to do that wisely. Thanks</p>
0debug
Qualtrics Word Counter Javascript : <p>I am setting up a survey on Qualtrics. One question has a text box, in which participants shall write 100-130 words. I want to have a word counter so people can see how much they have written already. Can anyone help me out with a Javascript code for a word counter that is usable in Qualtrics? Thank you very much!</p>
0debug
Android make transition on activity recreate() : <p>I would like to put a transition on activity recreate() after changing theme, is it possible?</p> <p>I tried: @android:anim/fade_in @android:anim/fade_out but it didn't work, and that will also affect the transition when I open and close activity, but I don't want that</p>
0debug
Mean Programm in python : I'm trying to implement the median in Python language, but when I run the script, it doesn't work properly. But just stop, nothing else happen. Could someone help me, pls. **Median Programm** data = [] value = input("Enter a value (blank line to quit): ") while value != " ": value = float(value) data.append(value) value = input("Enter a value (blank line to quit): ") data.sort() if len(data) == 0: print("No values were entered: ") elif len(data) % 2 == 1: median = data[len(data) // 2] print("The median of those values is", median) else: median = (data[len(data) // 2] + data[len(data) // 2 - 1]) / 2 print("The median of those values is", median)
0debug
def check_monthnum_number(monthnum1): if monthnum1 == 2: return True else: return False
0debug
def frequency_Of_Smallest(n,arr): mn = arr[0] freq = 1 for i in range(1,n): if (arr[i] < mn): mn = arr[i] freq = 1 elif (arr[i] == mn): freq += 1 return freq
0debug
Why should initialize list in Java : <p>If I use the below code</p> <pre><code>List&lt;String&gt; listOfStrings=new ArrayList&lt;&gt;(); listOfStrings.add("first string"); </code></pre> <p>or the following code</p> <pre><code>List&lt;String&gt; listOfStrings; listOfStrings.add("first string"); </code></pre> <p>to create a Java list, both the codes get compiled successfully and give same output on iterating the list. So what is the relevance of initializing the list</p>
0debug
static void flash_sync_page(Flash *s, int page) { QEMUIOVector *iov = g_new(QEMUIOVector, 1); if (!s->blk || blk_is_read_only(s->blk)) { return; } qemu_iovec_init(iov, 1); qemu_iovec_add(iov, s->storage + page * s->pi->page_size, s->pi->page_size); blk_aio_pwritev(s->blk, page * s->pi->page_size, iov, 0, blk_sync_complete, iov); }
1threat
C++: Convert Win32 textbox input into ASCII integers, do some math, convert back into characters that can be printed in another Win32 textbox : This is hopefully, someday, going to be an encryption program. I decided to get fancy and make a window with two text boxes and two buttons; one text box for input, one text box for output, one button for encryption, one button for decryption. I'm using text boxes because unfortunately, a user can't copy and paste out of message boxes, and nobody wants to memorize or write down 200 pairs of numbers. My current problem is with getting the correct data type conversions happening before and after I do the math. My IDE is Code::Blocks, my compiler is GNU GCC. This first part is basically just initial setup. #if defined(UNICODE) && !defined(_UNICODE) #define _UNICODE #elif defined(_UNICODE) && !defined(UNICODE) #define UNICODE #endif #include <iostream> #include <windows.h> #include <tchar.h> #define ID_BTNENCRYPT 1 #define ID_TXTMSG 2 #define ID_TXTRTN 3 #define ID_BTNDECRYPT 4 const char g_szClassName[] = "MyWindowClass"; HWND button; HWND button2; HWND textbox; HWND textreturn; LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { //Creates buttons and text boxes switch(msg) { case WM_CREATE: { button = CreateWindow("button", "Encrypt Message", WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, 240, 560, 200, 30, hwnd, (HMENU) ID_BTNENCRYPT, GetModuleHandle(NULL), NULL); button2 = CreateWindow("button", "Decrypt Message", WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, 240, 600, 200, 30, hwnd, (HMENU) ID_BTNDECRYPT, GetModuleHandle(NULL), NULL); textbox = CreateWindow("EDIT", "Enter your message here:", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL, 30, 30, 620, 270, hwnd, (HMENU) ID_TXTMSG, GetModuleHandle(NULL), NULL); textreturn = CreateWindow("EDIT", "", WS_VISIBLE | WS_CHILD | WS_BORDER | WS_VSCROLL | ES_MULTILINE, 30, 310, 620, 200, hwnd, (HMENU) ID_TXTRTN, GetModuleHandle(NULL), NULL); break; } case WM_COMMAND: { //Executes commands upon the clicking of buttons switch (LOWORD(wParam)){ First button. I want to take text input through a text box, change the characters to integers, do fun math with my integers, and put them back into a char array to be printed in another text box. case ID_BTNENCRYPT: { int len = GetWindowTextLength(textbox) + 1; char* text = new char[len]; GetWindowText(textbox, &text[0], len); I don't know why this does not work int x = 0; int INTmessage[len]; int ENClen = (len * 2); char *ENCmessage = new char[ENClen]; while (x < len) { INTmessage[x] = int(&text[x]) - 32; x++; } int z = 0; int y = 0; while (z < ENClen) { I figure it has something to do with how I'm calling ENCmessage. I know that it should be &ENCmessage but &BlahBlahBlah can't go on the left side of the equal sign. ENCmessage[z] = char(INTmessage[y] % 9); ENCmessage[z + 1] = char(INTmessage[y] % 10); z += 2; y++; } /*int w = 0; //This stuff didn't work, ignore it. //char *textx = new char[ENClen]; char *ltr = new char[ENClen]; while (w < ENClen) { ltr[w] = (ENCmessage[w]); w++; }*/ SetWindowText(textreturn, ""); SetWindowText(textreturn, &ENCmessage[0]); I wish this output what I want it to but I get a bunch of very strange symbols, and get different symbols each time I run the same text through. ::MessageBox(hwnd, "Message Encrypted", "SUCCESS!", MB_OK); } } switch (LOWORD(wParam)){ case ID_BTNDECRYPT: { //This is a whole different party for a different time. int len = GetWindowTextLength(textbox) + 1; char* text = new char[len]; GetWindowText(textbox, &text[0], len); ::MessageBox(hwnd, "Message Decrypted", "SUCCESS!", MB_OK); } } break; } case WM_CLOSE: DestroyWindow(hwnd); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hwnd, msg, wParam, lParam); } return 0; } Here is my window creation if you need to see it. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { FreeConsole(); WNDCLASSEX wc; HWND hwnd; MSG Msg; wc.cbSize = sizeof(WNDCLASSEX); wc.style = 0; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH) (COLOR_WINDOW - 2); wc.lpszMenuName = NULL; wc.lpszClassName = g_szClassName; if (!RegisterClassEx(&wc)) { ::MessageBox(NULL, "Window Registration Status: Hopelessly F***ed", "", MB_OK); return 0; } hwnd = CreateWindowEx( WS_EX_CLIENTEDGE, g_szClassName, "enCRPEtion: Free Encryption Software", WS_OVERLAPPEDWINDOW, 0, 0, 700, 700, NULL, NULL, hInstance, NULL); if (hwnd == NULL) { ::MessageBox(NULL,"Window Creation Status: Gone to $h!t", "", MB_OK); } ShowWindow(hwnd, nCmdShow); UpdateWindow(hwnd); while(GetMessage(&Msg, NULL, 0, 0) > 0) { TranslateMessage(&Msg); DispatchMessage(&Msg); } return Msg.wParam; }
0debug
static void block_io_signals(void) { sigset_t set; struct sigaction sigact; sigemptyset(&set); sigaddset(&set, SIGUSR2); sigaddset(&set, SIGIO); sigaddset(&set, SIGALRM); sigaddset(&set, SIGCHLD); pthread_sigmask(SIG_BLOCK, &set, NULL); sigemptyset(&set); sigaddset(&set, SIGUSR1); pthread_sigmask(SIG_UNBLOCK, &set, NULL); memset(&sigact, 0, sizeof(sigact)); sigact.sa_handler = cpu_signal; sigaction(SIGUSR1, &sigact, NULL); }
1threat
static int do_cont(Monitor *mon, const QDict *qdict, QObject **ret_data) { struct bdrv_iterate_context context = { mon, 0 }; bdrv_iterate(encrypted_bdrv_it, &context); if (!context.err) { vm_start(); return 0; } else {
1threat
any reasons for inconsistent numpy arguments of numpy.zeros and numpy.random.randn : <p>I'm implementing a computation using numpy zeros and numpy.random.randn</p> <pre><code>W1 = np.random.randn(n_h, n_x) * .01 b1 = np.zeros((n_h, 1)) </code></pre> <p>I'm not sure why <strong><em>random.randn()</em></strong> can accept two integers while <strong><em>zeros()</em></strong> needs a tuple. Is there a good reason for that?</p> <p>Cheers, JChen.</p>
0debug
static void rcu_qtest_init(void) { struct list_element *new_el; int i; nthreadsrunning = 0; srand(time(0)); for (i = 0; i < RCU_Q_LEN; i++) { new_el = g_new(struct list_element, 1); new_el->val = i; QLIST_INSERT_HEAD_RCU(&Q_list_head, new_el, entry); } atomic_add(&n_nodes, RCU_Q_LEN); }
1threat
static void fill_gv_table(int table[256 + 2*YUVRGB_TABLE_HEADROOM], const int elemsize, const int inc) { int i; int off = -(inc >> 9); for (i = 0; i < 256 + 2*YUVRGB_TABLE_HEADROOM; i++) { int64_t cb = av_clip(i-YUVRGB_TABLE_HEADROOM, 0, 255)*inc; table[i] = elemsize * (off + (cb >> 16)); } }
1threat
static void resume_all_vcpus(void) { CPUState *penv = first_cpu; while (penv) { penv->stop = 0; penv->stopped = 0; qemu_thread_signal(penv->thread, SIGUSR1); qemu_cpu_kick(penv); penv = (CPUState *)penv->next_cpu; } }
1threat
static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, uint8_t *buf, int buf_size) { RTSPState *rt = s->priv_data; RTSPStream *rtsp_st; fd_set rfds; int fd, fd_max, n, i, ret, tcp_fd; struct timeval tv; for(;;) { if (url_interrupt_cb()) return AVERROR(EINTR); FD_ZERO(&rfds); tcp_fd = fd_max = url_get_file_handle(rt->rtsp_hd); FD_SET(tcp_fd, &rfds); for(i = 0; i < rt->nb_rtsp_streams; i++) { rtsp_st = rt->rtsp_streams[i]; if (rtsp_st->rtp_handle) { fd = url_get_file_handle(rtsp_st->rtp_handle); if (fd > fd_max) fd_max = fd; FD_SET(fd, &rfds); } } tv.tv_sec = 0; tv.tv_usec = 100 * 1000; n = select(fd_max + 1, &rfds, NULL, NULL, &tv); if (n > 0) { for(i = 0; i < rt->nb_rtsp_streams; i++) { rtsp_st = rt->rtsp_streams[i]; if (rtsp_st->rtp_handle) { fd = url_get_file_handle(rtsp_st->rtp_handle); if (FD_ISSET(fd, &rfds)) { ret = url_read(rtsp_st->rtp_handle, buf, buf_size); if (ret > 0) { *prtsp_st = rtsp_st; return ret; } } } } if (FD_ISSET(tcp_fd, &rfds)) { RTSPMessageHeader reply; rtsp_read_reply(s, &reply, NULL, 0); } } } }
1threat
static void qed_check_for_leaks(QEDCheck *check) { BDRVQEDState *s = check->s; size_t i; for (i = s->header.header_size; i < check->nclusters; i++) { if (!qed_test_bit(check->used_clusters, i)) { check->result->leaks++; } } }
1threat
How do I insert a Machine Name info a path? : So my goal is to put a MachineName string into the path location. Here = MachineName1 string MachineName1 = Environment.MachineName; Path = @"C:\Users\ Here \AppData\Local\Secret\Secret";
0debug
static ssize_t handle_aiocb_ioctl(struct qemu_paiocb *aiocb) { int ret; ret = ioctl(aiocb->aio_fildes, aiocb->aio_ioctl_cmd, aiocb->aio_ioctl_buf); if (ret == -1) return -errno; return aiocb->aio_nbytes; }
1threat
How to set focus on element with binding? : <p>In Angular2 how can I set binding on element focus. I don't want to set it with elementRef. I think in AngularJS there is ngFocus directive In Angular2 there is no such directive</p>
0debug
av_cold int MPV_common_init(MpegEncContext *s) { int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y, threads; if(s->codec_id == CODEC_ID_MPEG2VIDEO && !s->progressive_sequence) s->mb_height = (s->height + 31) / 32 * 2; else s->mb_height = (s->height + 15) / 16; if(s->avctx->pix_fmt == PIX_FMT_NONE){ av_log(s->avctx, AV_LOG_ERROR, "decoding to PIX_FMT_NONE is not supported.\n"); return -1; } if(s->avctx->thread_count > MAX_THREADS || (s->avctx->thread_count > s->mb_height && s->mb_height)){ av_log(s->avctx, AV_LOG_ERROR, "too many threads\n"); return -1; } if((s->width || s->height) && avcodec_check_dimensions(s->avctx, s->width, s->height)) return -1; dsputil_init(&s->dsp, s->avctx); ff_dct_common_init(s); s->flags= s->avctx->flags; s->flags2= s->avctx->flags2; s->mb_width = (s->width + 15) / 16; s->mb_stride = s->mb_width + 1; s->b8_stride = s->mb_width*2 + 1; s->b4_stride = s->mb_width*4 + 1; mb_array_size= s->mb_height * s->mb_stride; mv_table_size= (s->mb_height+2) * s->mb_stride + 1; avcodec_get_chroma_sub_sample(s->avctx->pix_fmt,&(s->chroma_x_shift), &(s->chroma_y_shift) ); s->h_edge_pos= s->mb_width*16; s->v_edge_pos= s->mb_height*16; s->mb_num = s->mb_width * s->mb_height; s->block_wrap[0]= s->block_wrap[1]= s->block_wrap[2]= s->block_wrap[3]= s->b8_stride; s->block_wrap[4]= s->block_wrap[5]= s->mb_stride; y_size = s->b8_stride * (2 * s->mb_height + 1); c_size = s->mb_stride * (s->mb_height + 1); yc_size = y_size + 2 * c_size; s->codec_tag = ff_toupper4(s->avctx->codec_tag); s->stream_codec_tag = ff_toupper4(s->avctx->stream_codec_tag); s->avctx->coded_frame= (AVFrame*)&s->current_picture; FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num+1)*sizeof(int), fail) for(y=0; y<s->mb_height; y++){ for(x=0; x<s->mb_width; x++){ s->mb_index2xy[ x + y*s->mb_width ] = x + y*s->mb_stride; } } s->mb_index2xy[ s->mb_height*s->mb_width ] = (s->mb_height-1)*s->mb_stride + s->mb_width; if (s->encoding) { FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->b_forw_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_forw_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail) s->p_mv_table = s->p_mv_table_base + s->mb_stride + 1; s->b_forw_mv_table = s->b_forw_mv_table_base + s->mb_stride + 1; s->b_back_mv_table = s->b_back_mv_table_base + s->mb_stride + 1; s->b_bidir_forw_mv_table= s->b_bidir_forw_mv_table_base + s->mb_stride + 1; s->b_bidir_back_mv_table= s->b_bidir_back_mv_table_base + s->mb_stride + 1; s->b_direct_mv_table = s->b_direct_mv_table_base + s->mb_stride + 1; if(s->msmpeg4_version){ FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_stats, 2*2*(MAX_LEVEL+1)*(MAX_RUN+1)*2*sizeof(int), fail); } FF_ALLOCZ_OR_GOTO(s->avctx, s->avctx->stats_out, 256, fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_type , mb_array_size * sizeof(uint16_t), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->lambda_table, mb_array_size * sizeof(int), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix , 64*32 * sizeof(int), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix , 64*32 * sizeof(int), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix16, 64*32*2 * sizeof(uint16_t), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix16, 64*32*2 * sizeof(uint16_t), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->input_picture, MAX_PICTURE_COUNT * sizeof(Picture*), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->reordered_input_picture, MAX_PICTURE_COUNT * sizeof(Picture*), fail) if(s->avctx->noise_reduction){ FF_ALLOCZ_OR_GOTO(s->avctx, s->dct_offset, 2 * 64 * sizeof(uint16_t), fail) } } FF_ALLOCZ_OR_GOTO(s->avctx, s->picture, MAX_PICTURE_COUNT * sizeof(Picture), fail) for(i = 0; i < MAX_PICTURE_COUNT; i++) { avcodec_get_frame_defaults((AVFrame *)&s->picture[i]); } FF_ALLOCZ_OR_GOTO(s->avctx, s->error_status_table, mb_array_size*sizeof(uint8_t), fail) if(s->codec_id==CODEC_ID_MPEG4 || (s->flags & CODEC_FLAG_INTERLACED_ME)){ for(i=0; i<2; i++){ int j, k; for(j=0; j<2; j++){ for(k=0; k<2; k++){ FF_ALLOCZ_OR_GOTO(s->avctx, s->b_field_mv_table_base[i][j][k], mv_table_size * 2 * sizeof(int16_t), fail) s->b_field_mv_table[i][j][k] = s->b_field_mv_table_base[i][j][k] + s->mb_stride + 1; } FF_ALLOCZ_OR_GOTO(s->avctx, s->b_field_select_table [i][j], mb_array_size * 2 * sizeof(uint8_t), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_mv_table_base[i][j], mv_table_size * 2 * sizeof(int16_t), fail) s->p_field_mv_table[i][j] = s->p_field_mv_table_base[i][j]+ s->mb_stride + 1; } FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_select_table[i], mb_array_size * 2 * sizeof(uint8_t), fail) } } if (s->out_format == FMT_H263) { FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_val_base, yc_size * sizeof(int16_t) * 16, fail); s->ac_val[0] = s->ac_val_base + s->b8_stride + 1; s->ac_val[1] = s->ac_val_base + y_size + s->mb_stride + 1; s->ac_val[2] = s->ac_val[1] + c_size; FF_ALLOCZ_OR_GOTO(s->avctx, s->coded_block_base, y_size, fail); s->coded_block= s->coded_block_base + s->b8_stride + 1; FF_ALLOCZ_OR_GOTO(s->avctx, s->cbp_table , mb_array_size * sizeof(uint8_t), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->pred_dir_table, mb_array_size * sizeof(uint8_t), fail) } if (s->h263_pred || s->h263_plus || !s->encoding) { FF_ALLOCZ_OR_GOTO(s->avctx, s->dc_val_base, yc_size * sizeof(int16_t), fail); s->dc_val[0] = s->dc_val_base + s->b8_stride + 1; s->dc_val[1] = s->dc_val_base + y_size + s->mb_stride + 1; s->dc_val[2] = s->dc_val[1] + c_size; for(i=0;i<yc_size;i++) s->dc_val_base[i] = 1024; } FF_ALLOCZ_OR_GOTO(s->avctx, s->mbintra_table, mb_array_size, fail); memset(s->mbintra_table, 1, mb_array_size); FF_ALLOCZ_OR_GOTO(s->avctx, s->mbskip_table, mb_array_size+2, fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE, fail); s->parse_context.state= -1; if((s->avctx->debug&(FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) || (s->avctx->debug_mv)){ s->visualization_buffer[0] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH); s->visualization_buffer[1] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH); s->visualization_buffer[2] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH); } s->context_initialized = 1; s->thread_context[0]= s; threads = s->avctx->thread_count; for(i=1; i<threads; i++){ s->thread_context[i]= av_malloc(sizeof(MpegEncContext)); memcpy(s->thread_context[i], s, sizeof(MpegEncContext)); } for(i=0; i<threads; i++){ if(init_duplicate_context(s->thread_context[i], s) < 0) goto fail; s->thread_context[i]->start_mb_y= (s->mb_height*(i ) + s->avctx->thread_count/2) / s->avctx->thread_count; s->thread_context[i]->end_mb_y = (s->mb_height*(i+1) + s->avctx->thread_count/2) / s->avctx->thread_count; } return 0; fail: MPV_common_end(s); return -1; }
1threat
Disable autouse fixtures on specific pytest marks : <p>Is it possible to prevent the execution of "function scoped" fixtures with <code>autouse=True</code> on specific marks only?</p> <p>I have the following fixture set to autouse so that all outgoing requests are automatically mocked out:</p> <pre><code>@pytest.fixture(autouse=True) def no_requests(monkeypatch): monkeypatch.setattr("requests.sessions.Session.request", MagicMock()) </code></pre> <p>But I have a mark called <code>endtoend</code> that I use to define a series of tests that are allowed to make external requests for more robust end to end testing. I would like to inject <code>no_requests</code> in all tests (the vast majority), but not in tests like the following:</p> <pre><code>@pytest.mark.endtoend def test_api_returns_ok(): assert make_request().status_code == 200 </code></pre> <p>Is this possible?</p>
0debug
Maven AspectJ plugin fails to build with Java 9 due to missing tools.jar : <p>I switched my JDK version from 8 to 9 and the AspectJ plugin no longer works due to missing tools.jar:</p> <p><em>Execution default of goal org.codehaus.mojo:aspectj-maven-plugin:1.10:compile failed: Plugin org.codehaus.mojo:aspectj-maven-plugin:1.10 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:9.0.1 at specified path C:\Program Files\Java\jdk-9.0.1/../lib/tools.jar</em></p> <p>I understand that tools.jar (and rt.jar) were removed from Java 9 JDK. I am wondering if there a way to get Maven AspectJ plugin to work with Java 9 without tools.jar?</p> <p>Here is my plugin definition with version info:</p> <pre><code> &lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;aspectj-maven-plugin&lt;/artifactId&gt; &lt;version&gt;1.10&lt;/version&gt; &lt;configuration&gt; &lt;encoding&gt;${project.build.sourceEncoding}&lt;/encoding&gt; &lt;complianceLevel&gt;1.9&lt;/complianceLevel&gt; &lt;showWeaveInfo&gt;true&lt;/showWeaveInfo&gt; &lt;XnoInline&gt;true&lt;/XnoInline&gt; &lt;/configuration&gt; &lt;executions&gt; &lt;execution&gt; &lt;goals&gt; &lt;goal&gt;compile&lt;/goal&gt; &lt;goal&gt;test-compile&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;org.aspectj&lt;/groupId&gt; &lt;artifactId&gt;aspectjrt&lt;/artifactId&gt; &lt;version&gt;1.9.0.RC2&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.aspectj&lt;/groupId&gt; &lt;artifactId&gt;aspectjtools&lt;/artifactId&gt; &lt;version&gt;1.9.0.RC2&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;/plugin&gt; </code></pre>
0debug
C++ | Game Stops after If statement : I run this code but when I reach the edge of the screen, it doesn't allow me to enter a new travel direction instead the console closes down.. need help fixing this please class weapon { public: weapon(); weapon(int x, int y); int xPos; int yPos; }; weapon::weapon() { xPos = 0; yPos = 0; } weapon::weapon(int x, int y) { xPos = x; yPos = y; } struct Game { weapon Bow; weapon Sword; }; int main() { weapon * Bow = new weapon(4, 6); // how to add cout to this to show you have the weapon? int xPos = 1; int yPos = 1; char input = '#'; while (xPos >= 1 && xPos <= 20 && yPos >= 1 && yPos <= 20) { cout << "Current x-coord = " << xPos << " Current y-coord = " << yPos << endl; cout << "Which direction would you like to travel? Enter N, E, S or W" << endl; cin >> input; switch (input) { case 'E': case 'e': ++xPos; break; case 'W': case 'w': --xPos; break; case 'N': case 'n': ++yPos; break; case 'S': case 's': --yPos; break; } if (xPos <= 0 || xPos >= 21 || yPos <= 0 || yPos >= 21) { cout << "There is a wall in the way!" << endl; //how do i make it continue the game after hitting a wall cout << "Which direction would you like to travel? Enter N, E, S or W" << endl; //cin >> input; // this whole section needs some fixing } } return 0; } The correct solution should return back to the while loop, allowing the user to enter a new input direction for travel thanks
0debug
JavaScript returning code : I've made a list of ships that it represented like so: var fleet = [ "RMS MARY", 2000, 15], ["TITANIC 2", 10000, 13], ["Boaty McBoatface", 2000, 18], ["Jutlandia", 1945, 10], ["Hjejlen", 250, 8], ]; What i need to do now is make a function that will filter the ships by a given capacity. Example: filterByCapacity(fleet,5000) This should only return the ship "Titanic 2" since it is the only ship with a capacity higher than 5000. Any ideas on how to make such a function?
0debug
Why we use #!/bin/bash in Bash script? : <p>What is the significant of using <strong>#!/bin/bash</strong> in the starting of bash script? Can we write a bash script without <strong>#!/bin/bash</strong> ?</p>
0debug
static struct omap_sti_s *omap_sti_init(struct omap_target_agent_s *ta, MemoryRegion *sysmem, target_phys_addr_t channel_base, qemu_irq irq, omap_clk clk, CharDriverState *chr) { struct omap_sti_s *s = (struct omap_sti_s *) g_malloc0(sizeof(struct omap_sti_s)); s->irq = irq; omap_sti_reset(s); s->chr = chr ?: qemu_chr_new("null", "null", NULL); memory_region_init_io(&s->iomem, &omap_sti_ops, s, "omap.sti", omap_l4_region_size(ta, 0)); omap_l4_attach(ta, 0, &s->iomem); memory_region_init_io(&s->iomem_fifo, &omap_sti_fifo_ops, s, "omap.sti.fifo", 0x10000); memory_region_add_subregion(sysmem, channel_base, &s->iomem_fifo); return s; }
1threat
AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b) { AVFilterFormats *ret; unsigned i, j, k = 0; ret = av_mallocz(sizeof(AVFilterFormats)); ret->formats = av_malloc(sizeof(*ret->formats) * FFMIN(a->format_count, b->format_count)); for(i = 0; i < a->format_count; i ++) for(j = 0; j < b->format_count; j ++) if(a->formats[i] == b->formats[j]) ret->formats[k++] = a->formats[i]; ret->format_count = k; if(!ret->format_count) { av_free(ret->formats); av_free(ret); return NULL; } ret->refs = av_malloc(sizeof(AVFilterFormats**)*(a->refcount+b->refcount)); merge_ref(ret, a); merge_ref(ret, b); return ret; }
1threat
static void shpc_set_status(SHPCDevice *shpc, int slot, uint8_t value, uint16_t msk) { uint8_t *status = shpc->config + SHPC_SLOT_STATUS(slot); pci_word_test_and_clear_mask(status, msk); pci_word_test_and_set_mask(status, value << (ffs(msk) - 1)); }
1threat
How to find same/mutual/common entries of two users? : <p>I want to find all pages two users like (<code>status = 1</code>) or dislike (<code>status = 0</code>).</p> <p>Structure <code>pages_likes</code>:</p> <p><a href="https://i.stack.imgur.com/maVNL.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/maVNL.jpg" alt="enter image description here"></a></p> <p>Assume my user id (<code>uid</code>) is <code>1</code> and I'm on the page of user with user id <code>uid = 2</code>, I want to select all <code>page_id</code> entries I have in common with that user.</p> <p>How could I select or just count the amount of all that <code>page_id</code> entries we have in common?</p>
0debug
How to enable maven artifact caching for gitlab ci runner? : <p>We use gitlab ci with shared runners to do our continuous integration. For each build, the runner downloads tons of maven artifacts.</p> <p>Is there a way to configure gitlab ci to cache those artifacts so we can speed up the building process by preventing downloading the same artifact over and over again?</p>
0debug
How can i stream audio from one device to another device over same wifi network? : I have music player and need to add sync play functionality with other mobile for example if 2 or more users are using my music player and want to play same song on all devices then they just connect through same network and can play music on all devices from one device with complete music player control of all devices on single device. I am already having some research but not getting any useful information... Reference app https://play.google.com/store/apps/details?id=com.kattwinkel.android.soundseeder.player PLEASE HELP TO GET THIS AND TRY THE APP IF YOU NOT GETTING WHAT I WANT Already try: https://stackoverflow.com/questions/14401340/live-stream-video-from-one-android-phone-to-another-over-wifi and some other examples of StackOverflow
0debug
static int adpcm_decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size) { ADPCMContext *c = avctx->priv_data; ADPCMChannelStatus *cs; int n, m, channel, i; int block_predictor[2]; short *samples; uint8_t *src; int st; unsigned char last_byte = 0; unsigned char nibble; int decode_top_nibble_next = 0; int diff_channel; samples = data; src = buf; st = avctx->channels == 2; switch(avctx->codec->id) { case CODEC_ID_ADPCM_IMA_QT: n = (buf_size - 2); channel = c->channel; cs = &(c->status[channel]); cs->predictor = (*src++) << 8; cs->predictor |= (*src & 0x80); cs->predictor &= 0xFF80; if(cs->predictor & 0x8000) cs->predictor -= 0x10000; CLAMP_TO_SHORT(cs->predictor); cs->step_index = (*src++) & 0x7F; if (cs->step_index > 88) fprintf(stderr, "ERROR: step_index = %i\n", cs->step_index); if (cs->step_index > 88) cs->step_index = 88; cs->step = step_table[cs->step_index]; if (st && channel) samples++; *samples++ = cs->predictor; samples += st; for(m=32; n>0 && m>0; n--, m--) { *samples = adpcm_ima_expand_nibble(cs, src[0] & 0x0F); samples += avctx->channels; *samples = adpcm_ima_expand_nibble(cs, (src[0] >> 4) & 0x0F); samples += avctx->channels; src ++; } if(st) { c->channel = (channel + 1) % 2; if(channel == 0) { *data_size = 0; return src - buf; } } break; case CODEC_ID_ADPCM_IMA_WAV: if (avctx->block_align != 0 && buf_size > avctx->block_align) buf_size = avctx->block_align; cs = &(c->status[0]); cs->predictor = (*src++) & 0x0FF; cs->predictor |= ((*src++) << 8) & 0x0FF00; if(cs->predictor & 0x8000) cs->predictor -= 0x10000; CLAMP_TO_SHORT(cs->predictor); cs->step_index = *src++; if (cs->step_index < 0) cs->step_index = 0; if (cs->step_index > 88) cs->step_index = 88; if (*src++) fprintf(stderr, "unused byte should be null !!\n"); if (st) { cs = &(c->status[1]); cs->predictor = (*src++) & 0x0FF; cs->predictor |= ((*src++) << 8) & 0x0FF00; if(cs->predictor & 0x8000) cs->predictor -= 0x10000; CLAMP_TO_SHORT(cs->predictor); cs->step_index = *src++; if (cs->step_index < 0) cs->step_index = 0; if (cs->step_index > 88) cs->step_index = 88; src++; } for(m=4; src < (buf + buf_size);) { *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[0] & 0x0F); if (st) *samples++ = adpcm_ima_expand_nibble(&c->status[1], src[4] & 0x0F); *samples++ = adpcm_ima_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F); if (st) { *samples++ = adpcm_ima_expand_nibble(&c->status[1], (src[4] >> 4) & 0x0F); if (!--m) { m=4; src+=4; } } src++; } break; case CODEC_ID_ADPCM_4XM: cs = &(c->status[0]); c->status[0].predictor= (int16_t)(src[0] + (src[1]<<8)); src+=2; if(st){ c->status[1].predictor= (int16_t)(src[0] + (src[1]<<8)); src+=2; } c->status[0].step_index= (int16_t)(src[0] + (src[1]<<8)); src+=2; if(st){ c->status[1].step_index= (int16_t)(src[0] + (src[1]<<8)); src+=2; } m= (buf_size - (src - buf))>>st; for(i=0; i<m; i++) { *samples++ = adpcm_4xa_expand_nibble(&c->status[0], src[i] & 0x0F); if (st) *samples++ = adpcm_4xa_expand_nibble(&c->status[1], src[i+m] & 0x0F); *samples++ = adpcm_4xa_expand_nibble(&c->status[0], src[i] >> 4); if (st) *samples++ = adpcm_4xa_expand_nibble(&c->status[1], src[i+m] >> 4); } src += m<<st; break; case CODEC_ID_ADPCM_MS: if (avctx->block_align != 0 && buf_size > avctx->block_align) buf_size = avctx->block_align; n = buf_size - 7 * avctx->channels; if (n < 0) return -1; block_predictor[0] = (*src++); block_predictor[0] = (block_predictor[0] < 0)?(0):((block_predictor[0] > 7)?(7):(block_predictor[0])); block_predictor[1] = 0; if (st) block_predictor[1] = (*src++); block_predictor[1] = (block_predictor[1] < 0)?(0):((block_predictor[1] > 7)?(7):(block_predictor[1])); c->status[0].idelta = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); if (c->status[0].idelta & 0x08000) c->status[0].idelta -= 0x10000; src+=2; if (st) c->status[1].idelta = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); if (st && c->status[1].idelta & 0x08000) c->status[1].idelta |= 0xFFFF0000; if (st) src+=2; c->status[0].coeff1 = AdaptCoeff1[block_predictor[0]]; c->status[0].coeff2 = AdaptCoeff2[block_predictor[0]]; c->status[1].coeff1 = AdaptCoeff1[block_predictor[1]]; c->status[1].coeff2 = AdaptCoeff2[block_predictor[1]]; c->status[0].sample1 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); src+=2; if (st) c->status[1].sample1 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); if (st) src+=2; c->status[0].sample2 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); src+=2; if (st) c->status[1].sample2 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); if (st) src+=2; *samples++ = c->status[0].sample1; if (st) *samples++ = c->status[1].sample1; *samples++ = c->status[0].sample2; if (st) *samples++ = c->status[1].sample2; for(;n>0;n--) { *samples++ = adpcm_ms_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F); *samples++ = adpcm_ms_expand_nibble(&c->status[st], src[0] & 0x0F); src ++; } break; case CODEC_ID_ADPCM_IMA_DK4: if (buf_size > BLKSIZE) { if (avctx->block_align != 0) buf_size = avctx->block_align; else buf_size = BLKSIZE; } c->status[0].predictor = (src[0] | (src[1] << 8)); c->status[0].step_index = src[2]; src += 4; if(c->status[0].predictor & 0x8000) c->status[0].predictor -= 0x10000; *samples++ = c->status[0].predictor; if (st) { c->status[1].predictor = (src[0] | (src[1] << 8)); c->status[1].step_index = src[2]; src += 4; if(c->status[1].predictor & 0x8000) c->status[1].predictor -= 0x10000; *samples++ = c->status[1].predictor; } while (src < buf + buf_size) { *samples++ = adpcm_ima_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F); if (st) *samples++ = adpcm_ima_expand_nibble(&c->status[1], src[0] & 0x0F); else *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[0] & 0x0F); src++; } break; case CODEC_ID_ADPCM_IMA_DK3: if (buf_size > BLKSIZE) { if (avctx->block_align != 0) buf_size = avctx->block_align; else buf_size = BLKSIZE; } c->status[0].predictor = (src[10] | (src[11] << 8)); c->status[1].predictor = (src[12] | (src[13] << 8)); c->status[0].step_index = src[14]; c->status[1].step_index = src[15]; if(c->status[0].predictor & 0x8000) c->status[0].predictor -= 0x10000; if(c->status[1].predictor & 0x8000) c->status[1].predictor -= 0x10000; src += 16; diff_channel = c->status[1].predictor; while (1) { DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[0], nibble); DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[1], nibble); diff_channel = (diff_channel + c->status[1].predictor) / 2; *samples++ = c->status[0].predictor + c->status[1].predictor; *samples++ = c->status[0].predictor - c->status[1].predictor; DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[0], nibble); diff_channel = (diff_channel + c->status[1].predictor) / 2; *samples++ = c->status[0].predictor + c->status[1].predictor; *samples++ = c->status[0].predictor - c->status[1].predictor; } break; case CODEC_ID_ADPCM_IMA_WS: while (src < buf + buf_size) { if (st) { *samples++ = adpcm_ima_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F); *samples++ = adpcm_ima_expand_nibble(&c->status[1], src[0] & 0x0F); } else { *samples++ = adpcm_ima_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F); *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[0] & 0x0F); } src++; } break; case CODEC_ID_ADPCM_XA: c->status[0].sample1 = c->status[0].sample2 = c->status[1].sample1 = c->status[1].sample2 = 0; while (buf_size >= 128) { xa_decode(samples, src, &c->status[0], &c->status[1], avctx->channels); src += 128; samples += 28 * 8; buf_size -= 128; } break; default: *data_size = 0; return -1; } *data_size = (uint8_t *)samples - (uint8_t *)data; return src - buf; }
1threat
Move Object in its own X - axis to and fro, on mouse drag : [Image][1] I want to move a particular object in its own X- axis to and fro, by using mouse.Clamp the movement between that box gap. [1]: https://i.stack.imgur.com/wxZ2P.jpg
0debug
static USBDevice *usb_serial_init(USBBus *bus, const char *filename) { USBDevice *dev; Chardev *cdrv; char label[32]; static int index; while (*filename && *filename != ':') { const char *p; if (strstart(filename, "vendorid=", &p)) { error_report("vendorid is not supported anymore"); return NULL; } else if (strstart(filename, "productid=", &p)) { error_report("productid is not supported anymore"); return NULL; } else { error_report("unrecognized serial USB option %s", filename); return NULL; } while(*filename == ',') filename++; } if (!*filename) { error_report("character device specification needed"); return NULL; } filename++; snprintf(label, sizeof(label), "usbserial%d", index++); cdrv = qemu_chr_new(label, filename); if (!cdrv) return NULL; dev = usb_create(bus, "usb-serial"); qdev_prop_set_chr(&dev->qdev, "chardev", cdrv); return dev; }
1threat
jwt_auth_no_auth_header error on validating WordPress REST API JWT token : <p>I have two AWS instances, one for WordPress website and another for React application. To connect them together I am using "WP REST API - OAuth 1.0a Server" and "JWT Authentication for WP-API" for accessing WP REST API. </p> <p>I am able to generate token by <code>/wp-json/jwt-auth/v1/token</code> but when I am trying to access any other endpoint or if trying to validate the token by <code>/wp-json/jwt-auth/v1/token/validate</code> I am getting following error :</p> <pre><code>{ "code": "jwt_auth_no_auth_header", "message": "Authorization header not found.", "data": { "status": 403 } } </code></pre> <p>I looked up and found few things to add to <code>.htaccess</code>. I added everything I could find but had no success.</p> <pre><code>RewriteEngine On RewriteBase / # Enable HTTP Auth RewriteCond %{HTTP:Authorization} ^(.*) RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1] # WordPress RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # For SetEnvIf Authorization #RewriteRule (.*) - [env=myenv:1] SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 #SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0 </code></pre> <p>I added following code to see if any Authorization Header is present in the request but there isn't any</p> <pre><code>add_filter( 'rest_pre_dispatch', 'prefix_show_request_headers', 10, 3 ); function prefix_show_request_headers( $result, $server, $request ) { $result = $request-&gt;get_headers(); return $result; } </code></pre> <p>Here (<a href="https://github.com/Tmeister/wp-api-jwt-auth/issues/6" rel="noreferrer">https://github.com/Tmeister/wp-api-jwt-auth/issues/6</a>) I read that WordPress is maybe trying to authenticate via cookie method by default and is throwing error and not reaching JWT authentication so I added this piece of code but still no success</p> <pre><code>add_filter( 'rest_authentication_errors', '__return_true' ); </code></pre> <p>At last I added "JSON Basic Authentication" plugin which also sends username:password in the Headers and it works. So I am not sure if it's an issue with Headers being stripped. As it is not recommended for production server so I need JWT authentication to work.</p> <p>Any help is appreciated.</p>
0debug
static int aac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { AACContext *ac = avctx->priv_data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; GetBitContext gb; int buf_consumed; int buf_offset; int err; int new_extradata_size; const uint8_t *new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &new_extradata_size); int jp_dualmono_size; const uint8_t *jp_dualmono = av_packet_get_side_data(avpkt, AV_PKT_DATA_JP_DUALMONO, &jp_dualmono_size); if (new_extradata && 0) { av_free(avctx->extradata); avctx->extradata = av_mallocz(new_extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) return AVERROR(ENOMEM); avctx->extradata_size = new_extradata_size; memcpy(avctx->extradata, new_extradata, new_extradata_size); push_output_configuration(ac); if (decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac, avctx->extradata, avctx->extradata_size*8, 1) < 0) { pop_output_configuration(ac); return AVERROR_INVALIDDATA; } } ac->dmono_mode = 0; if (jp_dualmono && jp_dualmono_size > 0) ac->dmono_mode = 1 + *jp_dualmono; if (ac->force_dmono_mode >= 0) ac->dmono_mode = ac->force_dmono_mode; if (INT_MAX / 8 <= buf_size) return AVERROR_INVALIDDATA; if ((err = init_get_bits8(&gb, buf, buf_size)) < 0) return err; switch (ac->oc[1].m4ac.object_type) { case AOT_ER_AAC_LC: case AOT_ER_AAC_LTP: case AOT_ER_AAC_LD: case AOT_ER_AAC_ELD: err = aac_decode_er_frame(avctx, data, got_frame_ptr, &gb); break; default: err = aac_decode_frame_int(avctx, data, got_frame_ptr, &gb, avpkt); } if (err < 0) return err; buf_consumed = (get_bits_count(&gb) + 7) >> 3; for (buf_offset = buf_consumed; buf_offset < buf_size; buf_offset++) if (buf[buf_offset]) break; return buf_size > buf_offset ? buf_consumed : buf_size; }
1threat
why is the if statement associated with the second radio button not writing? : i am working on a project in which There are two options in the selection screen. Block Title - Search 1)Flight Information 2)Customer ID On Choosing the first radio button, a selection block with the following fields must appear CARRID, CONNID , FLDATE which gives the first report and On choosing the second radio button, CUSTOMER ID which should give the second report but the if statement associated with the second radiobutton is not working. the part with the first radio button works. code ```REPORT zkj_miniproject. TABLES : sflight,scustom,sbook,spfli,scarr. TYPES : BEGIN OF st_final, carrid TYPE sbook-carrid, connid TYPE sbook-connid, customid TYPE sbook-customid, carrname TYPE scarr-carrname, cityfrom TYPE spfli-cityfrom, cityto TYPE spfli-cityto, fldate TYPE sbook-fldate, passname TYPE sbook-passname, luggweight TYPE sbook-luggweight, wunit TYPE sbook-wunit, loccuram TYPE sbook-loccuram, END OF st_final, BEGIN OF st_rad2final, customid TYPE sbook-customid, carrname TYPE scarr-carrname, carrid TYPE sbook-carrid, connid TYPE sbook-connid, fldate TYPE sbook-fldate, bookid TYPE sbook-bookid, loccuram TYPE sbook-loccuram, END OF st_rad2final, BEGIN OF st_rad2scarr, carrid TYPE scarr-carrid, carrname TYPE scarr-carrname, END OF st_rad2scarr, BEGIN OF st_scarr, carrid TYPE scarr-carrid, carrname TYPE scarr-carrname, END OF st_scarr, BEGIN OF st_spfli, carrid TYPE spfli-carrid, connid TYPE spfli-connid, cityfrom TYPE spfli-cityfrom, cityto TYPE spfli-cityto, END OF st_spfli. DATA : it_final TYPE TABLE OF st_final, wa_final LIKE LINE OF it_final, it_scarr TYPE TABLE OF st_scarr, wa_scarr LIKE LINE OF it_scarr, it_spfli TYPE TABLE OF st_spfli, wa_spfli LIKE LINE OF it_spfli, it_rad2final TYPE TABLE OF st_rad2final, wa_rad2final like LINE OF it_rad2final, it_rad2scarr TYPE TABLE OF st_rad2scarr, wa_rad2scarr LIKE LINE OF it_rad2scarr, text TYPE string. SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-t01. PARAMETERS : rad1 RADIOBUTTON GROUP rad USER-COMMAND abc DEFAULT'X', rad2 RADIOBUTTON GROUP rad . SELECTION-SCREEN END OF BLOCK block1. SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME TITLE text-t02. SELECT-OPTIONS : a FOR sbook-carrid MODIF ID ra, b FOR sbook-connid MODIF ID ra, c FOR sbook-fldate MODIF ID ra, d FOR sbook-customid MODIF ID rb. SELECTION-SCREEN END OF BLOCK block2. AT SELECTION-SCREEN OUTPUT. IF rad1 = 'X'. LOOP AT SCREEN. if screen-group1 = 'RB'. screen-active = 0. MODIFY SCREEN. ENDIF. ENDLOOP. ELSEif rad2 = 'X'. LOOP AT SCREEN. IF screen-group1 = 'RA'. screen-active = 0. MODIFY SCREEN. ENDIF. ENDLOOP. ENDIF. START-OF-SELECTION. if rad1 = 'X'. SELECT carrid connid fldate passname customid luggweight wunit loccuram FROM sbook INTO CORRESPONDING FIELDS OF TABLE it_final WHERE carrid IN a and connid IN b and fldate IN c. SELECT carrid carrname FROM scarr INTO CORRESPONDING FIELDS OF TABLE it_scarr. SELECT carrid connid cityfrom cityto FROM spfli INTO CORRESPONDING FIELDS OF TABLE it_spfli. ELSEIF rad2 = 'X'. SELECT customid carrid CONNid fldate bookid loccuram from sbook INTO CORRESPONDING FIELDS OF TABLE it_rad2final WHERE customid in d. SELECT carrid carrname FROM scarr INTO CORRESPONDING FIELDS OF TABLE it_rad2scarr. endif. if rad1 = 'X'. LOOP AT it_final INTO wa_final. READ TABLE it_spfli into wa_spfli with key carrid = wa_final-carrid connid = wa_final-connid. wa_final-cityfrom = wa_spfli-cityfrom. wa_final-cityto = wa_spfli-cityto. READ TABLE it_scarr INTO wa_scarr WITH KEY carrid = wa_final-carrid. wa_final-carrname = wa_scarr-carrname. if wa_final-luggweight > 10. WRITE : / wa_final-carrname , wa_final-cityfrom , wa_final-cityto , wa_final-fldate , wa_final-passname ,wa_final-luggweight COLOR 6, wa_final-wunit, wa_final-loccuram. else. WRITE : / wa_final-carrname , wa_final-cityfrom , wa_final-cityto , wa_final-fldate , wa_final-passname ,wa_final-luggweight COLOR 5, wa_final-wunit, wa_final-loccuram. ENDIF. ENDLOOP. endif. *BREAK-POINT. IF rad2 = 'X'. LOOP AT it_rad2final INTO wa_rad2final. READ TABLE it_rad2scarr INTO wa_rad2scarr WITH KEY carrid = wa_rad2final-carrid. wa_rad2final-carrname = wa_rad2scarr-carrname. ENDLOOP. WRITE :/ wa_rad2final-carrname , wa_rad2final-connid , wa_rad2final-fldate , wa_rad2final-bookid , wa_rad2final-loccuram. ENDIF. ```
0debug
html mobile and laptop website design : <p>I am working on a project on html in which we have to make a website which is both laptop and mobile compatible. what I want is that I want two different navigation bar meaning when I open the normal website it shows different one and when I open mobile it would have a different one navigation bar. any idea?</p>
0debug
php video upload doesn't work : <p>I have a php script. The script can't upload a video.</p> <p>When I submit the form, I get the error: Warning: getimagesize(): Filename cannot be empty. I have search on the internet, I change getimagesize in file() and $_FILES["uploaded_file"]["type"]; But this doesn't work.</p> <p>Can someone help me? How can I upload a video to the upload_video folder? The insert into in de database is working.</p> <p>my script is:</p> <pre><code>include 'connect.php'; $target_dir = "upload_video/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $uploadOk = 1; $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION); var_dump($imageFileType); if(isset($_POST["submit"])) { $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);//this is wrong } if (file_exists($target_file)) { echo "Sorry, file already exists."; $uploadOk = 0; } if($imageFileType != "mp4" ) { echo "only mp4 extensions"; $uploadOk = 0; } if ($uploadOk == 0) { echo "Sorry, your file was not uploaded."; } else { if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { echo "the video ". basename( $_FILES["fileToUpload"]["name"]). " is upload."; } else { echo "Sorry, there was an error uploading your file."; } } $sql = "INSERT INTO upload_video (file, description)VALUES (?, ?)"; $stmt = $link-&gt;prepare($sql); $stmt-&gt;bind_param("ss", $target_file, $description ); $beschrijving = $_POST['beschrijving']; $stmt-&gt;execute(); if ($sql) { } else{ echo "Data not add"; } $stmt-&gt;close(); mysqli_close($link); </code></pre>
0debug
void rgb15tobgr32(const uint8_t *src, uint8_t *dst, long src_size) { const uint16_t *end; uint8_t *d = (uint8_t *)dst; const uint16_t *s = (const uint16_t *)src; end = s + src_size/2; while(s < end) { register uint16_t bgr; bgr = *s++; #ifdef WORDS_BIGENDIAN *d++ = 0; *d++ = (bgr&0x1F)<<3; *d++ = (bgr&0x3E0)>>2; *d++ = (bgr&0x7C00)>>7; #else *d++ = (bgr&0x7C00)>>7; *d++ = (bgr&0x3E0)>>2; *d++ = (bgr&0x1F)<<3; *d++ = 0; #endif } }
1threat
Is there a concise way to "invert" an Option? : <p>Say I have a function that can take an optional parameter, and I want to return a <code>Some</code> if the argument is <code>None</code> and a <code>None</code> if the argument is <code>Some</code>:</p> <pre><code>def foo(a: Option[A]): Option[B] = a match { case Some(_) =&gt; None case None =&gt; Some(makeB()) } </code></pre> <p>So what I want to do is kind of the inverse of <code>map</code>. The variants of <code>orElse</code> are not applicable, because they retain the value of <code>a</code> if it's present.</p> <p>Is there a more concise way to do this than <code>if (a.isDefined) None else Some(makeB())</code>?</p>
0debug
Multiple stores in ngrx : <p>I am writing an enterprise-scale application with Angular and ngrx. The intention is to use Flux and ngrx throughout. For reuse and separability we require (at least) two state stores that do not interact with each other. But we do need both stores to be active at the same time, and potentially accessed from the same components.</p> <p>Ngrx seems to be predicated on the assumption that there will only ever be one Store at once. Is there an approach that will allow me to have multiple Store objects (templated of course with different State objects), and have them both loaded and active at the same time?</p> <p>I'm aware that 'best practice' recommends combining the stores into one. That's not viable here unless there is an entirely novel approach.</p>
0debug
static int oma_read_packet(AVFormatContext *s, AVPacket *pkt) { OMAContext *oc = s->priv_data; AVStream *st = s->streams[0]; int packet_size = st->codec->block_align; int byte_rate = st->codec->bit_rate >> 3; int64_t pos = avio_tell(s->pb); int ret = av_get_packet(s->pb, pkt, packet_size); if (ret < packet_size) pkt->flags |= AV_PKT_FLAG_CORRUPT; if (ret < 0) return ret; if (!ret) return AVERROR_EOF; pkt->stream_index = 0; if (pos > 0) { pkt->pts = pkt->dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num); } if (oc->encrypted) { if (ret == packet_size) av_des_crypt(&oc->av_des, pkt->data, pkt->data, (packet_size >> 3), oc->iv, 1); else memset(oc->iv, 0, 8); } return ret; }
1threat
What are the internals of Pythons str.join()? (Hiding passwords from output) : <p>I just stumbled upon an interesting(?) way to hide passwords (and other personal data) from general output from screen to logfiles.</p> <p>In his book <a href="http://www.oreilly.com/programming/free/files/how-to-make-mistakes-in-python.pdf" rel="nofollow noreferrer">How to make mistakes in Python</a> Mike Pirnat suggests to implement a class for sensitive strings and to overload its <code>__str__</code>- and <code>__repr__</code>-methods.</p> <p>I experimented with that and got this:</p> <pre class="lang-py prettyprint-override"><code>class secret(str): def __init__(self, s): self.string = s def __repr__(self): return "'" + "R"*len(self.string) + "'" def __str__(self): return "S" * len(self.string) def __add__(self, other): return str.__add__(self.__str__(), other) def __radd__(self, other): return str.__add__(other, self.__str__()) def __getslice__(self, i, j): return ("X"*len(self.string))[i:j] </code></pre> <p>(I'm aware that using <code>len</code> provides information about the content to hide. It's just for testing.)</p> <p>It works fine in this cases:</p> <pre class="lang-py prettyprint-override"><code>pwd = secret("nothidden") print("The passwort is " + pwd) # The passwort is SSSSSSSSS print(pwd + " is the passwort.") # SSSSSSSSS is the password. print("The passwort is {}.".format(pwd)) # The password is SSSSSSSSS. print(["The", "passwort", "is", pwd]) # ['The', 'password', 'is', 'RRRRRRRRR'] print(pwd[:]) # XXXXXXXXX </code></pre> <p>However this does not work:</p> <pre class="lang-py prettyprint-override"><code>print(" ".join(["The", "password", "is", pwd])) # The password is nothidden </code></pre> <p>So, how does str.join() work internally? Which method would I have to overload to obscure the string?</p>
0debug
php7 driver non trouvé (mysql) : voici mon code de connexion (php 7): try { $conn = new PDO('mysql :host='.$host.';dbname='.$database, $user, $password); } catch (Exception $e) { die('Erreur : ' . $e->getMessage()); } et je reçois un message "Erreur : could not find driver" un aperçu de phpinfo() ... PDO PDO support enabled PDO drivers mysql, sqlite pdo_mysql PDO Driver for MySQL enabled Client API version mysqlnd 5.0.12-dev - 20150407 - $Id: b5c5906d452ec590732a93b051f3827e02749b83 $ Directive Local Value Master Value pdo_mysql.default_socket /var/run/mysqld/mysqld.sock /var/run/mysqld/mysqld.sock Est-ce que quelqu'un peu m'aider, merci d'avance.
0debug
C# 7.0 Feature or what - [ClassName] obj when obj.Type is SomeType some : <p>I have been recently assigned to a project which is using C# 7.0. While I was debugging the code I came across some switch case statement and in that it was written something like below: </p> <pre><code>switch (message) { case MyClass obj when obj.Type is MyType type: // Dome Action break; case MyClass1 obj when obj.Type is MyType1 type: // Some Action break; } </code></pre> <p>I want to understand the purpose behind this magical statement. </p>
0debug
static int decode_cabac_field_decoding_flag(H264Context *h) { MpegEncContext * const s = &h->s; const int mb_x = s->mb_x; const int mb_y = s->mb_y & ~1; const int mba_xy = mb_x - 1 + mb_y *s->mb_stride; const int mbb_xy = mb_x + (mb_y-2)*s->mb_stride; unsigned int ctx = 0; if( h->slice_table[mba_xy] == h->slice_num && IS_INTERLACED( s->current_picture.mb_type[mba_xy] ) ) { ctx += 1; } if( h->slice_table[mbb_xy] == h->slice_num && IS_INTERLACED( s->current_picture.mb_type[mbb_xy] ) ) { ctx += 1; } return get_cabac( &h->cabac, &h->cabac_state[70 + ctx] ); }
1threat
void ide_exec_cmd(IDEBus *bus, uint32_t val) { uint16_t *identify_data; IDEState *s; int n; #if defined(DEBUG_IDE) printf("ide: CMD=%02x\n", val); #endif s = idebus_active_if(bus); if (s != bus->ifs && !s->bs) return; if ((s->status & (BUSY_STAT|DRQ_STAT)) && val != WIN_DEVICE_RESET) return; if (!ide_cmd_permitted(s, val)) { goto abort_cmd; } if (ide_cmd_table[val].handler != NULL) { bool complete; s->status = READY_STAT | BUSY_STAT; s->error = 0; complete = ide_cmd_table[val].handler(s, val); if (complete) { s->status &= ~BUSY_STAT; assert(!!s->error == !!(s->status & ERR_STAT)); if ((ide_cmd_table[val].flags & SET_DSC) && !s->error) { s->status |= SEEK_STAT; } ide_set_irq(s->bus); } return; } switch(val) { case WIN_CHECKPOWERMODE1: case WIN_CHECKPOWERMODE2: s->error = 0; s->nsector = 0xff; s->status = READY_STAT | SEEK_STAT; ide_set_irq(s->bus); break; case WIN_SETFEATURES: if (!s->bs) goto abort_cmd; switch(s->feature) { case 0x02: bdrv_set_enable_write_cache(s->bs, true); identify_data = (uint16_t *)s->identify_data; put_le16(identify_data + 85, (1 << 14) | (1 << 5) | 1); s->status = READY_STAT | SEEK_STAT; ide_set_irq(s->bus); break; case 0x82: bdrv_set_enable_write_cache(s->bs, false); identify_data = (uint16_t *)s->identify_data; put_le16(identify_data + 85, (1 << 14) | 1); ide_flush_cache(s); break; case 0xcc: case 0x66: case 0xaa: case 0x55: case 0x05: case 0x85: case 0x69: case 0x67: case 0x96: case 0x9a: case 0x42: case 0xc2: s->status = READY_STAT | SEEK_STAT; ide_set_irq(s->bus); break; case 0x03: { uint8_t val = s->nsector & 0x07; identify_data = (uint16_t *)s->identify_data; switch (s->nsector >> 3) { case 0x00: case 0x01: put_le16(identify_data + 62,0x07); put_le16(identify_data + 63,0x07); put_le16(identify_data + 88,0x3f); break; case 0x02: put_le16(identify_data + 62,0x07 | (1 << (val + 8))); put_le16(identify_data + 63,0x07); put_le16(identify_data + 88,0x3f); break; case 0x04: put_le16(identify_data + 62,0x07); put_le16(identify_data + 63,0x07 | (1 << (val + 8))); put_le16(identify_data + 88,0x3f); break; case 0x08: put_le16(identify_data + 62,0x07); put_le16(identify_data + 63,0x07); put_le16(identify_data + 88,0x3f | (1 << (val + 8))); break; default: goto abort_cmd; } s->status = READY_STAT | SEEK_STAT; ide_set_irq(s->bus); break; } default: goto abort_cmd; } break; case WIN_FLUSH_CACHE: case WIN_FLUSH_CACHE_EXT: ide_flush_cache(s); break; case WIN_SEEK: s->status = READY_STAT | SEEK_STAT; ide_set_irq(s->bus); break; case WIN_PIDENTIFY: ide_atapi_identify(s); s->status = READY_STAT | SEEK_STAT; ide_transfer_start(s, s->io_buffer, 512, ide_transfer_stop); ide_set_irq(s->bus); break; case WIN_DIAGNOSE: ide_set_signature(s); if (s->drive_kind == IDE_CD) s->status = 0; else s->status = READY_STAT | SEEK_STAT; s->error = 0x01; ide_set_irq(s->bus); break; case WIN_DEVICE_RESET: ide_set_signature(s); s->status = 0x00; s->error = 0x01; break; case WIN_PACKETCMD: if (s->feature & 0x02) goto abort_cmd; s->status = READY_STAT | SEEK_STAT; s->atapi_dma = s->feature & 1; s->nsector = 1; ide_transfer_start(s, s->io_buffer, ATAPI_PACKET_SIZE, ide_atapi_cmd); break; case CFA_REQ_EXT_ERROR_CODE: s->error = 0x09; s->status = READY_STAT | SEEK_STAT; ide_set_irq(s->bus); break; case CFA_ERASE_SECTORS: case CFA_WEAR_LEVEL: #if 0 case WIN_SECURITY_FREEZE_LOCK: #endif if (val == CFA_WEAR_LEVEL) s->nsector = 0; if (val == CFA_ERASE_SECTORS) s->media_changed = 1; s->error = 0x00; s->status = READY_STAT | SEEK_STAT; ide_set_irq(s->bus); break; case CFA_TRANSLATE_SECTOR: s->error = 0x00; s->status = READY_STAT | SEEK_STAT; memset(s->io_buffer, 0, 0x200); s->io_buffer[0x00] = s->hcyl; s->io_buffer[0x01] = s->lcyl; s->io_buffer[0x02] = s->select; s->io_buffer[0x03] = s->sector; s->io_buffer[0x04] = ide_get_sector(s) >> 16; s->io_buffer[0x05] = ide_get_sector(s) >> 8; s->io_buffer[0x06] = ide_get_sector(s) >> 0; s->io_buffer[0x13] = 0x00; s->io_buffer[0x18] = 0x00; s->io_buffer[0x19] = 0x00; s->io_buffer[0x1a] = 0x01; ide_transfer_start(s, s->io_buffer, 0x200, ide_transfer_stop); ide_set_irq(s->bus); break; case CFA_ACCESS_METADATA_STORAGE: switch (s->feature) { case 0x02: ide_cfata_metadata_inquiry(s); break; case 0x03: ide_cfata_metadata_read(s); break; case 0x04: ide_cfata_metadata_write(s); break; default: goto abort_cmd; } ide_transfer_start(s, s->io_buffer, 0x200, ide_transfer_stop); s->status = 0x00; ide_set_irq(s->bus); break; case IBM_SENSE_CONDITION: switch (s->feature) { case 0x01: s->nsector = 0x50; break; default: goto abort_cmd; } s->status = READY_STAT | SEEK_STAT; ide_set_irq(s->bus); break; case WIN_SMART: if (s->hcyl != 0xc2 || s->lcyl != 0x4f) goto abort_cmd; if (!s->smart_enabled && s->feature != SMART_ENABLE) goto abort_cmd; switch (s->feature) { case SMART_DISABLE: s->smart_enabled = 0; s->status = READY_STAT | SEEK_STAT; ide_set_irq(s->bus); break; case SMART_ENABLE: s->smart_enabled = 1; s->status = READY_STAT | SEEK_STAT; ide_set_irq(s->bus); break; case SMART_ATTR_AUTOSAVE: switch (s->sector) { case 0x00: s->smart_autosave = 0; break; case 0xf1: s->smart_autosave = 1; break; default: goto abort_cmd; } s->status = READY_STAT | SEEK_STAT; ide_set_irq(s->bus); break; case SMART_STATUS: if (!s->smart_errors) { s->hcyl = 0xc2; s->lcyl = 0x4f; } else { s->hcyl = 0x2c; s->lcyl = 0xf4; } s->status = READY_STAT | SEEK_STAT; ide_set_irq(s->bus); break; case SMART_READ_THRESH: memset(s->io_buffer, 0, 0x200); s->io_buffer[0] = 0x01; for (n = 0; n < ARRAY_SIZE(smart_attributes); n++) { s->io_buffer[2+0+(n*12)] = smart_attributes[n][0]; s->io_buffer[2+1+(n*12)] = smart_attributes[n][11]; } for (n=0; n<511; n++) s->io_buffer[511] += s->io_buffer[n]; s->io_buffer[511] = 0x100 - s->io_buffer[511]; s->status = READY_STAT | SEEK_STAT; ide_transfer_start(s, s->io_buffer, 0x200, ide_transfer_stop); ide_set_irq(s->bus); break; case SMART_READ_DATA: memset(s->io_buffer, 0, 0x200); s->io_buffer[0] = 0x01; for (n = 0; n < ARRAY_SIZE(smart_attributes); n++) { int i; for(i = 0; i < 11; i++) { s->io_buffer[2+i+(n*12)] = smart_attributes[n][i]; } } s->io_buffer[362] = 0x02 | (s->smart_autosave?0x80:0x00); if (s->smart_selftest_count == 0) { s->io_buffer[363] = 0; } else { s->io_buffer[363] = s->smart_selftest_data[3 + (s->smart_selftest_count - 1) * 24]; } s->io_buffer[364] = 0x20; s->io_buffer[365] = 0x01; s->io_buffer[367] = (1<<4 | 1<<3 | 1); s->io_buffer[368] = 0x03; s->io_buffer[369] = 0x00; s->io_buffer[370] = 0x01; s->io_buffer[372] = 0x02; s->io_buffer[373] = 0x36; s->io_buffer[374] = 0x01; for (n=0; n<511; n++) s->io_buffer[511] += s->io_buffer[n]; s->io_buffer[511] = 0x100 - s->io_buffer[511]; s->status = READY_STAT | SEEK_STAT; ide_transfer_start(s, s->io_buffer, 0x200, ide_transfer_stop); ide_set_irq(s->bus); break; case SMART_READ_LOG: switch (s->sector) { case 0x01: memset(s->io_buffer, 0, 0x200); s->io_buffer[0] = 0x01; s->io_buffer[1] = 0x00; s->io_buffer[452] = s->smart_errors & 0xff; s->io_buffer[453] = (s->smart_errors & 0xff00) >> 8; for (n=0; n<511; n++) s->io_buffer[511] += s->io_buffer[n]; s->io_buffer[511] = 0x100 - s->io_buffer[511]; break; case 0x06: memset(s->io_buffer, 0, 0x200); s->io_buffer[0] = 0x01; if (s->smart_selftest_count == 0) { s->io_buffer[508] = 0; } else { s->io_buffer[508] = s->smart_selftest_count; for (n=2; n<506; n++) s->io_buffer[n] = s->smart_selftest_data[n]; } for (n=0; n<511; n++) s->io_buffer[511] += s->io_buffer[n]; s->io_buffer[511] = 0x100 - s->io_buffer[511]; break; default: goto abort_cmd; } s->status = READY_STAT | SEEK_STAT; ide_transfer_start(s, s->io_buffer, 0x200, ide_transfer_stop); ide_set_irq(s->bus); break; case SMART_EXECUTE_OFFLINE: switch (s->sector) { case 0: case 1: case 2: s->smart_selftest_count++; if(s->smart_selftest_count > 21) s->smart_selftest_count = 0; n = 2 + (s->smart_selftest_count - 1) * 24; s->smart_selftest_data[n] = s->sector; s->smart_selftest_data[n+1] = 0x00; s->smart_selftest_data[n+2] = 0x34; s->smart_selftest_data[n+3] = 0x12; s->status = READY_STAT | SEEK_STAT; ide_set_irq(s->bus); break; default: goto abort_cmd; } break; default: goto abort_cmd; } break; default: abort_cmd: ide_abort_command(s); ide_set_irq(s->bus); break; } }
1threat
const char *postproc_configuration(void) { return FFMPEG_CONFIGURATION; }
1threat
How to make this Java code formatter more beautiful : <p>I'm learning programming skill from Robert C.Martin《Clean code》.When I read the content about code format,I confused. So I write below code.Can tell me which is good? Or is there any more good way.Thanks for all.</p> <p><strong>version one</strong></p> <pre class="lang-java prettyprint-override"><code> public void insert(Integer userId, MemberCardRecord oldCard, MemberCardRecord newCard) { String operate = "Admin option"; CardUpgradeRecordBuilder builder = CardUpgradeRecordBuilder.create(db().newRecord(CARD_UPGRADE)); CardUpgradeRecord record = builder.userId(userId).oldCardId(oldCard.getId()).newCardId(newCard.getId()) .oldGrade(oldCard.getGrade()).newGrade(newCard.getGrade()).oldCardName(oldCard.getCardName()) .newCardName(newCard.getCardName()).gradeCondition(newCard.getGradeCondition()).operate(operate) .build(); record.insert(); } </code></pre> <p><strong>version two</strong></p> <pre class="lang-java prettyprint-override"><code>public void insert(Integer userId,MemberCardRecord oldCard, MemberCardRecord newCard) { String operate = "Admin option"; CardUpgradeRecordBuilder builder = CardUpgradeRecordBuilder.create(db().newRecord(CARD_UPGRADE)); CardUpgradeRecord record = builder.userId(userId) .oldCardId(oldCard.getId()) .newCardId(newCard.getId()) .oldGrade(oldCard.getGrade()) .newGrade(newCard.getGrade()) .oldCardName(oldCard.getCardName()) .newCardName(newCard.getCardName()) .gradeCondition(newCard.getGradeCondition()) .operate(operate) .build(); record.insert(); } </code></pre>
0debug
Why is the Linq-to-Objects sum of a sequence of nullables itself nullable? : <p>As usual, <code>int?</code> means <code>System.Nullable&lt;int&gt;</code> (or <code>System.Nullable`1[System.Int32]</code>).</p> <p>Suppose you have an in-memory <code>IEnumerable&lt;int?&gt;</code> (such as a <code>List&lt;int?&gt;</code> for example), let us call it <code>seq</code>; then you can find its sum with:</p> <pre><code>var seqSum = seq.Sum(); </code></pre> <p>Of course this goes to the extension method overload <a href="https://msdn.microsoft.com/en-us/library/bb156065.aspx" rel="noreferrer"><code>int? IEnumerable&lt;int?&gt;.Sum()</code> (documentation)</a> which is really a static method on <code>System.Linq.Enumerable</code>.</p> <p>However, the method never returns <code>null</code>, <strong>so why is the return type declared as <code>Nullable&lt;&gt;</code>?</strong> Even in cases where <code>seq</code> is an empty collection or more generally a collection all of whose elements are the <code>null</code> value of type <code>int?</code>, the <code>Sum</code> method in question still returns zero, not <code>null</code>.</p> <p>This is evident from the documentation, but also from the System.Core.dll source code:</p> <pre><code>public static int? Sum(this IEnumerable&lt;int?&gt; source) { if (source == null) throw Error.ArgumentNull("source"); int sum = 0; checked { foreach (int? v in source) { if (v != null) sum += v.GetValueOrDefault(); } } return sum; } </code></pre> <p>Note that there is only one <code>return</code> statement and its <em>expression</em> <code>sum</code> has type <code>int</code> (which will then implicitly be converted to <code>int?</code> by a wrapping).</p> <p>It seems wasteful to always wrap the return value. (The caller could always do the wrapping implicitly on his side if desired.)</p> <p>Besides, this return type may lead the caller into writing code such as <code>if (!seqSum.HasValue) { /* logic to handle this */ }</code> which will in reality be unreachable (a fact which the C# compiler cannot know of).</p> <p><strong>So why is this return parameter not simply declared as <code>int</code> with no nullable?</strong></p> <p>I wonder if there is any benefit of having the same return type as <a href="https://msdn.microsoft.com/en-us/library/bb339977.aspx" rel="noreferrer"><code>int? IQueryable&lt;int?&gt;.Sum()</code></a> (in <code>System.Linq.Queryable</code> class). This latter method may return <code>null</code> in practice if there are LINQ providers (maybe LINQ to SQL?) that implement it so.</p>
0debug
static inline int hpel_motion_lowres(MpegEncContext *s, uint8_t *dest, uint8_t *src, int field_based, int field_select, int src_x, int src_y, int width, int height, int stride, int h_edge_pos, int v_edge_pos, int w, int h, h264_chroma_mc_func *pix_op, int motion_x, int motion_y) { const int lowres = s->avctx->lowres; const int op_index = FFMIN(lowres, 3); const int s_mask = (2 << lowres) - 1; int emu = 0; int sx, sy; if (s->quarter_sample) { motion_x /= 2; motion_y /= 2; } sx = motion_x & s_mask; sy = motion_y & s_mask; src_x += motion_x >> lowres + 1; src_y += motion_y >> lowres + 1; src += src_y * stride + src_x; if ((unsigned)src_x > FFMAX( h_edge_pos - (!!sx) - w, 0) || (unsigned)src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) { s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w + 1, (h + 1) << field_based, src_x, src_y << field_based, h_edge_pos, v_edge_pos); src = s->edge_emu_buffer; emu = 1; } sx = (sx << 2) >> lowres; sy = (sy << 2) >> lowres; if (field_select) src += s->linesize; pix_op[op_index](dest, src, stride, h, sx, sy); return emu; }
1threat
static inline void tcg_out_brcond(TCGContext *s, TCGCond cond, TCGReg arg1, TCGReg arg2, int label_index, int cmp4) { TCGLabel *l = &s->labels[label_index]; uint64_t imm; if (l->has_value) { imm = l->u.value_ptr - s->code_ptr; } else { imm = get_reloc_pcrel21b_slot2(s->code_ptr); tcg_out_reloc(s, s->code_ptr, R_IA64_PCREL21B, label_index, 0); } tcg_out_bundle(s, miB, INSN_NOP_M, tcg_opc_cmp_a(TCG_REG_P0, cond, arg1, arg2, cmp4), tcg_opc_b1(TCG_REG_P6, OPC_BR_DPTK_FEW_B1, imm)); }
1threat
How to Type Cast null as Bool in C#? : <p>I'm having one null-able bool (<code>bool?</code>) variable, it holds a value null. One more variable of type pure <code>bool</code>, I tried to convert the null-able bool to bool. But I faced an error "<strong>Nullable object must have a value.</strong>"</p> <p>My C# Code is </p> <pre><code>bool? x = (bool?) null; bool y = (bool)x; </code></pre>
0debug
void vp78_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *curframe, VP8Frame *prev_frame, int is_vp7) { VP8Context *s = avctx->priv_data; int mb_x, mb_y; s->mv_min.y = -MARGIN; s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN; for (mb_y = 0; mb_y < s->mb_height; mb_y++) { VP8Macroblock *mb = s->macroblocks_base + ((s->mb_width + 1) * (mb_y + 1) + 1); int mb_xy = mb_y * s->mb_width; AV_WN32A(s->intra4x4_pred_mode_left, DC_PRED * 0x01010101); s->mv_min.x = -MARGIN; s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN; for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) { if (mb_y == 0) AV_WN32A((mb - s->mb_width - 1)->intra4x4_pred_mode_top, DC_PRED * 0x01010101); decode_mb_mode(s, mb, mb_x, mb_y, curframe->seg_map->data + mb_xy, prev_frame && prev_frame->seg_map ? prev_frame->seg_map->data + mb_xy : NULL, 1, is_vp7); s->mv_min.x -= 64; s->mv_max.x -= 64; } s->mv_min.y -= 64; s->mv_max.y -= 64; } }
1threat
How to choose between Azure data lake analytics and Azure Databricks : <p>Azure data lake analytics and azure databricks both can be used for batch processing. Could anyone please help me understand when to choose one over another?</p>
0debug
def is_octagonal(n): return 3 * n * n - 2 * n
0debug
.class Expected error in java : <p>I get only two errors of .class expected <a href="https://i.stack.imgur.com/2RcQt.jpg" rel="nofollow noreferrer">I am getting this error in my program</a></p> <pre><code>String[] email= {"Sarangmemon8","Alimutaba626","Kali_denali"}; String[] pass= {"Sarang","Mujtaba","Kali"}; System.out.println("What is your name?"); String name = input.nextLine(); System.out.println("Hello! "+name +"Would you like to Login? y/n"); String ans = input.nextLine(); if(ans=="y"){ System.out.println("Enter your Email: "); String username = input.nextLine(email[0][1][2]); System.out.println("Enter your Password: "); String password = input.nextLine(pass[0][1][2]); if(username == email[]) { if (password == pass[]) { System.out.println("Hello Mr. " +name); } else System.out.println("Wrong password"); </code></pre>
0debug
static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb, int channel, int *last) { int t, t2; int sign, base, add, ret; WvChannel *c = &ctx->ch[channel]; *last = 0; if ((ctx->ch[0].median[0] < 2U) && (ctx->ch[1].median[0] < 2U) && !ctx->zero && !ctx->one) { if (ctx->zeroes) { ctx->zeroes--; if (ctx->zeroes) { c->slow_level -= LEVEL_DECAY(c->slow_level); return 0; } else { t = get_unary_0_33(gb); if (t >= 2) { if (get_bits_left(gb) < t - 1) t = get_bits(gb, t - 1) | (1 << (t-1)); } else { if (get_bits_left(gb) < 0) ctx->zeroes = t; if (ctx->zeroes) { memset(ctx->ch[0].median, 0, sizeof(ctx->ch[0].median)); memset(ctx->ch[1].median, 0, sizeof(ctx->ch[1].median)); c->slow_level -= LEVEL_DECAY(c->slow_level); return 0; if (ctx->zero) { t = 0; ctx->zero = 0; } else { t = get_unary_0_33(gb); if (get_bits_left(gb) < 0) if (t == 16) { t2 = get_unary_0_33(gb); if (t2 < 2) { if (get_bits_left(gb) < 0) t += t2; } else { if (get_bits_left(gb) < t2 - 1) t += get_bits(gb, t2 - 1) | (1 << (t2 - 1)); if (ctx->one) { ctx->one = t & 1; t = (t >> 1) + 1; } else { ctx->one = t & 1; t >>= 1; ctx->zero = !ctx->one; if (ctx->hybrid && !channel) update_error_limit(ctx); if (!t) { base = 0; add = GET_MED(0) - 1; DEC_MED(0); } else if (t == 1) { base = GET_MED(0); add = GET_MED(1) - 1; INC_MED(0); DEC_MED(1); } else if (t == 2) { base = GET_MED(0) + GET_MED(1); add = GET_MED(2) - 1; INC_MED(0); INC_MED(1); DEC_MED(2); } else { base = GET_MED(0) + GET_MED(1) + GET_MED(2) * (t - 2); add = GET_MED(2) - 1; INC_MED(0); INC_MED(1); INC_MED(2); if (!c->error_limit) { ret = base + get_tail(gb, add); if (get_bits_left(gb) <= 0) } else { int mid = (base * 2 + add + 1) >> 1; while (add > c->error_limit) { if (get_bits_left(gb) <= 0) if (get_bits1(gb)) { add -= (mid - base); base = mid; } else add = mid - base - 1; mid = (base * 2 + add + 1) >> 1; ret = mid; sign = get_bits1(gb); if (ctx->hybrid_bitrate) c->slow_level += wp_log2(ret) - LEVEL_DECAY(c->slow_level); return sign ? ~ret : ret; error: *last = 1; return 0;
1threat
How to deploy a project made in PHP with MVC structure in Google APP Engine? : I hope you can help me, I have the following problem: I am uploading my PHP project with MVC structure to Google App Engine, when I deploy everything is fine, but when I show it in the browser, I do not send, inspect the console and mark me css file errors. One of the mistakes I usually get is this: Resource interpreted as Stylesheet but transferred with MIME type text / javascript My structure of my project is as follows: [enter image description here][1] and the structure the app.yaml file is as follow: [enter image description here][2] [1]: https://i.stack.imgur.com/VJGd8.png [2]: https://i.stack.imgur.com/IgfrL.png
0debug
void error_propagate(Error **dst_err, Error *local_err) { if (dst_err) { *dst_err = local_err; } else if (local_err) { error_free(local_err); } }
1threat
static int pte_check_hash32(struct mmu_ctx_hash32 *ctx, target_ulong pte0, target_ulong pte1, int h, int rwx) { target_ulong mmask; int access, ret, pp; ret = -1; if ((pte0 & HPTE32_V_VALID) && (h == !!(pte0 & HPTE32_V_SECONDARY))) { mmask = PTE_CHECK_MASK; pp = pte1 & HPTE32_R_PP; if (HPTE32_V_COMPARE(pte0, ctx->ptem)) { if (ctx->raddr != (hwaddr)-1ULL) { if ((ctx->raddr & mmask) != (pte1 & mmask)) { qemu_log("Bad RPN/WIMG/PP\n"); return -3; } } access = ppc_hash32_pp_check(ctx->key, pp, ctx->nx); ctx->raddr = pte1; ctx->prot = access; ret = ppc_hash32_check_prot(ctx->prot, rwx); if (ret == 0) { LOG_MMU("PTE access granted !\n"); } else { LOG_MMU("PTE access rejected\n"); } } } return ret; }
1threat
Data is not enter in database using php : <p>I want to insert data into the database.but when i click on save button than data did not go in database.i did not understand where i did mistake. This is my php code:</p> <pre><code> &lt;?php $host = "localhost"; $user = "root"; $password =""; $database = "crud"; $conn = new mysqli($host, $user, $password); mysql_select_db($database); if(isset($_POST['btn-save'])) { $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $city_name = $_POST['city_name']; $sql_query ="INSERT INTO users(first_name,last_name,user_city) VALUES('$first_name','$last_name','$city_name')"; mysql_query($sql_query); } ?&gt; </code></pre>
0debug
How do i generate a random number in c++ between 1 and 16? : <p>I don't know how to generate a random number between 1 and 16 in c++, i only know the <code>int random = rand() % 100</code> method to generate a number between 0-99. can someone help me out please?</p>
0debug
static void h264_h_loop_filter_chroma_intra_c(uint8_t *pix, int stride, int alpha, int beta) { h264_loop_filter_chroma_intra_c(pix, 1, stride, alpha, beta); }
1threat
Does dictionaries add another one in a random order? : <p><a href="https://i.stack.imgur.com/IJ6eK.jpg" rel="nofollow noreferrer">enter image description here</a></p> <p>Please find the above program that I have used as an example to demonstrate what happened when I tried to update one dictionary with another.</p>
0debug
How to reverse value of string array? : <p>Let's say I have this array :</p> <pre><code>fruits: string[] = ['banana', 'strawberry', 'kiwi', 'apple']; </code></pre> <p>How can I do to have :</p> <pre><code>fruits = ['ananab', 'yrrebwarts', 'iwki', 'elppa']; </code></pre>
0debug
Export HTML to PDF always align at the bottom of a new page : <p>I am having a problem with export html to PDF. I would like section at the bottom to be always aligned at the bottom of a new page.</p> <p>Right now this section (when it comes to page break) is aligned at the top of a new page:</p> <p><a href="https://i.stack.imgur.com/N1ohj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/N1ohj.png" alt="enter image description here"></a></p> <p>Code for that section:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div style='page-break-inside:avoid;vertical-align:bottom;'&gt; &lt;font face="Verdana" &gt; &lt;br&gt; &lt;table cellspacing="0" cellpadding="0" style="width:900px;"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td style="width:500px"&gt; BLAGO DOSTAVIL:&amp;nbsp;______________________&lt;br/&gt;&lt;br/&gt; Podpis&lt;br/&gt;&lt;br/&gt; Datum:&amp;nbsp;______________________ &lt;/td&gt; &lt;td&gt; BLAGO PREVZEL:&amp;nbsp;______________________&lt;br/&gt;&lt;br/&gt; Podpis&lt;br/&gt;&lt;br/&gt; Datum:&amp;nbsp;______________________ &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/font&gt; &lt;font face="Verdana" size="1" &gt; &lt;br /&gt;&lt;br /&gt; &lt;table cellspacing="0" cellpadding="0" style="width:900px;"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td style="text-align:center"&gt; &lt;i&gt; testting d.o.o., testing, ID za DDV: testing, matična št.: testing &lt;br&gt; tel: +386 XXXXXXXXXX, fax: +386 1 XXXXXXXXX, e-mail: info@XXXX.si, web: www.xxxxxxx.si &lt;br&gt; Družba je vpisana pri okrožnem sodišču v Ljubljani, št. vpisa v registru: 1/XXXXX/00, ustanovni kapital: XX.000 EUR &lt;br&gt; Račun odprt pri NLB d.d., Iban: SIXXXXXXX, SWIFT-BIC: LJBASI2X &lt;/i&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/font&gt; &lt;/div&gt;</code></pre> </div> </div> </p> <p>Here is my code for the whole page (including section at the bottom which jumps into new page at page break):</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;style&gt;#tblArticles{font-size: 12px !important; font-family: verdana, sans-serif; border-collapse: collapse; width: 100%;} #tblArticles td{border: 1px solid black;text-align: center;padding: 8px;} #tblArticles th {border: 1px solid black;text-align: center;padding: 8px;background-color: #dddddd;} &lt;/style&gt; &lt;style&gt;#tblLeft{position:absolute;left:0; font-size: 10px !important; font-family: verdana, sans-serif;border-collapse:collapse; width:40%;} #tblLeft td{font-size: 10px !important; border: 1px solid black;text-align: center;padding: 8px;} #tblLeft th {font-size: 10px !important; border: 1px solid black;text-align: center;padding: 8px;background-color: #dddddd;}&lt;/style&gt; &lt;style&gt;#tblRight{position:absolute;right:0; font-size: 10px !important; font-family: verdana, sans-serif;border-collapse:collapse; width:20%;} #tblRight td{font-size: 10px !important; text-align: center;padding: 8px;}&lt;/style&gt; &lt;table id='tblArticles'&gt; &lt;thead&gt; &lt;th&gt;Vrsta blaga/storitve&lt;/th&gt; &lt;th&gt;Interna številka&lt;/th&gt; &lt;th&gt;Prodana koda&lt;/th&gt; &lt;th&gt;Količina&lt;/th&gt; &lt;th&gt;EnM&lt;/th&gt; &lt;th&gt;Cena brez DDV&lt;/th&gt; &lt;th&gt;Vrednost brez DDV&lt;/th&gt; &lt;th&gt;DDV&lt;/th&gt; &lt;th&gt;Znesek DDV&lt;/th&gt; &lt;th&gt;Vrednost z DDV&lt;/th&gt; &lt;/thead&gt; &lt;tfoot&gt; &lt;tr style='visibility:hidden;'&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style='visibility:hidden;'&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style='visibility:hidden;'&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/tfoot&gt; &lt;tbody style='page-break-inside:avoid;'&gt; &lt;tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'&gt; &lt;td rowspan='1' style='page-break-inside:avoid;'&gt;&lt;label&gt;Večerja na zajli&lt;/label&gt;&lt;/td&gt; &lt;td style=''&gt; &lt;img src=http://localhost:53358/resources/Images/EAN128/VzlSSlNYVlo=.jpg&gt;&lt;br/&gt; &lt;label&gt;VzlSSlNYVlo=&lt;/label&gt;&lt;br/&gt; &lt;/td&gt; &lt;td style=''&gt;&lt;input type='checkbox'&gt;&lt;br/&gt;&lt;label&gt;&lt;/label&gt;&lt;br/&gt;&lt;/td&gt; &lt;td style='overflow: hidden; white-space: nowrap;' rowspan='1'&gt;1,00&lt;/td&gt; &lt;td style='overflow: hidden; white-space: nowrap;' rowspan='1'&gt;KOM&lt;/td&gt; &lt;td style='overflow: hidden; white-space: nowrap;' rowspan='1'&gt;91,14 €&lt;/td&gt; &lt;td style='overflow: hidden; white-space: nowrap;' rowspan='1'&gt;91,14 €&lt;/td&gt; &lt;td style='overflow: hidden; white-space: nowrap;' rowspan='1'&gt;9,50 %&lt;/td&gt; &lt;td style='overflow: hidden; white-space: nowrap;' rowspan='1'&gt;8,66 €&lt;/td&gt; &lt;td style='overflow: hidden; white-space: nowrap;' rowspan='1'&gt;99,80 €&lt;/td&gt; &lt;/tr&gt; &lt;tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'&gt; &lt;td rowspan='7' style='page-break-inside:avoid;'&gt;&lt;label&gt;Veliki kuharski mojster&lt;/label&gt;&lt;/td&gt; &lt;td style='border-bottom-style:hidden;'&gt; &lt;img src=http://localhost:53358/resources/Images/EAN128/TDZKVzRDVks=.jpg&gt;&lt;br/&gt; &lt;label&gt;TDZKVzRDVks=&lt;/label&gt;&lt;br/&gt; &lt;/td&gt; &lt;td style='border-bottom-style:hidden;'&gt;&lt;input type='checkbox'&gt;&lt;br/&gt;&lt;label&gt;&lt;/label&gt;&lt;br/&gt;&lt;/td&gt; &lt;td style='overflow: hidden; white-space: nowrap;' rowspan='7'&gt;7,00&lt;/td&gt; &lt;td style='overflow: hidden; white-space: nowrap;' rowspan='7'&gt;KOM&lt;/td&gt; &lt;td style='overflow: hidden; white-space: nowrap;' rowspan='7'&gt;65,69 €&lt;/td&gt; &lt;td style='overflow: hidden; white-space: nowrap;' rowspan='7'&gt;459,83 €&lt;/td&gt; &lt;td style='overflow: hidden; white-space: nowrap;' rowspan='7'&gt;22,00 %&lt;/td&gt; &lt;td style='overflow: hidden; white-space: nowrap;' rowspan='7'&gt;101,16 €&lt;/td&gt; &lt;td style='overflow: hidden; white-space: nowrap;' rowspan='7'&gt;560,99 €&lt;/td&gt; &lt;/tr&gt; &lt;tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'&gt; &lt;td style='border-bottom-style:hidden;'&gt; &lt;img src=http://localhost:53358/resources/Images/EAN128/Q0U2RURCVks=.jpg&gt;&lt;br/&gt; &lt;label&gt;Q0U2RURCVks=&lt;/label&gt;&lt;br/&gt; &lt;/td&gt; &lt;td style='border-bottom-style:hidden;'&gt;&lt;input type='checkbox'&gt;&lt;br/&gt;&lt;label&gt;&lt;/label&gt;&lt;br/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'&gt; &lt;td style='border-bottom-style:hidden;'&gt; &lt;img src=http://localhost:53358/resources/Images/EAN128/RFg0TVZXVks=.jpg&gt;&lt;br/&gt; &lt;label&gt;RFg0TVZXVks=&lt;/label&gt;&lt;br/&gt; &lt;/td&gt; &lt;td style='border-bottom-style:hidden;'&gt;&lt;input type='checkbox'&gt;&lt;br/&gt;&lt;label&gt;&lt;/label&gt;&lt;br/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'&gt; &lt;td style='border-bottom-style:hidden;'&gt; &lt;img src=http://localhost:53358/resources/Images/EAN128/OFdGRTJLVks=.jpg&gt;&lt;br/&gt; &lt;label&gt;OFdGRTJLVks=&lt;/label&gt;&lt;br/&gt; &lt;/td&gt; &lt;td style='border-bottom-style:hidden;'&gt;&lt;input type='checkbox'&gt;&lt;br/&gt;&lt;label&gt;&lt;/label&gt;&lt;br/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'&gt; &lt;td style='border-bottom-style:hidden;'&gt; &lt;img src=http://localhost:53358/resources/Images/EAN128/QlROR0NMVks=.jpg&gt;&lt;br/&gt; &lt;label&gt;QlROR0NMVks=&lt;/label&gt;&lt;br/&gt; &lt;/td&gt; &lt;td style='border-bottom-style:hidden;'&gt;&lt;input type='checkbox'&gt;&lt;br/&gt;&lt;label&gt;&lt;/label&gt;&lt;br/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'&gt; &lt;td style='border-bottom-style:hidden;'&gt; &lt;img src=http://localhost:53358/resources/Images/EAN128/SjNYWkJOVks=.jpg&gt;&lt;br/&gt; &lt;label&gt;SjNYWkJOVks=&lt;/label&gt;&lt;br/&gt; &lt;/td&gt; &lt;td style='border-bottom-style:hidden;'&gt;&lt;input type='checkbox'&gt;&lt;br/&gt;&lt;label&gt;&lt;/label&gt;&lt;br/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'&gt; &lt;td style=''&gt; &lt;img src=http://localhost:53358/resources/Images/EAN128/M0RFWURXVks=.jpg&gt;&lt;br/&gt; &lt;label&gt;M0RFWURXVks=&lt;/label&gt;&lt;br/&gt; &lt;/td&gt; &lt;td style=''&gt;&lt;input type='checkbox'&gt;&lt;br/&gt;&lt;label&gt;&lt;/label&gt;&lt;br/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt;&lt;br/&gt; &lt;div style='page-break-inside:avoid;margin-bottom: 30px;'&gt; &lt;label style='position:relative;left:0;font-size:12px;'&gt;Specifikacija obračunanega davka, dokumenta št.:&lt;/label&gt;&lt;br/&gt; &lt;div id='divBottom' style='position:relative;width:100%;min-height:160px;'&gt; &lt;table id='tblLeft'&gt; &lt;th&gt;Stopnja&lt;/th&gt;&lt;th&gt;Osnova za DDV&lt;/th&gt;&lt;th&gt;Znesek DDV&lt;/th&gt;&lt;th&gt;Vrednost z DDV&lt;/th&gt; &lt;tr&gt; &lt;td&gt;9,5 %&lt;/td&gt;&lt;td&gt;91,14 €&lt;/td&gt;&lt;td&gt;8,66 €&lt;/td&gt;&lt;td&gt;99,80 €&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;22 %&lt;/td&gt;&lt;td&gt;459,83 €&lt;/td&gt;&lt;td&gt;101,16 €&lt;/td&gt;&lt;td&gt;560,99 €&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;table id='tblRight'&gt; &lt;tr style='border-bottom:1px solid black !important;'&gt; &lt;td style='text-align:left;'&gt;&lt;b&gt;Skupaj brez DDV:&lt;/b&gt;&lt;/td&gt;&lt;td style='text-align:right;'&gt;550,97 €&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style='text-align:left;'&gt;&lt;b&gt;Osnova za DDV&lt;/b&gt;&lt;/td&gt;&lt;td style='text-align:right;'&gt;550,97 €&lt;/td&gt; &lt;/tr&gt; &lt;tr style='border-bottom:1px solid black !important;'&gt; &lt;td style='text-align:left;'&gt;&lt;b&gt;DDV:&lt;/b&gt;&lt;/td&gt;&lt;td style='text-align:right;'&gt;109,82 €&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;label style='position:absolute;right:80px;bottom:20px;'&gt;&lt;b&gt;SKUPAJ:&lt;/b&gt;&lt;/label&gt; &lt;label style='position:absolute;right:0;bottom:20px;'&gt;&lt;b&gt;660,79 €&lt;/b&gt;&lt;/label&gt; &lt;/div&gt;&lt;/div&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt; &lt;div style='page-break-inside:avoid;vertical-align:bottom;'&gt; &lt;font face="Verdana" &gt; &lt;br&gt; &lt;table cellspacing="0" cellpadding="0" style="width:900px;"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td style="width:500px"&gt; BLAGO DOSTAVIL:&amp;nbsp;______________________&lt;br/&gt;&lt;br/&gt; Podpis&lt;br/&gt;&lt;br/&gt; Datum:&amp;nbsp;______________________ &lt;/td&gt; &lt;td&gt; BLAGO PREVZEL:&amp;nbsp;______________________&lt;br/&gt;&lt;br/&gt; Podpis&lt;br/&gt;&lt;br/&gt; Datum:&amp;nbsp;______________________ &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/font&gt; &lt;font face="Verdana" size="1" &gt; &lt;br /&gt;&lt;br /&gt; &lt;table cellspacing="0" cellpadding="0" style="width:900px;"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td style="text-align:center"&gt; &lt;i&gt; testting d.o.o., testing, ID za DDV: testing, matična št.: testing &lt;br&gt; tel: +386 XXXXXXXXXX, fax: +386 1 XXXXXXXXX, e-mail: info@XXXX.si, web: www.xxxxxxx.si &lt;br&gt; Družba je vpisana pri okrožnem sodišču v Ljubljani, št. vpisa v registru: 1/XXXXX/00, ustanovni kapital: XX.000 EUR &lt;br&gt; Račun odprt pri NLB d.d., Iban: SIXXXXXXX, SWIFT-BIC: LJBASI2X &lt;/i&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/font&gt; &lt;/div&gt;</code></pre> </div> </div> </p>
0debug
static void set_fifodepth(MSSSpiState *s) { unsigned int size = s->regs[R_SPI_DFSIZE] & FRAMESZ_MASK; if (size <= 8) { s->fifo_depth = 32; } else if (size <= 16) { s->fifo_depth = 16; } else if (size <= 32) { s->fifo_depth = 8; } else { s->fifo_depth = 4; } }
1threat
static CharDriverState *qemu_chr_open_win_path(const char *filename) { CharDriverState *chr; WinCharState *s; chr = qemu_chr_alloc(); s = g_malloc0(sizeof(WinCharState)); chr->opaque = s; chr->chr_write = win_chr_write; chr->chr_close = win_chr_close; if (win_chr_init(chr, filename) < 0) { g_free(s); g_free(chr); return NULL; } return chr; }
1threat
static inline int tcg_target_const_match(tcg_target_long val, const TCGArgConstraint *arg_ct) { int ct; ct = arg_ct->ct; if (ct & TCG_CT_CONST) return 1; else if ((ct & TCG_CT_CONST_S11) && ABS(val) == (ABS(val) & 0x3ff)) return 1; else if ((ct & TCG_CT_CONST_S13) && ABS(val) == (ABS(val) & 0xfff)) return 1; else return 0; }
1threat
Multiply all numbers in a list - Haskell : <p>I'm really new to haskell and would like to multiply all numbers in an array. For example.:</p> <p>Array:</p> <pre><code>[3,2,4] //3*2*4 </code></pre> <p>Output</p> <pre><code>24 </code></pre> <p>Thanks, any help is greatly appreciated. </p>
0debug
static int sch_handle_start_func_passthrough(SubchDev *sch) { PMCW *p = &sch->curr_status.pmcw; SCSW *s = &sch->curr_status.scsw; int ret; ORB *orb = &sch->orb; if (!(s->ctrl & SCSW_ACTL_SUSP)) { assert(orb != NULL); p->intparm = orb->intparm; } if (!(orb->ctrl0 & ORB_CTRL0_MASK_PFCH) || !(orb->ctrl0 & ORB_CTRL0_MASK_C64)) { return -EINVAL; } ret = s390_ccw_cmd_request(orb, s, sch->driver_data); switch (ret) { case 0: break; case -EBUSY: break; case -ENODEV: break; case -EACCES: ret = -ENODEV; break; default: break; }; return ret; }
1threat
static uint32_t arm_v7m_load_vector(ARMCPU *cpu) { CPUState *cs = CPU(cpu); CPUARMState *env = &cpu->env; MemTxResult result; hwaddr vec = env->v7m.vecbase + env->v7m.exception * 4; uint32_t addr; addr = address_space_ldl(cs->as, vec, MEMTXATTRS_UNSPECIFIED, &result); if (result != MEMTX_OK) { cpu_abort(cs, "Failed to read from exception vector table " "entry %08x\n", (unsigned)vec); } return addr; }
1threat
static int openpic_init(SysBusDevice *dev) { OpenPICState *opp = FROM_SYSBUS(typeof (*opp), dev); int i, j; struct memreg list_le[] = { {"glb", &openpic_glb_ops_le, true, OPENPIC_GLB_REG_START, OPENPIC_GLB_REG_SIZE}, {"tmr", &openpic_tmr_ops_le, true, OPENPIC_TMR_REG_START, OPENPIC_TMR_REG_SIZE}, {"msi", &openpic_msi_ops_le, true, OPENPIC_MSI_REG_START, OPENPIC_MSI_REG_SIZE}, {"src", &openpic_src_ops_le, true, OPENPIC_SRC_REG_START, OPENPIC_SRC_REG_SIZE}, {"cpu", &openpic_cpu_ops_le, true, OPENPIC_CPU_REG_START, OPENPIC_CPU_REG_SIZE}, }; struct memreg list_be[] = { {"glb", &openpic_glb_ops_be, true, OPENPIC_GLB_REG_START, OPENPIC_GLB_REG_SIZE}, {"tmr", &openpic_tmr_ops_be, true, OPENPIC_TMR_REG_START, OPENPIC_TMR_REG_SIZE}, {"msi", &openpic_msi_ops_be, true, OPENPIC_MSI_REG_START, OPENPIC_MSI_REG_SIZE}, {"src", &openpic_src_ops_be, true, OPENPIC_SRC_REG_START, OPENPIC_SRC_REG_SIZE}, {"cpu", &openpic_cpu_ops_be, true, OPENPIC_CPU_REG_START, OPENPIC_CPU_REG_SIZE}, }; struct memreg *list; switch (opp->model) { case OPENPIC_MODEL_FSL_MPIC_20: default: opp->flags |= OPENPIC_FLAG_IDE_CRIT; opp->nb_irqs = 80; opp->vid = VID_REVISION_1_2; opp->veni = VENI_GENERIC; opp->vector_mask = 0xFFFF; opp->tifr_reset = 0; opp->ipvp_reset = IPVP_MASK_MASK; opp->ide_reset = 1 << 0; opp->max_irq = FSL_MPIC_20_MAX_IRQ; opp->irq_ipi0 = FSL_MPIC_20_IPI_IRQ; opp->irq_tim0 = FSL_MPIC_20_TMR_IRQ; opp->irq_msi = FSL_MPIC_20_MSI_IRQ; opp->brr1 = FSL_BRR1_IPID | FSL_BRR1_IPMJ | FSL_BRR1_IPMN; msi_supported = true; list = list_be; break; case OPENPIC_MODEL_RAVEN: opp->nb_irqs = RAVEN_MAX_EXT; opp->vid = VID_REVISION_1_3; opp->veni = VENI_GENERIC; opp->vector_mask = 0xFF; opp->tifr_reset = 4160000; opp->ipvp_reset = IPVP_MASK_MASK | IPVP_MODE_MASK; opp->ide_reset = 0; opp->max_irq = RAVEN_MAX_IRQ; opp->irq_ipi0 = RAVEN_IPI_IRQ; opp->irq_tim0 = RAVEN_TMR_IRQ; opp->brr1 = -1; list = list_le; list[2].map = false; if (opp->nb_cpus != 1) { return -EINVAL; } break; } memory_region_init(&opp->mem, "openpic", 0x40000); for (i = 0; i < ARRAY_SIZE(list_le); i++) { if (!list[i].map) { continue; } memory_region_init_io(&opp->sub_io_mem[i], list[i].ops, opp, list[i].name, list[i].size); memory_region_add_subregion(&opp->mem, list[i].start_addr, &opp->sub_io_mem[i]); } for (i = 0; i < opp->nb_cpus; i++) { opp->dst[i].irqs = g_new(qemu_irq, OPENPIC_OUTPUT_NB); for (j = 0; j < OPENPIC_OUTPUT_NB; j++) { sysbus_init_irq(dev, &opp->dst[i].irqs[j]); } } register_savevm(&opp->busdev.qdev, "openpic", 0, 2, openpic_save, openpic_load, opp); sysbus_init_mmio(dev, &opp->mem); qdev_init_gpio_in(&dev->qdev, openpic_set_irq, opp->max_irq); return 0; }
1threat
playercontrols.cs(11,26): error CS1513: ; expected : <p>playercontrols.cs(11,26): error CS 1513: }expected I started making games 2 days ago. Now im making my first game and I have error. I don't know how to solve this problem this is my script:</p> <pre><code>using System.Collections; using System.Collections.Generic; using UnityEngine; public class playercontrols : MonoBehaviour { public Rigidbody2D rb; public Transform groundCheck; public float groundCheckRadius; public LayerMask whatIsGround; private bool onGround; // Start is called before the first frame update void Start(){ rb= GetComponent&lt;Rigidbody2D&gt;(); } // Update is called once per frame void Update(){ rb.velocity = new Vector2(1,rb.velocity.y); onGround = Physics2D.OverlapCircle(groundCheck.position, groundCheckRadius, whatIsGround); if (Input.GetMouseButtonDown(0) &amp;&amp; onGround); { rb.velocity=new Vector2(rb.velocity.x, 3); } } </code></pre>
0debug
alert('Hello ' + user_input);
1threat
JavaScript Function within a function undefined : <p>Can someone explain to me why the second function within the first function is undefined?</p> <pre><code>var a = 1 function abc () { alert(a); function xyz () { alert(a); } } </code></pre> <p><a href="https://jsfiddle.net/kp950/yLs73cth/" rel="nofollow">https://jsfiddle.net/kp950/yLs73cth/</a></p>
0debug
whats wrong with my if statement if x + y = z : I am trying to evaluate if the selected item meats the requirment by using the following code if @weight.nominal + x = required weights << @weight.id end However rather than doing what I would expect which is evaluate the result of nominal + x against required, it is adding nominal + x together. Why is that and how do do what I want? Thanks
0debug
Accessing same-type inactive member in unions : <p>I have something like this:</p> <pre><code>union DataXYZ { struct complex_t { float real, imag; } complex; struct vector_t { float magnitude, phase; } vector; }; </code></pre> <p>I have some vectors of these, being general-purpose workspace memory, where I use the fields accordingly after the semantic context. </p> <p>I know it's undefined behaviour to read a field in a union, when the last active member was another field (and type?). Does this matter when the types and layout match exactly?</p> <p>I've been commenting on some other similar questions, asking for references that guarantee the behaviour, but nothing came up yet - hence this question.</p>
0debug