problem
stringlengths
26
131k
labels
class label
2 classes
How can I use both /g and /i in regex to make my search repeat through the entire search as well as ignore case sensitivity in javaScript? : <p>I want to remove white space, comma, and digits from my string as well as ignore case sensitivity. Below is my regex to this I am not able to use /i(to remove case sensitivity) and /g(repeat search) together in my expression.</p> <blockquote> <p>Regex expression</p> </blockquote> <pre><code>var str = "My age is 0, 0 si ega ym." str.replace(/[,\s\d.]+/g,'') </code></pre> <p>Where shall I put /i in the above expression?</p>
0debug
Python <' not supported between instances of 'builtin_function_or_method' and 'int : can anyone help with the above issue? albeit my code is not finished trying to run a few tests and cant get past this step: # if it was to cold in the office remove number from list. if input < 16: total= len - 1 full code (so far here) #Ask for temperature print ("please enter the temperature") Temp1 = input("enter temp: ") Temp2 = input("enter temp: ") Temp3 = input("enter temp: ") Temp4 = input("enter temp: ") Temp5 = input("enter temp: ") Temp6 = input("enter temp: ") Temp7 = input("enter temp: ") Temp8 = input("enter temp: ") #compute length of the list length = len(Temp1+Temp2+Temp3+Temp4+Temp5+Temp6+Temp7+Temp8) # if it was to cold in the office remove number from list. if input < 16: total= len - 1 #Calculate the percentage percent= (len/total) * 100 #display the percentage the office was warm enough for the day print percent here
0debug
How to send data between fragments in different activities : <p>I've been working in infoSec for almost a decade and now I'm trying to pivot into Android development. I'm completely new in the field of Android. This question has probably been answered before, but I didn't find anyone using pictures. So here we go:</p> <p>I want to grasp this thing with Fragments and activities. <a href="https://i.stack.imgur.com/wbYL4.png" rel="nofollow noreferrer">Activities and fragments image</a></p> <p>Basically I want to do a simple thing; get the result from GameFragment, pass it to GameActivity, pass it to ResultActivity, and then show it in the result fragment. (Or if there is another way to communicate with fragments in different activities)</p>
0debug
Detect if an email domain is a disposable one : <p>Well I am using disposable emails like mailinator , guerilla , 10 minute mail and the like . But this type of email is not really reliable when it comes to production. I am thinking of blacklisting them all using reg ex, but that would be overkill I Guess... Is there any service that can help me in doing validations like this? As Far as I am concenrned I have used an app that doesn't allow that kind of email , I know it is possible , Any hints ?</p>
0debug
Vim command: how to select a word under cursor in normal mode : <p>I'm looking for a Vim command to select a word under cursor in normal mode, like double-clicking by mouse. Does it exist like this?</p>
0debug
Docker-compose with django could not translate host name "db" to address: Name or service not known : <p>I have currently a system built with docker-compose, it creates a Django application.</p> <p>Up until now I've used a database inside a container (postgresql) in my testing build. Now I've changed the database from this container to an RDS instance in AWS.</p> <p>Using Pg_dump I have recreated the database inside RDS and changed the settings.py, everything was supposedly normal. I have accessed the data from the database inside my webapp without any problems. </p> <p>Everything was ok until I had to make a migration. Without the database container the Django container gives me this message:</p> <blockquote> <p>django.db.utils.OperationalError: could not translate host name "db" to address: Name or service not known</p> </blockquote> <p>My Docker-compose.yml file before the changes:</p> <pre><code> version: '2' services: db: image: postgres:9.5 restart: always environment: POSTGRES_USER: testing POSTGRES_PASSWORD: tests POSTGRES_DB: test volumes: - /dbdata:/var/lib/postgresql/data django: build: ./django command: gunicorn contactto.wsgi:application -b 0.0.0.0:8000 restart: always volumes: - ./django:/usr/src/app - ./django/static:/usr/src/app/contactto/static ports: - "8000:8000" depends_on: - db </code></pre> <p>Now after the changes:</p> <pre><code> version: '2' services: django: build: ./django command: gunicorn contactto.wsgi:application -b 0.0.0.0:8000 restart: always volumes: - ./django:/usr/src/app - ./django/static:/usr/src/app/contactto/static ports: - "8000:8000" </code></pre> <p>And the DATABASES from settings.py . Before:</p> <pre><code>DATABASES = { 'default': { 'ENGINE': 'tenant_schemas.postgresql_backend', 'NAME': 'testing', 'USER': 'test', 'PASSWORD': 'test', 'HOST': 'db', 'PORT': '5432', } } </code></pre> <p>After:</p> <pre><code>DATABASES = { 'default': { 'ENGINE': 'tenant_schemas.postgresql_backend', 'NAME': 'testing', 'USER': 'test', 'PASSWORD': 'test', 'HOST': 'xxx.rds.amazonaws.com', 'PORT': '5432', } } </code></pre> <p>The weird thing is, I can use the aws database inside my app... I can create users and do things inside the database and the changes appear. Now in the CLI I can't even use manage.py shell without the message.</p> <p>I am completely lost.</p>
0debug
RecyclerView "cannot resolve symbol" errors - Android Studio : <p>I am getting cannot resolve symbol errors on all my RecyclerView's. What is going on? Because I have an error with RecyclerView, I also have errors on LayoutManager. My last four Override statements are in the wrong place and I don't know where they go. I am a beginner and have a very basic knowledge of programming so I don't know how to fix this. I am taking a class but the professor isn't helpful at all.</p> <pre><code>package com.bignerdranch.android.criminalintent; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CheckBox; import android.widget.TextView; import android.widget.Toast; import java.util.List; public class CrimeListFragment extends Fragment { private RecyclerView mCrimeRecyclerView; private CrimeAdapter mAdapter; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_crime_list, container, false); mCrimeRecyclerView = (RecyclerView) view .findViewById(R.id.crime_recycler_view); mCrimeRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); return view; } @Override public void onResume() { super.onResume(); updateUI(); } private void updateUI(){ CrimeLab crimeLab = CrimeLab.get(getActivity()); List&lt;Crime&gt; crimes = crimeLab.getCrimes(); if (mAdapter == null) { mAdapter = new CrimeAdapter(crimes); mCrimeRecyclerView.setAdapter(mAdapter); } else { mAdapter.notifyDataSetChanged(); } } private class CrimeAdapter extends RecyclerView.Adapter&lt;CrimeHolder&gt; { private List&lt;Crime&gt; mCrimes; public CrimeAdapter(List&lt;Crime&gt; crimes) { mCrimes = crimes; } } private class CrimeHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private TextView mTitleTextView; private TextView mDateTextView; private CheckBox mSolvedCheckBox; private Crime mCrime; public CrimeHolder(View itemView) { super(itemView); mTitleTextView = (TextView) itemView.findViewById(R.id.list_item_crime_title_text_view); mDateTextView = (TextView) itemView.findViewById(R.id.list_item_crime_date_text_view); mSolvedCheckBox = (CheckBox) itemView.findViewById(R.id.list_item_crime_solved_check_box); } public void bindCrime(Crime crime) { mCrime = crime; mTitleTextView.setText(mCrime.getTitle()); mDateTextView.setText(mCrime.getDate().toString()); mSolvedCheckBox.setChecked(mCrime.isSolved()); } @Override public CrimeHolder onCreateViewHolder(ViewGroup parent, int viewType) { LayoutInflater layoutInflater = LayoutInflater.from(getActivity()); View view = layoutInflater.inflate(R.layout.list_item_crime, parent, false); return new CrimeHolder(view); } @Override public void onBindViewHolder(CrimeHolder holder, int position) { Crime crime = mCrimes.get(position); holder.bindCrime(crime); } @Override public int getItemCount() { return mCrimes.size(); } @Override public void onClick(View v) { Intent intent = CrimeActivity.newIntent(getActivity(), mCrime.getId()); startActivity(intent); } } } </code></pre>
0debug
static void *circular_buffer_task_tx( void *_URLContext) { URLContext *h = _URLContext; UDPContext *s = h->priv_data; int old_cancelstate; pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old_cancelstate); for(;;) { int len; uint8_t tmp[4]; pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &old_cancelstate); av_usleep(s->packet_gap); pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old_cancelstate); pthread_mutex_lock(&s->mutex); len=av_fifo_size(s->fifo); while (len<4) { if (pthread_cond_wait(&s->cond, &s->mutex) < 0) { goto end; } len=av_fifo_size(s->fifo); } av_fifo_generic_peek(s->fifo, tmp, 4, NULL); len=AV_RL32(tmp); if (len>0 && av_fifo_size(s->fifo)>=len+4) { av_fifo_drain(s->fifo, 4); av_fifo_generic_read(s->fifo, h, len, do_udp_write); if (s->circular_buffer_error == len) { s->circular_buffer_error=0; } } pthread_mutex_unlock(&s->mutex); } end: pthread_mutex_unlock(&s->mutex); return NULL; }
1threat
Object of ‘NoneType’ has no len() - error : <pre><code>z=[] while len(z)&lt;8: z=z.append(1) </code></pre> <p>This programmes says error in the line where the while loop is. The error is mentioned in the title. What should I do ?</p>
0debug
React-native: trigger onPress event (Picker component) : <p>For some reason, the same <a href="https://facebook.github.io/react-native/docs/picker.html" rel="noreferrer">Picker</a> component behaves as list of options on iOS and as button on Android. I have no idea, who decided, that this is good idea to put it like that.</p> <p>I want to hide <code>&lt;Picker/&gt;</code> on android and render <code>TouchableOpacity</code> instead. It solves styling problems. However, i don't know, how do I make <code>TouchableOpacity</code> <code>onPress</code> method to trigger <code>onPress</code> event for the hidden <code>&lt;Picker /&gt;</code>?</p>
0debug
static void vmdk_close(BlockDriverState *bs) { BDRVVmdkState *s = bs->opaque; qemu_free(s->l1_table); qemu_free(s->l2_cache); bdrv_delete(s->hd); vmdk_parent_close(s->hd); }
1threat
static int check(AVIOContext *pb, int64_t pos, int64_t *out_pos) { MPADecodeHeader mh = { 0 }; int i; uint32_t header; int64_t off = 0; for (i = 0; i < SEEK_PACKETS; i++) { off = avio_seek(pb, pos + mh.frame_size, SEEK_SET); if (off < 0) break; header = avio_rb32(pb); if (ff_mpa_check_header(header) < 0 || avpriv_mpegaudio_decode_header(&mh, header)) break; out_pos[i] = off; } return i; }
1threat
static int read_packet(AVFormatContext *s1, AVPacket *pkt) { VideoDemuxData *s = s1->priv_data; char filename[1024]; int i; int size[3]={0}, ret[3]={0}; AVIOContext *f[3]; AVCodecContext *codec= s1->streams[0]->codec; if (!s->is_pipe) { if (s->loop && s->img_number > s->img_last) { s->img_number = s->img_first; } if (s->img_number > s->img_last) return AVERROR_EOF; if (av_get_frame_filename(filename, sizeof(filename), s->path, s->img_number)<0 && s->img_number > 1) return AVERROR(EIO); for(i=0; i<3; i++){ if (avio_open2(&f[i], filename, AVIO_FLAG_READ, &s1->interrupt_callback, NULL) < 0) { if(i==1) break; av_log(s1, AV_LOG_ERROR, "Could not open file : %s\n",filename); return AVERROR(EIO); } size[i]= avio_size(f[i]); if(codec->codec_id != AV_CODEC_ID_RAWVIDEO) break; filename[ strlen(filename) - 1 ]= 'U' + i; } if(codec->codec_id == AV_CODEC_ID_RAWVIDEO && !codec->width) infer_size(&codec->width, &codec->height, size[0]); } else { f[0] = s1->pb; if (f[0]->eof_reached) return AVERROR(EIO); size[0]= 4096; } av_new_packet(pkt, size[0] + size[1] + size[2]); pkt->stream_index = 0; pkt->flags |= AV_PKT_FLAG_KEY; pkt->size= 0; for(i=0; i<3; i++){ if(size[i]){ ret[i]= avio_read(f[i], pkt->data + pkt->size, size[i]); if (!s->is_pipe) avio_close(f[i]); if(ret[i]>0) pkt->size += ret[i]; } } if (ret[0] <= 0 || ret[1]<0 || ret[2]<0) { av_free_packet(pkt); return AVERROR(EIO); } else { s->img_count++; s->img_number++; return 0; } }
1threat
static int alloc_buffer(InputStream *ist, FrameBuffer **pbuf) { AVCodecContext *s = ist->st->codec; FrameBuffer *buf = av_mallocz(sizeof(*buf)); int ret; const int pixel_size = av_pix_fmt_descriptors[s->pix_fmt].comp[0].step_minus1+1; int h_chroma_shift, v_chroma_shift; int edge = 32; int w = s->width, h = s->height; if (!buf) return AVERROR(ENOMEM); if (!(s->flags & CODEC_FLAG_EMU_EDGE)) { w += 2*edge; h += 2*edge; } avcodec_align_dimensions(s, &w, &h); if ((ret = av_image_alloc(buf->base, buf->linesize, w, h, s->pix_fmt, 32)) < 0) { av_freep(&buf); return ret; } memset(buf->base[0], 128, ret); avcodec_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift); for (int i = 0; i < FF_ARRAY_ELEMS(buf->data); i++) { const int h_shift = i==0 ? 0 : h_chroma_shift; const int v_shift = i==0 ? 0 : v_chroma_shift; if (s->flags & CODEC_FLAG_EMU_EDGE) buf->data[i] = buf->base[i]; else buf->data[i] = buf->base[i] + FFALIGN((buf->linesize[i]*edge >> v_shift) + (pixel_size*edge >> h_shift), 32); } buf->w = s->width; buf->h = s->height; buf->pix_fmt = s->pix_fmt; buf->ist = ist; *pbuf = buf; return 0; }
1threat
int vp78_decode_mb_row_sliced(AVCodecContext *avctx, void *tdata, int jobnr, int threadnr, int is_vp7) { VP8Context *s = avctx->priv_data; VP8ThreadData *td = &s->thread_data[jobnr]; VP8ThreadData *next_td = NULL, *prev_td = NULL; VP8Frame *curframe = s->curframe; int mb_y, num_jobs = s->num_jobs; int ret; td->thread_nr = threadnr; for (mb_y = jobnr; mb_y < s->mb_height; mb_y += num_jobs) { atomic_store(&td->thread_mb_pos, mb_y << 16); ret = s->decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr); if (ret < 0) { update_pos(td, s->mb_height, INT_MAX & 0xFFFF); return ret; } if (s->deblock_filter) s->filter_mb_row(avctx, tdata, jobnr, threadnr); update_pos(td, mb_y, INT_MAX & 0xFFFF); s->mv_min.y -= 64; s->mv_max.y -= 64; if (avctx->active_thread_type == FF_THREAD_FRAME) ff_thread_report_progress(&curframe->tf, mb_y, 0); } return 0; }
1threat
Please help me to get this PHP code work correctly : <?php include 'header.php'; error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); $con = mysql_connect("localhost","root",""); $db_selected = mysql_select_db("layout",$con); $name = $_POST['name']; $password = $_POST['password']; if($_POST["submit"] == "LOGIN" ) { $sql = "SELECT username,password from secure"; $result = mysql_query($sql,$con); } while($row = mysql_fetch_array($result,MYSQL_BOTH)) { if($row['username'] == $name and $row['password'] == $password) { echo "welcome " .$name; } else { echo "Wrong Credentials"; } } ?> I'm a beginner. I wrote this PHP code for a sign in form. But it's showing "Wrong Credentials" followed by "Welcome George", even if the username and password matches. And if the username and password doesnt match it shows as "Wrong Credentials" followed by another "Wrong Credentials". Please help. Thanks in advance.
0debug
QPCIBus *qpci_init_spapr(QGuestAllocator *alloc) { QPCIBusSPAPR *ret; ret = g_malloc(sizeof(*ret)); ret->alloc = alloc; ret->bus.io_readb = qpci_spapr_io_readb; ret->bus.io_readw = qpci_spapr_io_readw; ret->bus.io_readl = qpci_spapr_io_readl; ret->bus.io_writeb = qpci_spapr_io_writeb; ret->bus.io_writew = qpci_spapr_io_writew; ret->bus.io_writel = qpci_spapr_io_writel; ret->bus.config_readb = qpci_spapr_config_readb; ret->bus.config_readw = qpci_spapr_config_readw; ret->bus.config_readl = qpci_spapr_config_readl; ret->bus.config_writeb = qpci_spapr_config_writeb; ret->bus.config_writew = qpci_spapr_config_writew; ret->bus.config_writel = qpci_spapr_config_writel; ret->bus.iomap = qpci_spapr_iomap; ret->bus.iounmap = qpci_spapr_iounmap; ret->buid = 0x800000020000000ULL; ret->pio_cpu_base = SPAPR_PCI_WINDOW_BASE + SPAPR_PCI_IO_WIN_OFF; ret->pio.pci_base = 0; ret->pio.size = SPAPR_PCI_IO_WIN_SIZE; ret->mmio_cpu_base = SPAPR_PCI_WINDOW_BASE + SPAPR_PCI_MMIO_WIN_OFF; ret->mmio.pci_base = SPAPR_PCI_MEM_WIN_BUS_OFFSET; ret->mmio.size = SPAPR_PCI_MMIO_WIN_SIZE; ret->pci_hole_start = 0xC0000000; ret->pci_hole_size = ret->mmio.pci_base + ret->mmio.size - ret->pci_hole_start; ret->pci_hole_alloc = 0; ret->pci_iohole_start = 0xc000; ret->pci_iohole_size = ret->pio.pci_base + ret->pio.size - ret->pci_iohole_start; ret->pci_iohole_alloc = 0; return &ret->bus; }
1threat
Can "active processes" be larger than "max_children" for PHP-FPM : <p>Having set the pool to static with max_children to 5 I would expect the metric "active processes" to be 5 or below. Sending 10 concurrent requests will have "active processes" report more than 5 (e.g. 10, 12, 25, ...).</p> <p>Is this valid behaviour?</p> <p>Pool configuration:</p> <pre><code># grep -v ";" /usr/local/etc/php-fpm.d/www.conf | grep -Ev "^$" [www] user = www-data group = www-data listen = 127.0.0.1:9000 pm = static pm.max_children = 5 pm.start_servers = 2 pm.min_spare_servers = 1 pm.max_spare_servers = 3 pm.process_idle_timeout = 10s pm.max_requests = 500 pm.status_path = /status ping.response = pong slowlog = log/$pool.log.slow request_slowlog_timeout = 0 request_terminate_timeout = 0 </code></pre> <p><strong>Expected result:</strong> Metric "active processes" from /status should be below 5.</p> <p><strong>Actual result:</strong> Metric "active processes" from /status is above 5.</p>
0debug
int kvm_irqchip_update_msi_route(KVMState *s, int virq, MSIMessage msg) { struct kvm_irq_routing_entry kroute; if (!kvm_irqchip_in_kernel()) { return -ENOSYS; } kroute.gsi = virq; kroute.type = KVM_IRQ_ROUTING_MSI; kroute.flags = 0; kroute.u.msi.address_lo = (uint32_t)msg.address; kroute.u.msi.address_hi = msg.address >> 32; kroute.u.msi.data = msg.data; return kvm_update_routing_entry(s, &kroute); }
1threat
cannot load png files with webpack, unexpected character : <p>Im trying to reconfigure my webpack, and now i cannot load the css files. i keep my styles in src > styles > main.css</p> <p>I am getting errors such as </p> <pre><code>ERROR in ./src/images/NavIcon03.png Module build failed: SyntaxError: /Users/myname/work/site/src/images/NavIcon03.png: Unexpected character '�' (1:0) </code></pre> <p>Here is my webpack configuration</p> <pre><code>var webpack = require('webpack') module.exports = { entry: [ './src/main.js' ], output: { path: __dirname, publicPath: '/', filename: 'bundle.js' }, module: { loaders: [{ exclude: /node_modules/, loader: 'babel' }, { test: /\.css$/, // Only .css files loader: 'style!css' // Run both loaders }] }, resolve: { extensions: ['', '.js', '.jsx'] }, devServer: { contentBase: './' } }; </code></pre> <p>Below is the package.json</p> <pre><code>{ "name": "website", "version": "0.0.1", "dependencies": { "ampersand-app": "^1.0.4", "ampersand-model": "^5.0.3", "ampersand-react-mixin": "^0.1.3", "ampersand-rest-collection": "^4.0.0", "ampersand-router": "^3.0.2", "asynquence": "^0.8.2", "autoprefixer": "^5.2.0", "autoprefixer-core": "^5.2.0", "autoprefixer-stylus": "^0.7.0", "axios": "^0.9.1", "babel": "^5.5.8", "babel-core": "^5.5.8", "babel-loader": "^5.1.4", "bootstrap": "^3.3.6", "bootstrap-webpack": "0.0.5", "css-loader": "^0.15.1", "d3": "^3.5.12", "file-loader": "^0.8.4", "font-awesome": "^4.5.0", "google-map-react": "^0.9.3", "history": "^1.17.0", "hjs-webpack": "^2.6.0", "json-loader": "^0.5.2", "local-links": "^1.4.0", "lodash": "^4.3.0", "lodash.assign": "^3.2.0", "lodash.has": "^3.2.1", "lodash.merge": "^3.3.1", "lodash.pick": "^3.1.0", "lodash.result": "^3.1.2", "milliseconds": "^1.0.3", "moment": "^2.11.1", "node-libs-browser": "^0.5.2", "object-assign": "^4.0.1", "octicons": "^2.2.0", "postcss-loader": "^0.5.0", "qs": "^3.1.0", "react": "^0.14.6", "react-avatar-editor": "^3.2.0", "react-bootstrap": "*", "react-bootstrap-table": "^1.3.3", "react-bootstrap-validation": "^0.1.11", "react-cropper": "^0.6.0", "react-d3-components": "^0.6.0", "react-dom": "^0.14.6", "react-dropzone": "^3.3.0", "react-dropzone-component": "^0.8.1", "react-facebook-login": "^2.0.3", "react-fileupload": "^1.1.3", "react-google-maps": "^4.7.1", "react-hot-loader": "^1.3.0", "react-input-slider": "^1.5.0", "react-redux": "^4.4.0", "react-router": "^2.0.0", "react-select": "^1.0.0-beta8", "react-star-rating-component": "^0.1.0", "redux": "^3.3.1", "redux-promise": "^0.5.1", "slugger": "^1.0.0", "standard": "^4.3.1", "style-loader": "^0.12.3", "stylus-loader": "^1.2.1", "surge": "^0.14.2", "url-loader": "^0.5.6", "webpack": "^1.9.11", "webpack-dev-server": "^1.9.0", "xhr": "^2.0.2", "yeticss": "^6.0.7" }, "license": "", "private": true, "scripts": { "build": "webpack", "deploy": "surge -p public -d labelr.surge.sh", "start": "webpack-dev-server", "yolo": "git add --all &amp;&amp; git commit -am \"$(date)\" &amp;&amp; npm version minor &amp;&amp; git push origin master --tags &amp;&amp; npm run build &amp;&amp; npm run deploy" }, "devDependencies": { "babel-preset-react": "^6.5.0", "css-loader": "^0.15.6", "redux-devtools": "^3.1.1", "style-loader": "^0.12.4" } } </code></pre>
0debug
Cannot find setter for field - using Kotlin with Room database : <p>I'm integrating with the Room persistence library. I have a data class in Kotlin like:</p> <pre><code>@Entity(tableName = "story") data class Story ( @PrimaryKey val id: Long, val by: String, val descendants: Int, val score: Int, val time: Long, val title: String, val type: String, val url: String ) </code></pre> <p>The <code>@Entity</code> and <code>@PrimaryKey</code> annotations are for the Room library. When I try to build, it is failing with error:</p> <pre><code>Error:Cannot find setter for field. Error:Execution failed for task ':app:compileDebugJavaWithJavac'. &gt; Compilation failed; see the compiler error output for details. </code></pre> <p>I also tried providing a default constructor:</p> <pre><code>@Entity(tableName = "story") data class Story ( @PrimaryKey val id: Long, val by: String, val descendants: Int, val score: Int, val time: Long, val title: String, val type: String, val url: String ) { constructor() : this(0, "", 0, 0, 0, "", "", "") } </code></pre> <p>But this doesn't work as well. A thing to note is that it works if I convert this Kotlin class into a Java class with getters and setters. Any help is appreciated!</p>
0debug
i want to craete a table with fixed column,but each column show a data from data base, Jsp : I want fixed column e.g. 3 , but each column show a data from data base, for example i have 10 data(row) in my database like data1 data2 etc. now i want to show the data like iam using Jsp & html.`enter code here <tr> <td>data 1</td><td>data 2</td><td>data 3</td></tr> <tr><td>data 4</td><td>data 5</td><td>data 6</td></tr> <tr><td>data 7</td><td>data 8</td><td>data 9</td></tr> <tr><td>data 10</td></tr>
0debug
python log formatter that shows all kwargs in extra : <p>I hope to add the following log points to my application and display the full contents of <code>extra</code> on console, e.g., </p> <pre><code>logger.info('Status', extra={'foo':data}) logger.info('Status', extra={'bar':data}) logger.info('Status', extra={'foo':data, 'bar':data}) </code></pre> <p>and I hope to see:</p> <pre><code>2016-10-10 15:28:31,408, INFO, Status, foo=data 2016-10-10 15:38:31,408, INFO, Status, bar=data 2016-10-10 15:48:31,408, INFO, Status, foo=data, bar=data </code></pre> <p>Is this even possible? According to official logging documentation, the <code>Formatter</code> must be set up with a format string that expects <code>foo</code> and <code>bar</code> but in my case all I want is to dump out the entire kwargs of <code>extra</code> without prior knowledge of <code>foo</code> and <code>bar</code>.</p>
0debug
static void curl_readv_bh_cb(void *p) { CURLState *state; CURLAIOCB *acb = p; BDRVCURLState *s = acb->common.bs->opaque; qemu_bh_delete(acb->bh); acb->bh = NULL; size_t start = acb->sector_num * SECTOR_SIZE; size_t end; switch (curl_find_buf(s, start, acb->nb_sectors * SECTOR_SIZE, acb)) { case FIND_RET_OK: qemu_aio_release(acb); case FIND_RET_WAIT: return; default: break; } state = curl_init_state(s); if (!state) { acb->common.cb(acb->common.opaque, -EIO); qemu_aio_release(acb); return; } acb->start = 0; acb->end = (acb->nb_sectors * SECTOR_SIZE); state->buf_off = 0; if (state->orig_buf) g_free(state->orig_buf); state->buf_start = start; state->buf_len = acb->end + s->readahead_size; end = MIN(start + state->buf_len, s->len) - 1; state->orig_buf = g_malloc(state->buf_len); state->acb[0] = acb; snprintf(state->range, 127, "%zd-%zd", start, end); DPRINTF("CURL (AIO): Reading %d at %zd (%s)\n", (acb->nb_sectors * SECTOR_SIZE), start, state->range); curl_easy_setopt(state->curl, CURLOPT_RANGE, state->range); curl_multi_add_handle(s->multi, state->curl); curl_multi_do(s); }
1threat
PHP substr return wrong value : Here is the example code : <?php $number = 0130; $a1 = substr($number,0,1); $a2 = substr($number,1,1); $a3 = substr($number,2,1); $a4 = substr($number,3,1); $a = [$a1,$a2,$a3,$a4]; echo $a1; i got result is 8 why not 0?
0debug
Get the length of a number by only using modulus : <p>Can someone help me figure out an exersice the IT teacher gave me? I have to make a program, that calculates how many digits are in a number. For example:</p> <p>I input a number 100, and the program gives me an output of 3. If I input 99, the program gives me 2.</p> <p>How can I achieve this by ONLY using the modulus (%) operator and nothing else, but mathematical calculations.</p>
0debug
Making a checkers board in python : <p>I am trying to make a 2D array that is 8x8 for a checkers game in python. How would I go about doing this? Here is my current code:</p> <pre><code>class Board(): board = [[]] def __init__(self,width,height): self.width = width self.height = height def __repr__(self): print(self.board) def setup(self): for y in range(self.height): for x in range(self.width): self.board[y].append(0) board = Board(8,8) board.setup() print(board.board) </code></pre>
0debug
void ff_aac_apply_tns(SingleChannelElement *sce) { const int mmm = FFMIN(sce->ics.tns_max_bands, sce->ics.max_sfb); float *coef = sce->pcoeffs; TemporalNoiseShaping *tns = &sce->tns; int w, filt, m, i; int bottom, top, order, start, end, size, inc; float *lpc, tmp[TNS_MAX_ORDER+1]; for (w = 0; w < sce->ics.num_windows; w++) { bottom = sce->ics.num_swb; for (filt = 0; filt < tns->n_filt[w]; filt++) { top = bottom; bottom = FFMAX(0, top - tns->length[w][filt]); order = tns->order[w][filt]; lpc = tns->coef[w][filt]; if (!order) continue; start = sce->ics.swb_offset[FFMIN(bottom, mmm)]; end = sce->ics.swb_offset[FFMIN( top, mmm)]; if ((size = end - start) <= 0) continue; if (tns->direction[w][filt]) { inc = -1; start = end - 1; } else { inc = 1; } start += w * 128; if (!sce->ics.ltp.present) { for (m = 0; m < size; m++, start += inc) for (i = 1; i <= FFMIN(m, order); i++) coef[start] += coef[start - i * inc]*lpc[i - 1]; } else { for (m = 0; m < size; m++, start += inc) { tmp[0] = coef[start]; for (i = 1; i <= FFMIN(m, order); i++) coef[start] += tmp[i]*lpc[i - 1]; for (i = order; i > 0; i--) tmp[i] = tmp[i - 1]; } } } } }
1threat
static int decode_frame(FLACContext *s) { int i, ret; GetBitContext *gb = &s->gb; FLACFrameInfo fi; if ((ret = ff_flac_decode_frame_header(s->avctx, gb, &fi, 0)) < 0) { av_log(s->avctx, AV_LOG_ERROR, "invalid frame header\n"); return ret; } if (s->channels && fi.channels != s->channels && s->got_streaminfo) { s->channels = s->avctx->channels = fi.channels; ff_flac_set_channel_layout(s->avctx); ret = allocate_buffers(s); if (ret < 0) return ret; } s->channels = s->avctx->channels = fi.channels; if (!s->avctx->channel_layout) ff_flac_set_channel_layout(s->avctx); s->ch_mode = fi.ch_mode; if (!s->bps && !fi.bps) { av_log(s->avctx, AV_LOG_ERROR, "bps not found in STREAMINFO or frame header\n"); return AVERROR_INVALIDDATA; } if (!fi.bps) { fi.bps = s->bps; } else if (s->bps && fi.bps != s->bps) { av_log(s->avctx, AV_LOG_ERROR, "switching bps mid-stream is not " "supported\n"); return AVERROR_INVALIDDATA; } if (!s->bps) { s->bps = s->avctx->bits_per_raw_sample = fi.bps; flac_set_bps(s); } if (!s->max_blocksize) s->max_blocksize = FLAC_MAX_BLOCKSIZE; if (fi.blocksize > s->max_blocksize) { av_log(s->avctx, AV_LOG_ERROR, "blocksize %d > %d\n", fi.blocksize, s->max_blocksize); return AVERROR_INVALIDDATA; } s->blocksize = fi.blocksize; if (!s->samplerate && !fi.samplerate) { av_log(s->avctx, AV_LOG_ERROR, "sample rate not found in STREAMINFO" " or frame header\n"); return AVERROR_INVALIDDATA; } if (fi.samplerate == 0) fi.samplerate = s->samplerate; s->samplerate = s->avctx->sample_rate = fi.samplerate; if (!s->got_streaminfo) { ret = allocate_buffers(s); if (ret < 0) return ret; ff_flacdsp_init(&s->dsp, s->avctx->sample_fmt, s->channels, s->bps); s->got_streaminfo = 1; dump_headers(s->avctx, (FLACStreaminfo *)s); } for (i = 0; i < s->channels; i++) { if ((ret = decode_subframe(s, i)) < 0) return ret; } align_get_bits(gb); skip_bits(gb, 16); return 0; }
1threat
void *virtqueue_pop(VirtQueue *vq, size_t sz) { unsigned int i, head, max; hwaddr desc_pa = vq->vring.desc; VirtIODevice *vdev = vq->vdev; VirtQueueElement *elem; unsigned out_num, in_num; hwaddr addr[VIRTQUEUE_MAX_SIZE]; struct iovec iov[VIRTQUEUE_MAX_SIZE]; VRingDesc desc; if (virtio_queue_empty(vq)) { return NULL; smp_rmb(); out_num = in_num = 0; max = vq->vring.num; i = head = virtqueue_get_head(vq, vq->last_avail_idx++); if (virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { vring_set_avail_event(vq, vq->last_avail_idx); vring_desc_read(vdev, &desc, desc_pa, i); if (desc.flags & VRING_DESC_F_INDIRECT) { if (desc.len % sizeof(VRingDesc)) { error_report("Invalid size for indirect buffer table"); max = desc.len / sizeof(VRingDesc); desc_pa = desc.addr; i = 0; vring_desc_read(vdev, &desc, desc_pa, i); do { if (desc.flags & VRING_DESC_F_WRITE) { virtqueue_map_desc(&in_num, addr + out_num, iov + out_num, VIRTQUEUE_MAX_SIZE - out_num, true, desc.addr, desc.len); } else { if (in_num) { error_report("Incorrect order for descriptors"); virtqueue_map_desc(&out_num, addr, iov, VIRTQUEUE_MAX_SIZE, false, desc.addr, desc.len); if ((in_num + out_num) > max) { error_report("Looped descriptor"); } while ((i = virtqueue_read_next_desc(vdev, &desc, desc_pa, max)) != max); elem = virtqueue_alloc_element(sz, out_num, in_num); elem->index = head; for (i = 0; i < out_num; i++) { elem->out_addr[i] = addr[i]; elem->out_sg[i] = iov[i]; for (i = 0; i < in_num; i++) { elem->in_addr[i] = addr[out_num + i]; elem->in_sg[i] = iov[out_num + i]; vq->inuse++; trace_virtqueue_pop(vq, elem, elem->in_num, elem->out_num); return elem;
1threat
static bool enforce_config_section(void) { MachineState *machine = MACHINE(qdev_get_machine()); return machine->enforce_config_section; }
1threat
regex expression for 11 digit - separated number c# winforms : I am creating a text parser in c# windows form and I want to identify 11 digit phone numbers starting from 0 with a **-** separator, eg 0341-2239548 or 021-34223311 should be converted to 03412239548 and 02134223311 respectively using Regex.Match. I am unable to find the relevant regex expression, can anyone help me please?
0debug
How to sort list of objects? : <p>I have a list of objects, each object has a method that returns distance from player to said object like that</p> <pre><code>object.distance(player) </code></pre> <p>now i need to sort that list from loqwest distance to furthest</p>
0debug
document.location = 'http://evil.com?username=' + user_input;
1threat
Using Javascript, how I compare to values to see if they are divisible by each other? : I am trying to write a event handler here so that when users enter a number in the first text box and the second text box, and click "Compare Values" button, a function executes and it checks if either of the number is ZERO, it prints out on "box5", "You have entered zero" if the two numbers are the same, it prints out on "box5", "The numbers are the same" If the first number is evenly divisible by the second, it prints out on "box5", "The first is divisible by the second" if the second number is evenly divisible by the first, it prints out on "box5", "The second is divisible by the first" else-if the numbers do not divide into each other, it prints out on "box5", "They are not divisible" I've already created the HTML page for this but I do not know how I should approach this. A few users have told me to use the "keyup" method and I was hoping if someone could show me an example of the way they would approach this using the "keyup" method if that is possible. Thanks in advance <p> Enter two numbers and we will tell you if they are evenly divisble <p> Enter your first number:</p> <input type="text" id="box3"> <p> Enter your second number: </p> <input type="text" id="box4"> <button id="compareValue">Compare Values</button> <p> Output will appear here: </p> <input text="type" id="box5" disabled> I am just trying to create a simple tool to compare 2 numbers entered by a user, and check to see if they are divisible, and if they are, which number is divisible by which one, and to make sure that no ZERO is entered in the input, and else-if nothing is divisible by each other, then it tells you they are not divisible.
0debug
static void sd_blk_read(SDState *sd, uint64_t addr, uint32_t len) { uint64_t end = addr + len; DPRINTF("sd_blk_read: addr = 0x%08llx, len = %d\n", (unsigned long long) addr, len); if (!sd->bdrv || bdrv_read(sd->bdrv, addr >> 9, sd->buf, 1) < 0) { fprintf(stderr, "sd_blk_read: read error on host side\n"); return; } if (end > (addr & ~511) + 512) { memcpy(sd->data, sd->buf + (addr & 511), 512 - (addr & 511)); if (bdrv_read(sd->bdrv, end >> 9, sd->buf, 1) < 0) { fprintf(stderr, "sd_blk_read: read error on host side\n"); return; } memcpy(sd->data + 512 - (addr & 511), sd->buf, end & 511); } else memcpy(sd->data, sd->buf + (addr & 511), len); }
1threat
How to Use SceneKit to get this effect , i using the NSConstraint to develop but no success : Need some help or minds , how to Use SceneKit to get this effect , i using the NSConstraint to develop but no success..[enter image description here][1] [1]: https://i.stack.imgur.com/MenMF.gif
0debug
How to see videos from a network stream(http)? : <p>I was wondering: how does youtube or any other website containing videos, send such data to clients? When using the web browser, and asking for a webpage, what happens is that the browser sends an HTTP GET request to the server, which returns the html page; but how does the video data get transferred? Is it opened an additional connection to do that? And, is there a way to capture this stream in a program using some software library?</p> <p>What i want to achieve is something like the VLC's network stream feature, which allows you to watch videos from youtube, but i don't know where to start from.</p> <p>Thanks</p>
0debug
static uint32_t ehci_mem_readb(void *ptr, target_phys_addr_t addr) { EHCIState *s = ptr; uint32_t val; val = s->mmio[addr]; return val; }
1threat
.Net Core warning No XML encryptor configured : <p>When I start my service (API on .Net Core 2.2 in Docker container) I've got a warning:</p> <blockquote> <p>No XML encryptor configured. Key {daa53741-8295-4c9b-ae9c-e69b003f16fa} may be persisted to storage in unencrypted form.</p> </blockquote> <p>I didn't configure DataProtection. I've found solutions to configure DataProtection but I don't need to save this key. For me if the key will only be persisted until the application restarts - it's Ok. But I don't need to see this warning in logs</p> <p>Any ideas? How can we do it?</p> <p>My startup Class looks like there:</p> <pre><code>public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } public void ConfigureServices(IServiceCollection services) { services.AddMemoryCache(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); services.AddApiVersioning(o =&gt; o.ApiVersionReader = new HeaderApiVersionReader("api-version")); } public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime lifetime) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseMvc(); lifetime.ApplicationStarted.Register(OnApplicationStarted); lifetime.ApplicationStopping.Register(OnShutdown); } public void OnApplicationStarted() { Console.Out.WriteLine($"Open Api Started"); } public void OnShutdown() { Console.Out.WriteLine($"Open Api is shutting down."); } } </code></pre> <p><em>Maybe it's help too</em> my packages in the project</p> <pre><code>&lt;ItemGroup&gt; &lt;PackageReference Include="BouncyCastle.NetCore" Version="1.8.5" /&gt; &lt;PackageReference Include="Microsoft.AspNetCore.App" /&gt; &lt;PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="3.1.2" /&gt; &lt;PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" /&gt; &lt;PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.5.4" /&gt; &lt;PackageReference Include="Oracle.ManagedDataAccess.Core" Version="2.18.6" /&gt; &lt;/ItemGroup&gt; </code></pre>
0debug
Compare two files and append the difference at the bottom : I would like to first compare two files (`POSCAR.init` and `POSCAR.final`) in the link https://www.dropbox.com/sh/w9z7psuzq3qo9jm/AAAhySzuiYv08LPWpfFTaxtoa?dl=0 and then append the differences at the end of the respective files. The final files should look like `test.init` and `test.final` where one can see I manually put the differences at the bottom. If one uses `sdiff test.init test.final` one can see the difference appears now in the last line (ignore the first line). Since I have many folders like `stack` in the link given above, I am looking for some loop where basically I go to every folder, pick the difference between two files and then append the difference at the end as I explained above. Please let me know if anyone has some idea, I would very much appreciate it. N.B: Please note that I already looked a bit related-type queries such as here (https://stackoverflow.com/questions/4544709/compare-two-files-line-by-line-and-generate-the-difference-in-another-file) but that still not exactly the solution I am looking for here.
0debug
Add column to DataFrame in sparkR : <p>I would like to add a column filled with a character <code>N</code> in a DataFrame in SparkR. I would do it like that with non-SparkR code :</p> <pre><code>df$new_column &lt;- "N" </code></pre> <p>But with SparkR, I get the following error : </p> <pre><code>Error: class(value) == "Column" || is.null(value) is not TRUE </code></pre> <p>I've tried insane things to manage it, I was able to create a column using another (existing) one with <code>df &lt;- withColumn(df, "new_column", df$existing_column)</code>, but this simple thing, nope...</p> <p>Any help ?</p> <p>Thanks.</p>
0debug
Why is computed value not updated after vuex store update? : <p>I got a <code>printerList</code> computed property that should be re-evaluated after <code>getPrinters()</code> resolve, but it look like it's not.</p> <p><a href="https://github.com/Coaxis-ASP/opt/tree/f1267a6a4f1202a3db710b1ee0639996730186c1/frontend/src" rel="noreferrer">sources are online</a>: <a href="https://github.com/Coaxis-ASP/opt/blob/f1267a6a4f1202a3db710b1ee0639996730186c1/frontend/src/pages/optboxes/optbox.component.vue" rel="noreferrer">optbox.component.vue</a>, <a href="https://github.com/Coaxis-ASP/opt/tree/f1267a6a4f1202a3db710b1ee0639996730186c1/frontend/src/vuex" rel="noreferrer">vuex</a>, <a href="https://github.com/Coaxis-ASP/opt/blob/f1267a6a4f1202a3db710b1ee0639996730186c1/frontend/src/services/optboxes.service.js" rel="noreferrer">optboxes.service.js</a></p> <h3>Component</h3> <pre><code>&lt;template&gt; &lt;div v-for="printer in printersList"&gt; &lt;printer :printer="printer" :optbox="optbox"&gt;&lt;/printer&gt; &lt;/div&gt; &lt;/template&gt; &lt;script&gt; … created() { this.getPrinters(this.optbox.id); }, computed: { printersList() { var index = optboxesService.getIndex(this.optboxesList, this.optbox.id); return this.optboxesList[index].printers } }, vuex: { actions: { getPrinters: actions.getPrinters,}, getters: { optboxesList: getters.retrieveOptboxes} } &lt;script&gt; </code></pre> <h3>Actions</h3> <pre><code>getPrinters({dispatch}, optboxId) { printers.get({optbox_id: optboxId}).then(response =&gt; { dispatch('setPrinters', response.data.optbox, response.data.output.channels); }).catch((err) =&gt; { console.error(err); logging.error(this.$t('printers.get.failed')) }); }, </code></pre> <h3>Mutations</h3> <pre><code>setPrinters(optboxes, optboxId, printers) { var index = this.getIndex(optboxes, optboxId); optboxes[index] = {...optboxes[index], printers: printers } }, </code></pre> <h3>Question</h3> <p>Why does the <code>printerList</code> computed property isn't re-evaluated (i.e. the <code>v-for</code> is empty)</p>
0debug
C# replace integer if integer has other numbers from both ends : I want to replace an integer if it is a part of another integer from both ends. Say for example an integer +35343+3566. I want to replace +35 with 0 only if it is surrounded with numbers from both sides. So desired outcome would be +35343066. Normally I'd use line.Replace("+35", "0") and perhaps 'if-else' to meet a condition int a = +35343+3566; string b = a.ToString(); string c = b.Replace("+35", "0"); I would want c = +35343066 and not c = 0343066
0debug
Exit Kodi by pressing HOME button, is this safe? : <p>Using Himedia TV box Q5 Pro with Android 5.1 and Kodi 17.1.</p> <p>Instead of shutting down Kodi by using the screen exit button (which will take a few seconds), find it easier if I used the HOME button on the remote.</p> <p>Will this HOME button exit route result in Kodi software problem later?</p> <p>Appreciate the above program flow in using the HOME button and if that HOME route is not recommended, why?</p> <p>Like to learn more on Android. </p> <p>Many thanks.</p>
0debug
up to how much memory limit can be set POST method in PHP? Maximum how much? : <p>Normally 8mb is default memory limit of POST method..how much we can set? up to GB is possible or less than that? can we send large video of 4 gig through POST method? </p>
0debug
Passing array to function of specific type : <p>I need help with this code. I cant make it work so.. something is unclear for me yet.</p> <pre><code>using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static int[] foo(int[] array) { int[] xx = new int[array.Length]; for(int i = 0; i &lt; array.Length; i++) { array[i] *= 2; Console.WriteLine(array[i]); } return array; } static void Main(string[] args) { int[] array = new int[4] {73, 67, 38, 33 }; foo(array); } } </code></pre> <p>How to rebuild <em>foo</em> function to return values from <em>array</em> ?</p> <p>I saw a lot of help links with void function.. and they werent useful. When it comes to specific type of function I cant make it work. </p> <p>Thanks</p> <p>ddr8</p>
0debug
static void gen_branch(DisasContext *ctx, int insn_bytes) { if (ctx->hflags & MIPS_HFLAG_BMASK) { int proc_hflags = ctx->hflags & MIPS_HFLAG_BMASK; ctx->hflags &= ~MIPS_HFLAG_BMASK; ctx->bstate = BS_BRANCH; save_cpu_state(ctx, 0); switch (proc_hflags & MIPS_HFLAG_BMASK_BASE) { case MIPS_HFLAG_FBNSLOT: MIPS_DEBUG("forbidden slot"); gen_goto_tb(ctx, 0, ctx->pc + insn_bytes); break; case MIPS_HFLAG_B: MIPS_DEBUG("unconditional branch"); if (proc_hflags & MIPS_HFLAG_BX) { tcg_gen_xori_i32(hflags, hflags, MIPS_HFLAG_M16); } gen_goto_tb(ctx, 0, ctx->btarget); break; case MIPS_HFLAG_BL: MIPS_DEBUG("blikely branch taken"); gen_goto_tb(ctx, 0, ctx->btarget); break; case MIPS_HFLAG_BC: MIPS_DEBUG("conditional branch"); { TCGLabel *l1 = gen_new_label(); tcg_gen_brcondi_tl(TCG_COND_NE, bcond, 0, l1); gen_goto_tb(ctx, 1, ctx->pc + insn_bytes); gen_set_label(l1); gen_goto_tb(ctx, 0, ctx->btarget); } break; case MIPS_HFLAG_BR: MIPS_DEBUG("branch to register"); if (ctx->insn_flags & (ASE_MIPS16 | ASE_MICROMIPS)) { TCGv t0 = tcg_temp_new(); TCGv_i32 t1 = tcg_temp_new_i32(); tcg_gen_andi_tl(t0, btarget, 0x1); tcg_gen_trunc_tl_i32(t1, t0); tcg_temp_free(t0); tcg_gen_andi_i32(hflags, hflags, ~(uint32_t)MIPS_HFLAG_M16); tcg_gen_shli_i32(t1, t1, MIPS_HFLAG_M16_SHIFT); tcg_gen_or_i32(hflags, hflags, t1); tcg_temp_free_i32(t1); tcg_gen_andi_tl(cpu_PC, btarget, ~(target_ulong)0x1); } else { tcg_gen_mov_tl(cpu_PC, btarget); } if (ctx->singlestep_enabled) { save_cpu_state(ctx, 0); gen_helper_0e0i(raise_exception, EXCP_DEBUG); } tcg_gen_exit_tb(0); break; default: MIPS_DEBUG("unknown branch"); break; } } }
1threat
how to get records from tables where time is grater than mytime : this is my database image i want to all records where clockin_time is > 10:00 AM can you help me please ? [this is my database image i want to all records where clockin_time is > 10:00 AM can you help me please ?][1] [1]: https://i.stack.imgur.com/OEtOG.png
0debug
Flutter - SimpleDialog in FloatingActionButton : <p>I'm trying to create a <code>SimpleDialog</code> after a tap on the <code>FloatingActionButton</code>, however when pressing that button nothing happens.</p> <p>What was I doing wrong?</p> <pre><code>import "package:flutter/material.dart"; void main() { runApp(new ControlleApp()); } class ControlleApp extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( home: new HomePage(), ); } } class HomePage extends StatelessWidget { @override Widget build(BuildContext context) =&gt; new Scaffold( appBar: new AppBar( backgroundColor: new Color(0xFF26C6DA), ), floatingActionButton: new FloatingActionButton( tooltip: 'Add', child: new Icon(Icons.add), backgroundColor: new Color(0xFFF44336), onPressed: (){ new SimpleDialog( title: new Text('Test'), children: &lt;Widget&gt;[ new RadioListTile( title: new Text('Testing'), value: null, groupValue: null, onChanged: (value) {}, ) ], ); } ), ); } </code></pre>
0debug
I don't think I have loaded Java SE 12 properly : I don't believe I have loaded Java properly--chiefly because I can't see an exe suffix after the javac icon in program files (check out screenshot). Furthermore I have carefully copied (in front and with semi-colon) and pasted the pathway for javac into the system variable editing box (again see screenshot) I followed the oracle tutorial for the HelloWorldApp to the letter, setting up a my application folder and putting the notepad file inside. Take a look for yourself (ssh) Et puis I open the shell punch in my script; hit dir; get the spiel about files and such; enter javac HelloWorldApp.java to only end invariably with Javac not a recognised command Arrgh what am I doing wrong? Is it as I suspect--that the Java SE12 isn't loaded properly (mind you I tried with earlier versions and it didn't work either) Am not saving the notepad file correctly (ie helloworld?) Am I not editing the path for the javac compiler properly? Help please. Thanx
0debug
A Haskell function that receive a List with different types and returns only a Integer List : I have a function like this : > '[(String, [Int], Int)]' I desire a function that returns a list that just returns a list of '[Int]' Input example : > [("R1",[6,10,14],6),("R2",[8,10,14],8),("R3",[11,15,24],11)] Output example (the bahavior that I want of the output) : > [6,8,10,11,14,15,24] I've been thinking in create a function of input, like this : > function :: [(String, [Int], Int)] > function = [("R1",[6,10,14],6),("R2",[8,10,14],8),("R3",[11,15,24],11)] And another to convert it to what I desire, like this : > convert :: [(String, [Int], Int)] -> [Int] > convert [] = [] > ... How can I develop the function "convert"?
0debug
Find a string in HTML and print value : I'm posting to a webpage and in my respose I get a big chunk of HTML that will change next request. With groovy I'd like to find this string: var WPQ1FormCtx = {"ListData":{"owshiddenversion":23, The value "23" will change next time I post to the webpage, and I need that value. With .contains I'll find if string exists. def htmlParse = Jsoup.parse(htmlResponse) log.info a.contains('var WPQ1FormCtx = {"ListData":{"owshiddenversion":23,') But I need to write out the value after 'var WPQ1FormCtx = {"ListData":{"owshiddenversion":**xxxxx**, that can be anything from 1 to 100 000.
0debug
Create Buttons from image in HTML : <p>I've got this interesting challenge here that I don't know how to solve. I'm trying to create HTML buttons from an Image. This image here is the example I am using. How can I split up all the trapezoids into separate buttons that register separately when tapped on the corresponding regions. I would assume I need to specify some kind of boundary for each trapezoid but I don't know how you would do that for a decently complex shape like this. <a href="https://i.stack.imgur.com/e9OKl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/e9OKl.png" alt="Example image"></a></p>
0debug
static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) { ReadInfo *read_info = (ReadInfo *) sccb; MachineState *machine = MACHINE(qdev_get_machine()); sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev(); CPUState *cpu; int cpu_count = 0; int rnsize, rnmax; int slots = MIN(machine->ram_slots, s390_get_memslot_count(kvm_state)); IplParameterBlock *ipib = s390_ipl_get_iplb(); CPU_FOREACH(cpu) { cpu_count++; } read_info->entries_cpu = cpu_to_be16(cpu_count); read_info->offset_cpu = cpu_to_be16(offsetof(ReadInfo, entries)); read_info->highest_cpu = cpu_to_be16(max_cpus); read_info->ibc_val = cpu_to_be32(s390_get_ibc_val()); s390_get_feat_block(S390_FEAT_TYPE_SCLP_CONF_CHAR, read_info->conf_char); s390_get_feat_block(S390_FEAT_TYPE_SCLP_CONF_CHAR_EXT, read_info->conf_char_ext); prepare_cpu_entries(sclp, read_info->entries, cpu_count); read_info->facilities = cpu_to_be64(SCLP_HAS_CPU_INFO | SCLP_HAS_PCI_RECONFIG); if (mhd) { mhd->standby_subregion_size = MEM_SECTION_SIZE; if (slots > 0) { while ((mhd->standby_subregion_size * (slots - 1) < mhd->standby_mem_size)) { mhd->standby_subregion_size = mhd->standby_subregion_size << 1; } } if (mhd->standby_state_map == 0) { if (mhd->standby_mem_size % mhd->standby_subregion_size) { mhd->standby_state_map = g_malloc0((mhd->standby_mem_size / mhd->standby_subregion_size + 1) * (mhd->standby_subregion_size / MEM_SECTION_SIZE)); } else { mhd->standby_state_map = g_malloc0(mhd->standby_mem_size / MEM_SECTION_SIZE); } } mhd->padded_ram_size = ram_size + mhd->pad_size; mhd->rzm = 1 << mhd->increment_size; read_info->facilities |= cpu_to_be64(SCLP_FC_ASSIGN_ATTACH_READ_STOR); } read_info->mha_pow = s390_get_mha_pow(); read_info->hmfai = cpu_to_be32(s390_get_hmfai()); rnsize = 1 << (sclp->increment_size - 20); if (rnsize <= 128) { read_info->rnsize = rnsize; } else { read_info->rnsize = 0; read_info->rnsize2 = cpu_to_be32(rnsize); } rnmax = machine->maxram_size >> sclp->increment_size; if (rnmax < 0x10000) { read_info->rnmax = cpu_to_be16(rnmax); } else { read_info->rnmax = cpu_to_be16(0); read_info->rnmax2 = cpu_to_be64(rnmax); } if (ipib && ipib->flags & DIAG308_FLAGS_LP_VALID) { memcpy(&read_info->loadparm, &ipib->loadparm, sizeof(read_info->loadparm)); } else { s390_ipl_set_loadparm(read_info->loadparm); } sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_READ_COMPLETION); }
1threat
javascript - call function before declaration : I have this function inside test.js: function testing(){ document.write("<p>Tes1</p>"); } And then a basic html page. Is possible to call the function before being declared and add to the page the: > <p>Test1</p> Because if I include the test.js at the bottom of the page, is not working. Is there a way to make it work (with .js file being included at the bottom of the html page)? Thanks
0debug
Return a value from a method : <p>I have this method to get the user location and I want to return <code>myLocation</code> variable : </p> <pre><code>mFusedLocationClient.getLastLocation().addOnSuccessListener(new OnSuccessListener&lt;Location&gt;() { @Override public void onSuccess(Location location) { // Got last known location. In some rare situations this can be null. if (location != null) { double latitude = location.getLatitude(); double longitude = location.getLongitude(); LatLng mylocation = new LatLng(latitude, longitude); } } }); </code></pre> <p>I have this method inside of a function that returns a LatLng value but I can't get the value from inside of the method.</p>
0debug
static void mpegts_write_pes(AVFormatContext *s, AVStream *st, const uint8_t *payload, int payload_size, int64_t pts, int64_t dts, int key) { MpegTSWriteStream *ts_st = st->priv_data; MpegTSWrite *ts = s->priv_data; uint8_t buf[TS_PACKET_SIZE]; uint8_t *q; int val, is_start, len, header_len, write_pcr, is_dvb_subtitle, is_dvb_teletext, flags; int afc_len, stuffing_len; int64_t pcr = -1; int64_t delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE); int force_pat = st->codec->codec_type == AVMEDIA_TYPE_VIDEO && key && !ts_st->prev_payload_key; is_start = 1; while (payload_size > 0) { retransmit_si_info(s, force_pat); force_pat = 0; write_pcr = 0; if (ts_st->pid == ts_st->service->pcr_pid) { if (ts->mux_rate > 1 || is_start) ts_st->service->pcr_packet_count++; if (ts_st->service->pcr_packet_count >= ts_st->service->pcr_packet_period) { ts_st->service->pcr_packet_count = 0; write_pcr = 1; if (ts->mux_rate > 1 && dts != AV_NOPTS_VALUE && (dts - get_pcr(ts, s->pb)/300) > delay) { if (write_pcr) mpegts_insert_pcr_only(s, st); else mpegts_insert_null_packet(s); continue; q = buf; *q++ = 0x47; val = (ts_st->pid >> 8); if (is_start) val |= 0x40; *q++ = val; *q++ = ts_st->pid; ts_st->cc = (ts_st->cc + 1) & 0xf; *q++ = 0x10 | ts_st->cc; if (key && is_start && pts != AV_NOPTS_VALUE) { if (ts_st->pid == ts_st->service->pcr_pid) write_pcr = 1; set_af_flag(buf, 0x40); q = get_ts_payload_start(buf); if (write_pcr) { set_af_flag(buf, 0x10); q = get_ts_payload_start(buf); if (ts->mux_rate > 1) pcr = get_pcr(ts, s->pb); else pcr = (dts - delay)*300; if (dts != AV_NOPTS_VALUE && dts < pcr / 300) av_log(s, AV_LOG_WARNING, "dts < pcr, TS is invalid\n"); extend_af(buf, write_pcr_bits(q, pcr)); q = get_ts_payload_start(buf); if (is_start) { int pes_extension = 0; int pes_header_stuffing_bytes = 0; *q++ = 0x00; *q++ = 0x00; *q++ = 0x01; is_dvb_subtitle = 0; is_dvb_teletext = 0; if (st->codec->codec_id == AV_CODEC_ID_DIRAC) { *q++ = 0xfd; } else *q++ = 0xe0; } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && (st->codec->codec_id == AV_CODEC_ID_MP2 || st->codec->codec_id == AV_CODEC_ID_MP3 || st->codec->codec_id == AV_CODEC_ID_AAC)) { *q++ = 0xc0; } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->codec->codec_id == AV_CODEC_ID_AC3 && ts->m2ts_mode) { *q++ = 0xfd; } else { *q++ = 0xbd; if(st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) { if (st->codec->codec_id == AV_CODEC_ID_DVB_SUBTITLE) { is_dvb_subtitle = 1; } else if (st->codec->codec_id == AV_CODEC_ID_DVB_TELETEXT) { is_dvb_teletext = 1; header_len = 0; flags = 0; if (pts != AV_NOPTS_VALUE) { header_len += 5; flags |= 0x80; if (dts != AV_NOPTS_VALUE && pts != AV_NOPTS_VALUE && dts != pts) { header_len += 5; flags |= 0x40; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->codec->codec_id == AV_CODEC_ID_DIRAC) { pes_extension = 1; flags |= 0x01; header_len += 3; if (ts->m2ts_mode && st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->codec->codec_id == AV_CODEC_ID_AC3) { pes_extension = 1; flags |= 0x01; header_len += 3; if (is_dvb_teletext) { pes_header_stuffing_bytes = 0x24 - header_len; header_len = 0x24; len = payload_size + header_len + 3; if (is_dvb_subtitle) { len += 3; payload_size++; if (len > 0xffff) *q++ = len >> 8; *q++ = len; val = 0x80; if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE || st->codec->codec_type == AVMEDIA_TYPE_DATA) val |= 0x04; *q++ = val; *q++ = flags; *q++ = header_len; if (pts != AV_NOPTS_VALUE) { write_pts(q, flags >> 6, pts); q += 5; if (dts != AV_NOPTS_VALUE && pts != AV_NOPTS_VALUE && dts != pts) { write_pts(q, 1, dts); q += 5; if (pes_extension && st->codec->codec_id == AV_CODEC_ID_DIRAC) { flags = 0x01; *q++ = flags; *q++ = 0x80 | 0x01; *q++ = 0x00 | 0x60; if (ts->m2ts_mode && pes_extension && st->codec->codec_id == AV_CODEC_ID_AC3) { flags = 0x01; *q++ = flags; *q++ = 0x80 | 0x01; *q++ = 0x00 | 0x71; if (is_dvb_subtitle) { *q++ = 0x20; *q++ = 0x00; if (is_dvb_teletext) { memset(q, 0xff, pes_header_stuffing_bytes); q += pes_header_stuffing_bytes; is_start = 0; header_len = q - buf; len = TS_PACKET_SIZE - header_len; if (len > payload_size) len = payload_size; stuffing_len = TS_PACKET_SIZE - header_len - len; if (stuffing_len > 0) { if (buf[3] & 0x20) { afc_len = buf[4] + 1; memmove(buf + 4 + afc_len + stuffing_len, buf + 4 + afc_len, header_len - (4 + afc_len)); buf[4] += stuffing_len; memset(buf + 4 + afc_len, 0xff, stuffing_len); } else { memmove(buf + 4 + stuffing_len, buf + 4, header_len - 4); buf[3] |= 0x20; buf[4] = stuffing_len - 1; if (stuffing_len >= 2) { buf[5] = 0x00; memset(buf + 6, 0xff, stuffing_len - 2); if (is_dvb_subtitle && payload_size == len) { memcpy(buf + TS_PACKET_SIZE - len, payload, len - 1); buf[TS_PACKET_SIZE - 1] = 0xff; } else { memcpy(buf + TS_PACKET_SIZE - len, payload, len); payload += len; payload_size -= len; mpegts_prefix_m2ts_header(s); avio_write(s->pb, buf, TS_PACKET_SIZE); avio_flush(s->pb); ts_st->prev_payload_key = key;
1threat
Apache Batik No WriteAdapter is available? : <p>I'm writing code to convert SVG's to PNG's:</p> <pre><code>package com.example; import java.io.*; import java.nio.file.Paths; import org.apache.batik.transcoder.image.PNGTranscoder; import org.apache.batik.transcoder.SVGAbstractTranscoder; import org.apache.batik.transcoder.TranscoderInput; import org.apache.batik.transcoder.TranscoderOutput; public class Main { public static void main(String [] args) throws Exception { // read the input SVG document into TranscoderInput String svgURI = Paths.get(args[0]).toUri().toURL().toString(); TranscoderInput input = new TranscoderInput(svgURI); // define OutputStream to PNG Image and attach to TranscoderOutput OutputStream ostream = new FileOutputStream("out.png"); TranscoderOutput output = new TranscoderOutput(ostream); // create a JPEG transcoder PNGTranscoder t = new PNGTranscoder(); // set the transcoding hints t.addTranscodingHint(SVGAbstractTranscoder.KEY_HEIGHT, new Float(600)); t.addTranscodingHint(SVGAbstractTranscoder.KEY_WIDTH, new Float(600)); // convert and write output t.transcode(input, output); // flush and close the stream then exit ostream.flush(); ostream.close(); } } </code></pre> <p>I get the following exceptions executing it with a variety of SVG's:</p> <pre><code>Exception in thread "main" org.apache.batik.transcoder.TranscoderException: null Enclosed Exception: Could not write PNG file because no WriteAdapter is availble at org.apache.batik.transcoder.image.ImageTranscoder.transcode(ImageTranscoder.java:132) at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:142) at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156) at com.example.Main.main(Main.java:26) </code></pre> <p>Batik version (reported by Maven):</p> <pre><code>version=1.9 groupId=org.apache.xmlgraphics artifactId=batik-transcoder </code></pre> <p>I get the same error with Batik 1.7.</p> <p>Suggestions?</p>
0debug
How do I remove some String from file - but not all of them JAVA : Here's the problem. I have some text in my .txt file, it look exactly like this: Bee-bee is the voice that Sheep giv- e. Mou-Mou is the voice that Cow gi- ve. Miau-Miau is the voice that Ca- t gives. Program that I need reading this file and connect line. Output (txt.file): Bee-bee is the voice that Sheep give. Mou-Mou is the voice that Cow give. Miau-Miau is the voice that Cat gives. I think I need to do something like this: //Locate the file: File file = new File("/path/to/file.txt"); //Create a temporary file File temp = File.createTempFile("file", ".txt", file.getParentFile()); //String I want to remove String delete = "-"; //open the file, open the tmp file, read the file line by line and replacing signs for (String line; (line = reader.readLine()) != null;) { // ... } Delete the string from the line. line = line.replace(delete, ""); Here's a problem that it replace "Bee-bee" with "beebee" in output file and that is not what I want. I need some construction "if the sign is "-" and the next sign is carriage return, delete "-"" but I have no idea how to write this.
0debug
How to monitor disk usage of kubernetes persistent volumes? : <p>I have <code>container_fs_usage_bytes</code> with prometheus to monitor container root fs, but it seems that there is no metrics for other volumes in cAdvisor.</p>
0debug
static int ahci_start_transfer(IDEDMA *dma) { AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma); IDEState *s = &ad->port.ifs[0]; uint32_t size = (uint32_t)(s->data_end - s->data_ptr); uint32_t opts = le32_to_cpu(ad->cur_cmd->opts); int is_write = opts & AHCI_CMD_WRITE; int is_atapi = opts & AHCI_CMD_ATAPI; int has_sglist = 0; if (is_atapi && !ad->done_atapi_packet) { ad->done_atapi_packet = 1; goto out; } if (!ahci_populate_sglist(ad, &s->sg)) { has_sglist = 1; } DPRINTF(ad->port_no, "%sing %d bytes on %s w/%s sglist\n", is_write ? "writ" : "read", size, is_atapi ? "atapi" : "ata", has_sglist ? "" : "o"); if (has_sglist && size) { if (is_write) { dma_buf_write(s->data_ptr, size, &s->sg); } else { dma_buf_read(s->data_ptr, size, &s->sg); } } ad->cur_cmd->status = cpu_to_le32(le32_to_cpu(ad->cur_cmd->status) + size); out: s->data_ptr = s->data_end; if (has_sglist) { qemu_sglist_destroy(&s->sg); } s->end_transfer_func(s); if (!(s->status & DRQ_STAT)) { ahci_trigger_irq(ad->hba, ad, PORT_IRQ_STAT_DSS); } return 0; }
1threat
jQuery loop through checkboxes : I have these checkboxes: <input type="checkbox" class="ids" name="ids[]" value="2"> <input type="checkbox" class="ids" name="ids[]" value="3"> <input type="checkbox" class="ids" name="ids[]" value="4"> <input type="checkbox" class="ids" name="ids[]" value="5"> <input type="checkbox" class="ids" name="ids[]" value="6"> My question is via jquery, how would I loop through the ids[] on form submit? $("#form").submit(function(e) { //Loop throught ids[] });
0debug
static target_long monitor_get_ccr (const struct MonitorDef *md, int val) { CPUArchState *env = mon_get_cpu(); unsigned int u; int i; u = 0; for (i = 0; i < 8; i++) u |= env->crf[i] << (32 - (4 * i)); return u; }
1threat
Custom packet to send over a socket : <p>Any recommendations on how to encode data to send over a socket?</p> <p>Example</p> <pre class="lang-cpp prettyprint-override"><code>struct { int id, std::string name, std::string address } </code></pre> <p>I have this currently:</p> <pre class="lang-cpp prettyprint-override"><code>std::string s; client_type client = { INVALID_SOCKET, -1, "" }; send(client.socket, s.c_str(), strlen(s.c_str()), 0); </code></pre> <p>I can send a string. What would be the best way to send the above information to the server?</p>
0debug
Kubernetes configMap - only one file : <p>I have a <code>configMap</code> created from file:</p> <pre><code>kubectl create configmap ssportal-apache-conf --from-file=ssportal.conf=ssportal.conf </code></pre> <p>and then I need to mount this file into the deployment:</p> <pre><code>apiVersion: extensions/v1beta1 kind: Deployment metadata: name: ssportal spec: replicas: 2 template: metadata: labels: app: ssportal spec: containers: - name: ssportal image: eu.gcr.io/my-project/ssportal:0.0.0 ports: - containerPort: 80 volumeMounts: - name: apache2-config-volume mountPath: /etc/apache2/ volumes: - name: apache2-config-volume configMap: name: ssportal-apache-conf items: - key: ssportal.conf path: sites-enabled/ssportal.conf </code></pre> <p>But this effectively removes the existing <code>/etc/apache2/</code> directory from the container and replaces it with one an only file <code>/etc/apache2/sites-enabled/ssportal.conf</code>.</p> <p>Is it possible to overlay only one file over the existing config directory?</p>
0debug
Allow for zero-value in short-circuit evaluation : <p>Short-circuit evaluation determines if the first value is falsey. If so, return the second value, as follows:</p> <pre><code>var x = y || z; // if y is falsey return z </code></pre> <p>Is there a way to disregard zero-values as being falsey when using short-circuit evaluation without resorting to if/else statements or ternary operators?</p>
0debug
static void test_acpi_piix4_tcg_cphp(void) { test_data data; memset(&data, 0, sizeof(data)); data.machine = MACHINE_PC; data.variant = ".cphp"; test_acpi_one("-smp 2,cores=3,sockets=2,maxcpus=6", &data); free_test_data(&data); }
1threat
static int decode_block(MJpegDecodeContext *s, int16_t *block, int component, int dc_index, int ac_index, int16_t *quant_matrix) { int code, i, j, level, val; val = mjpeg_decode_dc(s, dc_index); if (val == 0xfffff) { av_log(s->avctx, AV_LOG_ERROR, "error dc\n"); return AVERROR_INVALIDDATA; } val = val * quant_matrix[0] + s->last_dc[component]; s->last_dc[component] = val; block[0] = val; i = 0; {OPEN_READER(re, &s->gb); do { UPDATE_CACHE(re, &s->gb); GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2); i += ((unsigned)code) >> 4; code &= 0xf; if (code) { if (code > MIN_CACHE_BITS - 16) UPDATE_CACHE(re, &s->gb); { int cache = GET_CACHE(re, &s->gb); int sign = (~cache) >> 31; level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign; } LAST_SKIP_BITS(re, &s->gb, code); if (i > 63) { av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i); return AVERROR_INVALIDDATA; } j = s->scantable.permutated[i]; block[j] = level * quant_matrix[j]; } } while (i < 63); CLOSE_READER(re, &s->gb);} return 0; }
1threat
Export GIT LOG into an Excel file : <p>I have looked into the forum, but with no luck.</p> <p>Requirement :</p> <p>Run GIT LOG (format) command and write the results into an Excel File . </p> <p>I have seen examples wherein with GIT Log command, data can be written into a CSV, but formatting is double the effort.</p> <p>Any utility or approach would be helpful.</p> <p>Thanks Milind</p>
0debug
int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags) { if(min_ts > ts || max_ts < ts) return -1; ff_read_frame_flush(s); if (s->iformat->read_seek2) return s->iformat->read_seek2(s, stream_index, min_ts, ts, max_ts, flags); if(s->iformat->read_timestamp){ } if(s->iformat->read_seek || 1) return av_seek_frame(s, stream_index, ts, flags | (ts - min_ts > (uint64_t)(max_ts - ts) ? AVSEEK_FLAG_BACKWARD : 0)); }
1threat
Django, how to pass a variables from the Django admin to a template? : I want to be able to set a variable in the django admin panel, wich will be passed to the template as template variable, similar to placeholder in cms. (For exapmle when I save this variable in admin panel it will be rendered to the template)
0debug
why don't we always use the latest .net framework? : <p>I am very new to DOT.net frameworks. Shouldn't we always update to the latest release? List Entity framework or identity framework .. all those frameworks ... why do we keep them around? just use the latest ones. </p> <p>In fact, I am just starting to develop an asp.net website with RestAPIs, login, register, social login... I wonder what is the best framework version (4.5) to use </p>
0debug
almost increasing sequence algorithm : I have had an algorithm problem below: "Given a sequence of integers as an array, determine whether it is possible to obtain a strictly increasing sequence by removing no more than one element from the array. Example For sequence = [1, 3, 2, 1], the output should be almostIncreasingSequence(sequence) = false; There is no one element in this array that can be removed in order to get a strictly increasing sequence. For sequence = [1, 3, 2], the output should be almostIncreasingSequence(sequence) = true. You can remove 3 from the array to get the strictly increasing sequence [1, 2]. Alternately, you can remove 2 to get the strictly increasing sequence [1, 3]." Please explain to me some algorithms that can be used to solve this problem. I can read Javascript and Java example codes but please explain more about the algorithms so that I can understand Thank you very much
0debug
Image sizes for android and iOS in react-native : <p>While making iOS Apps, we generally used to supply @x,@2x,@3x images. And based on my knowledge in case of android, there was some approx six different sizes </p> <p>I have started working on react-native and came across the image issue.</p> <p>My Question are: Do I need to provide images with all different sizes (i.e. approx 6-7 image sets by combining iOS and android) Or only 1 image and rest will be taken care internally? Will it look blurred on higher resolution phones? </p> <p>Thanks. </p>
0debug
I don't know why it happens, It seems angular can't understand what I'm writing : This is my HttpClient code what I wrote: import { Component, OnInit } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { CreeperUser } from '../Models/CreeperUser'; import { Observable } from 'rxjs'; @Component({ templateUrl: 'friends.component.html' }) export class FriendsComponent { users: number; constructor(private http: HttpClient) { this.DisplayUser(); } public CallApi_HttpGet(): Observable<CreeperUser[]> { return this.http.get<CreeperUser[]> ('https://localhost:44399/api/user'); } public DisplayUser(){ this.CallApi_HttpGet().subscribe(response => { this.users = response[0].userId; }); } } And when I use the code to run on my server, the Chrome's console told me this: Error: Uncaught (in promise): Error: StaticInjectorError(AppModule) [enter image description here][1] [1]: https://i.stack.imgur.com/GbpFI.jpg And I don't know how can I do. Please help me!
0debug
db.execute('SELECT * FROM employees WHERE id = ' + user_input)
1threat
static void handle_hmp_command(Monitor *mon, const char *cmdline) { QDict *qdict; const mon_cmd_t *cmd; qdict = qdict_new(); cmd = monitor_parse_command(mon, cmdline, 0, mon->cmd_table, qdict); if (cmd) { cmd->mhandler.cmd(mon, qdict); } QDECREF(qdict); }
1threat
the program sometimes outputs blank from the text file , how do i stop this? : <p>i have this code that is a future program, it is a very simple program , it has two buttons a reset and a button that actually gets your future. It then has a label for your future to be outputted to. i import the text from a text file, however when u run the program i sometimes get blank from the text file, how do i stop this.</p> <p>the code is very simple as i am new to python and tkinter and am just building little programs to build up my knowledge. Any help on this issue would be much appretiacted , thanks</p> <pre><code>from tkinter import* import random window =Tk() #static properties window.title("Your Future") window.resizable(0,0) # this stop the window from being able to be resized #Things in the application Label1 = Label(window, relief = 'groove', width = 100, height = 2) FutureButton = Button(window) ResetButton = Button(window) #text in button FutureButton.configure(text = "Get your Furture") ResetButton.configure(text = "Reset") ResetButton.configure(state = DISABLED) #dynamic properties def pick(): with open("Future.txt") as f: lines = f.readlines() test = (random.choice(lines)) print(test) if test ==(): test = ("You wil get old and die alone") Label1.configure(text = test) FutureButton.configure(state = DISABLED) ResetButton.configure(state = NORMAL) def reset(): Label1.configure(text = "..........") FutureButton.configure(state = NORMAL) ResetButton.configure(state = DISABLED) FutureButton.configure(command = pick) ResetButton.configure(command = reset) #Placing shit Label1.grid(row = 1, column = 1, columnspan = 10,) FutureButton.grid(row = 2, column = 5, rowspan = 3) ResetButton.grid(row = 3, column = 6, rowspan = 2,) window.mainloop() </code></pre>
0debug
JSON error (Swift 4) Cannot assign value of type 'String?' to type 'String?.Type' : Can't solve the error below & attached. Code snippet: ------------------------------------------------------------------------ `func setInfo(json: JSON) { self.name = json["name"].string self.email = json["email"].string let image = json["picture"].dictionary let imageData = image?["data"]?.dictionary self.pictureURL = imageData?["url"]?.string } func resetInfo() { self.name = nil self.email = nil self.pictureURL = nil` -------------------------------------------------------------------- Getting error message: **'Cannot assign value of type 'String?' to type 'String?.Type'** in the lines: **`self.name = json["name"].string`** & **`self.email = json["email"].string`** [Screenshot of the error][1] [1]: https://i.stack.imgur.com/X2vRm.png
0debug
2D array Swift goes out of bounds when appending arrays : <p>I want to append elements from one 2D array to the another 2D array, but I get fatal error index out of bound. </p> <p>the code is as follows: </p> <pre><code> var array = [["a", "b", "c"], ["d","e","f"],["g","h","i"]] var array2 = [[String]]() var x = array.count var y = array[1].count for j in 0..&lt;x { for i in 0..&lt;y { array2[j].append(array[j][i]) } } print(array2) </code></pre> <p>please don't tell me to just copy the array as this is not what I need, I am using this procedure to do something more complex than just copying an array.</p> <p>Any suggestions as to why it goes out of bounds?</p> <p>thanks</p>
0debug
app crashing by pressing buttons in activity bar : Im new in android studio, the problem that i have is that when when i start the app and press a button in the activity bar it crashes these is my main activity ` package com.example.tirir_000.iavq; import android.net.Uri; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.app.FragmentManager; import android.view.View; import android.support.design.widget.NavigationView; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, AdmisionFragment.OnFragmentInteractionListener { NavigationView navigationView = null; Toolbar toolbar = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Override public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @SuppressWarnings("StatementWithEmptyBody") @Override public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.nav_camera) { InicioFragment fragment = new InicioFragment(); android.support.v4.app.FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.fragment_container, fragment); fragmentTransaction.commit(); } else if (id == R.id.nav_gallery) { AdmisionFragment fragment = new AdmisionFragment(); android.support.v4.app.FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.fragment_container, fragment); fragmentTransaction.commit(); } else if (id == R.id.nav_slideshow) { CarrerasFragment fragment = new CarrerasFragment(); android.support.v4.app.FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.fragment_container, fragment); fragmentTransaction.commit(); } else if (id == R.id.nav_manage) { ComunidadFragment fragment = new ComunidadFragment(); android.support.v4.app.FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.fragment_container, fragment); fragmentTransaction.commit(); } else if (id == R.id.nav_share) { } else if (id == R.id.nav_send) { SgaFragment fragment = new SgaFragment(); android.support.v4.app.FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.fragment_container, fragment); fragmentTransaction.commit(); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } @Override public void onFragmentInteraction(Uri uri) { } `} please anyone help me, i am new at this and i cant fix it
0debug
Unhashing an email address string with Java or Groovy : <p>I have a report which has email addresses that have been hashed. So for example I see...</p> <pre><code>Email Hash 8b405f28e92ea2c7bd4f05197350c876 </code></pre> <p>Is there any way to get the original email address from this? Preferably with Java or Groovy?</p>
0debug
void cpu_reset(CPUM68KState *env) { memset(env, 0, offsetof(CPUM68KState, breakpoints)); #if !defined (CONFIG_USER_ONLY) env->sr = 0x2700; #endif m68k_switch_sp(env); env->cc_op = CC_OP_FLAGS; env->pc = 0; tlb_flush(env, 1);
1threat
void bdrv_init(void) { module_call_init(MODULE_INIT_BLOCK); }
1threat
Else statement does not get executed in Javascript : <p>Hello I've been trying to write a function to validate a string value. My code is below</p> <pre><code>function verifyPassword(){ passW = prompt ("Password:"); if (passW = 'Pass123'){ document.write ('Your password is correct'); } else { document.write ('Your password is incorrect'); } } verifyPassword(); </code></pre> <p>But here I always seem to get the result as 'Your password is correct', no matter what I put. </p> <p>Please can someone help me to resolve this issue?</p>
0debug
s3 urls - get bucket name and path : <p>I have a variable which has the aws s3 url </p> <pre><code>s3://bucket_name/folder1/folder2/file1.json </code></pre> <p>I want to get the bucket_name in a variables and rest i.e /folder1/folder2/file1.json in another variable. I tried the regular expressions and could get the bucket_name like below, not sure if there is a better way.</p> <pre><code>m = re.search('(?&lt;=s3:\/\/)[^\/]+', 's3://bucket_name/folder1/folder2/file1.json') print(m.group(0)) </code></pre> <p>How do I get the rest i.e - folder1/folder2/file1.json ?</p> <p>I have checked if there is a boto3 feature to extract the bucket_name and key from the url, but couldn't find it.</p>
0debug
def sum_even_and_even_index(arr,n): i = 0 sum = 0 for i in range(0,n,2): if (arr[i] % 2 == 0) : sum += arr[i] return sum
0debug
void acpi_setup(PcGuestInfo *guest_info) { AcpiBuildTables tables; AcpiBuildState *build_state; if (!guest_info->fw_cfg) { ACPI_BUILD_DPRINTF("No fw cfg. Bailing out.\n"); return; } if (!guest_info->has_acpi_build) { ACPI_BUILD_DPRINTF("ACPI build disabled. Bailing out.\n"); return; } if (!acpi_enabled) { ACPI_BUILD_DPRINTF("ACPI disabled. Bailing out.\n"); return; } build_state = g_malloc0(sizeof *build_state); build_state->guest_info = guest_info; acpi_set_pci_info(); acpi_build_tables_init(&tables); acpi_build(build_state->guest_info, &tables); build_state->table_ram = acpi_add_rom_blob(build_state, tables.table_data, ACPI_BUILD_TABLE_FILE, ACPI_BUILD_TABLE_MAX_SIZE); assert(build_state->table_ram != RAM_ADDR_MAX); build_state->table_size = acpi_data_len(tables.table_data); acpi_add_rom_blob(NULL, tables.linker, "etc/table-loader", 0); fw_cfg_add_file(guest_info->fw_cfg, ACPI_BUILD_TPMLOG_FILE, tables.tcpalog->data, acpi_data_len(tables.tcpalog)); fw_cfg_add_file(guest_info->fw_cfg, ACPI_BUILD_RSDP_FILE, tables.rsdp->data, acpi_data_len(tables.rsdp)); qemu_register_reset(acpi_build_reset, build_state); acpi_build_reset(build_state); vmstate_register(NULL, 0, &vmstate_acpi_build, build_state); acpi_build_tables_cleanup(&tables, false); }
1threat
static void spapr_phb_finish_realize(sPAPRPHBState *sphb, Error **errp) { sphb->dma_window_start = 0; sphb->dma_window_size = 0x40000000; sphb->tcet = spapr_tce_new_table(DEVICE(sphb), sphb->dma_liobn, sphb->dma_window_size); if (!sphb->tcet) { error_setg(errp, "Unable to create TCE table for %s", sphb->dtbusname); return ; } address_space_init(&sphb->iommu_as, spapr_tce_get_iommu(sphb->tcet), sphb->dtbusname); }
1threat
what is the significance of these four lines show below : I found in this complete [code][1] on codeforces . I am not that expert please guide me the use of these lines of code shown below The question just reads an input string of integers of maximum length 1000 ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); `#ifndef ONLINE_JUDGE `freopen("test.in", "r", stdin); `#endif [1]: http://codeforces.com/contest/743/submission/22981724
0debug
static void xen_pt_pci_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int len) { XenPCIPassthroughState *s = DO_UPCAST(XenPCIPassthroughState, dev, d); int index = 0; XenPTRegGroup *reg_grp_entry = NULL; int rc = 0; uint32_t read_val = 0, wb_mask; int emul_len = 0; XenPTReg *reg_entry = NULL; uint32_t find_addr = addr; XenPTRegInfo *reg = NULL; if (xen_pt_pci_config_access_check(d, addr, len)) { return; } XEN_PT_LOG_CONFIG(d, addr, val, len); index = xen_pt_bar_offset_to_index(addr); if ((index >= 0) && (val > 0 && val < XEN_PT_BAR_ALLF) && (s->bases[index].bar_flag == XEN_PT_BAR_FLAG_UNUSED)) { XEN_PT_WARN(d, "Guest attempt to set address to unused Base Address " "Register. (addr: 0x%02x, len: %d)\n", addr, len); } reg_grp_entry = xen_pt_find_reg_grp(s, addr); if (reg_grp_entry) { if (reg_grp_entry->reg_grp->grp_type == XEN_PT_GRP_TYPE_HARDWIRED) { XEN_PT_WARN(d, "Access to 0-Hardwired register. " "(addr: 0x%02x, len: %d)\n", addr, len); return; } } rc = xen_host_pci_get_block(&s->real_device, addr, (uint8_t *)&read_val, len); if (rc < 0) { XEN_PT_ERR(d, "pci_read_block failed. return value: %d.\n", rc); memset(&read_val, 0xff, len); wb_mask = 0; } else { wb_mask = 0xFFFFFFFF >> ((4 - len) << 3); } if (reg_grp_entry == NULL) { goto out; } memory_region_transaction_begin(); pci_default_write_config(d, addr, val, len); read_val <<= (addr & 3) << 3; val <<= (addr & 3) << 3; emul_len = len; while (emul_len > 0) { reg_entry = xen_pt_find_reg(reg_grp_entry, find_addr); if (reg_entry) { reg = reg_entry->reg; uint32_t real_offset = reg_grp_entry->base_offset + reg->offset; uint32_t valid_mask = 0xFFFFFFFF >> ((4 - emul_len) << 3); uint8_t *ptr_val = NULL; valid_mask <<= (find_addr - real_offset) << 3; ptr_val = (uint8_t *)&val + (real_offset & 3); if (reg->emu_mask == (0xFFFFFFFF >> ((4 - reg->size) << 3))) { wb_mask &= ~((reg->emu_mask >> ((find_addr - real_offset) << 3)) << ((len - emul_len) << 3)); } switch (reg->size) { case 1: if (reg->u.b.write) { rc = reg->u.b.write(s, reg_entry, ptr_val, read_val >> ((real_offset & 3) << 3), valid_mask); } break; case 2: if (reg->u.w.write) { rc = reg->u.w.write(s, reg_entry, (uint16_t *)ptr_val, (read_val >> ((real_offset & 3) << 3)), valid_mask); } break; case 4: if (reg->u.dw.write) { rc = reg->u.dw.write(s, reg_entry, (uint32_t *)ptr_val, (read_val >> ((real_offset & 3) << 3)), valid_mask); } break; } if (rc < 0) { xen_shutdown_fatal_error("Internal error: Invalid write" " emulation. (%s, rc: %d)\n", __func__, rc); return; } emul_len -= reg->size; if (emul_len > 0) { find_addr = real_offset + reg->size; } } else { emul_len--; find_addr++; } } val >>= (addr & 3) << 3; memory_region_transaction_commit(); out: for (index = 0; wb_mask; index += len) { while (!(wb_mask & 0xff)) { index++; wb_mask >>= 8; } len = 0; do { len++; wb_mask >>= 8; } while (wb_mask & 0xff); rc = xen_host_pci_set_block(&s->real_device, addr + index, (uint8_t *)&val + index, len); if (rc < 0) { XEN_PT_ERR(d, "pci_write_block failed. return value: %d.\n", rc); } } }
1threat
void ff_write_pass1_stats(MpegEncContext *s) { snprintf(s->avctx->stats_out, 256, "in:%d out:%d type:%d q:%d itex:%d ptex:%d mv:%d misc:%d " "fcode:%d bcode:%d mc-var:%d var:%d icount:%d skipcount:%d hbits:%d;\n", s->current_picture_ptr->f.display_picture_number, s->current_picture_ptr->f.coded_picture_number, s->pict_type, s->current_picture.f.quality, s->i_tex_bits, s->p_tex_bits, s->mv_bits, s->misc_bits, s->f_code, s->b_code, s->current_picture.mc_mb_var_sum, s->current_picture.mb_var_sum, s->i_count, s->skip_count, s->header_bits); }
1threat
Pascal's Triangle - Finding Nth Line : Having issues with my code. It has to ask the user to enter a nth line, and print the line. If you guys could help me I'd appreciate it. The error is in line 62, when I remove the arrow it doesn't give a suggestion Using this: [![enter image description here][1]][1] import java.util.Scanner; public class PascalsTriangle { private int lineNumber,count; private int[] num; public PascalsTriangle() { lineNumber = 1; } public PascalsTriangle(int n) { set(n); } public void set(int n) { if (n<1) lineNumber = n; } public int get() { return lineNumber; } private void pascal(int[] row) { if (count >= lineNumber) return; num = new int [row.length+1]; num[0] = 1; for (int i=1; i<row.length; i++) num[i] = row[i-1] + row[i]; num[row.length] = 1; count++; pascal(num); return; } public int[] output() { count = 1; num = new int[count]; return num; } public static void main(String[] args) { { int i,num; Scanner scan = new Scanner (System.in); System.out.println("Enter the Nth number: "); num = scan.nextInt(); PascalsTriangle t = new PascalsTriangle(num); int[] result = t.output(); System.out.println("Line" + t.get()); for(i=0;< result.length;i++) System.out.println(result[i] + " ");; } } } [1]: https://i.stack.imgur.com/iZRA8.png
0debug
Why does my program skip over the replace method? : <p>Whenever I run the java code below it compiles but the line that include the replace method seems to be skipped, such so that the inputted string and the output (newMessage) are the same. Why? variable C and variable D are chars...</p> <p>import java.util.Scanner;</p> <pre><code>public class javaencrypt { public static void main(String[] args) { // define and instantiate Scanner object Scanner input = new Scanner(System.in); //prompt user to enter a string System.out.println("Please enter a string: "); String message = input.nextLine(); String newMessage = message; char c=' '; // the character at even locations char d=' '; // new character // go throughout the entire string, and replace characters at even positions by the character shifted by 5. // access the even characters with a for loop starting at 0, step 2, and ending at length()-1 // for( initial value; maximum value; step) for(int k=0; k&lt;message.length(); k=k+2) { c=message.charAt(k); d=(char)(c+5); /* there will always be characters available, because keyboard is mapped on ASCII which is in the beginning of UNICODE */ newMessage.replace(c,d); } System.out.println("Message replacement is: " + newMessage); } } </code></pre>
0debug
void h263_encode_picture_header(MpegEncContext * s, int picture_number) { int format; align_put_bits(&s->pb); s->ptr_lastgob = pbBufPtr(&s->pb); s->gob_number = 0; put_bits(&s->pb, 22, 0x20); put_bits(&s->pb, 8, (((int64_t)s->picture_number * 30 * s->avctx->frame_rate_base) / s->avctx->frame_rate) & 0xff); put_bits(&s->pb, 1, 1); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, 0); format = h263_get_picture_format(s->width, s->height); if (!s->h263_plus) { put_bits(&s->pb, 3, format); put_bits(&s->pb, 1, (s->pict_type == P_TYPE)); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, s->obmc); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 5, s->qscale); put_bits(&s->pb, 1, 0); } else { put_bits(&s->pb, 3, 7); put_bits(&s->pb,3,1); if (format == 7) put_bits(&s->pb,3,6); else put_bits(&s->pb, 3, format); put_bits(&s->pb,1,0); s->umvplus = s->unrestricted_mv; put_bits(&s->pb, 1, s->umvplus); put_bits(&s->pb,1,0); put_bits(&s->pb,1,s->obmc); put_bits(&s->pb,1,s->h263_aic); put_bits(&s->pb,1,0); put_bits(&s->pb,1,0); put_bits(&s->pb,1,0); put_bits(&s->pb,1,0); put_bits(&s->pb,1,s->alt_inter_vlc); put_bits(&s->pb,1,0); put_bits(&s->pb,1,1); put_bits(&s->pb,3,0); put_bits(&s->pb, 3, s->pict_type == P_TYPE); put_bits(&s->pb,1,0); put_bits(&s->pb,1,0); put_bits(&s->pb,1,s->no_rounding); put_bits(&s->pb,2,0); put_bits(&s->pb,1,1); put_bits(&s->pb, 1, 0); if (format == 7) { aspect_to_info(s, s->avctx->sample_aspect_ratio); put_bits(&s->pb,4,s->aspect_ratio_info); put_bits(&s->pb,9,(s->width >> 2) - 1); put_bits(&s->pb,1,1); put_bits(&s->pb,9,(s->height >> 2)); if (s->aspect_ratio_info == FF_ASPECT_EXTENDED){ put_bits(&s->pb, 8, s->avctx->sample_aspect_ratio.num); put_bits(&s->pb, 8, s->avctx->sample_aspect_ratio.den); } } if (s->umvplus) put_bits(&s->pb,2,1); put_bits(&s->pb, 5, s->qscale); } put_bits(&s->pb, 1, 0); if(s->h263_aic){ s->y_dc_scale_table= s->c_dc_scale_table= ff_aic_dc_scale_table; }else{ s->y_dc_scale_table= s->c_dc_scale_table= ff_mpeg1_dc_scale_table; } }
1threat
void gic_update(GICState *s) { int best_irq; int best_prio; int irq; int level; int cpu; int cm; for (cpu = 0; cpu < NUM_CPU(s); cpu++) { cm = 1 << cpu; s->current_pending[cpu] = 1023; if (!s->enabled || !s->cpu_enabled[cpu]) { qemu_irq_lower(s->parent_irq[cpu]); return; } best_prio = 0x100; best_irq = 1023; for (irq = 0; irq < s->num_irq; irq++) { if (GIC_TEST_ENABLED(irq, cm) && gic_test_pending(s, irq, cm) && (irq < GIC_INTERNAL || GIC_TARGET(irq) & cm)) { if (GIC_GET_PRIORITY(irq, cpu) < best_prio) { best_prio = GIC_GET_PRIORITY(irq, cpu); best_irq = irq; } } } level = 0; if (best_prio < s->priority_mask[cpu]) { s->current_pending[cpu] = best_irq; if (best_prio < s->running_priority[cpu]) { DPRINTF("Raised pending IRQ %d (cpu %d)\n", best_irq, cpu); level = 1; } } qemu_set_irq(s->parent_irq[cpu], level); } }
1threat
Excel vba Internet Explorer automation problem : Im trying to search on Some site by writing What I want to search on A cell and That It will search For me. My only problem is That I cant find the ID of the search box For getelementById. When I press F12 and go to this search box I Can get the name, tile, align, class, style, onkeyup, onproperychange, type and Size. What Can I do? Thanks in advance.
0debug
Remove the contents of block based on condition : <p>Below sed removes all occurrences of blocks between {content-start} and {content-end}, but want to remove only block contains the sting 'labtest'.</p> <pre><code>sed -ie '/{content-start.*}/,/{content-end}/d' test.txt </code></pre> <p>test.txt</p> <pre><code>{content-start} abc1 labtest def1 ghi1 {content-end} {content-start} abc2 def2 labtest ghi2 {content-end} {content-start} abc3 def3 ghi3 {content-end} </code></pre>
0debug
C# WPF - RegisterHotKey prevents from Textbox to receive input : Hello there and thank you for your time, I've been recently fiddling around with WPF, trying to learn as I go and decided to do a small project to help me learn faster. I have run into this problem, which is not quite exactly a problem, more of a logical contradiction, I would say. What I've been doing is registering global key presses. While my window is either the top window or another one is highlighted, register every key press there is on Windows. I have been using the RegisterHotKey function which tells the computer to interpret keyboard input differently, if I understand properly. Which prevents me from using the keyboard as I would normally while this application is open in the background. Every search I make comes up empty, they all lead me to RegisterHotKey which might not be the right solution in my case. I want to read global key presses while still keeping the same old keyboard input. Even a slight suggestion on how this might be done will be greatly appreciated! Thank you in advance.
0debug