problem
stringlengths
26
131k
labels
class label
2 classes
What actually happens when we do newlink.next? Don't tell me it goes to next node .Check my class and description below : <pre><code>class Link { int data; Link next; Link(int data) { this.data=data; } public String toString() { return "{"+data+"}"; } } class MyLinkList { Link first; MyLinkList() { first=null; // list is empty } void insertFirst(int data) { Link newlink=new Link(data); newlink.next=first; first=newlink; } public String toString() { String str=""; Link current=first; while(current!=null) { str=str+ current.toString(); current=current.next; } return str; } } public class SinglyLinkedList { public static void main(String[] args) { MyLinkList list=new MyLinkList(); list.insertFirst(52); list.insertFirst(78); System.out.println(list); } } </code></pre> <p>/* This is My Linked List class which I made using java. We all know there are nodes and we traverse it. But one thing I didn't get it. Link next is used Link first is used and we use newlink.next=first; Refer to function insertFirst()</p> <p>How is it actually working ? next,newlink,first are class Link references. What actually happens inside when we do newlink.next or first.next ?</p> <p>What are nodes? Are they objects or references or what ? </p> <p>*/</p>
0debug
static void pxa2xx_pm_write(void *opaque, hwaddr addr, uint64_t value, unsigned size) { PXA2xxState *s = (PXA2xxState *) opaque; switch (addr) { case PMCR: s->pm_regs[addr >> 2] &= ~(value & 0x2a); s->pm_regs[addr >> 2] &= ~0x15; s->pm_regs[addr >> 2] |= value & 0x15; break; case PSSR: case RCSR: case PKSR: s->pm_regs[addr >> 2] &= ~value; break; default: if (!(addr & 3)) { s->pm_regs[addr >> 2] = value; break; } printf("%s: Bad register " REG_FMT "\n", __FUNCTION__, addr); break; } }
1threat
android Google Maps change MyLocation icon to Material icon : <p>I am using Google Maps API in my android app and I want to change the appearance of my location button from the old one with square to the new round material design icon.</p> <p>Current one:<br> <a href="https://i.stack.imgur.com/92zQt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/92zQt.png" alt="old"></a></p> <p>I wanna change it to this one: </p> <p><a href="https://i.stack.imgur.com/GSWXJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GSWXJ.png" alt="new"></a></p> <p>Also, how do I change its position from upper right corner to bottom right corner?</p> <p>Below is my code for XML file:</p> <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.bhoiwala.locationmocker.MapsActivity" &gt; &lt;fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:map="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/map" android:name="com.google.android.gms.maps.SupportMapFragment" android:layout_width="match_parent" android:layout_height="wrap_content" /&gt; &lt;/FrameLayout&gt; </code></pre> <p>Below is the code on how I'm using it:</p> <pre><code> private void updateLocationUI() { if (mMap == null) { return; } if (mLocationPermissionGranted) { mMap.setMyLocationEnabled(true); mMap.getUiSettings().setMyLocationButtonEnabled(true); } </code></pre> <p>Thank you :)</p>
0debug
Test database every morning : <p>I made a platform to remind me of some things I haven't done. I've stored this reminds into a database and now I want this PHP based Website to send me emails. I want to make tests to the database every morning and if I found records that are critical to send notifications to my email. How can I do this ? Thank you :) </p>
0debug
bool qht_reset_size(struct qht *ht, size_t n_elems) { struct qht_map *new; struct qht_map *map; size_t n_buckets; bool resize = false; n_buckets = qht_elems_to_buckets(n_elems); qemu_mutex_lock(&ht->lock); map = ht->map; if (n_buckets != map->n_buckets) { new = qht_map_create(n_buckets); resize = true; } qht_map_lock_buckets(map); qht_map_reset__all_locked(map); if (resize) { qht_do_resize(ht, new); } qht_map_unlock_buckets(map); qemu_mutex_unlock(&ht->lock); return resize; }
1threat
How to preserve THIS when calling a function in jasmine : I am writing tests for a service. The snippet of the service I a testing is getDesign(designId: number): Observable<any> { const params = new HttpParams().set('designId', String(designId)); return this.http .get('/get-design', { params: params }) .pipe(retry(1), map((res) => res['data'] || []), catchError(this.handleError)); } The snippet of spec file is: fit('getDesign should append params and return', () => { const response = { 'success': true, 'data': [{foo: 'bar'}], 'metadata': {'version': '1.8.25', 'versionHash': '14e456e062583f176d25'}, 'total': 0, 'message': [] }; // service.getDesign(42).subscribe((res) => { // expect(res).toEqual([{foo: 'bar'}]); // }); // // const call: TestRequest = httpMock.expectOne('/get-design?designId=42'); // expect(call.request.method).toEqual('GET'); // call.flush(response); doServiceTest(service.getDesign, response, 42, [{foo: 'bar'}], '/get-design?designId=42', 'POST'); }); function doServiceTest(myFunction: Function, myResponse, myParam, myExpected, myUrl, myMethod) { myFunction.bind(this); myFunction(myParam).subscribe((res) => { expect(res).toEqual(myExpected); }); const call: TestRequest = httpMock.expectOne(myUrl); expect(call.request.method).toEqual(myMethod); call.flush(myResponse); } The code which is commented out works just fine. I would prefer to use the other approach as I have multiple functions which vary only by "params" and "expected". But when I try this way I get an error of "TypeError: Cannot read property 'http' of undefined" which says to me that "this" reference is somehow lost. What am I doing wrong?
0debug
Which Theme Editor I can use for the develop Shopify theme? : <p>Is there any theme Editor is available for Shopify theme development? </p> <p>I have an idea for Desktop Theme Editor for the Shopify. But that Editor is used for Mac OS. If there is any other editor is available then Please suggest me. </p> <p>Thanks</p>
0debug
Data augmentation techniques for small image datasets? : <p>Currently i am training small logo datasets similar to <a href="http://www.multimedia-computing.de/flickrlogos/" rel="noreferrer">Flickrlogos-32</a> with deep CNNs. For training larger networks i need more dataset, thus using augmentation. The best i'm doing right now is using affine transformations(featurewise normalization, featurewise center, rotation, width height shift, horizontal vertical flip). But for bigger networks i need more augmentation. I tried searching on kaggle's national data science bowl's <a href="https://www.kaggle.com/c/datasciencebowl/forums/t/11360/data-augmentation" rel="noreferrer">forum</a> but couldn't get much help. There's code for some methods given <a href="https://github.com/benanne/kaggle-galaxies/blob/master/realtime_augmentation.py" rel="noreferrer">here</a> but i'm not sure what could be useful. What are some other(or better) image data augmentation techniques that could be applied to this type of(or in any general image) dataset other than affine transformations? </p>
0debug
static int mpeg_mux_write_packet(AVFormatContext *ctx, int stream_index, const uint8_t *buf, int size, int64_t pts) { MpegMuxContext *s = ctx->priv_data; AVStream *st = ctx->streams[stream_index]; StreamInfo *stream = st->priv_data; int len; while (size > 0) { if (stream->start_pts == -1) { stream->start_pts = pts; } len = s->packet_data_max_size - stream->buffer_ptr; if (len > size) len = size; memcpy(stream->buffer + stream->buffer_ptr, buf, len); stream->buffer_ptr += len; buf += len; size -= len; while (stream->buffer_ptr >= s->packet_data_max_size) { if (stream->start_pts == -1) stream->start_pts = pts; flush_packet(ctx, stream_index, 0); } } return 0; }
1threat
React Native build failed: 'React/RCTBridge.h' file not found : <p>I'm trying to build a React Native app with the following file structure:</p> <pre><code>Kurts-MacBook-Pro-2:lucy-app kurtpeek$ tree -L 1 . β”œβ”€β”€ README.md β”œβ”€β”€ __tests__ β”œβ”€β”€ android β”œβ”€β”€ app.json β”œβ”€β”€ assets β”œβ”€β”€ index.js β”œβ”€β”€ ios β”œβ”€β”€ node_modules β”œβ”€β”€ package.json β”œβ”€β”€ src └── yarn.lock </code></pre> <p>The <code>package.json</code> is</p> <pre><code>{ "name": "app", "version": "0.0.1", "private": true, "scripts": { "android": "concurrently 'emulator @Nexus_5X_API_27_x86' 'yarn android-noavd'", "android-noavd": "react-native run-android", "android-px": "concurrently 'emulator @Pixel_2_API_27' 'yarn android-noavd'", "android:release": "cross-env ENVFILE=.env.release yarn run android", "android:staging": "cross-env ENVFILE=.env.staging yarn run android", "build:android:dev": "cross-env ENVFILE=.env ./android/gradlew assembleRelease -p ./android/", "build:android:release": "cross-env ENVFILE=.env.release ./android/gradlew assembleRelease -p ./android/", "build:android:staging": "cross-env ENVFILE=.env.staging ./android/gradlew assembleRelease -p ./android/", "clean": "concurrently 'rimraf ./android/build/' 'rimraf ./ios/build/' 'rimraf node_modules/' 'yarn cache clean'", "codepush": "yarn codepush:ios; yarn codepush:android", "codepush:android": "code-push release-react Lucy-Eng/LucyApp-Android android", "codepush:ios": "code-push release-react Lucy-Eng/LucyApp-iOS ios --plistFile ios/LucyApp/Info.plist", "codepush:ls:apps": "code-push app ls", "codepush:ls:deploys": "echo iOS &amp;&amp; code-push deployment ls Lucy-Eng/LucyApp-iOS; echo ANDROID &amp;&amp; code-push deployment ls Lucy-Eng/LucyApp-Android", "codepush:promote:android": "code-push promote Lucy-Eng/LucyApp-Android Staging Production", "codepush:promote:ios": "code-push promote Lucy-Eng/LucyApp-iOS Staging Production", "ios": "react-native run-ios --simulator='iPhone 7'", "ios8": "react-native run-ios --simulator='iPhone 8'", "ios:release": "cross-env ENVFILE=.env.release yarn run ios", "ios:staging": "cross-env ENVFILE=.env.staging yarn run ios", "iosx": "react-native run-ios --simulator='iPhone X'", "lint": "eslint .", "log:android": "react-native log-android", "log:ios": "react-native log-ios", "react-devtools": "react-devtools", "start": "./node_modules/react-native/local-cli/cli.js start", "test": "jest" }, "dependencies": { "analytics-react-native": "^1.2.0", "immutability-helper": "^2.5.0", "libphonenumber-js": "^1.1.10", "lodash": "^4.17.4", "moment": "^2.19.0", "moment-timezone": "^0.5.14", "prop-types": "^15.6.0", "querystring": "^0.2.0", "raven-for-redux": "^1.3.0", "react": "^16.2.0", "react-native": "^0.53.3", "react-native-android-keyboard-adjust": "^1.1.1", "react-native-code-push": "^5.3.2", "react-native-config": "^0.11.5", "react-native-country-picker-modal": "^0.5.1", "react-native-datepicker": "^1.6.0", "react-native-intercom": "^8.0.0", "react-native-keyboard-aware-scroll-view": "^0.4.4", "react-native-markdown-renderer": "^3.1.0", "react-native-material-kit": "git://github.com/xinthink/react-native-material-kit#95b0980", "react-native-material-menu": "^0.2.3", "react-native-modal": "^4.1.1", "react-native-onesignal": "^3.0.6", "react-native-phone-input": "^0.2.1", "react-native-router-flux": "4.0.0-beta.27", "react-native-sentry": "^0.35.3", "react-native-smart-splash-screen": "^2.3.5", "react-native-snackbar": "^0.4.3", "react-native-swiper": "^1.5.13", "react-native-vector-icons": "^4.4.0", "react-navigation": "^1.5.11", "react-redux": "^5.0.6", "redux": "^3.7.2", "redux-devtools-extension": "^2.13.2", "redux-form": "^7.3.0", "redux-logger": "^3.0.6", "redux-persist": "^4.10.1", "redux-thunk": "^2.2.0", "reselect": "^3.0.1", "validator": "^10.2.0" }, "devDependencies": { "babel-core": "^6.26.3", "babel-eslint": "^8.0.1", "babel-jest": "21.2.0", "babel-preset-react-native": "4.0.0", "code-push-cli": "^2.1.6", "concurrently": "^3.5.1", "cross-env": "^5.1.4", "enzyme": "^3.1.1", "enzyme-adapter-react-16": "^1.0.4", "eslint": "^4.8.0", "eslint-config-airbnb": "^15.1.0", "eslint-import-resolver-reactnative": "^1.0.2", "eslint-plugin-import": "^2.7.0", "eslint-plugin-jsx-a11y": "^5.1.1", "eslint-plugin-react": "^7.4.0", "eslint-plugin-react-native": "^3.1.0", "jest": "21.2.1", "react-devtools": "^3.1.0", "react-dom": "^16.0.0", "react-test-renderer": "16.0.0-beta.5", "rimraf": "^2.6.2" }, "jest": { "preset": "react-native", "setupTestFrameworkScriptFile": "&lt;rootDir&gt;src/test-config/enzyme-config.js" }, "rnpm": { "assets": [ "./assets/fonts/" ] } } </code></pre> <p>and there is an <code>ios/Podfile</code> like so:</p> <pre><code>target 'LucyApp' do pod 'React', :path =&gt; '../node_modules/react-native', :subspecs =&gt; [ 'Core', 'BatchedBridge', 'DevSupport', # Include this to enable In-App Devmenu if RN &gt;= 0.43 'RCTText', 'RCTNetwork', 'RCTWebSocket', # needed for debugging # 'RCTBridge', # Add any other subspecs you want to use in your project ] # Explicitly include Yoga if you are using RN &gt;= 0.42.0 pod 'yoga', :path =&gt; '../node_modules/react-native/ReactCommon/yoga' # Third party deps podspec link pod 'Intercom' pod 'CodePush', :path =&gt; '../node_modules/react-native-code-push' pod 'SentryReactNative', :path =&gt; '../node_modules/react-native-sentry' # Add new pods below this line end </code></pre> <p>When I try to build this app in Xcode, I get an import error from <code>SentryReactNative</code>:</p> <p><a href="https://i.stack.imgur.com/IdtHH.png" rel="noreferrer"><img src="https://i.stack.imgur.com/IdtHH.png" alt="enter image description here"></a></p> <p>Similarly, when I try to run the simulator using <code>yarn ios</code>, I get the following error:</p> <pre><code>In file included from /Users/kurtpeek/Documents/Dev/lucy/lucy-app/node_modules/react-native-sentry/ios/RNSentry.m:1: In file included from /Users/kurtpeek/Documents/Dev/lucy/lucy-app/node_modules/react-native-sentry/ios/RNSentry.h:4: /Users/kurtpeek/Documents/Dev/lucy/lucy-app/node_modules/react-native/React/Base/RCTBridge.h:12:9: fatal error: 'React/RCTBridgeDelegate.h' file not found #import &lt;React/RCTBridgeDelegate.h&gt; ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ** BUILD FAILED ** The following commands produced analyzer issues: Analyze Base/RCTModuleMethod.mm normal x86_64 (1 command with analyzer issues) The following build commands failed: CompileC /Users/kurtpeek/Documents/Dev/lucy/lucy-app/ios/build/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SentryReactNative.build/Objects-normal/x86_64/RNSentryEventEmitter.o /Users/kurtpeek/Documents/Dev/lucy/lucy-app/node_modules/react-native-sentry/ios/RNSentryEventEmitter.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (1 failure) Installing build/Build/Products/Debug-iphonesimulator/LucyApp.app An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2): Failed to install the requested application An application bundle was not found at the provided path. Provide a valid path to the desired application bundle. Print: Entry, ":CFBundleIdentifier", Does Not Exist Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/LucyApp.app/Info.plist Print: Entry, ":CFBundleIdentifier", Does Not Exist error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. </code></pre> <p>Following <a href="https://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies" rel="noreferrer">https://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies</a>, I thought at first that I might need to add <code>'RCTBridge'</code> to the <code>subspec</code>s of <code>'React'</code>, which is the reason for the commented-out line in the <code>Podfile</code>. However, if I uncomment that line and try to <code>pod install</code>, I get a "CocoaPods could not find compatible versions" error:</p> <p><a href="https://i.stack.imgur.com/mDSuc.png" rel="noreferrer"><img src="https://i.stack.imgur.com/mDSuc.png" alt="enter image description here"></a></p> <p>How can I update the imports to make the app build?</p>
0debug
Why am I being cahrged on the very first day of Blumix trial? : i signed up bluemix, so i am on trial account I have started learning Kitura along the tutorial https://developer.ibm.com/swift/2016/07/06/tutorial-deploying-a-swift-to-do-list-app-to-the-cloud/#comment-2218 I uploaded the files a several time to make the server run (actually the tutorial gave me wrong link for the files) now it works. but I saw my Runtime Cost is $289. [![enter image description here][1]][1] [![enter image description here][2]][2] I have not added any support plan although I have not put my credit card info yet, is that what is going to be charged after Trial or for every month ? Why am I being charged anyway? nearly $300 is too high for testing a server. Would you explain about the Runtime Cost that I am currently being charged please? [1]: http://i.stack.imgur.com/oeCdv.jpg [2]: http://i.stack.imgur.com/d1bT2.jpg
0debug
not able to convert Strng "rejectedDate":"2018-03-29" to ZoneDate time format : java.time.format.DateTimeParseException: Text '2018-03-29 16:15:30' could not be parsed at index 10 DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd"); OffsetDateTime date = OffsetDateTime.parse(entry.getValue(), fmt); predicates.add(cb.equal(root.get(entry.getKey()), date));
0debug
Put last element of each column in quotation marks : <p>I am trying to put every last element of each column of a csv into quotation marks by using regex in Visual Studio Code. I am matching the string using <code>[^,;]+$</code> and trying to replace it by using <code>"$1"</code>. After replacing, the strings are not in order anymore and some vanish. Can anybody help me out here?</p> <p>My csv is shaped like this: </p> <pre><code>SOME_ID,SOME_ID2,SOME_ID3,NUM,CODE 1234,100,1723,1,403 1235,101,1723,2,486 1236,101,1723,3,5822 </code></pre>
0debug
C++ simple malloc and sizeof : <p>I am getting a weird result with these 2 simple lines</p> <pre><code>char* reverse = (char*) malloc(sizeof(char)*19); cout &lt;&lt; sizeof(reverse)/sizeof(char) &lt;&lt; endl; </code></pre> <p>No matter what number i put in the first line (in this example, it is 19). I always get 4 as the output. What is wrong ? Thanks.</p>
0debug
static int decoder_decode_frame(Decoder *d, void *fframe) { int got_frame = 0; AVFrame *frame = fframe; d->flushed = 0; do { int ret = -1; if (d->queue->abort_request) return -1; if (!d->packet_pending || d->queue->serial != d->pkt_serial) { AVPacket pkt; do { if (d->queue->nb_packets == 0) SDL_CondSignal(d->empty_queue_cond); if (packet_queue_get(d->queue, &pkt, 1, &d->pkt_serial) < 0) return -1; if (pkt.data == flush_pkt.data) { avcodec_flush_buffers(d->avctx); d->finished = 0; d->flushed = 1; d->next_pts = d->start_pts; d->next_pts_tb = d->start_pts_tb; } } while (pkt.data == flush_pkt.data || d->queue->serial != d->pkt_serial); av_free_packet(&d->pkt); d->pkt_temp = d->pkt = pkt; d->packet_pending = 1; } switch (d->avctx->codec_type) { case AVMEDIA_TYPE_VIDEO: ret = avcodec_decode_video2(d->avctx, frame, &got_frame, &d->pkt_temp); if (got_frame) { if (decoder_reorder_pts == -1) { frame->pts = av_frame_get_best_effort_timestamp(frame); } else if (decoder_reorder_pts) { frame->pts = frame->pkt_pts; } else { frame->pts = frame->pkt_dts; } } break; case AVMEDIA_TYPE_AUDIO: ret = avcodec_decode_audio4(d->avctx, frame, &got_frame, &d->pkt_temp); if (got_frame) { AVRational tb = (AVRational){1, frame->sample_rate}; if (frame->pts != AV_NOPTS_VALUE) frame->pts = av_rescale_q(frame->pts, d->avctx->time_base, tb); else if (frame->pkt_pts != AV_NOPTS_VALUE) frame->pts = av_rescale_q(frame->pkt_pts, av_codec_get_pkt_timebase(d->avctx), tb); else if (d->next_pts != AV_NOPTS_VALUE) frame->pts = av_rescale_q(d->next_pts, d->next_pts_tb, tb); if (frame->pts != AV_NOPTS_VALUE) { d->next_pts = frame->pts + frame->nb_samples; d->next_pts_tb = tb; } } break; case AVMEDIA_TYPE_SUBTITLE: ret = avcodec_decode_subtitle2(d->avctx, fframe, &got_frame, &d->pkt_temp); break; } if (ret < 0) { d->packet_pending = 0; } else { d->pkt_temp.dts = d->pkt_temp.pts = AV_NOPTS_VALUE; if (d->pkt_temp.data) { if (d->avctx->codec_type != AVMEDIA_TYPE_AUDIO) ret = d->pkt_temp.size; d->pkt_temp.data += ret; d->pkt_temp.size -= ret; if (d->pkt_temp.size <= 0) d->packet_pending = 0; } else { if (!got_frame) { d->packet_pending = 0; d->finished = d->pkt_serial; } } } } while (!got_frame && !d->finished); return got_frame; }
1threat
failed to resolve me.answershahriar:calligrapher:1.0 : I am trying to create a calculator. I want to add a library to add font. so I added compile 'me.answershahriar:calligraper:4.0' but I got error failed to resolve 'me.answershahriar:calligraper:4.0' - I am using android studio 2.2 and compilesdk version 28
0debug
static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size) { FLACParseContext *fpc = s->priv_data; FLACHeaderMarker *curr; int nb_headers; const uint8_t *read_end = buf; const uint8_t *read_start = buf; if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) { FLACFrameInfo fi; if (frame_header_is_valid(avctx, buf, &fi)) { s->duration = fi.blocksize; if (!avctx->sample_rate) avctx->sample_rate = fi.samplerate; if (fpc->pc->flags & PARSER_FLAG_USE_CODEC_TS){ fpc->pc->pts = fi.frame_or_sample_num; if (!fi.is_var_size) fpc->pc->pts *= fi.blocksize; } } *poutbuf = buf; *poutbuf_size = buf_size; return buf_size; } fpc->avctx = avctx; if (fpc->best_header_valid) return get_best_header(fpc, poutbuf, poutbuf_size); if (fpc->best_header && fpc->best_header->best_child) { FLACHeaderMarker *temp; FLACHeaderMarker *best_child = fpc->best_header->best_child; for (curr = fpc->headers; curr != best_child; curr = temp) { if (curr != fpc->best_header) { av_log(avctx, AV_LOG_DEBUG, "dropping low score %i frame header from offset %i to %i\n", curr->max_score, curr->offset, curr->next->offset); } temp = curr->next; av_freep(&curr->link_penalty); av_free(curr); } av_fifo_drain(fpc->fifo_buf, best_child->offset); for (curr = best_child->next; curr; curr = curr->next) curr->offset -= best_child->offset; best_child->offset = 0; fpc->headers = best_child; if (fpc->nb_headers_buffered >= FLAC_MIN_HEADERS) { fpc->best_header = best_child; return get_best_header(fpc, poutbuf, poutbuf_size); } fpc->best_header = NULL; } else if (fpc->best_header) { FLACHeaderMarker *temp; for (curr = fpc->headers; curr != fpc->best_header; curr = temp) { temp = curr->next; av_freep(&curr->link_penalty); av_free(curr); } fpc->headers = fpc->best_header->next; av_freep(&fpc->best_header->link_penalty); av_freep(&fpc->best_header); } while ((buf && buf_size && read_end < buf + buf_size && fpc->nb_headers_buffered < FLAC_MIN_HEADERS) || ((!buf || !buf_size) && !fpc->end_padded)) { int start_offset; if (!buf || !buf_size) { fpc->end_padded = 1; buf_size = MAX_FRAME_HEADER_SIZE; read_end = read_start + MAX_FRAME_HEADER_SIZE; } else { int nb_desired = FLAC_MIN_HEADERS - fpc->nb_headers_buffered + 1; read_end = read_end + FFMIN(buf + buf_size - read_end, nb_desired * FLAC_AVG_FRAME_SIZE); } if (!av_fifo_space(fpc->fifo_buf) && av_fifo_size(fpc->fifo_buf) / FLAC_AVG_FRAME_SIZE > fpc->nb_headers_buffered * 20) { goto handle_error; } if ( av_fifo_space(fpc->fifo_buf) < read_end - read_start && av_fifo_realloc2(fpc->fifo_buf, (read_end - read_start) + 2*av_fifo_size(fpc->fifo_buf)) < 0) { av_log(avctx, AV_LOG_ERROR, "couldn't reallocate buffer of size %"PTRDIFF_SPECIFIER"\n", (read_end - read_start) + av_fifo_size(fpc->fifo_buf)); goto handle_error; } if (buf && buf_size) { av_fifo_generic_write(fpc->fifo_buf, (void*) read_start, read_end - read_start, NULL); } else { int8_t pad[MAX_FRAME_HEADER_SIZE] = { 0 }; av_fifo_generic_write(fpc->fifo_buf, (void*) pad, sizeof(pad), NULL); } start_offset = av_fifo_size(fpc->fifo_buf) - ((read_end - read_start) + (MAX_FRAME_HEADER_SIZE - 1)); start_offset = FFMAX(0, start_offset); nb_headers = find_new_headers(fpc, start_offset); if (nb_headers < 0) { av_log(avctx, AV_LOG_ERROR, "find_new_headers couldn't allocate FLAC header\n"); goto handle_error; } fpc->nb_headers_buffered = nb_headers; if (!fpc->end_padded && fpc->nb_headers_buffered < FLAC_MIN_HEADERS) { if (buf && read_end < buf + buf_size) { read_start = read_end; continue; } else { goto handle_error; } } if (fpc->end_padded || fpc->nb_headers_found) score_sequences(fpc); if (fpc->end_padded) { int warp = fpc->fifo_buf->wptr - fpc->fifo_buf->buffer < MAX_FRAME_HEADER_SIZE; fpc->fifo_buf->wptr -= MAX_FRAME_HEADER_SIZE; fpc->fifo_buf->wndx -= MAX_FRAME_HEADER_SIZE; if (warp) { fpc->fifo_buf->wptr += fpc->fifo_buf->end - fpc->fifo_buf->buffer; } buf_size = 0; read_start = read_end = NULL; } } for (curr = fpc->headers; curr; curr = curr->next) { if (curr->max_score > 0 && (!fpc->best_header || curr->max_score > fpc->best_header->max_score)) { fpc->best_header = curr; } } if (fpc->best_header) { fpc->best_header_valid = 1; if (fpc->best_header->offset > 0) { av_log(avctx, AV_LOG_DEBUG, "Junk frame till offset %i\n", fpc->best_header->offset); s->duration = 0; *poutbuf_size = fpc->best_header->offset; *poutbuf = flac_fifo_read_wrap(fpc, 0, *poutbuf_size, &fpc->wrap_buf, &fpc->wrap_buf_allocated_size); return buf_size ? (read_end - buf) : (fpc->best_header->offset - av_fifo_size(fpc->fifo_buf)); } if (!buf_size) return get_best_header(fpc, poutbuf, poutbuf_size); } handle_error: *poutbuf = NULL; *poutbuf_size = 0; return buf_size ? read_end - buf : 0; }
1threat
Incorrectly overriding a package : <p>I am getting this error.</p> <blockquote> <p>03-22 11:41:20.439 20933-20933/com.androidcss.jsonexample E/RecyclerView: No adapter attached; skipping layout 03-22 11:41:20.760 20933-20933/com.androidcss.jsonexample W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView</p> </blockquote> <p><strong>MainActivity.java</strong></p> <pre><code>package com.androidcss.jsonexample; import android.app.ProgressDialog; import android.os.AsyncTask; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.widget.Toast; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { // CONNECTION_TIMEOUT and READ_TIMEOUT are in milliseconds public static final int CONNECTION_TIMEOUT = 10000; public static final int READ_TIMEOUT = 15000; private RecyclerView mRVFishPrice; private AdapterFish mAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Make call to AsyncTask new AsyncLogin().execute(); } private class AsyncLogin extends AsyncTask&lt;String, String, String&gt; { ProgressDialog pdLoading = new ProgressDialog(MainActivity.this); HttpURLConnection conn; URL url = null; @Override protected void onPreExecute() { super.onPreExecute(); //this method will be running on UI thread pdLoading.setMessage("\tLoading..."); pdLoading.setCancelable(false); pdLoading.show(); } @Override protected String doInBackground(String... params) { try { // Enter URL address where your json file resides // Even you can make call to php file which returns json data url = new URL("https://newsapi.org/v1/articles?source=the-next-web&amp;sortBy=latest&amp;apiKey=bdba5de1b490495796a1595f77ed3f37"); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); return e.toString(); } try { // Setup HttpURLConnection class to send and receive data from php and mysql conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(READ_TIMEOUT); conn.setConnectTimeout(CONNECTION_TIMEOUT); conn.setRequestMethod("GET"); // setDoOutput to true as we recieve data from json file conn.setDoOutput(true); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); return e1.toString(); } try { int response_code = conn.getResponseCode(); // Check if successful connection made if (response_code == HttpURLConnection.HTTP_OK) { // Read data sent from server InputStream input = conn.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(input)); StringBuilder result = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { result.append(line); } // Pass data to onPostExecute method return (result.toString()); } else { return ("unsuccessful"); } } catch (IOException e) { e.printStackTrace(); return e.toString(); } finally { conn.disconnect(); } } @Override protected void onPostExecute(String result) { //this method will be running on UI thread pdLoading.dismiss(); List&lt;Item&gt; data=new ArrayList&lt;&gt;(); pdLoading.dismiss(); try { JSONObject object= new JSONObject(result); JSONArray array = object.getJSONArray("articles"); // Extract data from json and store into ArrayList as class objects for(int i=0;i&lt;array.length();i++){ JSONObject json_data = array.getJSONObject(i); Item item= new Item(); item.name= json_data.getString("title"); data.add(item); } // Setup and Handover data to recyclerview mRVFishPrice = (RecyclerView)findViewById(R.id.fishPriceList); mAdapter = new AdapterFish(MainActivity.this, data); mRVFishPrice.setAdapter(mAdapter); mRVFishPrice.setLayoutManager(new LinearLayoutManager(MainActivity.this)); } catch (JSONException e) { Toast.makeText(MainActivity.this, e.toString(), Toast.LENGTH_LONG).show(); } } } } </code></pre> <p><strong>AdapterFish.java</strong></p> <pre><code>package com.androidcss.jsonexample; import android.content.Context; import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.bumptech.glide.Glide; import java.util.Collections; import java.util.List; public class AdapterFish extends RecyclerView.Adapter&lt;RecyclerView.ViewHolder&gt; { private Context context; private LayoutInflater inflater; List&lt;Item&gt; data= Collections.emptyList(); Item current; int currentPos=0; // create constructor to innitilize context and data sent from MainActivity public AdapterFish(Context context, List&lt;Item&gt; data){ this.context=context; inflater= LayoutInflater.from(context); this.data=data; } // Inflate the layout when viewholder created @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view=inflater.inflate(R.layout.card, parent,false); MyHolder holder=new MyHolder(view); return holder; } // Bind data @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { // Get current position of item in recyclerview to bind data and assign values from list MyHolder myHolder= (MyHolder) holder; Item current=data.get(position); myHolder.name.setText(current.getName()); // load image into imageview using glide /*Glide.with(context).load("http://192.168.1.7/test/images/" + current.fishImage) .placeholder(R.drawable.ic_img_error) .error(R.drawable.ic_img_error) .into(myHolder.ivFish);*/ } // return total item from List @Override public int getItemCount() { return data.size(); } class MyHolder extends RecyclerView.ViewHolder{ TextView name; // create constructor to get widget reference public MyHolder(View itemView) { super(itemView); name = (TextView)itemView.findViewById(R.id.name); } } } </code></pre> <p><strong>Item.java</strong></p> <pre><code>package com.androidcss.jsonexample; public class Item { String name; public String getName() { return name; } } </code></pre>
0debug
JQuery - Horizontally slide in div from right onClick event : <p>I have a webpage that has a list-group of Products. </p> <p>What I am trying to do is...when a viewer clicks on a product chevron, the Product List slides off to the left and the details of the products slides in from the right. Then when user clicks on details chevron, the details slide off to the right and the Product List slides in from the left.</p> <p>For example, if I had a webpage with this showing...</p> <pre><code>Product1 &gt; Product2 &gt; Product3 &gt; </code></pre> <p>When user clicks on Product2 >, the details will slide in from the right and the list will slide out to the left. And the webpage looks like this.</p> <pre><code>&lt; Product2 p2 detail1 p2 detail2 p2 detail3 </code></pre> <p>When the user clicks on &lt; Product2, the details will slide off to right and product list slide in from left.</p> <p>This is probably so simple, using .animate or the like, and is surely being done on mobile sites, but I just cannot find a good example. I've seen samples showing sliding divs horizontally, but nothing that slides off/on the page.</p> <p>Any and all help is appreciated. Thank you.</p>
0debug
Angular 7/Typescript : I have a class called `myClass` which looks like the following: ````typescript export class myClass { name: string; age: number; city: string; } ```` I have another class called `people` which looks like: ````typescript export class people { name: string; age: number; } ```` Within my `component.ts` I have declared a list of type myClass: ````typescript listMyClass : myClass[]; ```` Which is populated from `ngOnInit()` using data from an API. I want to create a method in `component.ts` which loops through the `listMyClass` and if the city matches london it gets added to a list of the `people` class. I thought I would be able to write something outside of `ngOnInit()` along the lines of: ````typescript getLondonPeople(){ listPeople : people; for (let item in listMyClass){ if(item.city == "london"){ //something like listpeople.add(item) } } } ````
0debug
void ppc_tlb_invalidate_one(CPUPPCState *env, target_ulong addr) { #if !defined(FLUSH_ALL_TLBS) PowerPCCPU *cpu = ppc_env_get_cpu(env); CPUState *cs; addr &= TARGET_PAGE_MASK; switch (env->mmu_model) { case POWERPC_MMU_SOFT_6xx: case POWERPC_MMU_SOFT_74xx: ppc6xx_tlb_invalidate_virt(env, addr, 0); if (env->id_tlbs == 1) { ppc6xx_tlb_invalidate_virt(env, addr, 1); } break; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: ppc4xx_tlb_invalidate_virt(env, addr, env->spr[SPR_40x_PID]); break; case POWERPC_MMU_REAL: cpu_abort(CPU(cpu), "No TLB for PowerPC 4xx in real mode\n"); break; case POWERPC_MMU_MPC8xx: cpu_abort(CPU(cpu), "MPC8xx MMU model is not implemented\n"); break; case POWERPC_MMU_BOOKE: cpu_abort(CPU(cpu), "BookE MMU model is not implemented\n"); break; case POWERPC_MMU_BOOKE206: cpu_abort(CPU(cpu), "BookE 2.06 MMU model is not implemented\n"); break; case POWERPC_MMU_32B: case POWERPC_MMU_601: addr &= ~((target_ulong)-1ULL << 28); cs = CPU(cpu); tlb_flush_page(cs, addr | (0x0 << 28)); tlb_flush_page(cs, addr | (0x1 << 28)); tlb_flush_page(cs, addr | (0x2 << 28)); tlb_flush_page(cs, addr | (0x3 << 28)); tlb_flush_page(cs, addr | (0x4 << 28)); tlb_flush_page(cs, addr | (0x5 << 28)); tlb_flush_page(cs, addr | (0x6 << 28)); tlb_flush_page(cs, addr | (0x7 << 28)); tlb_flush_page(cs, addr | (0x8 << 28)); tlb_flush_page(cs, addr | (0x9 << 28)); tlb_flush_page(cs, addr | (0xA << 28)); tlb_flush_page(cs, addr | (0xB << 28)); tlb_flush_page(cs, addr | (0xC << 28)); tlb_flush_page(cs, addr | (0xD << 28)); tlb_flush_page(cs, addr | (0xE << 28)); tlb_flush_page(cs, addr | (0xF << 28)); break; #if defined(TARGET_PPC64) case POWERPC_MMU_64B: case POWERPC_MMU_2_03: case POWERPC_MMU_2_06: case POWERPC_MMU_2_06a: case POWERPC_MMU_2_07: case POWERPC_MMU_2_07a: tlb_flush(CPU(cpu), 1); break; #endif default: cpu_abort(CPU(cpu), "Unknown MMU model\n"); break; } #else ppc_tlb_invalidate_all(env); #endif }
1threat
Count the text in a listbox together : <p>Hello Stackoverflow community, I have the following problem. I created a listbox with this format (the data is always different):</p> <pre><code>item1 item2 item1 item2 item1 item3 item1 </code></pre> <p>but now i want to sort this and count it together like that:</p> <pre><code>4 x item1 2 x item2 1 x item3 </code></pre> <p>I just can't think of a method that would be able to do this with a dynamic text. Thanks for all your help in advance.</p>
0debug
Is it possible to execute functions in a hosted php file from android/java? : <p>I have an amazon web services MySql database that I want to perform CRUD operations on from an android application. I think that the way to do this is through some HTTP protocol and get and post operations. However, I have access to PHP code that connects to the database and allows me to execute quires. This PHP code is hosted on an elastic beanstalk application. Someone else has used this same code to connect the database to IOS. I am just trying to figure out how it all works.</p> <p>Is it possible to use the PHP that is hosted to act as an API for me? </p> <p>--I cant post any links due to security concerns, sorry.--</p>
0debug
Vector declaration "expected parameter declarator" : <p>I have a line of code inside a class's private member variables:</p> <pre><code>vector&lt;double&gt; dQdt(3) </code></pre> <p>When compiling in xcode, this gives an error "expected parameter declarator." I think I provided sufficient info. I don't see anything wrong with this declaration. </p>
0debug
Looping through an array within a .new object : Sorry, for the awful title. I'm not sure how to even phrase this question without showing it. I'm currently trying to test out dynamic buttons for a kid app using the ruby on rails gem Rubychy. This is the way it would be done statically. keyboard = Rubychy::DataTypes::Keyboard.new( :to => 'myname', :hidden => false, :responses => [ Rubychy::DataTypes::KeyboardResponse.new( type: "text", body: blah, ), Rubychy::DataTypes::KeyboardResponse.new( type: "text", body: blah1, ) ] ) as you can see the responses are predefined. what i need to do is loop through an array and call Rubychy::DataTypes::KeyboardResponse.new() each time. While this is terribly incorrect, it shows what i need to loop. I've tried a bunch of different ways to do this and I've been caught up overtime. keyboard = Rubychy::DataTypes::Keyboard.new( :to => 'myname', :hidden => false, :responses => [ parsed_response["values"].each do |val| Rubychy::DataTypes::KeyboardResponse.new( type: "text", body: val.name, ) end ] ) Can anyone assist with this? thank you in advance.
0debug
How to call function only once in a recursive function? : I want to call recursive function only once,I tried it like we do as for static variable but it is throwing error, can anybody suggest? say I have function recur(int j); void recur(int x){ if(x==0) return; //want x to be xth fibnocci number,but only at initialization. //like x=fib(x); cout<<x<<" "; recur(x-1); } So output recur(5) must be {5,4,3 2 1} not {5,3,1}
0debug
How is this achieved using CSS Grids? : <p>I have been playing around with CSS grids and for some reason I am just not getting it. From what I have heard it should be easy so either i'm being stupid or I'm not getting it. I decided to scrap that and just ask you guys (oh powerful overlords that have helped me so many time before). </p> <p>I am trying to achieve the following:</p> <p><a href="https://i.stack.imgur.com/EmKmn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EmKmn.png" alt="enter image description here"></a> </p> <p>Massive thanks in advance. </p>
0debug
C# XML Parse Can't Get All Element : i have smailler XML file i want to parse it . <?xml version="1.0" encoding="utf-8"?> <!-- GeeSuth Checker Time --> <Geranal> <AftrNoon Min="20" StartAftrNoon="05:00:00" EndAftrNoon="11:01:00" /> <Night Min="50" StartNight="2:00:00" EndNight="6:00:00" /> <AlFajr Min="100" StartAlfajr="9:00:00" EndAlfajr="10:00:00" /> </Geranal> i want to get all the value in line , like <AftrNoon Min="20" StartAftrNoon="05:00:00" EndAftrNoon="11:01:00" /> i need save the values in string paramater :. > Min > > StartAftrNoon > > EndAftrNoon and save it in paramater ? im using this :. XmlReader ReaderXML = XmlReader.Create("Date.xml"); while (ReaderXML.Read()) { ReaderXML.IsStartElement("Geranal"); if (ReaderXML.NodeType == XmlNodeType.Element && ReaderXML.Name == "AftrNoon") { //AftarNoon Fill txt_Min_Aftrnoon.Text = ReaderXML.GetAttribute(0); dt_Aftr_start.Text = ReaderXML.GetAttribute(1); dt_aftar_End.Text = ReaderXML.GetAttribute(2); } if (ReaderXML.NodeType == XmlNodeType.Element && ReaderXML.Name == "Night") { txt_Min_Night.Text = ReaderXML.GetAttribute(0); dt_Night_Start.Text = ReaderXML.GetAttribute(1); dt_Night_end.Text = ReaderXML.GetAttribute(2); } if (ReaderXML.NodeType == XmlNodeType.Element && ReaderXML.Name == "AlFajr") { txt_Min_Fajr.Text = ReaderXML.GetAttribute(0); dt_Fajr_Start.Text = ReaderXML.GetAttribute(1); dt_fajar_end.Text = ReaderXML.GetAttribute(2); } } It's Not Working ,
0debug
void ff_simple_idct84_add(uint8_t *dest, int line_size, DCTELEM *block) { int i; for(i=0; i<4; i++) { idctRowCondDC_8(block + i*8); } for(i=0;i<8;i++) { idct4col_add(dest + i, line_size, block + i); } }
1threat
PHP - Merge inner arrays within a multi-dimensional array if a specific element matches : <p>I have an array of arrays:</p> <pre><code>Array ( [0] =&gt; Array ( [product_id] =&gt; 1 [name] =&gt; size [lang_key] =&gt; en [value] =&gt; Medium ) [1] =&gt; Array ( [product_id] =&gt; 1 [name] =&gt; colour [lang_key] =&gt; en [value] =&gt; Orange ) [2] =&gt; Array ( [product_id] =&gt; 2 [name] =&gt; size [lang_key] =&gt; en [value] =&gt; Medium ) [3] =&gt; Array ( [product_id] =&gt; 2 [name] =&gt; colour [lang_key] =&gt; en [value] =&gt; Green ) [4] =&gt; Array ( [product_id] =&gt; 3 [name] =&gt; size [lang_key] =&gt; en [value] =&gt; Medium ) [5] =&gt; Array ( [product_id] =&gt; 3 [name] =&gt; colour [lang_key] =&gt; en [value] =&gt; Pink ) ) </code></pre> <p>As you can see there are six inner arrays and the product_id field matches twice for each value, so there are three pairs.</p> <p>I'd like to merge the "name" and "value" fields of each inner array into just the value field if the "product_id" field matches.</p> <p>I'm aiming to end up with this:</p> <pre><code>Array ( [0] =&gt; Array ( [product_id] =&gt; 1 [lang_key] =&gt; en [value] =&gt; Size: Medium, Colour: Orange ) [1] =&gt; Array ( [product_id] =&gt; 2 [lang_key] =&gt; en [value] =&gt; Size: Medium, Colour: Green ) [2] =&gt; Array ( [product_id] =&gt; 2 [lang_key] =&gt; en [value] =&gt; Size: Medium, Colour: Pink ) ) </code></pre> <p>Which PHP function should I be using and how?</p>
0debug
INSERT INTO statement not working error 3134 : <p>Currently trying to get my add button to work. I'm trying to insert into a table and I'm getting a Run-Time error '3134. I've watched several youtube videos and searched here. Not sure why its erroring out. There are no prime keys associated with this table.</p> <pre><code>CurrentDb.Execute "INSERT INTO tblMemberRecords (strLastName, strTimeType, strCrewPosition, strStartTime, strStopTime, ) " &amp; _ " VALUES ('" &amp; Me.cboLastName &amp; "','" &amp; Me.cboTimeType &amp; "','" &amp; Me.strCrewPosition &amp; "','" &amp; Me.strStartTime &amp; "','" &amp; Me.strStopTime &amp; "')" </code></pre>
0debug
static int decode_extradata(AVFormatContext *s, ADTSContext *adts, uint8_t *buf, int size) { GetBitContext gb; init_get_bits(&gb, buf, size * 8); adts->objecttype = get_bits(&gb, 5) - 1; adts->sample_rate_index = get_bits(&gb, 4); adts->channel_conf = get_bits(&gb, 4); if (adts->objecttype > 3) { av_log(s, AV_LOG_ERROR, "MPEG-4 AOT %d is not allowed in ADTS\n", adts->objecttype); return -1; } if (adts->sample_rate_index == 15) { av_log(s, AV_LOG_ERROR, "Escape sample rate index illegal in ADTS\n"); return -1; } if (adts->channel_conf == 0) { ff_log_missing_feature(s, "PCE based channel configuration", 0); return -1; } adts->write_adts = 1; return 0; }
1threat
Rotating x label text in ggplot : <p>The code below should rotate and align the text labels on the x-axis, but for some reason it don't:</p> <pre><code>ggplot(res, aes(x=TOPIC,y=count), labs(x=NULL)) + scale_y_continuous(limits=c(0,130),expand=c(0,0)) + scale_x_discrete("",labels=c("ANA"="Anatomy","BEH"="Behavior","BOUND"="Boundaries", "CC"="Climate change","DIS"="Disease","EVO"="Evolution", "POPSTAT"="Pop status","POPABU"="Pop abundance", "POPTR"="Pop trend","HARV"="Harvest","HAB"="Habitat", "HABP"="Habitat protection","POLL"="Pollution", "ZOO"="Captivity","SHIP"="Shipping","TOUR"="Tourism", "REPEC"="Reprod ecology","PHYS"="Physiology","TEK"="TEK", "HWC"="HWC","PRED"="Predator-prey","METH"="Methods", "POPGEN"="Pop genetics","RESIMP"="Research impact", "ISSUE"="Other","PROT"="Protection","PA"="Protected areas", "PEFF"="Protection efficiency","MINOR"="Minor")) + theme(axis.text.x=element_text(angle=90,hjust=1)) + geom_bar(stat='identity') + theme_bw(base_size = 16) + ggtitle("Peer-reviewed papers per topic") </code></pre>
0debug
Kubernetes rolling deployments and database migrations : <p>When processing a rolling update with database migrations, how does kubernetes handle this? </p> <p>For an instance - I have an app that gets updated from app-v1 to app-v2, which includes a migration step to alter an existing table. So this would mean it requires me to run something like <code>db:migrate</code> for a rails app once deployed.</p> <p>When a rolling deployment takes place on 3 replica set. It will deploy from one pod to another. Potentially allowing PODs that don't have the new version of the app to break. </p> <p>Although this scenario is not something that happens very often. It's quite possible that it would. I would like to learn about the best/recommended approaches for this scenario.</p>
0debug
third party api parsing, xml parsing, raw data parsing, ror parsing, ror nokoigiri, third party api parsing with nokogiri : <p>I have an application in ruby on rails and have a raw format data file as a response from third party API. I want to parse that file in xml and get some element values as I am using nokogiri gem. So is there any way to parse that file?</p> <p>here is detail of nokogiri </p> <pre><code>https://github.com/sparklemotion/nokogiri </code></pre>
0debug
R ggplot put argument in or out aes : <p>I am always confused about <code>aes()</code>. which argument should be put in it and which should not. Is there some principal or rule of thumb? Thanks so much!</p>
0debug
How can I dublicate the content of one table column into another column? : This is my table "data": name | descripton ======|=========== lara | fred | todd | I want to transfer now the content of my column "name" into my column "description": name | descripton ======|=========== lara | lara fred | fred todd | todd This is my approach: update data SET description=(select name from data) > #1093 - You can't specify target table 'story_category' for update in FROM clause
0debug
Why IF statement iterate over all AND conditions even if the first is false : <p>In c# i've an IF condition like this</p> <pre><code>if(x != null &amp;&amp; x.myprop != "value") { // } </code></pre> <p>when x is null why the compiler continues after '&amp;&amp;' operator even if the condition is guarantee to be not satsfied.</p> <p>i've null exceptions if i do x.myprop when x is null, i know that '?' fix the problem but i can't understand why it continues. Sorry for my bad english.</p>
0debug
Can I use Swift to list all apps that are currently running? : <p>Am I able to use Swift code to display all apps that are currently running on an Iphone (or Ipad)? I am hoping to integrate this with an "on/off" button, but am having trouble getting the display to appear. </p>
0debug
Error in my SQL Query related to Oracle SQL Developer : I'm using Oracle SQL Developer for learning and implementing SQL Queries. But every time I try to Create Table, it gives an error and I'm not sure what's exactly I'm missing. See the image to see the error:- [SQL Error: ORA-00906: missing left parenthesis][1] [1]: https://i.stack.imgur.com/AWe2z.png
0debug
div class works with css but div class doesn't? : So i've tried marking up a letter, and I'm wondering why when I use span class, css is not implemented (date doesn't move to the left), but when I use div class, css is implemented. (date moves to the left). I assumed both should work but one is a block level element and the other is an inline. I changed this line: <div class="receiver-column"> 20 January 2016 </div> to <span class="receiver-column">20 January 2016 </span> Heres the html code: <!DOCTYPE html> <html lang = "en-US"> <head> <title> Project </title> <meta charset = "utf-8"> <meta name = "author" content = "Eleanor Gaye"> <link rel = "stylesheet" href = "css.css"> </head> <body> <p class="receiver-column"><strong>Dr. Eleanor Gaye </strong> Awesome Science faculty <br> University of Awesome <br> Bobtown, CA 99999, <br> USA <br> <strong>Tel</strong>: 123-456-7890 <br> <strong>Email</strong>: no_reply@example.com </p> <div class="receiver-column"> 20 January 2016 </div> </body> </html> here's the css code: body { max-width: 800px; margin: 0 auto; } .receiver-column { text-align: right; } h1 { font-size: 1.5em; } h2 { font-size: 1.3em; } p,ul,ol,dl,address { font-size: 1.1em; } p, li, dd, dt, address { line-height: 1.5; }
0debug
print_operand_value (char *buf, size_t bufsize, int hex, bfd_vma disp) { if (address_mode == mode_64bit) { if (hex) { char tmp[30]; int i; buf[0] = '0'; buf[1] = 'x'; snprintf_vma (tmp, sizeof(tmp), disp); for (i = 0; tmp[i] == '0' && tmp[i + 1]; i++); pstrcpy (buf + 2, bufsize - 2, tmp + i); } else { bfd_signed_vma v = disp; char tmp[30]; int i; if (v < 0) { *(buf++) = '-'; v = -disp; if (v < 0) { pstrcpy (buf, bufsize, "9223372036854775808"); return; } } if (!v) { pstrcpy (buf, bufsize, "0"); return; } i = 0; tmp[29] = 0; while (v) { tmp[28 - i] = (v % 10) + '0'; v /= 10; i++; } pstrcpy (buf, bufsize, tmp + 29 - i); } } else { if (hex) snprintf (buf, bufsize, "0x%x", (unsigned int) disp); else snprintf (buf, bufsize, "%d", (int) disp); } }
1threat
Padding time-series subsequences for LSTM-RNN training : <p>I have a dataset of time series that I use as input to an LSTM-RNN for action anticipation. The time series comprises a time of 5 seconds at 30 fps (i.e. 150 data points), and the data represents the position/movement of facial features.</p> <p>I sample additional sub-sequences of smaller length from my dataset in order to add redundancy in the dataset and reduce overfitting. In this case I know the starting and ending frame of the sub-sequences.</p> <p>In order to train the model in batches, all time series need to have the same length, and according to many papers in the literature padding should not affect the performance of the network.</p> <p>Example:</p> <p>Original sequence:</p> <pre><code> 1 2 3 4 5 6 7 8 9 10 </code></pre> <p>Subsequences:</p> <pre><code>4 5 6 7 8 9 10 2 3 4 5 6 </code></pre> <p>considering that my network is trying to <em>anticipate</em> an action (meaning that as soon as P(action) > threshold as it goes from t = 0 to T = tmax, it will predict that action) will it matter where the padding goes? </p> <p><strong>Option 1</strong>: Zeros go to substitute original values</p> <pre><code>0 0 0 4 5 6 7 0 0 0 0 0 0 0 0 0 0 8 9 10 0 2 3 4 5 6 0 0 0 0 </code></pre> <p><strong>Option 2</strong>: all zeros at the end</p> <pre><code>4 5 6 7 0 0 0 0 0 0 8 9 10 0 0 0 0 0 0 0 2 3 4 5 0 0 0 0 0 0 </code></pre> <p>Moreover, some of the time series are missing a number of frames, but it is not known which ones they are - meaning that if we only have 60 frames, we don't know whether they are taken from 0 to 2 seconds, from 1 to 3s, etc. These need to be padded before the subsequences are even taken. What is the best practice for padding in this case?</p> <p>Thank you in advance.</p>
0debug
js list of strings to string : <p>I need to convert list of strings</p> <pre><code>const ar: string[] = ['str1', 'str2'] </code></pre> <p>to a string which contains <code>ar</code> container with square brackets <code>[]</code> and quotes <code>"</code></p> <pre><code>const str: string = `["str1", "str2"]` </code></pre> <p>how to do it in proper way?</p>
0debug
static void thread_pool_co_cb(void *opaque, int ret) { ThreadPoolCo *co = opaque; co->ret = ret; qemu_coroutine_enter(co->co); }
1threat
static inline void RENAME(rgb32to24)(const uint8_t *src,uint8_t *dst,unsigned src_size) { uint8_t *dest = dst; const uint8_t *s = src; const uint8_t *end; #ifdef HAVE_MMX const uint8_t *mm_end; #endif end = s + src_size; #ifdef HAVE_MMX __asm __volatile(PREFETCH" %0"::"m"(*s):"memory"); mm_end = end - 31; while(s < mm_end) { __asm __volatile( PREFETCH" 32%1\n\t" "movq %1, %%mm0\n\t" "movq 8%1, %%mm1\n\t" "movq 16%1, %%mm4\n\t" "movq 24%1, %%mm5\n\t" "movq %%mm0, %%mm2\n\t" "movq %%mm1, %%mm3\n\t" "movq %%mm4, %%mm6\n\t" "movq %%mm5, %%mm7\n\t" "psrlq $8, %%mm2\n\t" "psrlq $8, %%mm3\n\t" "psrlq $8, %%mm6\n\t" "psrlq $8, %%mm7\n\t" "pand %2, %%mm0\n\t" "pand %2, %%mm1\n\t" "pand %2, %%mm4\n\t" "pand %2, %%mm5\n\t" "pand %3, %%mm2\n\t" "pand %3, %%mm3\n\t" "pand %3, %%mm6\n\t" "pand %3, %%mm7\n\t" "por %%mm2, %%mm0\n\t" "por %%mm3, %%mm1\n\t" "por %%mm6, %%mm4\n\t" "por %%mm7, %%mm5\n\t" "movq %%mm1, %%mm2\n\t" "movq %%mm4, %%mm3\n\t" "psllq $48, %%mm2\n\t" "psllq $32, %%mm3\n\t" "pand %4, %%mm2\n\t" "pand %5, %%mm3\n\t" "por %%mm2, %%mm0\n\t" "psrlq $16, %%mm1\n\t" "psrlq $32, %%mm4\n\t" "psllq $16, %%mm5\n\t" "por %%mm3, %%mm1\n\t" "pand %6, %%mm5\n\t" "por %%mm5, %%mm4\n\t" MOVNTQ" %%mm0, %0\n\t" MOVNTQ" %%mm1, 8%0\n\t" MOVNTQ" %%mm4, 16%0" :"=m"(*dest) :"m"(*s),"m"(mask24l), "m"(mask24h),"m"(mask24hh),"m"(mask24hhh),"m"(mask24hhhh) :"memory"); dest += 24; s += 32; } __asm __volatile(SFENCE:::"memory"); __asm __volatile(EMMS:::"memory"); #endif while(s < end) { #ifdef WORDS_BIGENDIAN s++; *dest++ = *s++; *dest++ = *s++; *dest++ = *s++; #else *dest++ = *s++; *dest++ = *s++; *dest++ = *s++; s++; #endif } }
1threat
Include/delete a checkbox automatically when a column is not empty : <p>I need to have a new checkbox automatically created in column 2 every time that column 1 is populated. Any helper, please?</p>
0debug
Pandas DataFrame column naming conventions : <p>Is there any commonly used Pandas DataFrame column naming convention? Is <a href="https://www.python.org/dev/peps/pep-0008/" rel="noreferrer">PEP8</a> recommended here (ex. instance variables)? </p> <p>Concious that lots of data is loaded from external sources with headers but I'm curious what is the correct approach when I have to name/rename the columns on my own?</p>
0debug
openssh windows bad owner or permissions : <p>I've installed openssh for windows and when I run <code>ssh localhost</code> I get </p> <blockquote> <p>Bad owner or permissions on C:\Users\gary/.ssh/config</p> </blockquote> <p>I've looked at these 2 questions <a href="https://superuser.com/questions/348694/bad-owner-or-permissions-error-using-cygwins-ssh-exe">https://superuser.com/questions/348694/bad-owner-or-permissions-error-using-cygwins-ssh-exe</a> and <a href="https://serverfault.com/questions/253313/ssh-returns-bad-owner-or-permissions-on-ssh-config">https://serverfault.com/questions/253313/ssh-returns-bad-owner-or-permissions-on-ssh-config</a> but none of the answers work for me. sshd is running as a service as the Local System user. I've run <code>chmod 0600 C:\Users\gary\.ssh\config</code> and <code>chown gary C:\Users\gary\.ssh\config</code>. I've also cleared the ACL by running <code>setfacl -b C:\Users\gary\.ssh\config</code> and then <code>chmod 0600 C:\Users\gary\.ssh\config</code> again. I've also tried changing the owner to SYSTEM and got the same error.</p> <p>I'm not sure what else to do, is there anything wrong with my setup? I also have git installed which installed mingw, I deleted ssh and sshd from my git installation so they wouldn't be on my path.</p> <p>Other commands I've run are <code>icacls "C:\Users\gary\.ssh\config" /setowner gary</code> <code>chown -R gary:1049089 C:\Users\gary\.ssh</code></p> <p><code>ls -la C:\Users\gary\.ssh\config</code> shows </p> <blockquote> <p>-rw-r--r-- 1 gary 1049089 229 Jan 3 14:43 'C:\Users\gary.ssh\config'</p> </blockquote> <p>it keeps showing this even after changing the owner to SYSTEM, but in the file properties in file explorer it shows SYSTEM as the owner</p>
0debug
static void ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band, IVITile *tile, int32_t mv_scale) { int x, y, need_mc, mbn, blk, num_blocks, mv_x, mv_y, mc_type; int offs, mb_offset, row_offset; IVIMbInfo *mb, *ref_mb; const int16_t *src; int16_t *dst; void (*mc_no_delta_func)(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type); offs = tile->ypos * band->pitch + tile->xpos; mb = tile->mbs; ref_mb = tile->ref_mbs; row_offset = band->mb_size * band->pitch; need_mc = 0; for (y = tile->ypos; y < (tile->ypos + tile->height); y += band->mb_size) { mb_offset = offs; for (x = tile->xpos; x < (tile->xpos + tile->width); x += band->mb_size) { mb->xpos = x; mb->ypos = y; mb->buf_offs = mb_offset; mb->type = 1; mb->cbp = 0; if (!band->qdelta_present && !band->plane && !band->band_num) { mb->q_delta = band->glob_quant; mb->mv_x = 0; mb->mv_y = 0; } if (band->inherit_qdelta && ref_mb) mb->q_delta = ref_mb->q_delta; if (band->inherit_mv) { if (mv_scale) { mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale); mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale); } else { mb->mv_x = ref_mb->mv_x; mb->mv_y = ref_mb->mv_y; } need_mc |= mb->mv_x || mb->mv_y; } mb++; if (ref_mb) ref_mb++; mb_offset += band->mb_size; } offs += row_offset; } if (band->inherit_mv && need_mc) { num_blocks = (band->mb_size != band->blk_size) ? 4 : 1; mc_no_delta_func = (band->blk_size == 8) ? ff_ivi_mc_8x8_no_delta : ff_ivi_mc_4x4_no_delta; for (mbn = 0, mb = tile->mbs; mbn < tile->num_MBs; mb++, mbn++) { mv_x = mb->mv_x; mv_y = mb->mv_y; if (!band->is_halfpel) { mc_type = 0; } else { mc_type = ((mv_y & 1) << 1) | (mv_x & 1); mv_x >>= 1; mv_y >>= 1; } for (blk = 0; blk < num_blocks; blk++) { offs = mb->buf_offs + band->blk_size * ((blk & 1) + !!(blk & 2) * band->pitch); mc_no_delta_func(band->buf + offs, band->ref_buf + offs + mv_y * band->pitch + mv_x, band->pitch, mc_type); } } } else { src = band->ref_buf + tile->ypos * band->pitch + tile->xpos; dst = band->buf + tile->ypos * band->pitch + tile->xpos; for (y = 0; y < tile->height; y++) { memcpy(dst, src, tile->width*sizeof(band->buf[0])); src += band->pitch; dst += band->pitch; } } }
1threat
Separating similar values froom array in python : I have numpy array with values 0,1,2. I want to separate then in different arrays and plot them. How can i do that?? for i in range(2): if i==0 z = [i] elsif i==1 y= [i] else w = [i] this is what i tried
0debug
How to query many to many relationship sequelize? : <p>Tables have many to many relationship, junction by an order table in between. </p> <p>Outlet --> Order &lt;-- Product</p> <p>I want to get the list of Outlet for today Order. </p> <p>So here is a function to get all outlets:</p> <pre><code>db.Outlet.findAll({include: [ {model:db.Product, attributes: ['id', 'name', 'nameKh']} ]}).then(function(outlets){ return res.jsonp(outlets); }) </code></pre> <p>I got this result:</p> <p><a href="https://i.stack.imgur.com/P6gx9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/P6gx9.png" alt="enter image description here"></a></p> <p>I can only select with where Product Id by using this:</p> <pre><code>db.Outlet.findAll({include: [ {model:db.Product, attributes: ['id', 'name', 'nameKh'], where: {id: 2} ]}).then(function(outlets){ return res.jsonp(outlets); }) </code></pre> <p>How can I query by specific order amount, or today order date? </p> <p>Here are my models:</p> <p>Outlet:</p> <pre><code>var Outlet = sequelize.define('Outlet', { outletCode: DataTypes.STRING, outletName: DataTypes.STRING, outletNameKh: DataTypes.STRING, outletSubtype: DataTypes.STRING, perfectStoreType: DataTypes.STRING, address: DataTypes.STRING }, { associate: function(models){ Outlet.belongsToMany(models.Product, {through: models.Order}); Outlet.belongsTo(models.Distributor); // Outlet.hasMany(models.Order); } } ); </code></pre> <p>Product:</p> <pre><code>var Product = sequelize.define('Product', { inventoryCode: DataTypes.STRING, name: DataTypes.STRING, nameKh: DataTypes.STRING, monthlyCaseTarget: DataTypes.INTEGER, pieces: DataTypes.INTEGER, star: DataTypes.BOOLEAN, price: DataTypes.FLOAT, active: DataTypes.BOOLEAN }, { associate: function(models){ Product.belongsToMany(models.Outlet, {through: models.Order}); Product.belongsTo(models.Category); // Product.hasMany(models.Order); } } ); </code></pre> <p>Order:</p> <pre><code>var Order = sequelize.define('Order', { id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true }, amount: DataTypes.INTEGER }, { associate: function(models){ Order.belongsTo(models.Outlet); Order.belongsTo(models.Product); Order.belongsTo(models.User); } } ); </code></pre>
0debug
Is nested function efficient? : <p>In programming languages like Scala or Lua, we can define nested functions such as</p> <pre><code>function factorial(n) function _fac(n, acc) if n == 0 then return acc else return _fac(n-1, acc * n) end end return _fac(n, 1) end </code></pre> <p>Does this approach cause any inefficiency because the nested function instance is defined, or created, everytime we invoke the outer function?</p>
0debug
static int uncouple_channels(AC3DecodeContext * ctx) { ac3_audio_block *ab = &ctx->audio_block; int ch, sbnd, bin; int index; float (*samples)[256]; int16_t mantissa; samples = (float (*)[256])((ctx->bsi.flags & AC3_BSI_LFEON) ? (ctx->samples + 256) : (ctx->samples)); for (ch = 0; ch < ctx->bsi.nfchans; ch++) if (ab->chincpl & (1 << ch)) for (sbnd = ab->cplbegf; sbnd < 3 + ab->cplendf; sbnd++) for (bin = 0; bin < 12; bin++) { index = sbnd * 12 + bin + 37; samples[ch][index] = ab->cplcoeffs[index] * ab->cplco[ch][sbnd] * ab->chcoeffs[ch]; } for (ch = 0; ch < ctx->bsi.nfchans; ch++) if ((ab->chincpl & (1 << ch)) && (ab->dithflag & (1 << ch))) for (index = 0; index < ab->endmant[ch]; index++) if (!ab->bap[ch][index]) { mantissa = dither_int16(&ctx->state); samples[ch][index] = to_float(ab->dexps[ch][index], mantissa) * ab->chcoeffs[ch]; } return 0; }
1threat
static int term_can_read(void *opaque) { return 128; }
1threat
def add_nested_tuples(test_tup1, test_tup2): res = tuple(tuple(a + b for a, b in zip(tup1, tup2)) for tup1, tup2 in zip(test_tup1, test_tup2)) return (res)
0debug
connection.query('SELECT * FROM users WHERE username = ' + input_string)
1threat
How to add a list to lists within a list, to create lists within lists within a list - Python : pretty new to Python so if the title isn't confusing enough, i'd appreciate some help. I will able to best explain this using an example of what I'm aiming to achieve. Number = [25, 30, 36] Ratings = [ [101, 201, 301], [102, 202, 302], [103, 203, 304,] ] what_i_want = [ [ [101, 25],[201,30],[301,36] ], [ [102,25],[202,25],[302,36] ], [ [103,25],[203,30],[303,36] ] ] I'm completely stumped on how to do this, I've tried using nested for loops but the list ends up looking like this: list = [ ([101, 201, 301], 25), ([102, 202, 302], 30), ([103, 203, 304,], 36) ] Any help is much appreciated!! Thanks
0debug
i want to print last moth last date with time stamp '23:59:59' using command : Below is my output but i want to get output like Apr 30 23:59:59 please suggest date -d "$(date +%Y-%m-01) -1 day" Tue Apr 30 00:00:00 UCT 2019 I want below output Tue Apr 30 23:59:59 UCT 2019
0debug
Coding a Javascript hidden message : I've been asked by a web company to give them around 30 lines of HTML/javascript code to be used for a wall display. The code would need to be a real piece of valid code that would execute in a modern browser and display a message of around 30 words or less (e.g. a clever/cheeky brand message for the company). One big `document.write()` statement would do this, but they are looking for something that would conceal the message more. Essentially they are looking to make a visual puzzle that conceals their message from anyone without an intermediate understanding of JS. To a layperson it should just look like random code. I'm looking for ideas/suggestions on how to do this. I've tried using automatic javascript minifiers or obfuscators online but these generally output code that is completely unreadable to a human, what I want is for it to be difficult for a human/coder to read but not impossible. Supposing the message to be hidden was: > "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent > quis ipsum ipsum. Donec quis lectus et ante gravida ultricies at." What might be a good/interesting way to do this? HTML/CSS, JS & JQuery are all allowed. (Moderators, please move this question to somewhere more appropriate if it's not right for stack overflow)
0debug
@Repository not necessary when implementing JpaRepository? : <p>I have a rpository class in my spring boot app. First, I annotated it with <code>@Repository</code> and then I implemented <code>JpaRepository</code>. Now I got rid of the annotation and it still works.</p> <p>I saw that <code>JpaRepository</code> has the <code>@NoRepositoryBean</code> annotation.</p> <p>How does this work? Or should this not work and there's something weird going on in my application?</p>
0debug
Adding custom hosting domain: "Unexpected TXT records found. Continuing to watch for changes." : <p>I'm attempting to add a custom domain to firebase hosting.</p> <p>Added the TXT records as instructed, and I get this message in the firebase dashboard:</p> <p>"Unexpected TXT records found. Continuing to watch for changes."</p> <p>There is one additional TXT record in my DNS settings, but I can't remove it. I don't see how it would get in the way of firebase's verification of my domain either.</p> <p>I'm using Namecheap if that helps.</p> <p>Thanks in advance!</p>
0debug
Golang: privat class in a struct : I'm new to Go and couldnt find a good solution for my problem. I got 2 types, the first one is private, because I want that the programmer has to use a constructor. The 2nd type has the first one inside it. [screenshot of foo bar example][1] [1]: https://i.stack.imgur.com/BRBGi.png Sorry not only new on GO, but also on stackoverflow question asking...so thats why no code, but a screenshot
0debug
How do BluRay players or washing machine run Java programs? : <p>What OS do they use for example and how to they boot up so quickly (compared to a raspberry pi)?</p>
0debug
Cron Jobs login on website : <p>I am currently hosting a website on a developer's server. The server requires me to logon every so often or they will delete my account and my entire website. They do support cron jobs. I am wondering how to set up a cron job that would login to the server every so often. The cron job maker is set up like this:</p> <p>minute:</p> <p>hour:</p> <p>day:</p> <p>month:</p> <p>weekday:</p> <p>command:</p> <p>Any help here would be greatly appreciated. Thank You</p>
0debug
how to get a specific text from a webpage android studio : [**how to get a specific text from a webpage android studio**][1] [1]: https://i.stack.imgur.com/hL35a.png
0debug
Difference between word-wrap: break-word and word-break: break-word : <p>I needed to fix some CSS somewhere because my text wasn't wrapping around and was instead going on indefinitely if it was an extremely long word.</p> <p>Like in most cases, I tried <code>word-wrap: break-word;</code> in my CSS file and it did not work.</p> <p>Then, to my surprise, and by the suggestion of Google Chrome Developer Tools, I tried <code>word-break: break-word;</code> and it fixed my problem. I was shocked by this so I've been googling to know the difference between these two but I have seen nothing on the subject.</p> <p>Further, I don't think <code>word-break: break-word;</code> is documented behavior seeing as how <a href="http://www.w3schools.com/cssref/css3_pr_word-break.asp" rel="noreferrer">W3</a> has no mention of it. I tested it on Safari and Chrome, and it works perfectly on both, but I'm hesitant to use <code>word-break: break-word;</code> because I see no mention of it anywhere.</p>
0debug
What is this theme and colour scheme : Simple question... what is both the theme (e.g. panels, sidebar etc.) and the code color scheme used by PHPStorm in the attached screenshot? Many thanks! [![screenshot of IDE][1]][1] [1]: https://i.stack.imgur.com/RTxzu.png
0debug
javascript not working can't get a right title with this either : <p>I don't understand what's wrong with this.... I'm getting an error though everything was right.</p> <pre><code>source https://codepen.io/manufufu/pen/wjRPQR </code></pre>
0debug
PHP Regular Experssion for the field : I'm finding the PHP Regular Expression for preg_match. I'm not good in regular expression. Below are the conditions for the field named "city".<br> -not allow all special character<br> -not allow all numbers<br> -allow alphabets with spaces OR <br> -allow alphabets with special character with spaces OR<br> -allow alphabets with numbers with spaces<br>
0debug
void ff_set_mpeg4_time(MpegEncContext * s){ if(s->pict_type==AV_PICTURE_TYPE_B){ ff_mpeg4_init_direct_mv(s); }else{ s->last_time_base= s->time_base; s->time_base= s->time/s->avctx->time_base.den; } }
1threat
UIActivityViewController unable to set subject when sharing to Gmail app : <p>I see via sharing content from other apps that it is possible to set a different subject and body when using share sheet to share into the Gmail Mail app. I have implemented it and it works fine on the native mail app but not Gmail.</p> <p>Going into Yelp and sharing a business then choosing gmail from the share sheet, I see that the subject and body are different. The subject contains the address of the business while the body contains the address + a link to the business on Yelp.</p> <p>I have tried to replicate this logic with success on the native Mail app but not in the Gmail app.</p> <p>I have tried the following:</p> <p><strong>Implementing UIActivityItemSource methods</strong> </p> <pre><code>UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[self] applicationActivities:nil]; - (id)activityViewControllerPlaceholderItem:(UIActivityViewController *)activityViewController { return @""; } - (id)activityViewController:(UIActivityViewController *)activityViewController itemForActivityType:(NSString *)activityType { return @"body"; } - (NSString *)activityViewController:(UIActivityViewController *)activityViewController subjectForActivityType:(NSString *)activityType { return @"subject"; } </code></pre> <p><strong>Result</strong></p> <p>Apple Mail Subject set to "subject", Body set to "body"</p> <p>Gmail Subject set to "body", Body set to "body"</p> <pre><code>- (NSString *)activityViewController:(UIActivityViewController *)activityViewController subjectForActivityType:(NSString *)activityType </code></pre> <p>Is never called when sharing into the Gmail app.</p> <p><strong>I then try the more hack way of doing it</strong></p> <pre><code>UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[@"body"] applicationActivities:nil]; [activityViewController setValue:@"subject" forKey:@"subject"]; </code></pre> <p><strong>Result</strong> </p> <p>Apple Mail Subject set to "subject", Body set to "body"</p> <p>Gmail Subject set to "body", Body set to "body"</p> <p><strong>Any way to make Gmail Behave like Apple Mail?</strong></p> <p>Again, I have seen that other applications like Yelp and Safari have gotten the proper behavior out of the Gmail app through share sheet. Any advice would be appreciated, thanks.</p>
0debug
What am I doing wrong? : >I keep getting an out of bounds error. Want to check for duplicates. there is more after this, but for right now all thats important. its for a school project. it says the the Array list is index:1 size: 1 out of bounds exception ArrayList <Integer> lottery = new ArrayList<Integer>(); for (int n=0; n<4;) { int number = 0; int first = 0; int value = 0; boolean found = false; first =(int)(Math.random()*42 +1); lottery.add(first); count[first]++; for (int i=1; i<6;) { number = (int)(Math.random()*42 +1); for(int k = 0; k<6; ) { // here value = lottery.get(k); if (value == number) { found = true; } else { found = false; } if (found == true) { number = (int)(Math.random()*42 +1); } else { k++; } } System.out.println("number " + (i+1) + ": " + number); if ( found == false) { lottery.add(number); count[number] ++; i++; } }
0debug
static int vaapi_h264_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) { H264Context * const h = avctx->priv_data; struct vaapi_context * const vactx = avctx->hwaccel_context; VAPictureParameterBufferH264 *pic_param; VAIQMatrixBufferH264 *iq_matrix; ff_dlog(avctx, "vaapi_h264_start_frame()\n"); vactx->slice_param_size = sizeof(VASliceParameterBufferH264); pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VAPictureParameterBufferH264)); if (!pic_param) return -1; fill_vaapi_pic(&pic_param->CurrPic, h->cur_pic_ptr, h->picture_structure); if (fill_vaapi_ReferenceFrames(pic_param, h) < 0) return -1; pic_param->picture_width_in_mbs_minus1 = h->mb_width - 1; pic_param->picture_height_in_mbs_minus1 = h->mb_height - 1; pic_param->bit_depth_luma_minus8 = h->sps.bit_depth_luma - 8; pic_param->bit_depth_chroma_minus8 = h->sps.bit_depth_chroma - 8; pic_param->num_ref_frames = h->sps.ref_frame_count; pic_param->seq_fields.value = 0; pic_param->seq_fields.bits.chroma_format_idc = h->sps.chroma_format_idc; pic_param->seq_fields.bits.residual_colour_transform_flag = h->sps.residual_color_transform_flag; pic_param->seq_fields.bits.gaps_in_frame_num_value_allowed_flag = h->sps.gaps_in_frame_num_allowed_flag; pic_param->seq_fields.bits.frame_mbs_only_flag = h->sps.frame_mbs_only_flag; pic_param->seq_fields.bits.mb_adaptive_frame_field_flag = h->sps.mb_aff; pic_param->seq_fields.bits.direct_8x8_inference_flag = h->sps.direct_8x8_inference_flag; pic_param->seq_fields.bits.MinLumaBiPredSize8x8 = h->sps.level_idc >= 31; pic_param->seq_fields.bits.log2_max_frame_num_minus4 = h->sps.log2_max_frame_num - 4; pic_param->seq_fields.bits.pic_order_cnt_type = h->sps.poc_type; pic_param->seq_fields.bits.log2_max_pic_order_cnt_lsb_minus4 = h->sps.log2_max_poc_lsb - 4; pic_param->seq_fields.bits.delta_pic_order_always_zero_flag = h->sps.delta_pic_order_always_zero_flag; pic_param->num_slice_groups_minus1 = h->pps.slice_group_count - 1; pic_param->slice_group_map_type = h->pps.mb_slice_group_map_type; pic_param->slice_group_change_rate_minus1 = 0; pic_param->pic_init_qp_minus26 = h->pps.init_qp - 26; pic_param->pic_init_qs_minus26 = h->pps.init_qs - 26; pic_param->chroma_qp_index_offset = h->pps.chroma_qp_index_offset[0]; pic_param->second_chroma_qp_index_offset = h->pps.chroma_qp_index_offset[1]; pic_param->pic_fields.value = 0; pic_param->pic_fields.bits.entropy_coding_mode_flag = h->pps.cabac; pic_param->pic_fields.bits.weighted_pred_flag = h->pps.weighted_pred; pic_param->pic_fields.bits.weighted_bipred_idc = h->pps.weighted_bipred_idc; pic_param->pic_fields.bits.transform_8x8_mode_flag = h->pps.transform_8x8_mode; pic_param->pic_fields.bits.field_pic_flag = h->picture_structure != PICT_FRAME; pic_param->pic_fields.bits.constrained_intra_pred_flag = h->pps.constrained_intra_pred; pic_param->pic_fields.bits.pic_order_present_flag = h->pps.pic_order_present; pic_param->pic_fields.bits.deblocking_filter_control_present_flag = h->pps.deblocking_filter_parameters_present; pic_param->pic_fields.bits.redundant_pic_cnt_present_flag = h->pps.redundant_pic_cnt_present; pic_param->pic_fields.bits.reference_pic_flag = h->nal_ref_idc != 0; pic_param->frame_num = h->frame_num; iq_matrix = ff_vaapi_alloc_iq_matrix(vactx, sizeof(VAIQMatrixBufferH264)); if (!iq_matrix) return -1; memcpy(iq_matrix->ScalingList4x4, h->pps.scaling_matrix4, sizeof(iq_matrix->ScalingList4x4)); memcpy(iq_matrix->ScalingList8x8[0], h->pps.scaling_matrix8[0], sizeof(iq_matrix->ScalingList8x8[0])); memcpy(iq_matrix->ScalingList8x8[1], h->pps.scaling_matrix8[3], sizeof(iq_matrix->ScalingList8x8[0])); return 0; }
1threat
Jump to a specific carousel slide based on something other than position? : <p>I'm trying to achieve a way, where I can jump to a specific carousel slide after clicking a button. Now, I know you can do that using indices of specific slides, however, because the content of the slides won't always be in the same order, indices don't solve my issue.</p> <p>I've looked at Owl carousel, and it seems to be possible to achieve this with it, but I'm limited with the libraries I can use and would much prefer to avoid it.</p> <p>Is there a way to jump to a specific slide using something else, like an id or an attribute I could set, preferably by using JQuery, JS or HTML, without any additional libraries?</p>
0debug
static void test_opts_parse_size(void) { Error *err = NULL; QemuOpts *opts; opts = qemu_opts_parse(&opts_list_02, "size1=0", false, &error_abort); g_assert_cmpuint(opts_count(opts), ==, 1); g_assert_cmpuint(qemu_opt_get_size(opts, "size1", 1), ==, 0); opts = qemu_opts_parse(&opts_list_02, "size1=9007199254740991," "size2=9007199254740992," "size3=9007199254740993", false, &error_abort); g_assert_cmpuint(opts_count(opts), ==, 3); g_assert_cmphex(qemu_opt_get_size(opts, "size1", 1), ==, 0x1fffffffffffff); g_assert_cmphex(qemu_opt_get_size(opts, "size2", 1), ==, 0x20000000000000); g_assert_cmphex(qemu_opt_get_size(opts, "size3", 1), ==, 0x20000000000000); opts = qemu_opts_parse(&opts_list_02, "size1=9223372036854774784," "size2=9223372036854775295", false, &error_abort); g_assert_cmpuint(opts_count(opts), ==, 2); g_assert_cmphex(qemu_opt_get_size(opts, "size1", 1), ==, 0x7ffffffffffffc00); g_assert_cmphex(qemu_opt_get_size(opts, "size2", 1), ==, 0x7ffffffffffffc00); opts = qemu_opts_parse(&opts_list_02, "size1=18446744073709549568," "size2=18446744073709550591", false, &error_abort); g_assert_cmpuint(opts_count(opts), ==, 2); g_assert_cmphex(qemu_opt_get_size(opts, "size1", 1), ==, 0xfffffffffffff800); g_assert_cmphex(qemu_opt_get_size(opts, "size2", 1), ==, 0xfffffffffffff800); opts = qemu_opts_parse(&opts_list_02, "size1=-1", false, &err); error_free_or_abort(&err); g_assert(!opts); opts = qemu_opts_parse(&opts_list_02, "size1=18446744073709550592", false, &error_abort); g_assert_cmpuint(opts_count(opts), ==, 1); g_assert_cmpuint(qemu_opt_get_size(opts, "size1", 1), ==, 0); opts = qemu_opts_parse(&opts_list_02, "size1=8b,size2=1.5k,size3=2M", false, &error_abort); g_assert_cmpuint(opts_count(opts), ==, 3); g_assert_cmphex(qemu_opt_get_size(opts, "size1", 0), ==, 8); g_assert_cmphex(qemu_opt_get_size(opts, "size2", 0), ==, 1536); g_assert_cmphex(qemu_opt_get_size(opts, "size3", 0), ==, 2 * M_BYTE); opts = qemu_opts_parse(&opts_list_02, "size1=0.1G,size2=16777215T", false, &error_abort); g_assert_cmpuint(opts_count(opts), ==, 2); g_assert_cmphex(qemu_opt_get_size(opts, "size1", 0), ==, G_BYTE / 10); g_assert_cmphex(qemu_opt_get_size(opts, "size2", 0), ==, 16777215 * T_BYTE); opts = qemu_opts_parse(&opts_list_02, "size1=16777216T", false, &error_abort); g_assert_cmpuint(opts_count(opts), ==, 1); g_assert_cmpuint(qemu_opt_get_size(opts, "size1", 1), ==, 0); opts = qemu_opts_parse(&opts_list_02, "size1=16E", false, &err); error_free_or_abort(&err); g_assert(!opts); opts = qemu_opts_parse(&opts_list_02, "size1=16Gi", false, &error_abort); g_assert_cmpuint(opts_count(opts), ==, 1); g_assert_cmpuint(qemu_opt_get_size(opts, "size1", 1), ==, 16 * G_BYTE); qemu_opts_reset(&opts_list_02); }
1threat
be why here hava a get request be sent when i click the delete button : <script src="static/jquery-3.2.1.min.js"></script> <script type="text/javascript"> $(function() { var ids = ${requestScope.ids}; for (let i = 0; i < ids.length; i++) { $("#delete-" + ids[i]).click(function() { var path="employees/"+ids[i]; $("#form").attr("action", path).submit(); }); } }); </script> <body> <c:forEach items="${requestScope.employees}" var="employee"> <tr> <td>${employee.id }</td> <td>${employee.name }</td> <td>${employee.email }</td> <!--θΏ›θ‘Œεˆ€ζ–­:0δΈΊη”·ζ€§,1δΈΊε₯³ζ€§--> <td><c:if test="${employee.gender==0}">η”·</c:if> <c:if test="${employee.gender!=0}">ε₯³</c:if></td> <td>${employee.department.deptName }</td> <td><button id="delete-${employee.id }">DELETE</button></td> <td><button>UPDATE</button></td> </tr> </c:forEach> </table> </c:if> <form method="post" id="form"> <input type="hidden" name="_method" value="DELETE" /> </form> </body> </html> when i click the delete button ,i hope the form be post,it do,but i see the network the a get request also be send,where is the get reqeust be sent? [![enter image description here][1]][1] help me plz [1]: https://i.stack.imgur.com/4mdPJ.png
0debug
static inline void do_imdct(AC3DecodeContext *s, int channels) { int ch; for (ch=1; ch<=channels; ch++) { if (s->block_switch[ch]) { int i; float *x = s->tmp_output+128; for(i=0; i<128; i++) x[i] = s->transform_coeffs[ch][2*i]; ff_imdct_half(&s->imdct_256, s->tmp_output, x); s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, s->add_bias, 128); for(i=0; i<128; i++) x[i] = s->transform_coeffs[ch][2*i+1]; ff_imdct_half(&s->imdct_256, s->delay[ch-1], x); } else { ff_imdct_half(&s->imdct_512, s->tmp_output, s->transform_coeffs[ch]); s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, s->add_bias, 128); memcpy(s->delay[ch-1], s->tmp_output+128, 128*sizeof(float)); } } }
1threat
How to get an Observable to return an array of transformed items (Rxjs) : <p>I have an endpoint that produces a json list of products. I have a custom class type defined in my code for Products. I'm trying to get the data from the endpoint and have the json array of products transformed into an array of the Product class.</p> <p><strong>Sample API json (simplified from my actual data):</strong></p> <pre><code>{ "products": [{ "id": 1, "name": "Product 1", "materials": [{ "id": 100, "desc": "wood" }, { "id": 101, "desc": "metal" }] }, { "id": 2, "name": "Product 2", "materials": [{ "id": 100, "desc": "wood" }, { "id": 102, "desc": "brick" }] }] } </code></pre> <p><strong>My code:</strong></p> <pre><code>loadProducts(){ this.fetchProducts().subscribe(data =&gt; { console.log("the data:", data); }) } fetchProducts(): Observable&lt;Product[]&gt; { return this.http.get("http://example.com/mydata.json") .map((response) =&gt; { const products = (response.json()).products; console.log("Converting to json" + products.length); return products; }) .map( data =&gt; { console.log("Working on data: ", data); return new Product(data.id, data.name, data.materials); }); </code></pre> <p>What I would expect to see in my console is..</p> <pre><code>"Converting to json 2" "Working on data: " [object] "Working on data: " [object] "the data:" [object,object] </code></pre> <p>.. but what I am seeing is..</p> <pre><code>"Converting to json 2" "Working on data: " [object,object] "the data:" [object,object] </code></pre> <p>I thought that the .map function would run for each item sent to it. I can see that when I first call .map that it is being run once on the one item (the response) that it has -- and I know that there are products 2 items being returned. I would expect the second map function to then be run twice - once for each product item. Instead it seems that it's called once being passed in the array of products.</p> <p>To make matters more complicated I want to also convert the list of materials into a Material class type I've created. I know I could do <strong>all</strong> of this with forEach loops, but I want to do this the "React" way.</p>
0debug
In which thread is the terminate handler called? : <p>In which thread is called the terminate handler:</p> <ol> <li><p>when an exception is thrown inside a <code>noexcept</code> function?</p></li> <li><p>when the user call <code>std::terminate</code>()?</p></li> <li><p>at start up or destruction of <code>thread</code>?</p></li> </ol> <p>Is it defined in the standard, will I have access to <code>thread_local</code> objects?</p>
0debug
Android xml shape drawable : <p><a href="https://i.stack.imgur.com/asoTh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/asoTh.png" alt="enter image description here"></a></p> <p>I want to draw xml layout shape above showing image android.please help me</p>
0debug
Eliminate white space in between characters in PHP : <p>lets say: " &nbsp; &nbsp;i have &nbsp; &nbsp; &nbsp; something &nbsp; &nbsp; &nbsp; here, please allow &nbsp; &nbsp; &nbsp;me! &nbsp; &nbsp;"</p> <p>will become: "i have something here, please allow me!"</p>
0debug
static int mp_user_setxattr(FsContext *ctx, const char *path, const char *name, void *value, size_t size, int flags) { char *buffer; int ret; if (strncmp(name, "user.virtfs.", 12) == 0) { errno = EACCES; return -1; } buffer = rpath(ctx, path); ret = lsetxattr(buffer, name, value, size, flags); g_free(buffer); return ret; }
1threat
How to select the latest price for product? : <p>Here is my table:</p> <pre><code>+----+------------+-----------+---------------+ | id | product_id | price | date | +----+------------+-----------+---------------+ | 1 | 4 | 2000 | 2019-02-10 | | 2 | 5 | 1600 | 2019-02-11 | | 3 | 4 | 850 | 2019-02-11 | | 4 | 5 | 1500 | 2019-02-13 | +----+------------+-----------+---------------+ </code></pre> <p>I need to get a list of unique product ids that are the latest (newest, in other word, bigger <code>date</code>) ones. So this is the expected result:</p> <pre><code>+------------+-----------+---------------+ | product_id | price | date | +------------+-----------+---------------+ | 4 | 850 | 2019-02-11 | | 5 | 1500 | 2019-02-13 | +------------+-----------+---------------+ </code></pre> <p>Any idea how can I achieve that?</p> <hr> <p>Here is my query:</p> <pre><code>SELECT id, product_id, price, MAX(date) FROM tbl GROUP BY product_id -- ot selects the max `date` with random price like this: +------------+-----------+---------------+ | product_id | price | date | +------------+-----------+---------------+ | 4 | 2000 | 2019-02-11 | | 5 | 1600 | 2019-02-13 | +------------+-----------+---------------+ -- See? Prices are wrong </code></pre>
0debug
Preceding sibling in selenium : [TD][1] [1]: https://i.stack.imgur.com/nDarD.png **Code:** checkbox1 = driver.find_element_by_xpath("td/nobr/a[text()='192.168.50.120']/../preceding-sibling::td/input[@class='checkbox']") Here is the code after using siblings I'm not able to click on the checkbox. Please check the code and let me know where I have done mistake in the code and provide me solution
0debug
uint32_t do_arm_semihosting(CPUARMState *env) { ARMCPU *cpu = arm_env_get_cpu(env); CPUState *cs = CPU(cpu); target_ulong args; target_ulong arg0, arg1, arg2, arg3; char * s; int nr; uint32_t ret; uint32_t len; #ifdef CONFIG_USER_ONLY TaskState *ts = cs->opaque; #else CPUARMState *ts = env; #endif nr = env->regs[0]; args = env->regs[1]; switch (nr) { case TARGET_SYS_OPEN: GET_ARG(0); GET_ARG(1); GET_ARG(2); s = lock_user_string(arg0); if (!s) { return (uint32_t)-1; } if (arg1 >= 12) { unlock_user(s, arg0, 0); return (uint32_t)-1; } if (strcmp(s, ":tt") == 0) { int result_fileno = arg1 < 4 ? STDIN_FILENO : STDOUT_FILENO; unlock_user(s, arg0, 0); return result_fileno; } if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "open,%s,%x,1a4", arg0, (int)arg2+1, gdb_open_modeflags[arg1]); ret = env->regs[0]; } else { ret = set_swi_errno(ts, open(s, open_modeflags[arg1], 0644)); } unlock_user(s, arg0, 0); return ret; case TARGET_SYS_CLOSE: GET_ARG(0); if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "close,%x", arg0); return env->regs[0]; } else { return set_swi_errno(ts, close(arg0)); } case TARGET_SYS_WRITEC: { char c; if (get_user_u8(c, args)) return (uint32_t)-1; if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "write,2,%x,1", args); return env->regs[0]; } else { return write(STDERR_FILENO, &c, 1); } } case TARGET_SYS_WRITE0: if (!(s = lock_user_string(args))) return (uint32_t)-1; len = strlen(s); if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "write,2,%x,%x\n", args, len); ret = env->regs[0]; } else { ret = write(STDERR_FILENO, s, len); } unlock_user(s, args, 0); return ret; case TARGET_SYS_WRITE: GET_ARG(0); GET_ARG(1); GET_ARG(2); len = arg2; if (use_gdb_syscalls()) { arm_semi_syscall_len = len; gdb_do_syscall(arm_semi_cb, "write,%x,%x,%x", arg0, arg1, len); return env->regs[0]; } else { s = lock_user(VERIFY_READ, arg1, len, 1); if (!s) { return (uint32_t)-1; } ret = set_swi_errno(ts, write(arg0, s, len)); unlock_user(s, arg1, 0); if (ret == (uint32_t)-1) return -1; return len - ret; } case TARGET_SYS_READ: GET_ARG(0); GET_ARG(1); GET_ARG(2); len = arg2; if (use_gdb_syscalls()) { arm_semi_syscall_len = len; gdb_do_syscall(arm_semi_cb, "read,%x,%x,%x", arg0, arg1, len); return env->regs[0]; } else { s = lock_user(VERIFY_WRITE, arg1, len, 0); if (!s) { return (uint32_t)-1; } do { ret = set_swi_errno(ts, read(arg0, s, len)); } while (ret == -1 && errno == EINTR); unlock_user(s, arg1, len); if (ret == (uint32_t)-1) return -1; return len - ret; } case TARGET_SYS_READC: return 0; case TARGET_SYS_ISTTY: GET_ARG(0); if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "isatty,%x", arg0); return env->regs[0]; } else { return isatty(arg0); } case TARGET_SYS_SEEK: GET_ARG(0); GET_ARG(1); if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "lseek,%x,%x,0", arg0, arg1); return env->regs[0]; } else { ret = set_swi_errno(ts, lseek(arg0, arg1, SEEK_SET)); if (ret == (uint32_t)-1) return -1; return 0; } case TARGET_SYS_FLEN: GET_ARG(0); if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_flen_cb, "fstat,%x,%x", arg0, env->regs[13]-64); return env->regs[0]; } else { struct stat buf; ret = set_swi_errno(ts, fstat(arg0, &buf)); if (ret == (uint32_t)-1) return -1; return buf.st_size; } case TARGET_SYS_TMPNAM: return -1; case TARGET_SYS_REMOVE: GET_ARG(0); GET_ARG(1); if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "unlink,%s", arg0, (int)arg1+1); ret = env->regs[0]; } else { s = lock_user_string(arg0); if (!s) { return (uint32_t)-1; } ret = set_swi_errno(ts, remove(s)); unlock_user(s, arg0, 0); } return ret; case TARGET_SYS_RENAME: GET_ARG(0); GET_ARG(1); GET_ARG(2); GET_ARG(3); if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "rename,%s,%s", arg0, (int)arg1+1, arg2, (int)arg3+1); return env->regs[0]; } else { char *s2; s = lock_user_string(arg0); s2 = lock_user_string(arg2); if (!s || !s2) ret = (uint32_t)-1; else ret = set_swi_errno(ts, rename(s, s2)); if (s2) unlock_user(s2, arg2, 0); if (s) unlock_user(s, arg0, 0); return ret; } case TARGET_SYS_CLOCK: return clock() / (CLOCKS_PER_SEC / 100); case TARGET_SYS_TIME: return set_swi_errno(ts, time(NULL)); case TARGET_SYS_SYSTEM: GET_ARG(0); GET_ARG(1); if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "system,%s", arg0, (int)arg1+1); return env->regs[0]; } else { s = lock_user_string(arg0); if (!s) { return (uint32_t)-1; } ret = set_swi_errno(ts, system(s)); unlock_user(s, arg0, 0); return ret; } case TARGET_SYS_ERRNO: #ifdef CONFIG_USER_ONLY return ts->swi_errno; #else return syscall_err; #endif case TARGET_SYS_GET_CMDLINE: { char *output_buffer; size_t input_size; size_t output_size; int status = 0; GET_ARG(0); GET_ARG(1); input_size = arg1; #if !defined(CONFIG_USER_ONLY) output_size = strlen(ts->boot_info->kernel_filename) + 1 + strlen(ts->boot_info->kernel_cmdline) + 1; #else unsigned int i; output_size = ts->info->arg_end - ts->info->arg_start; if (!output_size) { output_size = 1; } #endif if (output_size > input_size) { return -1; } if (SET_ARG(1, output_size - 1)) { return -1; } output_buffer = lock_user(VERIFY_WRITE, arg0, output_size, 0); if (!output_buffer) { return -1; } #if !defined(CONFIG_USER_ONLY) pstrcpy(output_buffer, output_size, ts->boot_info->kernel_filename); pstrcat(output_buffer, output_size, " "); pstrcat(output_buffer, output_size, ts->boot_info->kernel_cmdline); #else if (output_size == 1) { output_buffer[0] = '\0'; goto out; } if (copy_from_user(output_buffer, ts->info->arg_start, output_size)) { status = -1; goto out; } for (i = 0; i < output_size - 1; i++) { if (output_buffer[i] == 0) { output_buffer[i] = ' '; } } out: #endif unlock_user(output_buffer, arg0, output_size); return status; } case TARGET_SYS_HEAPINFO: { uint32_t *ptr; uint32_t limit; GET_ARG(0); #ifdef CONFIG_USER_ONLY if (!ts->heap_limit) { abi_ulong ret; ts->heap_base = do_brk(0); limit = ts->heap_base + ARM_ANGEL_HEAP_SIZE; for (;;) { ret = do_brk(limit); if (ret >= limit) { break; } limit = (ts->heap_base >> 1) + (limit >> 1); } ts->heap_limit = limit; } ptr = lock_user(VERIFY_WRITE, arg0, 16, 0); if (!ptr) { return (uint32_t)-1; } ptr[0] = tswap32(ts->heap_base); ptr[1] = tswap32(ts->heap_limit); ptr[2] = tswap32(ts->stack_base); ptr[3] = tswap32(0); unlock_user(ptr, arg0, 16); #else limit = ram_size; ptr = lock_user(VERIFY_WRITE, arg0, 16, 0); if (!ptr) { return (uint32_t)-1; } ptr[0] = tswap32(limit / 2); ptr[1] = tswap32(limit); ptr[2] = tswap32(limit); ptr[3] = tswap32(0); unlock_user(ptr, arg0, 16); #endif return 0; } case TARGET_SYS_EXIT: gdb_exit(env, 0); exit(0); default: fprintf(stderr, "qemu: Unsupported SemiHosting SWI 0x%02x\n", nr); cpu_dump_state(cs, stderr, fprintf, 0); abort(); } }
1threat
static void __attribute__((constructor)) coroutine_pool_init(void) { qemu_mutex_init(&pool_lock); }
1threat
How to prompt if the user is existing in database : <?php include('dbcon.php'); $code = $_POST['code']; $result=mysqli_query($dbcon,"INSERT into attendance(firstname,lastname,type,year_level,date_added)Select firstname,lastname,type,year_level,CURRENT_TIMESTAMP() FROM member WHERE code='$code'") or die("Error ".mysqli_error()); if(isset($_POST['submit'])) { if(!$result) { echo "Database NOT Found."; } else { $result; header('location:add_member_attendance.php'); } } else { } ?> I want to display prompt if it successfully entered the data and if the user is not found in database but I don't know what problem of my code. Thanks for helping me
0debug
Is there a java script code to animate vertical black bars with certain width to move over white background? : <p>Is there a java script code to animate vertical black bars with certain width to move over white background ? I want the finish result to be like in this video : <a href="https://www.youtube.com/watch?v=bdMWbfTMOMM" rel="nofollow noreferrer">https://www.youtube.com/watch?v=bdMWbfTMOMM</a> Thank you </p>
0debug
how to drop duplicated columns data based on column name in pandas : <p>Assume I have a table like below</p> <pre><code> A B C B 0 0 1 2 3 1 4 5 6 7 </code></pre> <p>I'd like to drop column B. I tried to use drop_duplicate, but it seems that it only works based on duplicated data not header. Hope anyone know how to do this</p> <p>Thanks</p>
0debug
static uint32_t gic_dist_readb(void *opaque, hwaddr offset) { GICState *s = (GICState *)opaque; uint32_t res; int irq; int i; int cpu; int cm; int mask; cpu = gic_get_current_cpu(s); cm = 1 << cpu; if (offset < 0x100) { if (offset == 0) return s->enabled; if (offset == 4) return ((s->num_irq / 32) - 1) | ((NUM_CPU(s) - 1) << 5); if (offset < 0x08) return 0; if (offset >= 0x80) { return 0; } goto bad_reg; } else if (offset < 0x200) { if (offset < 0x180) irq = (offset - 0x100) * 8; else irq = (offset - 0x180) * 8; irq += GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; res = 0; for (i = 0; i < 8; i++) { if (GIC_TEST_ENABLED(irq + i, cm)) { res |= (1 << i); } } } else if (offset < 0x300) { if (offset < 0x280) irq = (offset - 0x200) * 8; else irq = (offset - 0x280) * 8; irq += GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; res = 0; mask = (irq < GIC_INTERNAL) ? cm : ALL_CPU_MASK; for (i = 0; i < 8; i++) { if (GIC_TEST_PENDING(irq + i, mask)) { res |= (1 << i); } } } else if (offset < 0x400) { irq = (offset - 0x300) * 8 + GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; res = 0; mask = (irq < GIC_INTERNAL) ? cm : ALL_CPU_MASK; for (i = 0; i < 8; i++) { if (GIC_TEST_ACTIVE(irq + i, mask)) { res |= (1 << i); } } } else if (offset < 0x800) { irq = (offset - 0x400) + GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; res = GIC_GET_PRIORITY(irq, cpu); } else if (offset < 0xc00) { if (s->num_cpu == 1 && s->revision != REV_11MPCORE) { res = 0; } else { irq = (offset - 0x800) + GIC_BASE_IRQ; if (irq >= s->num_irq) { goto bad_reg; } if (irq >= 29 && irq <= 31) { res = cm; } else { res = GIC_TARGET(irq); } } } else if (offset < 0xf00) { irq = (offset - 0xc00) * 2 + GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; res = 0; for (i = 0; i < 4; i++) { if (GIC_TEST_MODEL(irq + i)) res |= (1 << (i * 2)); if (GIC_TEST_EDGE_TRIGGER(irq + i)) res |= (2 << (i * 2)); } } else if (offset < 0xfe0) { goto bad_reg; } else { if (offset & 3) { res = 0; } else { res = gic_id[(offset - 0xfe0) >> 2]; } } return res; bad_reg: qemu_log_mask(LOG_GUEST_ERROR, "gic_dist_readb: Bad offset %x\n", (int)offset); return 0; }
1threat
strikethrough code in markdown on github : <p>I am talking about <strong>github markdown</strong> here, for files like <code>README.md</code>.</p> <p><strong>Question:</strong> Is it possible to strikethrough a complete code block in markdown on github?</p> <p>I know how to mark text as a block of code</p> <pre><code>this is multiline code </code></pre> <p><code>and this </code></p> <p><code>this</code></p> <p><code>also</code></p> <p>by indenting by 4 spaces or by using ``` or `...</p> <p>I also know how to <s>strike through texts</s> using</p> <ul> <li>del tag</li> <li>s tag</li> <li>~~</li> </ul> <p><strong>Temporary solution</strong>:</p> <p>Independently they work fine, but together not as expected or desired. I tried several combinations of the above mentioned.</p> <p>For now, I use this: </p> <p><s><code>striked</code></s></p> <p><s><code>through</code></s></p> <p>by using ~~ and ` for every single line.</p> <p><strong>Requirement</strong>:</p> <p>I would like to have a code formatted text striked through, where the code block is continuous:</p> <pre><code>unfortunately, this is not striked through </code></pre> <p>or at least with only a small paragraph in between:</p> <p><code>unfortunately, also not striked through </code></p> <p>Is this possible at all?</p> <p>I found some old posts and hints on using jekyll, but what I was searching for is a simple way, preferably in markdown.</p>
0debug
weired data output about PHP & MySQLi : I am the beginner of PHP & MySQL and I am practicing about PHP & MySQL. It's wired that only Field name is correct but others. I can't get the the expected result from the code... How get the correct meta data from the database? [The expected result][1] [Actual result][2] [1]: http://i.stack.imgur.com/dESiN.jpg [2]: http://i.stack.imgur.com/asWKY.jpg <?php // Open a connection to the server and USE the winestore $link = mysqli_connect("localhost","root","","winestore"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } // Run a query on the wine table in the winestore database to retrieve // one row $query = "SELECT * FROM wine LIMIT 1"; $result = mysqli_query($link, $query); // Output a header, with headers spaced by padding print "\n" . str_pad("Field", 20) . str_pad("Type", 14) . str_pad("Null", 6) . str_pad("Key", 5) . str_pad("Extra", 12) . "\n"; // How many attributes are there? $x = mysqli_num_fields($result); // for each of the attributes in the result set for($y=0;$y<$x;$y++) { // Get the meta-data for the attribute $info = mysqli_fetch_field ($result); // Print the attribute name print str_pad($info->name, 20); // Print the data type print str_pad($info->type, 6); // Print the field length in brackets e.g.(2) print str_pad("({$info->max_length})", 8); // Print out YES if attribute can be NULL if ($info->not_null != 1) print " YES "; else print " "; // Print out selected index information if ($info->primary_key == 1) print " PRI "; elseif ($info->multiple_key == 1) print " MUL "; elseif ($info->unique_key == 1) print " UNI "; // If zero-filled, print this if ($info->zerofill) print " Zero filled"; // Start a new line print "\n"; } mysqli_free_result($result); mysqli_close($link); ?>
0debug
Having an issue with java code which has to be executed on linux terminal : <p>I am a beginner in writing Java code. I am having trouble on executing command which is written on Java. I am trying to execute the command2. The code is below</p> <pre><code>import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class OSinventory2 { public static void main(String[] args) throws IOException, InterruptedException { OSinventory2 obj = new OSinventory2(); String PATH="/usr/bin:/usr/sbin:/bin:/sbin:/usr/ccs/bin:/usr/local/bin"; String LD_LIBRARY_PATH="/usr/lib:/usr/ccs/lib:/usr/local/lib"; String FP="ls -ld ~/mnt/c/Users/aitol/Desktop/Java/TESTING 2&gt; /dev/null"; String HOSTN="hostname | tr [:upper:] [:lower:]"; if (obj.executeCommand(FP) != null){ String command = "mkdir -p /mnt/c/Users/aitol/Desktop/Java/TESTING/Larry"; System.out.println(obj.executeCommand(command)); } String command2 = "touch /mnt/c/Users/aitol/Desktop/Java/TESTING/${`HOSTN`}.txt"; System.out.println(obj.executeCommand(command2)); } private String executeCommand(String command1) { StringBuffer output = new StringBuffer(); Process p; try { p = Runtime.getRuntime().exec(command1); p.waitFor(); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = ""; while ((line = reader.readLine())!= null) { output.append(line).append("\n"); } } catch (Exception e) { e.printStackTrace(); } return output.toString(); } } </code></pre> <p><a href="https://i.stack.imgur.com/q6n06.jpg" rel="nofollow noreferrer">And the output is here : (click)</a></p> <p>Please Help! Thank you!</p>
0debug
How to write bytes to file from Python shell? : <p>I have tried this key</p> <pre><code>b"\xa9Z\xfe\x16*L\xfaJ\xab\x87\xc3\xdf$:f\xb3U^\xf4Nf\xe8\xc2\x1cZ\xc1\xd8\xdc\xe4h\x98\xac\xa3b\x98\xbc\x9e\xb5\xa8\x8d\xf7n\x1b\xa6\xbfMe\xa4\xd8\xc0\xd9'\x10\x86L?\xd3\xd4\xbd\xc2H\xaa\xe7\x07" </code></pre> <p>Open file in wb mode</p> <pre><code>&gt;&gt;&gt; f = open('privkey.bin', 'wb' ) &gt;&gt;&gt; f.write(key) 64 </code></pre> <p>Any way the file is empty. Why?</p>
0debug
PHP form posting blank data in to mysql table : <p>I've created a form in order to post data in to a mysql database but when I submit the form it just enters blank data. I'm fairly new to PHP and mysql so if you can help using the simplest explanation, not assuming any great in depth knowledge that would be really appreciated.</p> <pre><code> &lt;?php DEFINE('DB_USERNAME', 'root'); DEFINE('DB_PASSWORD', 'root'); DEFINE('DB_HOST', 'localhost'); DEFINE('DB_DATABASE', 'users'); $con = new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE); if(!$con) { echo 'not connected to server'; } if (!mysqli_select_db($con, 'users')) { echo 'no database selected'; } $name = $_POST["name"]; $email = $_POST["email"]; $band = $_POST["band"]; $sql = "INSERT INTO users (Names, Emails, BandName) VALUES ('$name', '$email', '$band')"; if (!mysqli_query($con, $sql)) { echo 'Not worked'; } else { echo 'worked'; } ?&gt; </code></pre>
0debug
void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd, int64_t bps_wr, int64_t iops, int64_t iops_rd, int64_t iops_wr, Error **errp) { ThrottleConfig cfg; BlockDriverState *bs; bs = bdrv_find(device); if (!bs) { error_set(errp, QERR_DEVICE_NOT_FOUND, device); return; } memset(&cfg, 0, sizeof(cfg)); cfg.buckets[THROTTLE_BPS_TOTAL].avg = bps; cfg.buckets[THROTTLE_BPS_READ].avg = bps_rd; cfg.buckets[THROTTLE_BPS_WRITE].avg = bps_wr; cfg.buckets[THROTTLE_OPS_TOTAL].avg = iops; cfg.buckets[THROTTLE_OPS_READ].avg = iops_rd; cfg.buckets[THROTTLE_OPS_WRITE].avg = iops_wr; cfg.buckets[THROTTLE_BPS_TOTAL].max = 0; cfg.buckets[THROTTLE_BPS_READ].max = 0; cfg.buckets[THROTTLE_BPS_WRITE].max = 0; cfg.buckets[THROTTLE_OPS_TOTAL].max = 0; cfg.buckets[THROTTLE_OPS_READ].max = 0; cfg.buckets[THROTTLE_OPS_WRITE].max = 0; cfg.op_size = 0; if (!check_throttle_config(&cfg, errp)) { return; } if (!bs->io_limits_enabled && throttle_enabled(&cfg)) { bdrv_io_limits_enable(bs); } else if (bs->io_limits_enabled && !throttle_enabled(&cfg)) { bdrv_io_limits_disable(bs); } if (bs->io_limits_enabled) { bdrv_set_io_limits(bs, &cfg); } }
1threat
static void unterminated_string(void) { QObject *obj = qobject_from_json("\"abc", NULL); g_assert(obj == NULL); }
1threat
Javascript Fetch API - How to save output to variable as an Object (not the Promise) : <p>Please, how can I save output of fetch to a variable - to be able to work with it as with an object?</p> <p>Here is the code:</p> <pre><code>var obj; fetch("url", { method: "POST", body: JSON.stringify({ "filterParameters": { "id": 12345678 } }), headers: {"content-type": "application/json"}, //credentials: 'include' }) .then(res =&gt; res.json()) .then(console.log) </code></pre> <p>The final <code>console.log</code> will show an object. But when I tried to save it to variable <code>.then(res =&gt; obj = res.json())</code> than the <code>console.log(obj)</code> will not hold the Object, but the Promise. </p> <p><a href="https://i.stack.imgur.com/zkHFn.png" rel="noreferrer"><img src="https://i.stack.imgur.com/zkHFn.png" alt="Console"></a></p> <p>Any idea please, how to turn it into an Object saved in the variable?</p>
0debug
Why does not the authorization occur? : I implement search in my application. I try to implement the proposed in the seventh answer https://stackoverflow.com/questions/3727662/how-can-you-search-google-programmatically-java-api option. I insert my keys, but for some reason I do not pass authorization. Someone can tell me what I'm doing wrong. Below is my code. I use the com_google_apis_google_api_services_customsearch_v1_rev74_1_25_0.xml library I get the result: run: cs= com.google.api.services.customsearch.Customsearch@16b3fc9e list= {cx=MyCx, key=MyKey, q=test} IOException result result= null tried NB 8.2 ΠΈ IntelliJ IDEA import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.services.customsearch.Customsearch; import com.google.api.services.customsearch.CustomsearchRequestInitializer; import com.google.api.services.customsearch.model.Result; import com.google.api.services.customsearch.model.Search; import java.io.IOException; import java.security.GeneralSecurityException; public class Main { public static void main(String[] args) throws GeneralSecurityException, IOException { // String searchQuery = "test"; //The query to search // String cx = "MyCx"; //Your search engine String searchQuery = "test"; //The query to search String cx = "MyCx"; //Your search engine //Instance Customsearch Customsearch cs= null; try { cs = new Customsearch.Builder(GoogleNetHttpTransport.newTrustedTransport(), JacksonFactory.getDefaultInstance(), null) .setApplicationName("MYApp") .setGoogleClientRequestInitializer(new CustomsearchRequestInitializer("MyKey")) .build(); System.out.println("cs= "+cs); } catch (GeneralSecurityException e) { System.out.println("GeneralSecurityException cs"); } catch (IOException e) { System.out.println("IOException cs"); } catch (Exception e) { System.out.println("Exception cs"); } //Set search parameter Customsearch.Cse.List list = null; try { list = cs.cse().list(searchQuery).setCx(cx); System.out.println("list= "+list); } catch (IOException e) { System.out.println("IOException list"); } //Execute search Search result= null; try { result = list.execute(); } catch (IOException e) { System.out.println("IOException result"); } if (result!=null) { if (result.getItems()!=null){ for (Result ri : result.getItems()) { //Get title, link, body etc. from search System.out.println(ri.getTitle() + ", " + ri.getLink()); } } else { System.out.println(" resultgetItems()= null"); } } else { System.out.println(" result= null"); } } } The code seems to be correct, I would like to understand what you need to do to log in.
0debug