problem
stringlengths
26
131k
labels
class label
2 classes
I can't stop tracking files in source Tree : <p>I added to my repository files that I don't want to track now. I don't want them to appear in this pending files window but I don't wont to delete them from the project. The problem is that I don't know how to fix it. I tried everything. I even deleted them from repository(but not from the project so they were still on my disk) but after it they appeared in deleted files. It is really annoying. So how to get rid of this <code>/target/</code> files.</p> <p>Warning: Stop tracking option dosen't work! There is no reaction on it. </p> <p><a href="https://i.stack.imgur.com/MHk7q.png" rel="noreferrer"><img src="https://i.stack.imgur.com/MHk7q.png" alt="enter image description here"></a></p>
0debug
void qemu_system_reset(bool report) { MachineClass *mc; mc = current_machine ? MACHINE_GET_CLASS(current_machine) : NULL; cpu_synchronize_all_states(); if (mc && mc->reset) { mc->reset(); } else { qemu_devices_reset(); } if (report) { qapi_event_send_reset(&error_abort); } cpu_synchronize_all_post_reset(); }
1threat
static void sdl_refresh(DisplayState *ds) { SDL_Event ev1, *ev = &ev1; int mod_state; int buttonstate = SDL_GetMouseState(NULL, NULL); if (last_vm_running != vm_running) { last_vm_running = vm_running; sdl_update_caption(); } vga_hw_update(); SDL_EnableUNICODE(!is_graphic_console()); while (SDL_PollEvent(ev)) { switch (ev->type) { case SDL_VIDEOEXPOSE: sdl_update(ds, 0, 0, screen->w, screen->h); break; case SDL_KEYDOWN: case SDL_KEYUP: if (ev->type == SDL_KEYDOWN) { if (!alt_grab) { mod_state = (SDL_GetModState() & gui_grab_code) == gui_grab_code; } else { mod_state = (SDL_GetModState() & (gui_grab_code | KMOD_LSHIFT)) == (gui_grab_code | KMOD_LSHIFT); } gui_key_modifier_pressed = mod_state; if (gui_key_modifier_pressed) { int keycode; keycode = sdl_keyevent_to_keycode(&ev->key); switch(keycode) { case 0x21: toggle_full_screen(ds); gui_keysym = 1; break; case 0x02 ... 0x0a: reset_keys(); console_select(keycode - 0x02); if (!is_graphic_console()) { if (gui_grab) sdl_grab_end(); } gui_keysym = 1; break; default: break; } } else if (!is_graphic_console()) { int keysym; keysym = 0; if (ev->key.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL)) { switch(ev->key.keysym.sym) { case SDLK_UP: keysym = QEMU_KEY_CTRL_UP; break; case SDLK_DOWN: keysym = QEMU_KEY_CTRL_DOWN; break; case SDLK_LEFT: keysym = QEMU_KEY_CTRL_LEFT; break; case SDLK_RIGHT: keysym = QEMU_KEY_CTRL_RIGHT; break; case SDLK_HOME: keysym = QEMU_KEY_CTRL_HOME; break; case SDLK_END: keysym = QEMU_KEY_CTRL_END; break; case SDLK_PAGEUP: keysym = QEMU_KEY_CTRL_PAGEUP; break; case SDLK_PAGEDOWN: keysym = QEMU_KEY_CTRL_PAGEDOWN; break; default: break; } } else { switch(ev->key.keysym.sym) { case SDLK_UP: keysym = QEMU_KEY_UP; break; case SDLK_DOWN: keysym = QEMU_KEY_DOWN; break; case SDLK_LEFT: keysym = QEMU_KEY_LEFT; break; case SDLK_RIGHT: keysym = QEMU_KEY_RIGHT; break; case SDLK_HOME: keysym = QEMU_KEY_HOME; break; case SDLK_END: keysym = QEMU_KEY_END; break; case SDLK_PAGEUP: keysym = QEMU_KEY_PAGEUP; break; case SDLK_PAGEDOWN: keysym = QEMU_KEY_PAGEDOWN; break; case SDLK_BACKSPACE: keysym = QEMU_KEY_BACKSPACE; break; case SDLK_DELETE: keysym = QEMU_KEY_DELETE; break; default: break; } } if (keysym) { kbd_put_keysym(keysym); } else if (ev->key.keysym.unicode != 0) { kbd_put_keysym(ev->key.keysym.unicode); } } } else if (ev->type == SDL_KEYUP) { if (!alt_grab) { mod_state = (ev->key.keysym.mod & gui_grab_code); } else { mod_state = (ev->key.keysym.mod & (gui_grab_code | KMOD_LSHIFT)); } if (!mod_state) { if (gui_key_modifier_pressed) { gui_key_modifier_pressed = 0; if (gui_keysym == 0) { if (!gui_grab) { if (SDL_GetAppState() & SDL_APPACTIVE) sdl_grab_start(); } else { sdl_grab_end(); } reset_keys(); break; } gui_keysym = 0; } } } if (is_graphic_console() && !gui_keysym) sdl_process_key(&ev->key); break; case SDL_QUIT: if (!no_quit) { qemu_system_shutdown_request(); vm_start(); } break; case SDL_MOUSEMOTION: if (gui_grab || kbd_mouse_is_absolute() || absolute_enabled) { sdl_send_mouse_event(ev->motion.xrel, ev->motion.yrel, 0, ev->motion.x, ev->motion.y, ev->motion.state); } break; case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: { SDL_MouseButtonEvent *bev = &ev->button; if (!gui_grab && !kbd_mouse_is_absolute()) { if (ev->type == SDL_MOUSEBUTTONDOWN && (bev->button == SDL_BUTTON_LEFT)) { sdl_grab_start(); } } else { int dz; dz = 0; if (ev->type == SDL_MOUSEBUTTONDOWN) { buttonstate |= SDL_BUTTON(bev->button); } else { buttonstate &= ~SDL_BUTTON(bev->button); } #ifdef SDL_BUTTON_WHEELUP if (bev->button == SDL_BUTTON_WHEELUP && ev->type == SDL_MOUSEBUTTONDOWN) { dz = -1; } else if (bev->button == SDL_BUTTON_WHEELDOWN && ev->type == SDL_MOUSEBUTTONDOWN) { dz = 1; } #endif sdl_send_mouse_event(0, 0, dz, bev->x, bev->y, buttonstate); } } break; case SDL_ACTIVEEVENT: if (gui_grab && ev->active.state == SDL_APPINPUTFOCUS && !ev->active.gain && !gui_fullscreen_initial_grab) { sdl_grab_end(); } if (ev->active.state & SDL_APPACTIVE) { if (ev->active.gain) { ds->gui_timer_interval = 0; } else { ds->gui_timer_interval = 500; } } break; default: break; } } }
1threat
remove the timezone from a date-Javascript : Before asking this question on this thread I checked out the below source https://stackoverflow.com/questions/30535691/remove-the-local-timezone-from-a-date-in-javascript but my case I'm not getting the date in milliseconds when I do: new Date("2018-09-17 14:02:09 +0530 IST") // this is the date format I get as response from server. I;m not sure why `new Date("2018-09-17 14:02:09")` results into Invalid date. Hence I cannot use the `toLocaleString()` on the date. I know there can be ways using the split or regex, but they I feel get too restricted to a certain usecase. Is there a way I can convert `"2018-09-17 14:02:09 +0530 IST"` into `"2018-09-17 14:02:09"` or simply it could result into a readable date? appreciate any help!
0debug
I want to show a data in my website which is form other website : <p>I am very new to this code world but I am really interested. Now I'm having a problem.</p> <p>My Problems begins here-</p> <p>This is an example. Imagine that I need a data form this website [Picture below]</p> <p><a href="http://i.stack.imgur.com/h7trS.png" rel="nofollow">The Data I want form the website</a></p> <p>You saw that there is <strong>Total Clicks: #Number#</strong></p> <p>Now I want this <strong>Total Click: #Number#</strong> in my <strong>index.html</strong> which is located in my computer. Like this below [See Picture]</p> <p><a href="http://i.stack.imgur.com/JEuXJ.png" rel="nofollow">What I really want</a></p> <p>Please tell me is it possible. If yes please tell me the code should I use in it.</p> <p>Thank you very much..</p>
0debug
To display only one user queries in MYsQl : I have MySQL user called as **test**, **show processlist will give all queries running on MySQL host but i don't want all. i want only quires which test user running. how could i find out only test quires?
0debug
Getting library "libjsc.so" not found after upgrading React Native to 0.60-RC2 : <p>I have updated React Native to 0.60-RC2, migrated to AndroidX using the Android Studio refractor and used the jetifier mentioned here: <a href="https://github.com/react-native-community/discussions-and-proposals/issues/129" rel="noreferrer">https://github.com/react-native-community/discussions-and-proposals/issues/129</a></p> <p>After doing this, I get the error <code>library "libjsc.so" not found</code> when running <code>react-native run-android</code>. i get the same error when running a release APK.</p> <p>The stacktrace is:</p> <pre><code>06-24 15:55:01.823 8579 8656 E SoLoader: Error when loading lib: dlopen failed: library "libjsc.so" not found lib hash: 83f1717c1dc187d9f252a9f1fc66d430 search path is /data/app/com.jtv.testapp-4hvCKbqEmbyyOPykuQhm4Q==/lib/arm 06-24 15:55:01.823 8579 8656 E SoLoader: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found 06-24 15:55:01.825 8579 8656 E AndroidRuntime: FATAL EXCEPTION: create_react_context 06-24 15:55:01.825 8579 8656 E AndroidRuntime: Process: com.jtv.testapp, PID: 8579 06-24 15:55:01.825 8579 8656 E AndroidRuntime: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found 06-24 15:55:01.825 8579 8656 E AndroidRuntime: at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:738) 06-24 15:55:01.825 8579 8656 E AndroidRuntime: at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:591) 06-24 15:55:01.825 8579 8656 E AndroidRuntime: at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:529) 06-24 15:55:01.825 8579 8656 E AndroidRuntime: at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:484) 06-24 15:55:01.825 8579 8656 E AndroidRuntime: at com.facebook.react.jscexecutor.JSCExecutor.&lt;clinit&gt;(JSCExecutor.java:19) 06-24 15:55:01.825 8579 8656 E AndroidRuntime: at com.facebook.react.jscexecutor.JSCExecutorFactory.create(JSCExecutorFactory.java:29) 06-24 15:55:01.825 8579 8656 E AndroidRuntime: at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:949) 06-24 15:55:01.825 8579 8656 E AndroidRuntime: at java.lang.Thread.run(Thread.java:764) </code></pre> <p>My <code>package.json</code> is: </p> <pre><code>{ "name": "TestApp", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "test": "jest" }, "dependencies": { "@react-native-community/async-storage": "^1.2.0", "@react-native-community/blur": "^3.3.1", "@react-native-community/netinfo": "^1.2.3", "@react-native-community/slider": "^1.0.4", "axios": "^0.18.0", "jetifier": "^1.4.0", "native-base": "^2.10.0", "prop-types": "^15.6.2", "qs": "^6.6.0", "react": "^16.8.6", "react-native": "^0.60.0-rc.2", "react-native-appsee": "^2.6.21", "react-native-device-info": "^0.24.3", "react-native-dialog": "^5.5.0", "react-native-draggable-flatlist": "^1.1.7", "react-native-elements": "^0.19.1", "react-native-email": "^1.0.2", "react-native-fast-image": "^5.1.2", "react-native-gesture-handler": "^1.0.12", "react-native-iap": "^2.4.0", "react-native-image-picker": "^0.28.0", "react-native-iphone-x-helper": "^1.2.0", "react-native-keyboard-aware-scroll-view": "^0.8.0", "react-native-kochava-tracker": "^1.1.0", "react-native-linear-gradient": "^2.5.3", "react-native-material-dropdown": "^0.11.1", "react-native-modal": "^9.0.0", "react-native-orientation": "^3.1.3", "react-native-scrollable-tab-view": "^0.10.0", "react-native-snap-carousel": "^3.7.5", "react-native-super-grid": "^2.4.4", "react-native-tab-view": "^1.3.1", "react-native-underline-tabbar": "^1.3.6", "react-native-vector-icons": "^6.1.0", "react-native-video": "^4.3.1", "react-native-webview": "^5.12.0", "react-navigation": "^3.0.9", "react-navigation-backhandler": "^1.2.0", "react-redux": "^6.0.1", "redux": "^4.0.1", "redux-logger": "^3.0.6", "redux-thunk": "^2.3.0" }, "devDependencies": { "@babel/core": "^7.4.0", "@babel/runtime": "^7.4.2", "@react-native-community/eslint-config": "^0.0.3", "babel-jest": "^24.5.0", "babel-plugin-transform-remove-console": "^6.9.4", "eslint": "^5.15.3", "eslint-config-airbnb": "^17.1.0", "eslint-plugin-import": "^2.16.0", "eslint-plugin-jsx-a11y": "^6.2.1", "eslint-plugin-react": "^7.12.4", "eslint-plugin-react-hooks": "^1.5.1", "jest": "^24.5.0", "metro-react-native-babel-preset": "^0.53.1", "react-devtools-core": "^3.6.0", "react-test-renderer": "^16.8.6", "remote-redux-devtools": "^0.5.16" }, "jest": { "preset": "react-native" } } </code></pre> <p>My <code>build.gradle</code> is:</p> <pre><code>apply plugin: "com.android.application" import com.android.build.OutputFile project.ext.react = [ entryFile: "index.js" ] apply from: "../../node_modules/react-native/react.gradle" def enableSeparateBuildPerCPUArchitecture = false def enableProguardInReleaseBuilds = false project.ext.vectoricons = [ iconFontNames: [ 'MaterialIcons.ttf', 'FontAwesome.ttf', 'MaterialCommunityIcons.ttf' ] ] apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { applicationId "com.jtv.testapp" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 29 versionName "0.0.1" multiDexEnabled true renderscriptTargetApi 29 renderscriptSupportModeEnabled true ndk { abiFilters "arm64-v8a", "x86_64","armeabi-v7a", "x86" } packagingOptions { pickFirst 'lib/x86_64/libjsc.so' pickFirst 'lib/arm64-v8a/libjsc.so' exclude "lib/arm64-v8a/libimagepipeline.so" exclude "lib/arm64-v8a/librealm-jni.so" } } signingConfigs { release { if (project.hasProperty('RELEASE_STORE_FILE')) { storeFile file(RELEASE_STORE_FILE) storePassword RELEASE_STORE_PASSWORD keyAlias RELEASE_KEY_ALIAS keyPassword RELEASE_KEY_PASSWORD } } } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" } } buildTypes { release { minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" signingConfig signingConfigs.release } } // applicationVariants are e.g. debug, release applicationVariants.all { variant -&gt; variant.outputs.each { output -&gt; def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4] def abi = output.getFilter(OutputFile.ABI) if (abi != null) { // null for the universal-debug, universal-release variants output.versionCodeOverride = versionCodes.get(abi) * 1048576 + defaultConfig.versionCode } } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } dependencies { implementation project(':react-native-webview') implementation project(':react-native-jtv-comic-reader') //implementation project(':@react-native-community_slider') implementation project(':@react-native-community_blur') implementation project(':@react-native-community_async-storage') implementation project(':@react-native-community_netinfo') implementation project(':react-native-appsee') // implementation project(':react-native-tune-sdk') implementation project(':react-native-iap') implementation project(':react-native-gesture-handler') implementation project(':react-native-video') implementation project(':react-native-vector-icons') implementation project(':react-native-orientation') implementation project(':react-native-linear-gradient') implementation project(':react-native-kochava-tracker') // implementation project(':react-native-flurry-analytics') implementation project(':react-native-device-info') // implementation project(':react-native-fbsdk') implementation project(':react-native-fast-image') implementation project(':react-native-image-picker') implementation fileTree(dir: "libs", include: ["*.jar"]) implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.appcompat:appcompat:1.0.2' implementation "com.facebook.react:react-native:+" // From node_modules implementation 'com.facebook.fresco:fresco:1.13.0' implementation 'com.facebook.fresco:animated-gif:1.13.0' implementation 'androidx.mediarouter:mediarouter:1.0.0' implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.11.2' implementation 'com.google.android.gms:play-services-ads:18.0.0' implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0' implementation 'androidx.multidex:multidex:2.0.1' implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0' implementation 'com.android.installreferrer:installreferrer:1.0' implementation 'com.google.android.gms:play-services-location:17.0.0' implementation 'com.facebook.android:facebook-android-sdk:4.36.1' implementation 'com.swrve.sdk.android:swrve-firebase:6.0.1' implementation 'com.google.firebase:firebase-core:17.0.0' implementation 'com.google.firebase:firebase-messaging:19.0.0' implementation 'androidx.mediarouter:mediarouter:1.0.0' implementation 'com.google.android.gms:play-services-cast:17.0.0' implementation 'com.googlecode.android-query:android-query:0.25.9' implementation 'com.google.android.gms:play-services-cast-framework:17.0.0' } // Run this once to be able to run the application with BUCK // puts all compile dependencies into folder libs for BUCK to use task copyDownloadableDepsToLibs(type: Copy) { from configurations.compile into 'libs' } apply plugin: 'com.google.gms.google-services' </code></pre> <p>What is the <code>libjsc.so</code> file and how do I solve this error?</p>
0debug
merge columns of two dataframes : <p>How can two dataframes be quickly merged? dataframes</p> <pre><code>df1&lt;-data.frame(a=(1:5),b=(1:5)) df2&lt;-data.frame(c=(1:5),d=(1:5)) </code></pre> <p>intended output:</p> <pre><code>output&lt;-data.frame(a=(1:5),b=(1:5),c=(1:5),d=(1:5)) </code></pre>
0debug
static void logerr (struct audio_pt *pt, int err, const char *fmt, ...) { va_list ap; va_start (ap, fmt); AUD_vlog (pt->drv, fmt, ap); va_end (ap); AUD_log (NULL, "\n"); AUD_log (pt->drv, "Reason: %s\n", strerror (err)); }
1threat
Lexicographic Order in C : <p>I am working on strings in C and I would like to ask What exactly Lexicographic Order is and how is being used in C. Which is the best way to compare 2 strings . I have read about strcmp and it's lexicographic comparison but I am confused.</p>
0debug
MKPolyline strange rendering related with zooming in MapKit : <p>I have very simple View Controller to demonstrate this strange rendering behavior of MKPolyline. Nothing special just normal api calls.</p> <pre><code>import UIKit import MapKit class ViewController: UIViewController, MKMapViewDelegate { @IBOutlet weak var map: MKMapView! override func viewDidLoad() { super.viewDidLoad() map.delegate = self } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) let p1 = CLLocationCoordinate2D(latitude: 51, longitude: 13) var coords = [ p1, CLLocationCoordinate2D(latitude: 51.1, longitude: 13), CLLocationCoordinate2D(latitude: 51.2, longitude: 13), CLLocationCoordinate2D(latitude: 51.3, longitude: 13) ] let polyline = MKPolyline(coordinates: &amp;coords, count: coords.count) map.addOverlays([polyline], level: .aboveRoads) let cam = MKMapCamera(lookingAtCenter: p1, fromDistance: 1000, pitch: 45, heading: 0) map.setCamera(cam, animated: true) } func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -&gt; MKOverlayRenderer { let r = MKPolylineRenderer(overlay: overlay) r.strokeColor = UIColor.blue return r } } </code></pre> <p>The rendering of the polyline is very strange. During zooming and panning You can see some artifacts.</p> <p>Take a look at pictures below:</p> <p>Initial Screen <a href="https://i.stack.imgur.com/9eyNF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/9eyNF.png" alt="Initial Screen"></a></p> <p>After some panning <a href="https://i.stack.imgur.com/zUCzm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/zUCzm.png" alt="After some panning"></a></p> <p>After zooming out and zooming in again <a href="https://i.stack.imgur.com/uLZbK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/uLZbK.png" alt="After zooming out and zooming in again"></a></p> <p>How to fix this? I was trying to implement my own renderer but its the same situation. Like overaly is cached and it's not redrawing on time. I'm working on iOS 10, iPhone 6, Simulator from iOS SDK 10 xCode 8.</p>
0debug
Get list of all Android apps with QPython / sl4a : Does anyone know how I can get a list of packages from all apps installed on Android using Qpython? My goal is to list all apps and be able to run, using getLaunchableApplications () and the "launch" function until I could open some, but it does not work for everyone, I made tests and if I get the name of the packages I should be able to open any app with " startactivity ". Thank you very much in advance
0debug
static void *vnc_worker_thread(void *arg) { VncJobQueue *queue = arg; qemu_thread_self(&queue->thread); while (!vnc_worker_thread_loop(queue)) ; vnc_queue_clear(queue); return NULL; }
1threat
Guys how do I set a field to equal another field in another class : Guys I have the following: **Class 1:** public class SellProduct { private int productCost; public SellProduct(int productCost) { this.productCost = productCost; } public int getProductCost() { return productCost; } } This class will set how much a product costs. **Class 2:** public class SalesOfTheYear { private int totalIncome; SellProduct sellProduct; public SalesOfTheYear() { totalIncome = 0; } public void cashOut() { totalIncome = sellProduct.getProductCost() + totalIncome; } public int getSalesOfTheYear() { return totalIncome; } } Now what I want is that class two to take how much the products cost and then set it to the totalIncome field. And of course to keep it's value at the same time and not replace it with a new totalIncome value. However, every time I run cashout it sends a java.lang.NullPointerException. Does this mean I have to create an object of class sellPoduct? And if do I would have to supply it with a parameter does that mean that whatever I supply it with a parameter so will it always be the productCost?
0debug
static int vp8_alloc_frame(VP8Context *s, AVFrame *f) { int ret; if ((ret = ff_thread_get_buffer(s->avctx, f)) < 0) return ret; if (!s->maps_are_invalid && s->num_maps_to_be_freed) { f->ref_index[0] = s->segmentation_maps[--s->num_maps_to_be_freed]; } else if (!(f->ref_index[0] = av_mallocz(s->mb_width * s->mb_height))) { ff_thread_release_buffer(s->avctx, f); return AVERROR(ENOMEM); } return 0; }
1threat
Why do we need to use stored procedure? : <p>I had seen the features of it. But couldn't get the reason why to use</p>
0debug
how to remove this paranthesis () from this text value (123) : how to remove this paranthesis () from this text value (123)and make it as integer as i want to use this repeatedly in my code how to optimise this for math calculation i tried with below code but its not working var num1 = "(123)"; var num2 = "(321)"; value = checkIntegerValue(num1,num2); function checkIntegerValue(num1,num2){ num1 = num1.replace(/\(|\)/g,''); num2 = num2.replace(/\(|\)/g,''); if(parseInt(num1) && parseInt(num2)){ return parseInt(num2-num1); } }
0debug
static void unplug_disks(PCIBus *b, PCIDevice *d, void *o) { if (!strcmp(d->name, "xen-pci-passthrough")) { return; } switch (pci_get_word(d->config + PCI_CLASS_DEVICE)) { case PCI_CLASS_STORAGE_IDE: pci_piix3_xen_ide_unplug(DEVICE(d)); break; case PCI_CLASS_STORAGE_SCSI: case PCI_CLASS_STORAGE_EXPRESS: object_unparent(OBJECT(d)); break; default: break; } }
1threat
(Python) Best way to remove non alphanumeric characters: converting text file into list of strings : <pre><code>def getCandidates(f): try: candidates = [] flist = open(f,"r") for line in flist: line = line.strip() if (line==""): continue candidates.append(line) return candidates except IOError: print("Filename not found") return candidates </code></pre> <p>Need to remove any non alphanumeric characters coming from a text file into a list of strings, should I use a another loop or is there a way to implement it into my existing code.</p> <p>Cheers.</p>
0debug
Weighted correlation coefficient with pandas : <p>Is there any way to compute weighted correlation coefficient with pandas? I saw that R has such a method. Also, I'd like to get the p value of the correlation. This I did not find also in R. Link to Wikipedia for explanation about weighted correlation: <a href="https://en.wikipedia.org/wiki/Pearson_product-moment_correlation_coefficient#Weighted_correlation_coefficient" rel="noreferrer">https://en.wikipedia.org/wiki/Pearson_product-moment_correlation_coefficient#Weighted_correlation_coefficient</a></p>
0debug
kern_return_t FindEjectableCDMedia( io_iterator_t *mediaIterator ) { kern_return_t kernResult; mach_port_t masterPort; CFMutableDictionaryRef classesToMatch; kernResult = IOMasterPort( MACH_PORT_NULL, &masterPort ); if ( KERN_SUCCESS != kernResult ) { printf( "IOMasterPort returned %d\n", kernResult ); } classesToMatch = IOServiceMatching( kIOCDMediaClass ); if ( classesToMatch == NULL ) { printf( "IOServiceMatching returned a NULL dictionary.\n" ); } else { CFDictionarySetValue( classesToMatch, CFSTR( kIOMediaEjectableKey ), kCFBooleanTrue ); } kernResult = IOServiceGetMatchingServices( masterPort, classesToMatch, mediaIterator ); if ( KERN_SUCCESS != kernResult ) { printf( "IOServiceGetMatchingServices returned %d\n", kernResult ); } return kernResult; }
1threat
Connecting sql server database using IP address in different networks : As well, we can connect SQL server database using up address in Same network.but How do I connect SQL server database using IP Address in different network ?
0debug
SwiftUI - Search in List Header : <p>I am trying to to recreate what everyone know from UITableView with SwiftUI: A simple search field in the header of the tableview:</p> <p><a href="https://i.stack.imgur.com/KZoXE.png" rel="noreferrer"><img src="https://i.stack.imgur.com/KZoXE.png" alt="A simple search field in the header of the tableview"></a></p> <p>However, the List View in SwiftUI does not even seem to have a way to add a header or footer. You can set a header with a TextField to sections like this:</p> <pre><code>@State private var searchQuery: String = "" var body: some View { List { Section(header: Group{ TextField($searchQuery, placeholder: Text("Search")) .background(Color.white) }) { ListCell() ListCell() ListCell() } } } </code></pre> <p>However, I am not sure if this is the best way to do it because:</p> <ol> <li>The header does not hide when you scroll down as you know it from UITableView.</li> <li>The SearchField does not look like the search field we know and love.</li> </ol> <p>Has anyone found a good approach? I don't want to fall back on UITableView.</p>
0debug
static uint64_t fw_cfg_data_mem_read(void *opaque, hwaddr addr, unsigned size) { return fw_cfg_read(opaque); }
1threat
static void usbredir_handle_destroy(USBDevice *udev) { USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev); qemu_chr_delete(dev->cs); qemu_bh_delete(dev->chardev_close_bh); qemu_del_timer(dev->attach_timer); qemu_free_timer(dev->attach_timer); usbredir_cleanup_device_queues(dev); if (dev->parser) { usbredirparser_destroy(dev->parser); } if (dev->watch) { g_source_remove(dev->watch); } free(dev->filter_rules); }
1threat
static void pxa2xx_rtc_hzupdate(PXA2xxRTCState *s) { int64_t rt = qemu_get_clock(rt_clock); s->last_rcnr += ((rt - s->last_hz) << 15) / (1000 * ((s->rttr & 0xffff) + 1)); s->last_rdcr += ((rt - s->last_hz) << 15) / (1000 * ((s->rttr & 0xffff) + 1)); s->last_hz = rt; }
1threat
How to access node_modules folder from wwwroot in asp.net vnext project : <p>How can I access the node_modules folder which is not included in the visual studio solution file from the wwwroot where my index.html is put. That index.html file need to reference the npm installed packages like angular.js.</p> <p>But how? </p> <p>I do not want to copy the whole node_modules folder into wwwroot. Those are not the files to live there...</p> <p>I do not want to include the node_modules folder to the solution because that will slow down everything and hang up...</p> <p>It seems Frontend development belongs not in VS...</p>
0debug
unable to execute 'x86_64-conda_cos6-linux-gnu-gcc': No such file or directory (pysam installation) : <p>I am trying to install pysam. </p> <p>After excecuting: </p> <pre><code>python path/to/pysam-master/setup.py build </code></pre> <p>This error is produced:</p> <pre><code>unable to execute 'x86_64-conda_cos6-linux-gnu-gcc': No such file or directory error: command 'x86_64-conda_cos6-linux-gnu-gcc' failed with exit status 1 </code></pre> <p>There are similar threads, but they all seem to address the problem assumig administriator rights, which I do not have. Is there a way around to install the needed files?</p> <p>DISCLAIMER: This question derived from a previous post of mine. <a href="https://stackoverflow.com/questions/46447724/manually-installing-pysam-error-importerror-no-module-named-version">manually installing pysam error: &quot;ImportError: No module named version&quot;</a> But since it might require a different approach, I made it a question of its own. </p>
0debug
What is function of [1] in program? : class String def mgsub(key_value_pairs=[].freeze) regexp_fragments = key_value_pairs.collect { |k,v| k } gsub(Regexp.union(*regexp_fragments)) do |match| key_value_pairs.detect{|k,v| k =~ match}**[1]** end end end puts "GO HOME!".mgsub([[/.*GO/i, 'HoMe'], [/home/i, 'is where the heart is']]) puts "Here is number #123".mgsub([[/[a-z]/i, '#'], [/#/, 'P']])
0debug
What is ../.. , ../ : <p>I have strugure folder like this </p> <pre><code>root || client || libs \\bower install ||src index.html </code></pre> <p>In index I try inject <code>../jquery.js</code> but I get not found . Where is my wrong . And I want ask what is <code>../..</code> , <code>'../</code> </p>
0debug
`angular` how to fix this warning `Emitted value instead of an instance of Error` : <p>My <code>angular cli</code> works fine. getting the images as well. But still I am getting an <code>warning</code> as like this:</p> <pre><code>WARNING in ./src/app/home/home.component.css (Emitted value instead of an instance of Error) postcss-url: C:\Projects\dhl-testing\src\app\home\home.component.css:4:3: Can't read file 'C:\Projects\dhl-testing\src\app\home\assets\images\dhlmoped.jpg', ignoring </code></pre> <p>and </p> <pre><code>WARNING in ./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./src/styles.css (Emitted value instead of an instance of Error) postcss-url: C:\Projects\dhl-testing\src\assets\css\sm\header.css:43:5: Can't read file 'C:\Projects\dhl-testing\src\assets\css\sm\assets\images\icon-user.png', ignoring </code></pre> <p>what is these warning means? how to fix them?</p>
0debug
My accessor method returns null in Java but compiles without errors : <p>This is for a homework assignment and I'm totally stumped on this one.</p> <pre><code>public class Person { String name; int age; public Person(String myName,int myAge) { myName = name; myAge = age; } public int getAge() { return age; } public String getName() { } public void setAge(int newAge) { age = newAge; } public void printDetails() { System.out.println("The name of this person is " + getName()); } public static void main (String[] args ) { Person Eliza = new Person("Eliza", 66); Eliza.printDetails(); } } </code></pre> <p>This returns:</p> <pre><code>The name of this person is null </code></pre> <p>Hopefully I've missed something really obvious any comments are appreciated.</p>
0debug
static size_t stream_process_s2mem(struct Stream *s, unsigned char *buf, size_t len, uint32_t *app) { uint32_t prev_d; unsigned int rxlen; size_t pos = 0; int sof = 1; if (!stream_running(s) || stream_idle(s)) { return 0; } while (len) { stream_desc_load(s, s->regs[R_CURDESC]); if (s->desc.status & SDESC_STATUS_COMPLETE) { s->regs[R_DMASR] |= DMASR_HALTED; break; } rxlen = s->desc.control & SDESC_CTRL_LEN_MASK; if (rxlen > len) { rxlen = len; } cpu_physical_memory_write(s->desc.buffer_address, buf + pos, rxlen); len -= rxlen; pos += rxlen; if (!len) { int i; stream_complete(s); for (i = 0; i < 5; i++) { s->desc.app[i] = app[i]; } s->desc.status |= SDESC_STATUS_EOF; } s->desc.status |= sof << SDESC_STATUS_SOF_BIT; s->desc.status |= SDESC_STATUS_COMPLETE; stream_desc_store(s, s->regs[R_CURDESC]); sof = 0; prev_d = s->regs[R_CURDESC]; s->regs[R_CURDESC] = s->desc.nxtdesc; if (prev_d == s->regs[R_TAILDESC]) { s->regs[R_DMASR] |= DMASR_IDLE; break; } } return pos; }
1threat
How to unit test this Redux thunk? : <p>So I have this Redux action creator that is using <code>redux thunk</code> middleware:</p> <p><strong>accountDetailsActions.js:</strong></p> <pre><code>export function updateProduct(product) { return (dispatch, getState) =&gt; { const { accountDetails } = getState(); dispatch({ type: types.UPDATE_PRODUCT, stateOfResidence: accountDetails.stateOfResidence, product, }); }; } </code></pre> <p>How do I test it? I'm using the <code>chai</code> package for testing. I have found some resources online, but am unsure of how to proceed. Here is my test so far:</p> <p><strong>accountDetailsReducer.test.js:</strong></p> <pre><code>describe('types.UPDATE_PRODUCT', () =&gt; { it('should update product when passed a product object', () =&gt; { //arrange const initialState = { product: {} }; const product = { id: 1, accountTypeId: 1, officeRangeId: 1, additionalInfo: "", enabled: true }; const action = actions.updateProduct(product); const store = mockStore({courses: []}, action); store.dispatch(action); //this is as far as I've gotten - how can I populate my newState variable in order to test the `product` field after running the thunk? //act const newState = accountDetailsReducer(initialState, action); //assert expect(newState.product).to.be.an('object'); expect(newState.product).to.equal(product); }); }); </code></pre> <p>My thunk doesn't do any asynchronous actions. Any advice?</p>
0debug
Polymer - Animating a DIV : <p>I am learning Polymer. I have a element that includes a <code>div</code>. I want to animate that div's height. In an attempt to do this, I've got the following:</p> <p><strong>my-element.html</strong></p> <pre><code>&lt;dom-module id="my-element"&gt; &lt;template&gt; &lt;div id="container" style="height:100px; background-color:green; color:white;"&gt; Hello! &lt;/div&gt; &lt;paper-button on-click="_onTestClick"&gt;Expand&lt;/paper-button&gt; &lt;/template&gt; &lt;script&gt; Polymer({ is: 'my-element', _onTestClick: function() { // expand the height of container } }); &lt;/script&gt; &lt;/dom-module&gt; </code></pre> <p>I then used the grow height animation shown <a href="https://github.com/PolymerElements/paper-menu-button/blob/master/paper-menu-button-animations.html">here</a> for inspiration. So, I basically, have a animation defined like this:</p> <pre><code>Polymer({ is: 'grow-height-animation', behaviors: [ Polymer.NeonAnimationBehavior ], configure: function(config) { var node = config.node; var rect = node.getBoundingClientRect(); var height = rect.height; this._effect = new KeyframeEffect(node, [{ height: (height / 2) + 'px' }, { height: height + 'px' }], this.timingFromConfig(config)); return this._effect; } }); </code></pre> <p>My challenge is, I do not understand how to integrate this animation with the <code>div</code> element with the id of "container". Everything I see seems like it only works on Polymer elements. Yet, I'm trying to figure out how to animate the <code>div</code> using Polymer. What am I missing?</p> <p>Thanks!</p>
0debug
Parse error: syntax error, unexpected 'try' (T_TRY) in E:\wamp64\www\project-trial\install.php on line 10 : <p>I am trying to install the database for my project with this file - install.php Code Below: </p> <pre><code>&lt;?php /* ** Open a connection with the database via PDO to create a new database and tables with structure &amp; insert initial values. */ require "config.php" /* ** CREATING DATABASE CONNECTION** */ try{ $conn = new PDO("mysql:host=$host", $username, $password, $options); $sql = file_get_contents("data/init.sql"); $conn-&gt;exec($sql); echo "Databse and Tables created successfully. :)"; }catch(PDOException $error){ echo $sql."&lt;br&gt;".$error-&gt;getMessage(); } ?&gt; </code></pre> <p>If I remove the try...catch implementation. Then it shows error unexpected $conn. Has this anything to do with the PDO object creation. Wouldn't PDO run with<br> PHP 5.6.35. I am using WAMP 3.0. </p>
0debug
arraylist is not printing first element : <p>I am trying to write some java code, but I am getting an Exception. my problem is that I am getting a null pointer exception when I try to add athlete the program is to accept athletes and the calculate score average Here is my code</p> <pre><code>public class AthleteTest { final int MAX_ATHELETE = 200; private int count=0; Athlete[] at = new Athlete[MAX_ATHELETE]; Scanner sc = new Scanner(System.in); public void addAthletes(){ char add = 'Y'; while(add == 'Y'){ System.out.println("name:"); String name = sc.nextLine(); at[count].setName(name); //Get athlete's Id number System.out.println("id :"); int id = sc.nextInt(); at.setId(id); //sc.nextLine(); count++; System.out.println("Would you like to add another athlete? Y / N"); add = Character.toUpperCase(sc.next().charAt(0)); sc.nextLine(); } } } my Athlete class is as follow public class Athlete { private String name; private int id; private double [] grades; public Athlete(){ this.name = null; this.id= 0; } public Student(String name, int id){ this.name = name; this.id= id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getId() { return id; } public void setId(int id) { this.id = id; } } </code></pre>
0debug
static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int depth, AVFormatContext *s) { AVIOContext *pb; WtvFile *wf; uint8_t *buffer; if (seek_by_sector(s->pb, first_sector, 0) < 0) return NULL; wf = av_mallocz(sizeof(WtvFile)); if (!wf) return NULL; if (depth == 0) { wf->sectors = av_malloc(sizeof(uint32_t)); if (!wf->sectors) { av_free(wf); return NULL; } wf->sectors[0] = first_sector; wf->nb_sectors = 1; } else if (depth == 1) { wf->sectors = av_malloc(WTV_SECTOR_SIZE); if (!wf->sectors) { av_free(wf); return NULL; } wf->nb_sectors = read_ints(s->pb, wf->sectors, WTV_SECTOR_SIZE / 4); } else if (depth == 2) { uint32_t sectors1[WTV_SECTOR_SIZE / 4]; int nb_sectors1 = read_ints(s->pb, sectors1, WTV_SECTOR_SIZE / 4); int i; wf->sectors = av_malloc_array(nb_sectors1, 1 << WTV_SECTOR_BITS); if (!wf->sectors) { av_free(wf); return NULL; } wf->nb_sectors = 0; for (i = 0; i < nb_sectors1; i++) { if (seek_by_sector(s->pb, sectors1[i], 0) < 0) break; wf->nb_sectors += read_ints(s->pb, wf->sectors + i * WTV_SECTOR_SIZE / 4, WTV_SECTOR_SIZE / 4); } } else { av_log(s, AV_LOG_ERROR, "unsupported file allocation table depth (0x%x)\n", depth); av_free(wf); return NULL; } wf->sector_bits = length & (1ULL<<63) ? WTV_SECTOR_BITS : WTV_BIGSECTOR_BITS; if (!wf->nb_sectors) { av_free(wf->sectors); av_free(wf); return NULL; } if ((int64_t)wf->sectors[wf->nb_sectors - 1] << WTV_SECTOR_BITS > avio_tell(s->pb)) av_log(s, AV_LOG_WARNING, "truncated file\n"); length &= 0xFFFFFFFFFFFF; if (length > ((int64_t)wf->nb_sectors << wf->sector_bits)) { av_log(s, AV_LOG_WARNING, "reported file length (0x%"PRIx64") exceeds number of available sectors (0x%"PRIx64")\n", length, (int64_t)wf->nb_sectors << wf->sector_bits); length = (int64_t)wf->nb_sectors << wf->sector_bits; } wf->length = length; wf->position = 0; if (seek_by_sector(s->pb, wf->sectors[0], 0) < 0) { av_free(wf->sectors); av_free(wf); return NULL; } wf->pb_filesystem = s->pb; buffer = av_malloc(1 << wf->sector_bits); if (!buffer) { av_free(wf->sectors); av_free(wf); return NULL; } pb = avio_alloc_context(buffer, 1 << wf->sector_bits, 0, wf, wtvfile_read_packet, NULL, wtvfile_seek); if (!pb) { av_free(buffer); av_free(wf->sectors); av_free(wf); } return pb; }
1threat
rvalue reference's illegal operations : class A { int x; }; int main() { A&& a=A(); // 1 a.x=nullptr; // 2 cout<<a.x<<endl; cout<<&a<<endl; // 3 return 0; } Questions: (respectively with the numbers in each line) 1. Is there an implicit cast __from__ temporary values (values of built-in type, and temporary objects) __to__ objects of type `rvalue reference`? 2. I understood that the lifetime of a temporary object is ended after it's evaluation. If I am right, does it mean that `a.x=nullptr` is unsafe? 3. Does `a` has an address?
0debug
How to make backgroundimage move in Swift iOS : <p>For one of the viewcontrollers in my app, I would like a moving background image. How would I go about making this?</p>
0debug
stupid javascript error in image filter : So I am making a basic application that adds image filters to images. Here is the code. class ImageUtils { static getCanvas(w, h) { var c = document.querySelector("canvas"); c.width = w; c.height = h; return c; } static getPixels(img) { var c = ImageUtils.getCanvas(img.width, img.height); var ctx = c.getContext('2d'); ctx.drawImage(img, 0, 0); return ctx.getImageData(0,0,c.width,c.height); } static putPixels(imageData, w, h) { var c = ImageUtils.getCanvas(w, h); var ctx = c.getContext('2d'); ctx.putImageData(imageData, 0, 0); } } function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; ... function makeMoreRed(img, adjustment){ var pixels = ImageUtils.getPixels(img); var length = pixels.data.length; var data = pixels.data; for(var r = 0; r < length; r += 4) { data[r] += adjustment; } ImageUtils.putPixels(pixels, img.width. img.height); } ... $(document).ready(function() { var img = new Image(); img.src = "img/cat.jpg"; makeMoreRed(img, 50); }); When I launch it with the webpage, Chrome throws this error [stupid javascript error][1] This does not make any sense as there is nothing but a semicolon at the end of the function. Is there any solution on how to resolve this because here you can see that there is no change in the top image (the one that is supposed to be filtered) [two cat pictures][2] [1]: http://i.stack.imgur.com/Vvum7.png [2]: http://i.stack.imgur.com/MRi4m.png
0debug
How to convert strings to DateTime C# : <p>I have 3 separate strings with the following format: </p> <p><code>01-29-2016</code>: a date, picked from a bootstrap datepicker</p> <p><code>1:00am</code> start time, picked from a dropdown, format could also be e.g. 10:00pm</p> <p><code>2:30am</code> end time, picked from a dropdown, format could also be e.g. 11:30pm</p> <p>Using the above strings I need to construct 2 DateTime properties that represent the time range, something like below:</p> <p><code>2016-01-29 02:30:00</code></p> <p><code>2016-01-29 01:00:00</code></p> <p>I need the DateTime properties so I could update datetime database fields</p>
0debug
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
How to update docker stack without restarting all services : <p>I have a swarm cluster wherein different technology dockers are deployed. (Zookeeper, Kafka, Elastic, Storm and custom web application)</p> <p>Web application goes under tremendous changes and have to update the stack everytime web docker changes. Once in a while there will be updates to Elasticsearch image.</p> <p>When i run docker stack deploy, it goes and restarts all existing docker services which are not even changed. This hampers whole stack and there is a downtime for whole application. Docker stack does not have option of update.</p> <p>Someone has solution for this?</p>
0debug
void in_asm_used_var_warning_killer() { volatile int i= yCoeff+vrCoeff+ubCoeff+vgCoeff+ugCoeff+bF8+bFC+w400+w80+w10+ bm00001111+bm00000111+bm11111000+b16Mask+g16Mask+r16Mask+b15Mask+g15Mask+r15Mask+temp0+asm_yalpha1+ asm_uvalpha1+ M24A+M24B+M24C+w02 + funnyYCode[0]+ funnyUVCode[0]+b5Dither+g5Dither+r5Dither+g6Dither+dither4[0]+dither8[0]; if(i) i=0; }
1threat
Rxjs 5 - Simple Ajax Request : <p>I'm trying to get the value from a simple ajax request, but I don't understand how to do that. Here is the code: </p> <pre><code>Rx.Observable .ajax({ url: 'https://jsonplaceholder.typicode.com/posts', method: 'GET', responseType: 'json' }) .subscribe(function(data) { return data.response; }); </code></pre> <p>I searched everywhere and there is no simple explanation. </p> <p>Thanks!</p>
0debug
static int bochs_open(BlockDriverState *bs, int flags) { BDRVBochsState *s = bs->opaque; int i; struct bochs_header bochs; struct bochs_header_v1 header_v1; bs->read_only = 1; if (bdrv_pread(bs->file, 0, &bochs, sizeof(bochs)) != sizeof(bochs)) { goto fail; } if (strcmp(bochs.magic, HEADER_MAGIC) || strcmp(bochs.type, REDOLOG_TYPE) || strcmp(bochs.subtype, GROWING_TYPE) || ((le32_to_cpu(bochs.version) != HEADER_VERSION) && (le32_to_cpu(bochs.version) != HEADER_V1))) { return -EMEDIUMTYPE; } if (le32_to_cpu(bochs.version) == HEADER_V1) { memcpy(&header_v1, &bochs, sizeof(bochs)); bs->total_sectors = le64_to_cpu(header_v1.extra.redolog.disk) / 512; } else { bs->total_sectors = le64_to_cpu(bochs.extra.redolog.disk) / 512; } s->catalog_size = le32_to_cpu(bochs.extra.redolog.catalog); s->catalog_bitmap = g_malloc(s->catalog_size * 4); if (bdrv_pread(bs->file, le32_to_cpu(bochs.header), s->catalog_bitmap, s->catalog_size * 4) != s->catalog_size * 4) goto fail; for (i = 0; i < s->catalog_size; i++) le32_to_cpus(&s->catalog_bitmap[i]); s->data_offset = le32_to_cpu(bochs.header) + (s->catalog_size * 4); s->bitmap_blocks = 1 + (le32_to_cpu(bochs.extra.redolog.bitmap) - 1) / 512; s->extent_blocks = 1 + (le32_to_cpu(bochs.extra.redolog.extent) - 1) / 512; s->extent_size = le32_to_cpu(bochs.extra.redolog.extent); qemu_co_mutex_init(&s->lock); return 0; fail: return -1; }
1threat
static void mptsas_process_scsi_task_mgmt(MPTSASState *s, MPIMsgSCSITaskMgmt *req) { MPIMsgSCSITaskMgmtReply reply; MPIMsgSCSITaskMgmtReply *reply_async; int status, count; SCSIDevice *sdev; SCSIRequest *r, *next; BusChild *kid; mptsas_fix_scsi_task_mgmt_endianness(req); QEMU_BUILD_BUG_ON(MPTSAS_MAX_REQUEST_SIZE < sizeof(*req)); QEMU_BUILD_BUG_ON(sizeof(s->doorbell_msg) < sizeof(*req)); QEMU_BUILD_BUG_ON(sizeof(s->doorbell_reply) < sizeof(reply)); memset(&reply, 0, sizeof(reply)); reply.TargetID = req->TargetID; reply.Bus = req->Bus; reply.MsgLength = sizeof(reply) / 4; reply.Function = req->Function; reply.TaskType = req->TaskType; reply.MsgContext = req->MsgContext; switch (req->TaskType) { case MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK: case MPI_SCSITASKMGMT_TASKTYPE_QUERY_TASK: status = mptsas_scsi_device_find(s, req->Bus, req->TargetID, req->LUN, &sdev); if (status) { reply.IOCStatus = status; goto out; } if (sdev->lun != req->LUN[1]) { reply.ResponseCode = MPI_SCSITASKMGMT_RSP_TM_INVALID_LUN; goto out; } QTAILQ_FOREACH_SAFE(r, &sdev->requests, next, next) { MPTSASRequest *cmd_req = r->hba_private; if (cmd_req && cmd_req->scsi_io.MsgContext == req->TaskMsgContext) { break; } } if (r) { assert(r->hba_private); if (req->TaskType == MPI_SCSITASKMGMT_TASKTYPE_QUERY_TASK) { reply.ResponseCode = MPI_SCSITASKMGMT_RSP_TM_SUCCEEDED; } else { MPTSASCancelNotifier *notifier; reply_async = g_memdup(&reply, sizeof(MPIMsgSCSITaskMgmtReply)); reply_async->IOCLogInfo = INT_MAX; count = 1; notifier = g_new(MPTSASCancelNotifier, 1); notifier->s = s; notifier->reply = reply_async; notifier->notifier.notify = mptsas_cancel_notify; scsi_req_cancel_async(r, &notifier->notifier); goto reply_maybe_async; } } break; case MPI_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET: case MPI_SCSITASKMGMT_TASKTYPE_CLEAR_TASK_SET: status = mptsas_scsi_device_find(s, req->Bus, req->TargetID, req->LUN, &sdev); if (status) { reply.IOCStatus = status; goto out; } if (sdev->lun != req->LUN[1]) { reply.ResponseCode = MPI_SCSITASKMGMT_RSP_TM_INVALID_LUN; goto out; } reply_async = g_memdup(&reply, sizeof(MPIMsgSCSITaskMgmtReply)); reply_async->IOCLogInfo = INT_MAX; count = 0; QTAILQ_FOREACH_SAFE(r, &sdev->requests, next, next) { if (r->hba_private) { MPTSASCancelNotifier *notifier; count++; notifier = g_new(MPTSASCancelNotifier, 1); notifier->s = s; notifier->reply = reply_async; notifier->notifier.notify = mptsas_cancel_notify; scsi_req_cancel_async(r, &notifier->notifier); } } reply_maybe_async: if (reply_async->TerminationCount < count) { reply_async->IOCLogInfo = count; return; } reply.TerminationCount = count; break; case MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET: status = mptsas_scsi_device_find(s, req->Bus, req->TargetID, req->LUN, &sdev); if (status) { reply.IOCStatus = status; goto out; } if (sdev->lun != req->LUN[1]) { reply.ResponseCode = MPI_SCSITASKMGMT_RSP_TM_INVALID_LUN; goto out; } qdev_reset_all(&sdev->qdev); break; case MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET: if (req->Bus != 0) { reply.IOCStatus = MPI_IOCSTATUS_SCSI_INVALID_BUS; goto out; } if (req->TargetID > s->max_devices) { reply.IOCStatus = MPI_IOCSTATUS_SCSI_INVALID_TARGETID; goto out; } QTAILQ_FOREACH(kid, &s->bus.qbus.children, sibling) { sdev = SCSI_DEVICE(kid->child); if (sdev->channel == 0 && sdev->id == req->TargetID) { qdev_reset_all(kid->child); } } break; case MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS: qbus_reset_all(&s->bus.qbus); break; default: reply.ResponseCode = MPI_SCSITASKMGMT_RSP_TM_NOT_SUPPORTED; break; } out: mptsas_fix_scsi_task_mgmt_reply_endianness(&reply); mptsas_post_reply(s, (MPIDefaultReply *)&reply); }
1threat
static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src, InputEvent *evt) { VirtIOInput *vinput = VIRTIO_INPUT(dev); virtio_input_event event; int qcode; switch (evt->kind) { case INPUT_EVENT_KIND_KEY: qcode = qemu_input_key_value_to_qcode(evt->key->key); if (qcode && keymap_qcode[qcode]) { event.type = cpu_to_le16(EV_KEY); event.code = cpu_to_le16(keymap_qcode[qcode]); event.value = cpu_to_le32(evt->key->down ? 1 : 0); virtio_input_send(vinput, &event); } else { if (evt->key->down) { fprintf(stderr, "%s: unmapped key: %d [%s]\n", __func__, qcode, QKeyCode_lookup[qcode]); } } break; case INPUT_EVENT_KIND_BTN: if (keymap_button[evt->btn->button]) { event.type = cpu_to_le16(EV_KEY); event.code = cpu_to_le16(keymap_button[evt->btn->button]); event.value = cpu_to_le32(evt->btn->down ? 1 : 0); virtio_input_send(vinput, &event); } else { if (evt->btn->down) { fprintf(stderr, "%s: unmapped button: %d [%s]\n", __func__, evt->btn->button, InputButton_lookup[evt->btn->button]); } } break; case INPUT_EVENT_KIND_REL: event.type = cpu_to_le16(EV_REL); event.code = cpu_to_le16(axismap_rel[evt->rel->axis]); event.value = cpu_to_le32(evt->rel->value); virtio_input_send(vinput, &event); break; case INPUT_EVENT_KIND_ABS: event.type = cpu_to_le16(EV_ABS); event.code = cpu_to_le16(axismap_abs[evt->abs->axis]); event.value = cpu_to_le32(evt->abs->value); virtio_input_send(vinput, &event); break; default: break; } }
1threat
Segmentation Fault (Core Dump) with 2D Dynamic Array : <p>I'm writing a program that takes a number(s) from the command line and finds all the prime factors of said number. I want to collect the prime factors of each number inside an array of pointers, so that each pointer will point to each specific group of prime factors for each number entered. I'm currently running into a segmentation fault core dump and from what I've been able to research so far, I'm apparently trying to access a spot of either unallocated memory or something to do with a NULL pointer. I've indicated in the code below where I found the segmentation fault taking place. I'm currently at a loss on how to proceed but I'm going to keep looking but in the meantime, if someone with a little better understanding of C wouldn't mind helping me out, that would be greatly appreciated. Eventually I have to take this code and get it to work with pthreads.</p> <pre><code>`#include&lt;stdlib.h&gt; #include&lt;stdio.h&gt; #include&lt;string.h&gt; #include&lt;pthread.h&gt;` int main(int argc, char** argv){ int **primeFactor = malloc((argc-1)*sizeof(int*)); int i, j, counter, num, prime = 2; for(i = 1; i &lt; argc; i++){ counter = 0; num = atoi(argv[i]); printf("The number is: %d", num); primeFactor[i-1] = malloc((atoi(argv[i])/2)*sizeof(int)); while(num &gt; 1){ while(num % prime == 0){ num /= prime; // Segmentation Fault ==&gt; *primeFactor[i] = prime; printf("\n%d is a factor", prime); } prime++; } prime=2; } printf("\n"); return 0; } </code></pre>
0debug
JOIN Operation Error (Maria DB) : [This the QUERY I have done using normal WHERE condition][1] [This the Same process done with JOIN, but yields error][2] [1]: https://i.stack.imgur.com/zT7ld.jpg [2]: https://i.stack.imgur.com/OcJOx.jpg What am I doing wrong here ?. Please suggest the correct solution. Thank you.
0debug
static int siff_read_packet(AVFormatContext *s, AVPacket *pkt) { SIFFContext *c = s->priv_data; if (c->has_video) { unsigned int size; if (c->cur_frame >= c->frames) return AVERROR_EOF; if (c->curstrm == -1) { c->pktsize = avio_rl32(s->pb) - 4; c->flags = avio_rl16(s->pb); c->gmcsize = (c->flags & VB_HAS_GMC) ? 4 : 0; if (c->gmcsize) avio_read(s->pb, c->gmc, c->gmcsize); c->sndsize = (c->flags & VB_HAS_AUDIO) ? avio_rl32(s->pb) : 0; c->curstrm = !!(c->flags & VB_HAS_AUDIO); } if (!c->curstrm) { size = c->pktsize - c->sndsize - c->gmcsize - 2; size = ffio_limit(s->pb, size); if (size < 0 || c->pktsize < c->sndsize) return AVERROR_INVALIDDATA; if (av_new_packet(pkt, size + c->gmcsize + 2) < 0) return AVERROR(ENOMEM); AV_WL16(pkt->data, c->flags); if (c->gmcsize) memcpy(pkt->data + 2, c->gmc, c->gmcsize); if (avio_read(s->pb, pkt->data + 2 + c->gmcsize, size) != size) { av_free_packet(pkt); return AVERROR_INVALIDDATA; } pkt->stream_index = 0; c->curstrm = -1; } else { int pktsize = av_get_packet(s->pb, pkt, c->sndsize - 4); if (pktsize < 0) return AVERROR(EIO); pkt->stream_index = 1; pkt->duration = pktsize; c->curstrm = 0; } if (!c->cur_frame || c->curstrm) pkt->flags |= AV_PKT_FLAG_KEY; if (c->curstrm == -1) c->cur_frame++; } else { int pktsize = av_get_packet(s->pb, pkt, c->block_align); if (!pktsize) return AVERROR_EOF; if (pktsize <= 0) return AVERROR(EIO); pkt->duration = pktsize; } return pkt->size; }
1threat
MEMORY REPRESENTATION STRING IN LITTLEINDIAN AND BIGINDIAN : char S[6] = "18243"; how following string is represented in BigEndian vs Small endian system?
0debug
How to index a .PDF file in ElasticSearch : <p>I am new to ElasticSearch. I have gone through very basic tutorial on creating Indexes. I do understand the concept of a indexing. I want ElasticSearch to search inside a .PDF File. Based on my understanding of creating Indexes, it seems I need to read the .PDF file and extract all the keywords for indexing. But, I do not understand what steps I need to follow. How do I read .PFD file to extract keywords.</p>
0debug
static void pmsav5_insn_ap_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { env->cp15.c5_insn = extended_mpu_ap_bits(value); }
1threat
How to only allow one admin user to write Firebase Database? : <p>I am trying to set up a Firebase database that only I can write. So no user will have permission to write anything. But everyone will be able to read it.</p> <p>However, I could not set up the rules for it. I have one admin user that I created using Email/Password login, and I know its UID. Let's say my UID is: <code>dJrGShfgfd2</code></p> <p>I tried these two methods, but they didn't allow me to write to database.</p> <pre><code>{ "rules": { "events": { ".read": true, ".write": "auth.uid === 'dJrGShfgfd2'" } } } </code></pre> <p>.</p> <pre><code>{ "rules": { "users": { "$user_id": { ".read" : true, ".write": "$user_id === 'dJrGShfgfd2'" } } } } </code></pre> <p>So how do I allow only one user with a specific UID to write anything to database?</p>
0debug
HOW TO GET PREVIOUS 7 DAYS DATA FROM TODAY IN SQL SERVER : I have a `DataEntry` Table(`GuestAddressData`) with Users `Data.Columns` are `UserId,EDate` (type `DateTime`)and etc. I need to fetch Count of Users from `Today` to previous `7 Days` .(use for show in Graph) Query SELECT row_number() over (order by (SELECT 1)) ID, count(*) Total, LEFT(Datename(weekday, Cast(EDate as date)), 3) Day FROM CRM0001GuestAddressData WHERE EDate >= dateadd(week, datediff(d, -1, 2018-09-25-2)/7, -1) GROUP BY Cast(EDate as date) ORDER BY Cast(EDate as date) but this is not correct?How to SOLVE IT?
0debug
How to read and convert a protected object to an associative array in PHP : <p>I am working with an api which answers the requests with "protected" data object</p> <p>like this</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>( [id:protected] =&gt; id:NYhXwGRVDzAAAAAAAAAA62 [name:protected] =&gt; 5cf8cdd54328c.EDF [rev:protected] =&gt; 014a0000000150eaacf0 [size:protected] =&gt; 25136208 [server_modified:protected] =&gt; 2019-06-06T08:25:00Z [has_explicit_shared_members:protected] =&gt; [data:protected] =&gt; Array ( [name] =&gt; 5cf8cdd54328c.EDF [path_lower] =&gt; /5cf8cdd54328c.edf [path_display] =&gt; /5cf8cdd54328c.EDF [id] =&gt; id:NYhXwGRVDzAAAAAAAA125 [client_modified] =&gt; 2019-06-06T08:25:00Z [server_modified] =&gt; 2019-06-06T08:25:00Z [rev] =&gt; 014a0000000150eaacf0 [size] =&gt; 25136208 [is_downloadable] =&gt; 1 [content_hash] =&gt; 86442139304784e3b18d1d46f1b20bc48847 ) )</code></pre> </div> </div> </p> <p>I have converted the object to array with the following code</p> <pre><code>$metadata = (array)$file-&gt;getMetadata(); </code></pre> <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>Array ( [*id] =&gt; id:NYhXwGRVDzAAAAAA44554 [*name] =&gt; 5cf8cdd54328c.EDF [*rev] =&gt; 014a0000000150eaacf0 [*size] =&gt; 25136208 [*media_info] =&gt; [*sharing_info] =&gt; [*path_display] =&gt; /5cf8cdd54328c.EDF [*client_modified] =&gt; 2019-06-06T08:25:00Z [*server_modified] =&gt; 2019-06-06T08:25:00Z [*data] =&gt; Array ( [name] =&gt; 5cf8cdd54328c.EDF [path_display] =&gt; /5cf8cdd54328c.EDF [id] =&gt; id:NYhXwGRVDzAAAAAAA23382 [client_modified] =&gt; 2019-06-06T08:25:00Z [server_modified] =&gt; 2019-06-06T08:25:00Z [rev] =&gt; 014a0000000150eaacf0 [size] =&gt; 25136208 [is_downloadable] =&gt; 1 [content_hash] =&gt; 86442139304784e3b18d1d46f1b20bc4884 ) )</code></pre> </div> </div> </p> <p>But when i try to print the value <code>print_r($metadata['*size']);</code> </p> <blockquote> <p>Notice: Undefined index: *size in C:\xampp\htdocs\Proyectos\kardion\kardion\sistema\download.php on line 28</p> </blockquote> <p>I think it will be a very easy answer but I have no idea how to do it</p>
0debug
how to make a drop down list which responds to the letter you enter in html : <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>choose a country</title> </head> <body> <h1>Where would you like to go?</h1> <form action="some.jsp"> <select name="item"> <option value="america">America</option> <option value="turkey">Turkey</option> <option value="brazil">France</option> <option value ="spain">Spain</option> <option value ="Egypt">Egypt</option> <option value ="Dubai">Dubai</option> <option value = Argentina">Argentina </option> <option value = "canada"> Canada </option> <option value = "france">France</option> </select> <input type="submit" value="lets go!!"> </form> </body> </html> I want to make a drop list in which when you press the letter A then all the countries with the letter A pop up. Im confused on how to do this also I want to align this to the centre of the page. How would I go about this.
0debug
Line highlighting in javascipt : how can i height-light a line in paragraph with javascript. Background color of line should change when line is over it. A single should should high-light for its starting to full stop. And please provide code in javascript not jquery.
0debug
How should I configure the base href for Angular 2 when using Electron? : <p>I need to either set <code>&lt;base&gt;</code> in the HTML or <code>APP_BASE_HREF</code> during the bootstrap for Angular 2 to not throw exceptions. If I set either of these then <code>Electron</code>, thinking in terms of the file system, throws exceptions in <code>browser_adapter.ts</code> when trying to match a route: </p> <blockquote> <p>EXCEPTION: Error: Uncaught (in promise): Cannot match any routes. Current segment: 'C:'. Available routes: ['/dashboard', '/accounts'].</p> </blockquote> <p>I tried using just the <code>HashLocationStrategy</code> mentioned in <a href="https://www.xplatform.rocks/2016/01/07/building-an-electron-app-using-angular2-beta0-in-typescript/" rel="noreferrer">this blog post</a>, but Angular still complains about the base href not being set.</p>
0debug
Listing employees and their salary as percentage of total salaries using Derived table : I have a table with names, job, salary etc.. what i want to do is to list all names, salary and a third collumn with their salary as a percentage of total salary. like this: https://gyazo.com/179626fb821541405bce72b604cf9475 the table looks like this: https://gyazo.com/95562f6e7bf775aed80954608a2ac5e8 im new to mysql and all help is good help.. thanks
0debug
static void test_acpi_q35_tcg_cphp(void) { test_data data; memset(&data, 0, sizeof(data)); data.machine = MACHINE_Q35; data.variant = ".cphp"; test_acpi_one(" -smp 2,cores=3,sockets=2,maxcpus=6" " -numa node -numa node", &data); free_test_data(&data); }
1threat
static int get_device_guid( char *name, int name_size, char *actual_name, int actual_name_size) { LONG status; HKEY control_net_key; DWORD len; int i = 0; int stop = 0; status = RegOpenKeyEx( HKEY_LOCAL_MACHINE, NETWORK_CONNECTIONS_KEY, 0, KEY_READ, &control_net_key); if (status != ERROR_SUCCESS) { return -1; } while (!stop) { char enum_name[256]; char connection_string[256]; HKEY connection_key; char name_data[256]; DWORD name_type; const char name_string[] = "Name"; len = sizeof (enum_name); status = RegEnumKeyEx( control_net_key, i, enum_name, &len, NULL, NULL, NULL, NULL); if (status == ERROR_NO_MORE_ITEMS) break; else if (status != ERROR_SUCCESS) { return -1; } snprintf(connection_string, sizeof(connection_string), "%s\\%s\\Connection", NETWORK_CONNECTIONS_KEY, enum_name); status = RegOpenKeyEx( HKEY_LOCAL_MACHINE, connection_string, 0, KEY_READ, &connection_key); if (status == ERROR_SUCCESS) { len = sizeof (name_data); status = RegQueryValueEx( connection_key, name_string, NULL, &name_type, (LPBYTE)name_data, &len); if (status != ERROR_SUCCESS || name_type != REG_SZ) { return -1; } else { if (is_tap_win32_dev(enum_name)) { snprintf(name, name_size, "%s", enum_name); if (actual_name) { if (strcmp(actual_name, "") != 0) { if (strcmp(name_data, actual_name) != 0) { RegCloseKey (connection_key); ++i; continue; } } else { snprintf(actual_name, actual_name_size, "%s", name_data); } } stop = 1; } } RegCloseKey (connection_key); } ++i; } RegCloseKey (control_net_key); if (stop == 0) return -1; return 0; }
1threat
What is StatReloader while running Django? : <p>I've just created new Python 3.7 virtualenv with Django 2.2</p> <p>And each <code>runserver</code> it prints:</p> <blockquote> <p>Watching for file changes with StatReloader</p> </blockquote> <p>I could not find any info in Django's docs etc.</p> <p>Is it related specially to Django somehow? Does it go with Django? What it does? Why is it printed in red in PyCharm? Should I be careful about something? Could it be disabled?</p> <p>Big thx</p>
0debug
Do Go switch/cases fallthrough or not? : <p>What happens when you reach the end of a Go case, does it fall through to the next, or assume that most applications don't want to fall through?</p>
0debug
Do on class click without jquery ( $("a.zone1").click(function() {}) : <p>I would like to sent google analytics event, on click of link with specific class without using jquery something similare at…</p> <pre><code> &lt;script type="text/javascript"&gt; $("a.zone1").click(function() { ga('send', 'event', 'button', 'visit', 'click_visit_zone1'); var href = $(this).attr('href'); window.open(href, '_self'); return false; }); $("a.zone2").click(function() { ga('send', 'event', 'button', 'visit', 'click_visit_zone2'); var href = $(this).attr('href'); window.open(href, '_self'); return false; }); &lt;/script&gt; </code></pre> <p>each .zone got around 10 links, </p>
0debug
static av_cold int nvenc_open_session(AVCodecContext *avctx) { NvencContext *ctx = avctx->priv_data; NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs; NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS encode_session_params = { 0 }; NVENCSTATUS nv_status; encode_session_params.version = NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER; encode_session_params.apiVersion = NVENCAPI_VERSION; encode_session_params.device = ctx->cu_context; encode_session_params.deviceType = NV_ENC_DEVICE_TYPE_CUDA; nv_status = p_nvenc->nvEncOpenEncodeSessionEx(&encode_session_params, &ctx->nvencoder); if (nv_status != NV_ENC_SUCCESS) { ctx->nvencoder = NULL; return nvenc_print_error(avctx, nv_status, "OpenEncodeSessionEx failed"); } return 0; }
1threat
void ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd, int start, int end, int fast_gain, int is_lfe, int dba_mode, int dba_nsegs, uint8_t *dba_offsets, uint8_t *dba_lengths, uint8_t *dba_values, int16_t *mask) { int16_t excite[50]; int bin, k; int bndstrt, bndend, begin, end1, tmp; int lowcomp, fastleak, slowleak; bndstrt = bin_to_band_tab[start]; bndend = bin_to_band_tab[end-1] + 1; if (bndstrt == 0) { lowcomp = 0; lowcomp = calc_lowcomp1(lowcomp, band_psd[0], band_psd[1], 384); excite[0] = band_psd[0] - fast_gain - lowcomp; lowcomp = calc_lowcomp1(lowcomp, band_psd[1], band_psd[2], 384); excite[1] = band_psd[1] - fast_gain - lowcomp; begin = 7; for (bin = 2; bin < 7; bin++) { if (!(is_lfe && bin == 6)) lowcomp = calc_lowcomp1(lowcomp, band_psd[bin], band_psd[bin+1], 384); fastleak = band_psd[bin] - fast_gain; slowleak = band_psd[bin] - s->slow_gain; excite[bin] = fastleak - lowcomp; if (!(is_lfe && bin == 6)) { if (band_psd[bin] <= band_psd[bin+1]) { begin = bin + 1; break; } } } end1=bndend; if (end1 > 22) end1=22; for (bin = begin; bin < end1; bin++) { if (!(is_lfe && bin == 6)) lowcomp = calc_lowcomp(lowcomp, band_psd[bin], band_psd[bin+1], bin); fastleak = FFMAX(fastleak - s->fast_decay, band_psd[bin] - fast_gain); slowleak = FFMAX(slowleak - s->slow_decay, band_psd[bin] - s->slow_gain); excite[bin] = FFMAX(fastleak - lowcomp, slowleak); } begin = 22; } else { begin = bndstrt; fastleak = (s->cpl_fast_leak << 8) + 768; slowleak = (s->cpl_slow_leak << 8) + 768; } for (bin = begin; bin < bndend; bin++) { fastleak = FFMAX(fastleak - s->fast_decay, band_psd[bin] - fast_gain); slowleak = FFMAX(slowleak - s->slow_decay, band_psd[bin] - s->slow_gain); excite[bin] = FFMAX(fastleak, slowleak); } for (bin = bndstrt; bin < bndend; bin++) { tmp = s->db_per_bit - band_psd[bin]; if (tmp > 0) { excite[bin] += tmp >> 2; } mask[bin] = FFMAX(ff_ac3_hearing_threshold_tab[bin >> s->sr_shift][s->sr_code], excite[bin]); } if (dba_mode == DBA_REUSE || dba_mode == DBA_NEW) { int band, seg, delta; band = 0; for (seg = 0; seg < dba_nsegs; seg++) { band += dba_offsets[seg]; if (dba_values[seg] >= 4) { delta = (dba_values[seg] - 3) << 7; } else { delta = (dba_values[seg] - 4) << 7; } for (k = 0; k < dba_lengths[seg]; k++) { mask[band] += delta; band++; } } } }
1threat
program compiles and runs but after sometime it stops working in cpp ,using typedef keyword : <p>i am using this code but it is not running. it is not running in Dev C++. it runs then blows up. </p> <pre><code>#include &lt;iostream&gt; using namespace std; struct Node { struct Node* left; int data; struct Node* right; }; typedef struct Node *node; int main() { node n; n-&gt;data = 4; cout &lt;&lt; n-&gt;data &lt;&lt; endl; return 0; } </code></pre>
0debug
Android: AnimatedVectorDrawable Loop : <p>I'm playing around with AnimatedVectorDrawables using <a href="https://shapeshifter.design/" rel="noreferrer">https://shapeshifter.design/</a> The exported file I got is below. My research Tells me that in order to loop an animations i should add <em>android:repeatCount="infinite"</em> and <em>android:repeatMode="restart"</em> to the objectAnimator. </p> <p>Adding this to the objectAnimator only repeats one of these items out of series. <strong>How would I loop the entire series of animations?</strong> I want the animation to start on load and repeat.</p> <h2>Animation XML</h2> <pre><code>&lt;animated-vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"&gt; &lt;aapt:attr name="android:drawable"&gt; &lt;vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="50dp" android:height="50dp" android:viewportWidth="50" android:viewportHeight="50"&gt; &lt;path android:name="_x34_" android:pathData="M 25 12.3 L 39.7 37.7 L 10.3 37.7 Z" android:fillColor="#ffffff" android:strokeColor="#000000" android:strokeWidth="1" android:strokeLineCap="round" android:strokeLineJoin="round" android:strokeMiterLimit="10"/&gt; &lt;/vector&gt; &lt;/aapt:attr&gt; &lt;target android:name="_x34_"&gt; &lt;aapt:attr name="android:animation"&gt; &lt;set xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;objectAnimator android:propertyName="pathData" android:duration="1000" android:valueFrom="M 25 12.3 L 39.7 37.7 L 10.3 37.7 L 17.397 25.437 Z" android:valueTo="M 10 10 L 40 10 L 40 40 L 10 40 Z" android:valueType="pathType" android:interpolator="@android:anim/overshoot_interpolator"/&gt; &lt;objectAnimator android:propertyName="pathData" android:startOffset="1000" android:duration="1000" android:valueFrom="M 40 10 L 25.581 10 L 10 10 L 10 40 L 25.349 40 L 40 40 L 40 10" android:valueTo="M 36.3 18.7 L 25 10.4 L 13.7 18.7 L 12.8 31.5 L 25 39.6 L 37.2 31.5 L 36.3 18.7" android:valueType="pathType" android:interpolator="@android:interpolator/fast_out_slow_in"/&gt; &lt;objectAnimator android:propertyName="pathData" android:startOffset="2000" android:duration="1000" android:valueFrom="M 36.3 18.7 L 25 10.4 L 13.7 18.7 L 12.8 31.5 L 25 39.6 L 37.2 31.5 Z" android:valueTo="M 25 10.2 L 12.2 17.6 L 12.2 32.4 L 25 39.8 L 37.8 32.4 L 37.8 17.6 Z" android:valueType="pathType" android:interpolator="@android:anim/overshoot_interpolator"/&gt; &lt;objectAnimator android:propertyName="pathData" android:startOffset="3000" android:duration="1000" android:valueFrom="M 31.365 13.88 L 25 10.2 L 18.268 14.092 L 12.2 17.6 L 12.2 25.465 L 12.2 32.4 L 25 39.8 L 37.8 32.4 L 37.8 25.581 L 37.8 17.6 L 31.365 13.88" android:valueTo="M 33.7 13 L 25 10.2 L 16.3 13 L 10.9 20.4 L 10.9 29.6 L 16.3 37 L 25 39.8 L 33.7 37 L 39.1 29.6 L 39.1 20.4 L 33.7 13" android:valueType="pathType" android:interpolator="@android:anim/decelerate_interpolator"/&gt; &lt;objectAnimator android:propertyName="pathData" android:startOffset="4000" android:duration="1000" android:valueFrom="M 39.1 20.4 L 33.7 13 L 25 10.2 L 16.3 13 L 10.9 20.4 L 10.9 29.6 L 16.3 37 L 25 39.8 L 33.7 37 L 39.1 29.6 L 39.1 20.4" android:valueTo="M 39.7 20 L 32.199 16.173 L 25 12.5 L 17.885 16.13 L 10.3 20 L 10 31 L 16.994 34.031 L 25 37.5 L 32.948 34.056 L 40 31 L 39.7 20" android:valueType="pathType" android:interpolator="@android:interpolator/fast_out_slow_in"/&gt; &lt;objectAnimator android:propertyName="pathData" android:startOffset="5000" android:duration="1000" android:valueFrom="M 10.3 20 L 25 12.5 L 39.7 20 L 40 31 L 25 37.5 L 10 31 L 10.3 20" android:valueTo="M 17.995 24.403 L 25 12.3 L 32.23 24.792 L 39.7 37.7 L 25.581 37.7 L 10.3 37.7 L 17.995 24.403" android:valueType="pathType" android:interpolator="@android:interpolator/fast_out_slow_in"/&gt; &lt;/set&gt; &lt;/aapt:attr&gt; &lt;/target&gt; &lt;/animated-vector&gt; </code></pre> <h2>My java code for implementing the Animation is as follows:</h2> <pre><code>final ImageView animationView = (ImageView) findViewById(R.id.animationView); final AnimatedVectorDrawable drawable = (AnimatedVectorDrawable) getDrawable(R.drawable.avd_dice); animationView.setImageDrawable(drawable); drawable.start(); </code></pre>
0debug
Exclude holidays between 2 Dates [Might Be Duplicated] : I have searched all over the Internet, and I finally this piece of code in [Weekend Exclusion][1]. OR function calcBusinessDays(dDate1, dDate2) { // input given as Date objects var iWeeks, iDateDiff, iAdjust = 0; if (dDate2 < dDate1) return -1; // error code if dates transposed var iWeekday1 = dDate1.getDay(); // day of week var iWeekday2 = dDate2.getDay(); iWeekday1 = (iWeekday1 == 0) ? 7 : iWeekday1; // change Sunday from 0 to 7 iWeekday2 = (iWeekday2 == 0) ? 7 : iWeekday2; if ((iWeekday1 > 5) && (iWeekday2 > 5)) iAdjust = 1; // adjustment if both days on weekend iWeekday1 = (iWeekday1 > 5) ? 5 : iWeekday1; // only count weekdays iWeekday2 = (iWeekday2 > 5) ? 5 : iWeekday2; // calculate differnece in weeks (1000mS * 60sec * 60min * 24hrs * 7 days = 604800000) iWeeks = Math.floor((dDate2.getTime() - dDate1.getTime()) / 604800000) if (iWeekday1 <= iWeekday2) { iDateDiff = (iWeeks * 5) + (iWeekday2 - iWeekday1) } else { iDateDiff = ((iWeeks + 1) * 5) - (iWeekday1 - iWeekday2) } iDateDiff -= iAdjust // take into account both days on weekend return (iDateDiff + 1); // add 1 because dates are inclusive } I have no idea how to add codes to exclude the holiday. I understand I have to create an array to store the holidays, but after that I stuck at the point. I need your help, much appreciated. [1]: https://stackoverflow.com/questions/3464268/find-day-difference-between-two-dates-excluding-weekend-days?noredirect=1&lq=1
0debug
How to convert singleton array to a scalar value in Python? : <p>Suppose I have 1x1x1x1x... array and wish to convert it to scalar?</p> <p>How do I do it?</p> <p><code>squeeze</code> does not help.</p> <pre><code>import numpy as np matrix = np.array([[1]]) s = np.squeeze(matrix) print type(s) print s matrix = [[1]] print type(s) print s s = 1 print type(s) print s </code></pre>
0debug
void async_context_pop(void) { }
1threat
Please Help me with my Code : Please Help me i want to do when any person Click on any paymnet icon and do click on next i want to send on next page how i can do this? Please Help me <div class="container"> <div class="row"> <div class="paymentCont"> <div class="headingWrap"> <h3 class="headingTop text-center">Select Your Payment Method</h3> <p class="text-center">Created with bootsrap button and using radio button</p> </div> <div class="paymentWrap"> <div class="btn-group paymentBtnGroup btn-group-justified" data-toggle="buttons"> <label class="btn paymentMethod active"> <div class="method visa"></div> <input type="radio" name="options" checked> </label> <label class="btn paymentMethod"> <div class="method master-card"></div> <input type="radio" name="options"> </label> <label class="btn paymentMethod"> <div class="method amex"></div> <input type="radio" name="options"> </label> <label class="btn paymentMethod"> <div class="method vishwa"></div> <input type="radio" name="options"> </label> <label class="btn paymentMethod"> <div class="method ez-cash"></div> <input type="radio" name="options"> </label> </div> </div> <div class="footerNavWrap clearfix"> <div class="btn btn-success pull-left btn-fyi"><span class="glyphicon glyphicon-chevron-left"></span> CONTINUE SHOPPING</div> <div class="btn btn-success pull-right btn-fyi">Next<span class="glyphicon glyphicon-chevron-right"></span></div> </div> </div> </div> </div> Please Help me
0debug
static inline int read_line(AVFormatContext *s, char *rbuf, const int rbufsize, int *rbuflen) { RTSPState *rt = s->priv_data; int idx = 0; int ret = 0; *rbuflen = 0; do { ret = ffurl_read_complete(rt->rtsp_hd, rbuf + idx, 1); if (ret < 0) return ret; if (rbuf[idx] == '\r') { } else if (rbuf[idx] == '\n') { rbuf[idx] = '\0'; *rbuflen = idx; return 0; } else idx++; } while (idx < rbufsize); av_log(s, AV_LOG_ERROR, "Message too long\n"); return AVERROR(EIO); }
1threat
convert char* to int in C : Is there any way to convert char* to int? Got string(string1) of characters received from UART this string looks like: {3600,32,300} char t1_s[32],t2_s[32],t3_s[32]; static char string1[15]; strcpy(t3_s, strtok(string1 , ",")); strcpy(t2_s, strtok(NULL , ",")); strcpy(t1_s, strtok(NULL , ",")); t1= t1_s - '0'; t2= t2_s - '0'; t3= t3_s - '0'; and compiller get warning #515-D a value of type "char *" cannot be assigned to an entity of type "int" main.c Need to get values t1_s,t2_s,t3_s to integer.
0debug
Can I develop a private action only accessible via my google home or linked account? : <p>I have raspberry pi controlling my garage door and I want to be able to have an action to open or close it via google home / assistant. </p> <p>This action is custom and only specific to my needs and I'd like to be able to leverage google to interact with it, but I don't want to publish it for others since it is custom for me. Can this be done? I believe with Alexa it is possible and a quick browse through the docs nothing jumped out at me for this scenario.</p>
0debug
RxFilterInfoList *qmp_query_rx_filter(bool has_name, const char *name, Error **errp) { NetClientState *nc; RxFilterInfoList *filter_list = NULL, *last_entry = NULL; QTAILQ_FOREACH(nc, &net_clients, next) { RxFilterInfoList *entry; RxFilterInfo *info; if (has_name && strcmp(nc->name, name) != 0) { continue; } if (nc->info->type != NET_CLIENT_OPTIONS_KIND_NIC) { if (has_name) { error_setg(errp, "net client(%s) isn't a NIC", name); break; } continue; } if (nc->info->query_rx_filter) { info = nc->info->query_rx_filter(nc); entry = g_malloc0(sizeof(*entry)); entry->value = info; if (!filter_list) { filter_list = entry; } else { last_entry->next = entry; } last_entry = entry; } else if (has_name) { error_setg(errp, "net client(%s) doesn't support" " rx-filter querying", name); break; } if (has_name) { break; } } if (filter_list == NULL && !error_is_set(errp) && has_name) { error_setg(errp, "invalid net client name: %s", name); } return filter_list; }
1threat
static int qemu_rbd_set_conf(rados_t cluster, const char *conf) { char *p, *buf; char name[RBD_MAX_CONF_NAME_SIZE]; char value[RBD_MAX_CONF_VAL_SIZE]; int ret = 0; buf = g_strdup(conf); p = buf; while (p) { ret = qemu_rbd_next_tok(name, sizeof(name), p, '=', "conf option name", &p); if (ret < 0) { break; } if (!p) { error_report("conf option %s has no value", name); ret = -EINVAL; break; } ret = qemu_rbd_next_tok(value, sizeof(value), p, ':', "conf option value", &p); if (ret < 0) { break; } if (strcmp(name, "conf")) { ret = rados_conf_set(cluster, name, value); if (ret < 0) { error_report("invalid conf option %s", name); ret = -EINVAL; break; } } else { ret = rados_conf_read_file(cluster, value); if (ret < 0) { error_report("error reading conf file %s", value); break; } } } g_free(buf); return ret; }
1threat
static void compute_antialias_integer(MPADecodeContext *s, GranuleDef *g) { int32_t *ptr, *csa; int n, i; if (g->block_type == 2) { if (!g->switch_point) return; n = 1; } else { n = SBLIMIT - 1; } ptr = g->sb_hybrid + 18; for(i = n;i > 0;i--) { int tmp0, tmp1, tmp2; csa = &csa_table[0][0]; #define INT_AA(j) \ tmp0 = 4*(ptr[-1-j]);\ tmp1 = 4*(ptr[ j]);\ tmp2= MULH(tmp0 + tmp1, csa[0+4*j]);\ ptr[-1-j] = tmp2 - MULH(tmp1, csa[2+4*j]);\ ptr[ j] = tmp2 + MULH(tmp0, csa[3+4*j]); INT_AA(0) INT_AA(1) INT_AA(2) INT_AA(3) INT_AA(4) INT_AA(5) INT_AA(6) INT_AA(7) ptr += 18; } }
1threat
int net_init_l2tpv3(const NetClientOptions *opts, const char *name, NetClientState *peer) { const NetdevL2TPv3Options *l2tpv3; NetL2TPV3State *s; NetClientState *nc; int fd = -1, gairet; struct addrinfo hints; struct addrinfo *result = NULL; char *srcport, *dstport; nc = qemu_new_net_client(&net_l2tpv3_info, peer, "l2tpv3", name); s = DO_UPCAST(NetL2TPV3State, nc, nc); s->queue_head = 0; s->queue_tail = 0; s->header_mismatch = false; assert(opts->kind == NET_CLIENT_OPTIONS_KIND_L2TPV3); l2tpv3 = opts->l2tpv3; if (l2tpv3->has_ipv6 && l2tpv3->ipv6) { s->ipv6 = l2tpv3->ipv6; } else { s->ipv6 = false; } if ((l2tpv3->has_offset) && (l2tpv3->offset > 256)) { error_report("l2tpv3_open : offset must be less than 256 bytes"); goto outerr; } if (l2tpv3->has_rxcookie || l2tpv3->has_txcookie) { if (l2tpv3->has_rxcookie && l2tpv3->has_txcookie) { s->cookie = true; } else { goto outerr; } } else { s->cookie = false; } if (l2tpv3->has_cookie64 || l2tpv3->cookie64) { s->cookie_is_64 = true; } else { s->cookie_is_64 = false; } if (l2tpv3->has_udp && l2tpv3->udp) { s->udp = true; if (!(l2tpv3->has_srcport && l2tpv3->has_dstport)) { error_report("l2tpv3_open : need both src and dst port for udp"); goto outerr; } else { srcport = l2tpv3->srcport; dstport = l2tpv3->dstport; } } else { s->udp = false; srcport = NULL; dstport = NULL; } s->offset = 4; s->session_offset = 0; s->cookie_offset = 4; s->counter_offset = 4; s->tx_session = l2tpv3->txsession; if (l2tpv3->has_rxsession) { s->rx_session = l2tpv3->rxsession; } else { s->rx_session = s->tx_session; } if (s->cookie) { s->rx_cookie = l2tpv3->rxcookie; s->tx_cookie = l2tpv3->txcookie; if (s->cookie_is_64 == true) { s->offset += 8; s->counter_offset += 8; } else { s->offset += 4; s->counter_offset += 4; } } memset(&hints, 0, sizeof(hints)); if (s->ipv6) { hints.ai_family = AF_INET6; } else { hints.ai_family = AF_INET; } if (s->udp) { hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = 0; s->offset += 4; s->counter_offset += 4; s->session_offset += 4; s->cookie_offset += 4; } else { hints.ai_socktype = SOCK_RAW; hints.ai_protocol = IPPROTO_L2TP; } gairet = getaddrinfo(l2tpv3->src, srcport, &hints, &result); if ((gairet != 0) || (result == NULL)) { error_report( "l2tpv3_open : could not resolve src, errno = %s", gai_strerror(gairet) ); goto outerr; } fd = socket(result->ai_family, result->ai_socktype, result->ai_protocol); if (fd == -1) { fd = -errno; error_report("l2tpv3_open : socket creation failed, errno = %d", -fd); goto outerr; } if (bind(fd, (struct sockaddr *) result->ai_addr, result->ai_addrlen)) { error_report("l2tpv3_open : could not bind socket err=%i", errno); goto outerr; } if (result) { freeaddrinfo(result); } memset(&hints, 0, sizeof(hints)); if (s->ipv6) { hints.ai_family = AF_INET6; } else { hints.ai_family = AF_INET; } if (s->udp) { hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = 0; } else { hints.ai_socktype = SOCK_RAW; hints.ai_protocol = IPPROTO_L2TP; } result = NULL; gairet = getaddrinfo(l2tpv3->dst, dstport, &hints, &result); if ((gairet != 0) || (result == NULL)) { error_report( "l2tpv3_open : could not resolve dst, error = %s", gai_strerror(gairet) ); goto outerr; } s->dgram_dst = g_malloc(sizeof(struct sockaddr_storage)); memset(s->dgram_dst, '\0' , sizeof(struct sockaddr_storage)); memcpy(s->dgram_dst, result->ai_addr, result->ai_addrlen); s->dst_size = result->ai_addrlen; if (result) { freeaddrinfo(result); } if (l2tpv3->has_counter && l2tpv3->counter) { s->has_counter = true; s->offset += 4; } else { s->has_counter = false; } if (l2tpv3->has_pincounter && l2tpv3->pincounter) { s->has_counter = true; s->pin_counter = true; } else { s->pin_counter = false; } if (l2tpv3->has_offset) { s->offset += l2tpv3->offset; } if ((s->ipv6) || (s->udp)) { s->header_size = s->offset; } else { s->header_size = s->offset + sizeof(struct iphdr); } s->msgvec = build_l2tpv3_vector(s, MAX_L2TPV3_MSGCNT); s->vec = g_malloc(sizeof(struct iovec) * MAX_L2TPV3_IOVCNT); s->header_buf = g_malloc(s->header_size); qemu_set_nonblock(fd); s->fd = fd; s->counter = 0; l2tpv3_read_poll(s, true); snprintf(s->nc.info_str, sizeof(s->nc.info_str), "l2tpv3: connected"); return 0; outerr: qemu_del_net_client(nc); if (fd > 0) { close(fd); } if (result) { freeaddrinfo(result); } return -1; }
1threat
static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width) { #ifdef HAVE_MMX asm volatile( "mov %4, %%"REG_a" \n\t" "movq "MANGLE(w1111)", %%mm5 \n\t" "movq "MANGLE(bgr2UCoeff)", %%mm6 \n\t" "pxor %%mm7, %%mm7 \n\t" "lea (%%"REG_a", %%"REG_a", 2), %%"REG_b" \n\t" "add %%"REG_b", %%"REG_b" \n\t" ".balign 16 \n\t" "1: \n\t" PREFETCH" 64(%0, %%"REG_b") \n\t" PREFETCH" 64(%1, %%"REG_b") \n\t" #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) "movq (%0, %%"REG_b"), %%mm0 \n\t" "movq (%1, %%"REG_b"), %%mm1 \n\t" "movq 6(%0, %%"REG_b"), %%mm2 \n\t" "movq 6(%1, %%"REG_b"), %%mm3 \n\t" PAVGB(%%mm1, %%mm0) PAVGB(%%mm3, %%mm2) "movq %%mm0, %%mm1 \n\t" "movq %%mm2, %%mm3 \n\t" "psrlq $24, %%mm0 \n\t" "psrlq $24, %%mm2 \n\t" PAVGB(%%mm1, %%mm0) PAVGB(%%mm3, %%mm2) "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" #else "movd (%0, %%"REG_b"), %%mm0 \n\t" "movd (%1, %%"REG_b"), %%mm1 \n\t" "movd 3(%0, %%"REG_b"), %%mm2 \n\t" "movd 3(%1, %%"REG_b"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "paddw %%mm1, %%mm0 \n\t" "paddw %%mm3, %%mm2 \n\t" "paddw %%mm2, %%mm0 \n\t" "movd 6(%0, %%"REG_b"), %%mm4 \n\t" "movd 6(%1, %%"REG_b"), %%mm1 \n\t" "movd 9(%0, %%"REG_b"), %%mm2 \n\t" "movd 9(%1, %%"REG_b"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "paddw %%mm1, %%mm4 \n\t" "paddw %%mm3, %%mm2 \n\t" "paddw %%mm4, %%mm2 \n\t" "psrlw $2, %%mm0 \n\t" "psrlw $2, %%mm2 \n\t" #endif "movq "MANGLE(bgr2VCoeff)", %%mm1 \n\t" "movq "MANGLE(bgr2VCoeff)", %%mm3 \n\t" "pmaddwd %%mm0, %%mm1 \n\t" "pmaddwd %%mm2, %%mm3 \n\t" "pmaddwd %%mm6, %%mm0 \n\t" "pmaddwd %%mm6, %%mm2 \n\t" #ifndef FAST_BGR2YV12 "psrad $8, %%mm0 \n\t" "psrad $8, %%mm1 \n\t" "psrad $8, %%mm2 \n\t" "psrad $8, %%mm3 \n\t" #endif "packssdw %%mm2, %%mm0 \n\t" "packssdw %%mm3, %%mm1 \n\t" "pmaddwd %%mm5, %%mm0 \n\t" "pmaddwd %%mm5, %%mm1 \n\t" "packssdw %%mm1, %%mm0 \n\t" "psraw $7, %%mm0 \n\t" #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) "movq 12(%0, %%"REG_b"), %%mm4 \n\t" "movq 12(%1, %%"REG_b"), %%mm1 \n\t" "movq 18(%0, %%"REG_b"), %%mm2 \n\t" "movq 18(%1, %%"REG_b"), %%mm3 \n\t" PAVGB(%%mm1, %%mm4) PAVGB(%%mm3, %%mm2) "movq %%mm4, %%mm1 \n\t" "movq %%mm2, %%mm3 \n\t" "psrlq $24, %%mm4 \n\t" "psrlq $24, %%mm2 \n\t" PAVGB(%%mm1, %%mm4) PAVGB(%%mm3, %%mm2) "punpcklbw %%mm7, %%mm4 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" #else "movd 12(%0, %%"REG_b"), %%mm4 \n\t" "movd 12(%1, %%"REG_b"), %%mm1 \n\t" "movd 15(%0, %%"REG_b"), %%mm2 \n\t" "movd 15(%1, %%"REG_b"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "paddw %%mm1, %%mm4 \n\t" "paddw %%mm3, %%mm2 \n\t" "paddw %%mm2, %%mm4 \n\t" "movd 18(%0, %%"REG_b"), %%mm5 \n\t" "movd 18(%1, %%"REG_b"), %%mm1 \n\t" "movd 21(%0, %%"REG_b"), %%mm2 \n\t" "movd 21(%1, %%"REG_b"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm5 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "paddw %%mm1, %%mm5 \n\t" "paddw %%mm3, %%mm2 \n\t" "paddw %%mm5, %%mm2 \n\t" "movq "MANGLE(w1111)", %%mm5 \n\t" "psrlw $2, %%mm4 \n\t" "psrlw $2, %%mm2 \n\t" #endif "movq "MANGLE(bgr2VCoeff)", %%mm1 \n\t" "movq "MANGLE(bgr2VCoeff)", %%mm3 \n\t" "pmaddwd %%mm4, %%mm1 \n\t" "pmaddwd %%mm2, %%mm3 \n\t" "pmaddwd %%mm6, %%mm4 \n\t" "pmaddwd %%mm6, %%mm2 \n\t" #ifndef FAST_BGR2YV12 "psrad $8, %%mm4 \n\t" "psrad $8, %%mm1 \n\t" "psrad $8, %%mm2 \n\t" "psrad $8, %%mm3 \n\t" #endif "packssdw %%mm2, %%mm4 \n\t" "packssdw %%mm3, %%mm1 \n\t" "pmaddwd %%mm5, %%mm4 \n\t" "pmaddwd %%mm5, %%mm1 \n\t" "add $24, %%"REG_b" \n\t" "packssdw %%mm1, %%mm4 \n\t" "psraw $7, %%mm4 \n\t" "movq %%mm0, %%mm1 \n\t" "punpckldq %%mm4, %%mm0 \n\t" "punpckhdq %%mm4, %%mm1 \n\t" "packsswb %%mm1, %%mm0 \n\t" "paddb "MANGLE(bgr2UVOffset)", %%mm0 \n\t" "movd %%mm0, (%2, %%"REG_a") \n\t" "punpckhdq %%mm0, %%mm0 \n\t" "movd %%mm0, (%3, %%"REG_a") \n\t" "add $4, %%"REG_a" \n\t" " js 1b \n\t" : : "r" (src1+width*6), "r" (src2+width*6), "r" (dstU+width), "r" (dstV+width), "g" ((long)-width) : "%"REG_a, "%"REG_b ); #else int i; for(i=0; i<width; i++) { int b= src1[6*i + 0] + src1[6*i + 3] + src2[6*i + 0] + src2[6*i + 3]; int g= src1[6*i + 1] + src1[6*i + 4] + src2[6*i + 1] + src2[6*i + 4]; int r= src1[6*i + 2] + src1[6*i + 5] + src2[6*i + 2] + src2[6*i + 5]; dstU[i]= ((RU*r + GU*g + BU*b)>>(RGB2YUV_SHIFT+2)) + 128; dstV[i]= ((RV*r + GV*g + BV*b)>>(RGB2YUV_SHIFT+2)) + 128; } #endif }
1threat
CoreData: annotation: Failed to load optimized model (React Native) : <p>I can not start my react native application anymore. I updated XCode yesterday, maybe it has to do with it?</p> <pre><code>$ react-native run-ios Found Xcode workspace xyz.xcworkspace CoreData: annotation: Failed to load optimized model at path '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsPackaging.framework/Versions/A/Resources /XRPackageModel.momd/XRPackageModel 9.0.omo' dyld: Symbol not found: _SimAudioHostUseSystemDefaultDeviceUID Referenced from: /Applications/Xcode.app/Contents/Developer/usr/bin/../../Library/PrivateFrameworks/SimulatorKit.framework/Versions/A/SimulatorKit (which was built for Mac OS X 10.12) Expected in: /Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator in /Applications/Xcode.app/Contents/Developer/usr/bin/../../Library/PrivateFrameworks/SimulatorKit.framework/Versions/A/SimulatorKit </code></pre>
0debug
Convert Text To Varchar : <p>In <code>Postgresql</code> how do you convert a text field to a varchar? I have tried both of the below, but neither convert my text field to varchar.</p> <pre><code>Cast(Iamtextfield As Varchar) Char(Iamtextfield) </code></pre>
0debug
How to change 'eol' for all files from CLRF to LF in Visual Studio Code : <p>I had change the default eol from CRLF to LF, but this only applies to the new file. I would like to know how to change the eol for all the files at once as I have more than hundred of files and it will be hard to do it manually. Thanks</p>
0debug
Get Json value where key1=value1 and key2=value2 : I'm trying to parse a more complex Json with ruby: "data": [{ "resourceId": 381, "resourceName": "Admin.Config", "resourceDesc": "Correspondence Admin -> Configuration", "permissions": [{ "id": 1081, "operation": "Update", "assignedToRoleFlag": false }, { "id": 1071, "operation": "Read", "assignedToRoleFlag": false }], "productName": "Doc" }, { "resourceId": 391, "resourceName": "Admin.Usage", "resourceDesc": "Correspondence Admin -> Usage", "permissions": [{ "id": 1091, "operation": "Read", "assignedToRoleFlag": false }], "productName": "Doc" }, ...................................... } The issue is that I want to parse this to get ['data']['permissions']['id'] where ['data']['resourceName'] = Admin.Config and ['data']['permissions']['operation'] = Read for example.
0debug
int virtqueue_pop(VirtQueue *vq, VirtQueueElement *elem) { unsigned int i, head, max; target_phys_addr_t desc_pa = vq->vring.desc; if (!virtqueue_num_heads(vq, vq->last_avail_idx)) return 0; elem->out_num = elem->in_num = 0; max = vq->vring.num; i = head = virtqueue_get_head(vq, vq->last_avail_idx++); if (vq->vdev->guest_features & (1 << VIRTIO_RING_F_EVENT_IDX)) { vring_avail_event(vq, vring_avail_idx(vq)); if (vring_desc_flags(desc_pa, i) & VRING_DESC_F_INDIRECT) { if (vring_desc_len(desc_pa, i) % sizeof(VRingDesc)) { error_report("Invalid size for indirect buffer table"); max = vring_desc_len(desc_pa, i) / sizeof(VRingDesc); desc_pa = vring_desc_addr(desc_pa, i); i = 0; do { struct iovec *sg; if (vring_desc_flags(desc_pa, i) & VRING_DESC_F_WRITE) { elem->in_addr[elem->in_num] = vring_desc_addr(desc_pa, i); sg = &elem->in_sg[elem->in_num++]; } else { elem->out_addr[elem->out_num] = vring_desc_addr(desc_pa, i); sg = &elem->out_sg[elem->out_num++]; sg->iov_len = vring_desc_len(desc_pa, i); if ((elem->in_num + elem->out_num) > max) { error_report("Looped descriptor"); } while ((i = virtqueue_next_desc(desc_pa, i, max)) != max); virtqueue_map_sg(elem->in_sg, elem->in_addr, elem->in_num, 1); virtqueue_map_sg(elem->out_sg, elem->out_addr, elem->out_num, 0); elem->index = head; vq->inuse++; trace_virtqueue_pop(vq, elem, elem->in_num, elem->out_num); return elem->in_num + elem->out_num;
1threat
void helper_rfdi(CPUPPCState *env) { do_rfi(env, env->spr[SPR_BOOKE_DSRR0], SPR_BOOKE_DSRR1, ~((target_ulong)0x3FFF0000), 0); }
1threat
static VncServerInfo2List *qmp_query_server_entry(QIOChannelSocket *ioc, bool websocket, int auth, int subauth, VncServerInfo2List *prev) { VncServerInfo2List *list; VncServerInfo2 *info; Error *err = NULL; SocketAddress *addr; addr = qio_channel_socket_get_local_address(ioc, &err); if (!addr) { error_free(err); return prev; } info = g_new0(VncServerInfo2, 1); vnc_init_basic_info(addr, qapi_VncServerInfo2_base(info), &err); qapi_free_SocketAddress(addr); if (err) { qapi_free_VncServerInfo2(info); error_free(err); return prev; } info->websocket = websocket; qmp_query_auth(auth, subauth, &info->auth, &info->vencrypt, &info->has_vencrypt); list = g_new0(VncServerInfo2List, 1); list->value = info; list->next = prev; return list; }
1threat
static void qdev_reset(void *opaque) { DeviceState *dev = opaque; if (dev->info->reset) dev->info->reset(dev); }
1threat
Why Font-face no work on IE 11? : <p>i'm creating this Web Site: <a href="http://94.177.167.40/gmmcorporate" rel="nofollow noreferrer">http://94.177.167.40/gmmcorporate</a> But my css no work on IE 11 (11.608.15063.0). It's not take correctly font-face and dropdown menu after. Can help me?</p>
0debug
static void rtl8139_cleanup(NetClientState *nc) { RTL8139State *s = qemu_get_nic_opaque(nc); s->nic = NULL; }
1threat
I want to write sas query for this senerio : proc sql; create table test as select columns name then i put a where clause for putting join between 3 tables now i want to get get those ids which are between ranges which are present in the fourth table how can i write query for it in sas please help...!
0debug
void hmp_change(Monitor *mon, const QDict *qdict) { const char *device = qdict_get_str(qdict, "device"); const char *target = qdict_get_str(qdict, "target"); const char *arg = qdict_get_try_str(qdict, "arg"); const char *read_only = qdict_get_try_str(qdict, "read-only-mode"); BlockdevChangeReadOnlyMode read_only_mode = 0; Error *err = NULL; if (strcmp(device, "vnc") == 0) { if (read_only) { monitor_printf(mon, "Parameter 'read-only-mode' is invalid for VNC\n"); return; } if (strcmp(target, "passwd") == 0 || strcmp(target, "password") == 0) { if (!arg) { monitor_read_password(mon, hmp_change_read_arg, NULL); return; } } qmp_change("vnc", target, !!arg, arg, &err); } else { if (read_only) { read_only_mode = qapi_enum_parse(BlockdevChangeReadOnlyMode_lookup, read_only, BLOCKDEV_CHANGE_READ_ONLY_MODE__MAX, BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN, &err); if (err) { hmp_handle_error(mon, &err); return; } } qmp_blockdev_change_medium(true, device, false, NULL, target, !!arg, arg, !!read_only, read_only_mode, &err); if (err && error_get_class(err) == ERROR_CLASS_DEVICE_ENCRYPTED) { error_free(err); monitor_read_block_device_key(mon, device, NULL, NULL); return; } } hmp_handle_error(mon, &err); }
1threat
Java return error? im so confused : <p>Im notsure what im doing wrong at all im probably missing something stupid getting a return error someone please help heres the console error im getting...</p> <p>starting... src\com\rs\game\npc\combat\impl\ChaosElemental.java:59: error: missing return statement } 1 error Press any key to continue...</p> <pre><code> package com.rs.game.npc.combat.impl; import java.util.ArrayList; import com.rs.game.player.Player; import com.rs.game.Entity; import com.rs.game.ForceTalk; import com.rs.game.World; import com.rs.game.Animation; import com.rs.game.Graphics; import com.rs.game.Hit; import com.rs.game.Hit.HitLook; import com.rs.game.npc.NPC; import com.rs.game.npc.combat.CombatScript; import com.rs.game.npc.combat.NPCCombatDefinitions; import com.rs.game.tasks.WorldTask; import com.rs.game.tasks.WorldTasksManager; import com.rs.utils.Utils; public class ChaosElemental extends CombatScript { @Override public Object[] getKeys() { return new Object[] { 3200 }; } @Override public int attack(NPC npc, Entity target) { NPCCombatDefinitions cdefs = npc.getCombatDefinitions(); if (Utils.random(7) == 2) { if (target instanceof Player) { delayHit(npc, 2, target, getRangeHit(npc, getRandomMaxHit(npc, 2000, NPCCombatDefinitions.RANGE, target))); World.sendProjectile(npc, target, 552, 18, 18, 50, 50, 0, 0); npc.setNextForceTalk(new ForceTalk("Charging a powerful attack...")); } } else { int rand = Utils.random(10); if (rand &lt;= 3) { delayHit(npc, 2, target, getRangeHit(npc, getRandomMaxHit(npc, 650, NPCCombatDefinitions.RANGE, target))); World.sendProjectile(npc, target, 552, 18, 18, 50, 50, 0, 0); } else if (rand &gt;= 7) { delayHit(npc,0,target,getMeleeHit(npc, getRandomMaxHit(npc, 800, NPCCombatDefinitions.MELEE, target))); } else { int damage = getRandomMaxHit(npc, 750, NPCCombatDefinitions.MAGE, target); if (damage &gt; 0) { delayHit(npc, 1, target, getMagicHit(npc, damage)); } npc.setNextForceTalk(new ForceTalk("Your gon get rekt nerd")); } } } </code></pre> <p>}</p>
0debug
static int alloc_buffer(FrameBuffer **pool, AVCodecContext *s, FrameBuffer **pbuf) { FrameBuffer *buf = av_mallocz(sizeof(*buf)); int i, ret; const int pixel_size = av_pix_fmt_descriptors[s->pix_fmt].comp[0].step_minus1+1; int h_chroma_shift, v_chroma_shift; int edge = 32; int w = s->width, h = s->height; if (!buf) return AVERROR(ENOMEM); if (!(s->flags & CODEC_FLAG_EMU_EDGE)) { w += 2*edge; h += 2*edge; } avcodec_align_dimensions(s, &w, &h); if ((ret = av_image_alloc(buf->base, buf->linesize, w, h, s->pix_fmt, 32)) < 0) { av_freep(&buf); return ret; } memset(buf->base[0], 128, ret); avcodec_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift); for (i = 0; i < FF_ARRAY_ELEMS(buf->data); i++) { const int h_shift = i==0 ? 0 : h_chroma_shift; const int v_shift = i==0 ? 0 : v_chroma_shift; if (s->flags & CODEC_FLAG_EMU_EDGE) buf->data[i] = buf->base[i]; else buf->data[i] = buf->base[i] + FFALIGN((buf->linesize[i]*edge >> v_shift) + (pixel_size*edge >> h_shift), 32); } buf->w = s->width; buf->h = s->height; buf->pix_fmt = s->pix_fmt; buf->pool = pool; *pbuf = buf; return 0; }
1threat
Hosting multiple domains on single webapp folder in tomcat : <p>Possible duplicate of <a href="https://stackoverflow.com/questions/16763938/multiple-domains-to-single-webapp-in-tomcat">this</a> but answer is not accepted.</p> <p>I have 2 scenarios</p> <ol> <li>We are building a CRM and we will be having multiple clients using same product. Lets take a example, <code>subdomain1.maindomain1.com</code> and <code>anysubmain.anothermaindomain.com</code> should be pointed to same webapp folder. And depending on domain, we will select database dynamically but codebase will remain same. <strong><em>Point to note here : Whole codebase remains same</em></strong>.</li> <li>We are building series of website for a client where part of the codebase will remain same for all but depending on subdomain we will load the default servlet file. Lets take example, <code>manage.domain.com</code> <code>crm.domain.com</code> <code>equote.domain.com</code> should be pointing to same webapp folder. And depending on domain we will load default servlet file. <strong><em>Point to note here : Part of codebase will remain same for all domains. Ex. core architect files</em></strong>.</li> </ol> <p>What solutions other have suggested</p> <ol> <li><a href="https://stackoverflow.com/a/16764089/1056620">Deploy copy of same war file 2 time, Softlink, Create 2 contexts that point to the same file, Use alias</a>. Last one can be good option but no idea how we can use this for different subdomains / domains.</li> <li><a href="https://stackoverflow.com/a/49726750/1056620">This can be one of the solution but not sure whether it will work on same port or different port </a></li> <li>There are many articles over internet which shows how we can deploy multiple webapps on multiple domain on single tomcat server but not the way i need.</li> </ol> <p>Note: I can create 2 AWS EC2 instances for above 2 scenarios. It means that I am not expecting one solution to above 2 problems.</p>
0debug
Mongodb: failed to connect to server on first connect : <p>I get the following error:</p> <pre><code>Warning { MongoError: failed to connect to server [mongodb:27017] on first connect at Pool.&lt;anonymous&gt; (/Users/michaelks/Desktop/users/node_modules/mongodb-core/lib/topologies/server.js:325:35) at emitOne (events.js:96:13) at Pool.emit (events.js:188:7) at Connection.&lt;anonymous&gt; (/Users/michaelks/Desktop/users/node_modules/mongodb-core/lib/connection/pool.js:270:12) at Connection.g (events.js:292:16) at emitTwo (events.js:106:13) at Connection.emit (events.js:191:7) at Socket.&lt;anonymous&gt; (/Users/michaelks/Desktop/users/node_modules/mongodb-core/lib/connection/connection.js:173:49) at Socket.g (events.js:292:16) at emitOne (events.js:96:13) at Socket.emit (events.js:188:7) at connectErrorNT (net.js:1025:8) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9) name: 'MongoError', message: 'failed to connect to server [mongodb:27017] on first connect' } </code></pre> <p>Even though I get this in the terminal window where I run Mongo:</p> <pre><code>2016-12-25T03:45:23.715+0100 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58868 #8 (8 connections now open) </code></pre> <p>It kinda looks like there is a connection..</p> <p>I've tried both</p> <pre><code>$ mongod </code></pre> <p>and</p> <pre><code>$ brew services start mongo </code></pre> <p>This is my test_helper.js</p> <pre><code>const mongoose = require('mongoose'); mongoose.connect('mongodb:localhost/users_test'); mongoose.connection .once('open', () =&gt; console.log('Good to go!')) .on('error', (error) =&gt; { console.warn('Warning', error); }); </code></pre> <p>I have not specifically made the db "users_test" as I am under the impression that mongoose or mongo or both will do this on the fly.</p> <p>I've tried both "localhost" and "127.0.0.1​". I'm on OSX 10.11.5 I'm running Node 7.3.0 and Mongo 3.2.9</p> <p>What am I doing wrong? How do I figure out what's wrong?</p>
0debug
what is the different between 2 $ in linux script : whats id the difference between variable $processid ($) and Date=$(date +'%m-%d-%y')($). Here we are using 2 kind of $ symbol, please let me know is the difference of thosw 2 $. Thanks in advance.
0debug