problem
stringlengths
26
131k
labels
class label
2 classes
React i18n break lines in JSON String : <p>I'm working with i18next for react <a href="https://github.com/i18next/react-i18next" rel="noreferrer">https://github.com/i18next/react-i18next</a>. I'm struggling to break lines within the string in my JSON language file.</p> <p>This is what I already tried, which doesn't break a new line:</p> <ul> <li><code>line: "This is a line. \n This is another line. \n Yet another line"</code>, <a href="https://i.stack.imgur.com/ed1Yj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ed1Yj.png" alt="enter image description here"></a></li> <li><code>line: ("This is a line."+ &lt;br/&gt; + "This is another line. \n Yet another line")</code>, <a href="https://i.stack.imgur.com/BSjn5.png" rel="noreferrer"><img src="https://i.stack.imgur.com/BSjn5.png" alt="enter image description here"></a></li> <li><code>line: ('This is a line. &lt;br/&gt; This is another line. \n Yet another line')</code>, <a href="https://i.stack.imgur.com/WnPNi.png" rel="noreferrer"><img src="https://i.stack.imgur.com/WnPNi.png" alt="enter image description here"></a></li> </ul> <p>I obviously try to make a new line after each sentence. This is how I call it:</p> <pre><code>&lt;TooltipLink onClick={() =&gt; { this.toggleHelpTextDialog(t('test:test.line')); }}/&gt; </code></pre> <p>Any ideas? Thanks!</p>
0debug
can not set instance of ui image in script : using UnityEngine; using UnityEngine.UI; using System.Collections; using Image = UnityEngine.UI.Image; using UnityEngine.UI; public class changeimage : MonoBehaviour { public UnityEngine.UI.Image imageobject; // public Sprite myFirstImage; Sprite myFruit = Resources.Load("watermalon", typeof(Sprite)) as Sprite; // Use this for initialization void Start () { } // Update is called once per frame void Update () { } public void ClickToChange2() { //imageobject = GetComponent<Image>(); //Debug.Log(imageobject); imageobject.sprite = myFruit; } } **Error: Null reference to imageobject**
0debug
How could I hide the minimap bar on sublimetext 3 : <p>It takes too much space on the window,</p> <p>I tried some option in the configuration</p> <p>It seems not working, any idea ?</p> <h1>User setting</h1> <pre><code>"draw_minimap_border": false, "draw_minimap": false, "hide_minimap": true, "always_show_minimap_viewport": false </code></pre> <p><img src="https://i.imgur.com/mnYTOuL.png=300x" alt="inline" title="Title"></p>
0debug
void *qht_do_lookup(struct qht_bucket *head, qht_lookup_func_t func, const void *userp, uint32_t hash) { struct qht_bucket *b = head; int i; do { for (i = 0; i < QHT_BUCKET_ENTRIES; i++) { if (b->hashes[i] == hash) { void *p = atomic_rcu_read(&b->pointers[i]); if (likely(p) && likely(func(p, userp))) { return p; } } } b = atomic_rcu_read(&b->next); } while (b); return NULL; }
1threat
static void qmp_input_type_str(Visitor *v, const char *name, char **obj, Error **errp) { QmpInputVisitor *qiv = to_qiv(v); QObject *qobj = qmp_input_get_object(qiv, name, true, errp); QString *qstr; *obj = NULL; if (!qobj) { return; } qstr = qobject_to_qstring(qobj); if (!qstr) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", "string"); return; } *obj = g_strdup(qstring_get_str(qstr)); }
1threat
"pip install selenium" not working // using python 3 // windows 10 : <p>I cannot install selenium. I have python 3.7 and window 10.</p> <p>These are some of the things i have tried and the outcome: </p> <p>C:\Users\dani>pip install selenium 'pip' is not recognized as an internal or external command, operable program or batch file.</p> <p>C:\Users\dani>sudo pip install selenium 'sudo' is not recognized as an internal or external command, operable program or batch file.</p> <p>C:\Users\dani>pip3 install selenium 'pip3' is not recognized as an internal or external command, operable program or batch file.</p> <p>C:\Users\dani>conda install selenium 'conda' is not recognized as an internal or external command, operable program or batch file.</p> <p>C:\Users\dani>pip install -U selenium 'pip' is not recognized as an internal or external command, operable program or batch file.</p>
0debug
How can I remove every 6th comma in a CSV file using Regex and Python3? : <p>For a current project I need to remove the 6th comma on every line of a CSV file with a "\n" newline. Could someone suggest how I could do this using regex or any other easier method. Thanks for your help.</p>
0debug
like button like instgram crash after press : i added new option to my app the user can like the places but when i press on the like button i get crash and this is my code tableview cell button @IBAction func likePressed(_ sender: Any) { self.likeBtn.isEnabled = false let ref = Database.database().reference() //let key = ref.childByAutoId().key let keyToPost = ref.child("Restaurant").childByAutoId().key ref.child("Restaurant").child(self.postID).observeSingleEvent(of: .value, with: { (snapshot) in //.child(self.id) if let post = snapshot.value as? [String : AnyObject] { let updateLikes: [String : Any] = ["peopleWhoLike/\(keyToPost)" : Auth.auth().currentUser!.uid] ref.child("Restaurant").child(self.postID).updateChildValues(updateLikes, withCompletionBlock: { (error, reff) in if error == nil { ref.child("Restaurant").child(self.postID).observeSingleEvent(of: .value, with: { (snap) in if let properties = snap.value as? [String : AnyObject] { if let likes = properties["peopleWhoLike"] as? [String : AnyObject] { let count = likes.count self.likeLabel.text = "\(count) Likes this place" let update = ["likes" : count] ref.child("Restaurant").child(self.postID).updateChildValues(update) self.likeBtn.isHidden = true self.unlikeBtn.isHidden = false self.likeBtn.isEnabled = true print("Likes") } } }) } }) } }) ref.removeAllObservers() } some one can help me thank you
0debug
int read_targphys(const char *name, int fd, target_phys_addr_t dst_addr, size_t nbytes) { uint8_t *buf; size_t did; buf = g_malloc(nbytes); did = read(fd, buf, nbytes); if (did > 0) rom_add_blob_fixed("read", buf, did, dst_addr); g_free(buf); return did; }
1threat
When does `modify` copy the vector? : <p>From <a href="https://hackage.haskell.org/package/vector-0.12.0.1/docs/Data-Vector.html#v:modify" rel="noreferrer">https://hackage.haskell.org/package/vector-0.12.0.1/docs/Data-Vector.html#v:modify</a></p> <blockquote> <p>Apply a destructive operation to a vector. The operation will be performed in place if it is safe to do so and will modify a copy of the vector otherwise.</p> </blockquote> <p>This sounds like it can have drastically different performance characteristics depending on whether it is deemed "safe" to modify the vector in place. This motivates the questions...</p> <p>When will the modify be performed in place, and when will the vector be copied? Is there some way to ensure, by use of the type-system for example, that it <em>will</em> be modified in place?</p>
0debug
Cannot use Kotlin backticked method names in androidTest - bad descriptor exception : <p>In my unit tests I use Kotlin's backticked methods for better readability, e.g. </p> <pre><code>@Test fun `Foo should return bar`() </code></pre> <p>It works nice and well for tests in <code>&lt;module&gt;/src/test</code> directory, but when I try to do the same in <code>&lt;module&gt;/src/androidTest</code> I get an exception:</p> <pre><code>Error:java.lang.IllegalArgumentException: bad descriptor: Lcom/packageName/MainActivityTest$Foo should return bar$1; Error:Execution failed for task ':sample:transformClassesWithDexBuilderForDebugAndroidTest'. &gt; com.android.build.api.transform.TransformException: org.gradle.tooling.BuildException: com.android.dx.cf.iface.ParseException: bad descriptor: Lcom/packageName/MainActivityTest$Foo should return bar$1; </code></pre> <p>Is there some trick to make it work?</p>
0debug
Python Reindex Producing Nan : <p>Here is the code that I am working with:</p> <p><code>import pandas as pd</code></p> <pre><code>test3 = pd.Series([1,2,3], index = ['a','b','c']) test3 = test3.reindex(index = ['f','g','z']) </code></pre> <p>So originally every thing is fine and test3 has an index of 'a' 'b' 'c' and values 1,2,3. But then when I got to reindex test3 I get that my values 1 2 3 are lost. Why is that? The desired output would be:</p> <pre><code>f 1 g 2 z 3 </code></pre>
0debug
Small syntax error with miles-to-kilograms converter exercise : <p>I'm trying to get some practice in before my Intro to C++ class begins this Fall. I was going through some exercises in my textbook and I'm stuck on a miles-to-kilograms conversion exercise. Aparently my compiler says that it's expecting a ';' before line 7 but I don't understand where a ';' could possibly be placed before line 7?</p> <pre><code> #include &lt;iostream&gt; using namespace std; int main() { double miles; double kilograms == miles * 1.609; cout &lt;&lt; "How many miles away is your destination? "; cin &gt;&gt; miles; cout &lt;&lt; "Your destination is " &lt;&lt; kilograms &lt;&lt; " kilograms away!"; } </code></pre>
0debug
React Navigation re-render previous page when going back : <p>Whats the best way to refresh the previous page when going back using Stack Navigator. No life cycle hooks seems to be triggered on the page i am returning to. I'm just using the basic example and <code>this.props.navigation.goBack()</code></p>
0debug
Accessing webpack bundled libraries in the browser : <p>I'm having trouble accessing a webpack bundled library from the browser. </p> <p>Example: I have a class <code>Foo</code></p> <pre><code>// foo.js "use strict"; export default class Foo { constructor() { var bar = "bar"; } } </code></pre> <p><code>Foo</code> is imported in <code>src.js</code></p> <pre><code>// src.js "use strict"; import Foo from "./foo.js"; </code></pre> <p>The webpack config looks like this. The entry is <code>src.js</code> and the output file is <code>bundle.js</code>.</p> <pre><code>// webpack.config.js module.exports = { entry: './src.js', output: { path: '.', filename: 'bundle.js', }, module: { loaders: [ { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader', query: { presets: ['es2015'] } }, ] }, }; </code></pre> <p>Webpack compiles everything okay, and I'm able to load it into my HTML file.</p> <pre><code>&lt;!-- index.html --&gt; &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;script src="bundle.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var x = new Foo(); console.log(x); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>it's at this point that I'm getting the error. For some reason, the bundled JS doesn't put the <code>Foo</code> class into a namespace the browser is able to access.</p> <p>This is the error I get in Firefox:</p> <p><code>ReferenceError: Foo is not defined[Learn More]</code></p> <p>There's some configuration in WebPack I'm not grokking, I'm sure of it, but I've so far not been able to figure it out.</p>
0debug
static void cdrom_pio_impl(int nblocks) { QPCIDevice *dev; QPCIBar bmdma_bar, ide_bar; FILE *fh; int patt_blocks = MAX(16, nblocks); size_t patt_len = ATAPI_BLOCK_SIZE * patt_blocks; char *pattern = g_malloc(patt_len); size_t rxsize = ATAPI_BLOCK_SIZE * nblocks; uint16_t *rx = g_malloc0(rxsize); int i, j; uint8_t data; uint16_t limit; generate_pattern(pattern, patt_len, ATAPI_BLOCK_SIZE); fh = fopen(tmp_path, "w+"); fwrite(pattern, ATAPI_BLOCK_SIZE, patt_blocks, fh); fclose(fh); ide_test_start("-drive if=none,file=%s,media=cdrom,format=raw,id=sr0,index=0 " "-device ide-cd,drive=sr0,bus=ide.0", tmp_path); dev = get_pci_device(&bmdma_bar, &ide_bar); qtest_irq_intercept_in(global_qtest, "ioapic"); qpci_io_writeb(dev, ide_bar, reg_device, 0); qpci_io_writeb(dev, ide_bar, reg_lba_middle, BYTE_COUNT_LIMIT & 0xFF); qpci_io_writeb(dev, ide_bar, reg_lba_high, (BYTE_COUNT_LIMIT >> 8 & 0xFF)); qpci_io_writeb(dev, ide_bar, reg_command, CMD_PACKET); nsleep(400); data = ide_wait_clear(BSY); assert_bit_set(data, DRQ | DRDY); assert_bit_clear(data, ERR | DF | BSY); send_scsi_cdb_read10(dev, ide_bar, 0, nblocks); g_assert(!(rxsize & 1)); limit = BYTE_COUNT_LIMIT & ~1; for (i = 0; i < DIV_ROUND_UP(rxsize, limit); i++) { size_t offset = i * (limit / 2); size_t rem = (rxsize / 2) - offset; ide_wait_intr(IDE_PRIMARY_IRQ); data = ide_wait_clear(BSY); assert_bit_set(data, DRQ | DRDY); assert_bit_clear(data, ERR | DF | BSY); for (j = 0; j < MIN((limit / 2), rem); j++) { rx[offset + j] = cpu_to_le16(qpci_io_readw(dev, ide_bar, reg_data)); } } ide_wait_intr(IDE_PRIMARY_IRQ); data = ide_wait_clear(DRQ); assert_bit_set(data, DRDY); assert_bit_clear(data, DRQ | ERR | DF | BSY); g_assert_cmpint(memcmp(pattern, rx, rxsize), ==, 0); g_free(pattern); g_free(rx); test_bmdma_teardown(); free_pci_device(dev); }
1threat
I need to write a Python recursive function to count how many times a character in string : It should look like this: >>> numberofcharacters('a,'america') 2 >>> numberofcharacters('e,'engineering') 3 This is what I have so far: def count2(char,text): if len(text)==0: return 0 else: if char==count2(char,text[:-1]): return (1+count2(char,text[:-1])) else: return False It will just go to false, but I am trying to count how many times "char" equals each character of "text."
0debug
static void qxl_init_ramsize(PCIQXLDevice *qxl) { if (qxl->vgamem_size_mb < 8) { qxl->vgamem_size_mb = 8; } if (qxl->vgamem_size_mb > 256) { qxl->vgamem_size_mb = 256; } qxl->vgamem_size = qxl->vgamem_size_mb * 1024 * 1024; if (qxl->ram_size_mb != -1) { qxl->vga.vram_size = qxl->ram_size_mb * 1024 * 1024; } if (qxl->vga.vram_size < qxl->vgamem_size * 2) { qxl->vga.vram_size = qxl->vgamem_size * 2; } if (qxl->vram32_size_mb != -1) { qxl->vram32_size = qxl->vram32_size_mb * 1024 * 1024; } if (qxl->vram32_size < 4096) { qxl->vram32_size = 4096; } if (qxl->vram_size_mb != -1) { qxl->vram_size = qxl->vram_size_mb * 1024 * 1024; } if (qxl->vram_size < qxl->vram32_size) { qxl->vram_size = qxl->vram32_size; } if (qxl->revision == 1) { qxl->vram32_size = 4096; qxl->vram_size = 4096; } qxl->vgamem_size = pow2ceil(qxl->vgamem_size); qxl->vga.vram_size = pow2ceil(qxl->vga.vram_size); qxl->vram32_size = pow2ceil(qxl->vram32_size); qxl->vram_size = pow2ceil(qxl->vram_size); }
1threat
error: Failed to load the native TensorFlow runtime : <p>i'm new to tensorflow, today i installed tensorflow using:</p> <pre><code>C:\&gt;pip3 install --upgrade tensorflow Collecting tensorflow Using cached tensorflow-1.2.0-cp35-cp35m-win_amd64.whl Requirement already up-to-date: bleach==1.5.0 in c:\python35\lib\site-packages ( from tensorflow) Requirement already up-to-date: werkzeug&gt;=0.11.10 in c:\python35\lib\site-packag es (from tensorflow) Requirement already up-to-date: html5lib==0.9999999 in c:\python35\lib\site-pack ages (from tensorflow) Requirement already up-to-date: protobuf&gt;=3.2.0 in c:\python35\lib\site-packages (from tensorflow) Requirement already up-to-date: backports.weakref==1.0rc1 in c:\python35\lib\sit e-packages (from tensorflow) Requirement already up-to-date: markdown==2.2.0 in c:\python35\lib\site-packages (from tensorflow) Requirement already up-to-date: numpy&gt;=1.11.0 in c:\python35\lib\site-packages ( from tensorflow) Requirement already up-to-date: six&gt;=1.10.0 in c:\python35\lib\site-packages (fr om tensorflow) Requirement already up-to-date: wheel&gt;=0.26 in c:\python35\lib\site-packages (fr om tensorflow) Requirement already up-to-date: setuptools in c:\python35\lib\site-packages (fro m protobuf&gt;=3.2.0-&gt;tensorflow) Installing collected packages: tensorflow Successfully installed tensorflow-1.2.0 </code></pre> <p>when i tried to import tensorflow, it throws:</p> <pre><code>C:\&gt;python Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AM D64)] on win32 Type "help", "copyright", "credits" or "license" for more information. &gt;&gt;&gt; import tensorflow as tf Traceback (most recent call last): File "C:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_intern al.py", line 18, in swig_import_helper return importlib.import_module(mname) File "C:\Python35\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "&lt;frozen importlib._bootstrap&gt;", line 986, in _gcd_import File "&lt;frozen importlib._bootstrap&gt;", line 969, in _find_and_load File "&lt;frozen importlib._bootstrap&gt;", line 958, in _find_and_load_unlocked File "&lt;frozen importlib._bootstrap&gt;", line 666, in _load_unlocked File "&lt;frozen importlib._bootstrap&gt;", line 577, in module_from_spec File "&lt;frozen importlib._bootstrap_external&gt;", line 906, in create_module File "&lt;frozen importlib._bootstrap&gt;", line 222, in _call_with_frames_removed ImportError: DLL load failed: The specified module could not be found. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", l ine 41, in &lt;module&gt; from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_intern al.py", line 21, in &lt;module&gt; _pywrap_tensorflow_internal = swig_import_helper() File "C:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_intern al.py", line 20, in swig_import_helper return importlib.import_module('_pywrap_tensorflow_internal') File "C:\Python35\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ImportError: No module named '_pywrap_tensorflow_internal' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "&lt;stdin&gt;", line 1, in &lt;module&gt; File "C:\Python35\lib\site-packages\tensorflow\__init__.py", line 24, in &lt;modu le&gt; from tensorflow.python import * File "C:\Python35\lib\site-packages\tensorflow\python\__init__.py", line 49, i n &lt;module&gt; from tensorflow.python import pywrap_tensorflow File "C:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", l ine 52, in &lt;module&gt; raise ImportError(msg) ImportError: Traceback (most recent call last): File "C:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_intern al.py", line 18, in swig_import_helper return importlib.import_module(mname) File "C:\Python35\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "&lt;frozen importlib._bootstrap&gt;", line 986, in _gcd_import File "&lt;frozen importlib._bootstrap&gt;", line 969, in _find_and_load File "&lt;frozen importlib._bootstrap&gt;", line 958, in _find_and_load_unlocked File "&lt;frozen importlib._bootstrap&gt;", line 666, in _load_unlocked File "&lt;frozen importlib._bootstrap&gt;", line 577, in module_from_spec File "&lt;frozen importlib._bootstrap_external&gt;", line 906, in create_module File "&lt;frozen importlib._bootstrap&gt;", line 222, in _call_with_frames_removed ImportError: DLL load failed: The specified module could not be found. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", l ine 41, in &lt;module&gt; from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_intern al.py", line 21, in &lt;module&gt; _pywrap_tensorflow_internal = swig_import_helper() File "C:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_intern al.py", line 20, in swig_import_helper return importlib.import_module('_pywrap_tensorflow_internal') File "C:\Python35\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ImportError: No module named '_pywrap_tensorflow_internal' Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/install_sources#common_installation_probl ems for some common reasons and solutions. Include the entire stack trace above this error message when asking for help. &gt;&gt;&gt; </code></pre> <p>i'm using python 3.5.2 64bit, i don't really know why the import process throws error, please help me gurus</p> <p>thanks, best regards</p>
0debug
Edit Text to Text view between two fragments, Java : I'm developing an application which has two fragments. I need to get the text from EditText in one fragment into a TextView in the other. I have been tried some option but the app is still crashing. The first Fragment is Tab1Setup. The second Fragment is Tab2Auto. I tried: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //TODO slide to position View rootView = inflater.inflate(R.layout.tab1setup, container, false); slide = (TextView) rootView.findViewById(R.id.slide); textview = (TextView) rootView.findViewById(R.id.textView); MatchNumber = (EditText) rootView.findViewById(R.id.MatchNumber); ScouterName = (EditText) rootView.findViewById(R.id.ScouterName); TeamNumber1 = (EditText) rootView.findViewById(R.id.TeamNumber); TeamNumber2 = (EditText) rootView.findViewById(R.id.TeamNumber2); TeamNumber3 = (EditText) rootView.findViewById(R.id.TeamNumber3); Tab2Auto t2a = new Tab2Auto; t2a.textview.setText(TeamNumber1.getText.toString); hope you can help.
0debug
static void ffmpeg_cleanup(int ret) { int i, j; if (do_benchmark) { int maxrss = getmaxrss() / 1024; av_log(NULL, AV_LOG_INFO, "bench: maxrss=%ikB\n", maxrss); } for (i = 0; i < nb_filtergraphs; i++) { FilterGraph *fg = filtergraphs[i]; avfilter_graph_free(&fg->graph); for (j = 0; j < fg->nb_inputs; j++) { av_freep(&fg->inputs[j]->name); av_freep(&fg->inputs[j]); } av_freep(&fg->inputs); for (j = 0; j < fg->nb_outputs; j++) { av_freep(&fg->outputs[j]->name); av_freep(&fg->outputs[j]); } av_freep(&fg->outputs); av_freep(&fg->graph_desc); av_freep(&filtergraphs[i]); } av_freep(&filtergraphs); av_freep(&subtitle_out); for (i = 0; i < nb_output_files; i++) { OutputFile *of = output_files[i]; AVFormatContext *s; if (!of) continue; s = of->ctx; if (s && s->oformat && !(s->oformat->flags & AVFMT_NOFILE)) avio_closep(&s->pb); avformat_free_context(s); av_dict_free(&of->opts); av_freep(&output_files[i]); } for (i = 0; i < nb_output_streams; i++) { OutputStream *ost = output_streams[i]; AVBitStreamFilterContext *bsfc; if (!ost) continue; bsfc = ost->bitstream_filters; while (bsfc) { AVBitStreamFilterContext *next = bsfc->next; av_bitstream_filter_close(bsfc); bsfc = next; } ost->bitstream_filters = NULL; av_frame_free(&ost->filtered_frame); av_frame_free(&ost->last_frame); av_parser_close(ost->parser); av_freep(&ost->forced_keyframes); av_expr_free(ost->forced_keyframes_pexpr); av_freep(&ost->avfilter); av_freep(&ost->logfile_prefix); av_freep(&ost->audio_channels_map); ost->audio_channels_mapped = 0; avcodec_free_context(&ost->enc_ctx); av_freep(&output_streams[i]); } #if HAVE_PTHREADS free_input_threads(); #endif for (i = 0; i < nb_input_files; i++) { avformat_close_input(&input_files[i]->ctx); av_freep(&input_files[i]); } for (i = 0; i < nb_input_streams; i++) { InputStream *ist = input_streams[i]; av_frame_free(&ist->decoded_frame); av_frame_free(&ist->filter_frame); av_dict_free(&ist->decoder_opts); avsubtitle_free(&ist->prev_sub.subtitle); av_frame_free(&ist->sub2video.frame); av_freep(&ist->filters); av_freep(&ist->hwaccel_device); avcodec_free_context(&ist->dec_ctx); av_freep(&input_streams[i]); } if (vstats_file) { if (fclose(vstats_file)) av_log(NULL, AV_LOG_ERROR, "Error closing vstats file, loss of information possible: %s\n", av_err2str(AVERROR(errno))); } av_freep(&vstats_filename); av_freep(&input_streams); av_freep(&input_files); av_freep(&output_streams); av_freep(&output_files); uninit_opts(); avformat_network_deinit(); if (received_sigterm) { av_log(NULL, AV_LOG_INFO, "Exiting normally, received signal %d.\n", (int) received_sigterm); } else if (ret && transcode_init_done) { av_log(NULL, AV_LOG_INFO, "Conversion failed!\n"); } term_exit(); ffmpeg_exited = 1; }
1threat
How do I convert this format of date time? : <p>What is the datetime format is this? and how can I convert to a normal datetime to be used in c# or sql?</p> <p>2017-03-31T15:20:32.620436-04:00</p>
0debug
What does flatten_parameters() do? : <p>I saw many Pytorch examples using flatten_parameters in the forward function of the RNN</p> <p><code>self.rnn.flatten_parameters()</code> </p> <p>I saw this <a href="https://pytorch.org/docs/stable/_modules/torch/nn/modules/rnn.html" rel="noreferrer">RNNBase</a> and it is written that it</p> <blockquote> <p>Resets parameter data pointer so that they can use faster code paths</p> </blockquote> <p>What does that mean?</p>
0debug
inner product two rows in matrix C++ with Eigen : <p>I want to do an inner product as below. MatrixXd a= [1,2,3,4] MatrixXd b= [1,2,3,4]</p> <p>a*b = [1,4,9,16] &lt;=> c[i] = a[i]*b[i].</p> <p>How to do it with Eigen MatrixXd?</p> <p>Thanks.</p>
0debug
How are Kotlin Array's toList and asList different? : <p>The Kotlin <code>Array</code> class offers <code>asList()</code>, <code>toList()</code>, and <code>toMutableList()</code> methods. The first two methods both return a <code>List</code> and are described in the <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html" rel="noreferrer">Kotlin reference</a> as follows:</p> <ul> <li><code>asList()</code> returns a <code>List</code> that wraps the original <code>Array</code>.</li> <li><code>toList()</code> returns a <code>List</code> containing all elements [of the original <code>Array</code>].</li> </ul> <p>These methods <em>appear</em> interchangeable. How do these two methods differ in practice?</p>
0debug
Call nonstatic method in MainActivity from another Class : the Qestion is already in title... And this **don't** work: MainActivity mActivity = new MainActivity(); mActivity.update(); Thanks in advance
0debug
static int tiff_unpack_fax(TiffContext *s, uint8_t *dst, int stride, const uint8_t *src, int size, int width, int lines) { int i, ret = 0; int line; uint8_t *src2 = av_malloc((unsigned)size + AV_INPUT_BUFFER_PADDING_SIZE); if (!src2) { av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); return AVERROR(ENOMEM); } if (!s->fill_order) { memcpy(src2, src, size); } else { for (i = 0; i < size; i++) src2[i] = ff_reverse[src[i]]; } memset(src2 + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); ret = ff_ccitt_unpack(s->avctx, src2, size, dst, lines, stride, s->compr, s->fax_opts); if (s->bpp < 8 && s->avctx->pix_fmt == AV_PIX_FMT_PAL8) for (line = 0; line < lines; line++) { horizontal_fill(s->bpp, dst, 1, dst, 0, width, 0); dst += stride; } av_free(src2); return ret; }
1threat
Difference between List<int> and Dictionary<int, int>? : <p>Why would anyone ever use a dictionary with two integers?</p> <p>It seems to me like this would just create an indexed collection of integers, where the "key" is the integer index and the "value" is the integer. </p> <p>Or, in other words, it would be the same as a list of integers.</p> <p>Now, I suppose having a dictionary allows you to set custom integer keys, so for example you could have pairs like (1,2) (7,3), etc. but this still doesn't make much sense. But when would it actually be practical/useful to use a dictionary as opposed to List?</p>
0debug
I want to use video capture object outside the main function for making my program : I want to use video capture object outside the main function for making my program Something like this: ``` class MotionDetection{ void frameDetails(int width = 640,int height =480){ cap.set(CV_CAP_PROP_FRAME_WIDTH,width); cap.set(CV_CAP_PROP_FRAME_HEIGHT,height); } }; int main(int argc, char **argv){ cv::VideoCapture cap(0); MotionDetection obj; return 0; } ```
0debug
document.getElementById('input').innerHTML = user_input;
1threat
void hmp_info_tpm(Monitor *mon, const QDict *qdict) { TPMInfoList *info_list, *info; Error *err = NULL; unsigned int c = 0; TPMPassthroughOptions *tpo; info_list = qmp_query_tpm(&err); if (err) { monitor_printf(mon, "TPM device not supported\n"); error_free(err); return; } if (info_list) { monitor_printf(mon, "TPM device:\n"); } for (info = info_list; info; info = info->next) { TPMInfo *ti = info->value; monitor_printf(mon, " tpm%d: model=%s\n", c, TpmModel_lookup[ti->model]); monitor_printf(mon, " \\ %s: type=%s", ti->id, TpmTypeOptionsKind_lookup[ti->options->kind]); switch (ti->options->kind) { case TPM_TYPE_OPTIONS_KIND_PASSTHROUGH: tpo = ti->options->passthrough; monitor_printf(mon, "%s%s%s%s", tpo->has_path ? ",path=" : "", tpo->has_path ? tpo->path : "", tpo->has_cancel_path ? ",cancel-path=" : "", tpo->has_cancel_path ? tpo->cancel_path : ""); break; case TPM_TYPE_OPTIONS_KIND_MAX: break; } monitor_printf(mon, "\n"); c++; } qapi_free_TPMInfoList(info_list); }
1threat
static bool sd_get_inserted(SDState *sd) { return blk_is_inserted(sd->blk); }
1threat
def cal_electbill(units): if(units < 50): amount = units * 2.60 surcharge = 25 elif(units <= 100): amount = 130 + ((units - 50) * 3.25) surcharge = 35 elif(units <= 200): amount = 130 + 162.50 + ((units - 100) * 5.26) surcharge = 45 else: amount = 130 + 162.50 + 526 + ((units - 200) * 8.45) surcharge = 75 total = amount + surcharge return total
0debug
static void tgen_brcond(TCGContext *s, TCGType type, TCGCond c, TCGReg r1, TCGArg c2, int c2const, TCGLabel *l) { int cc; if (facilities & FACILITY_GEN_INST_EXT) { bool is_unsigned = is_unsigned_cond(c); bool in_range; S390Opcode opc; cc = tcg_cond_to_s390_cond[c]; if (!c2const) { opc = (type == TCG_TYPE_I32 ? (is_unsigned ? RIE_CLRJ : RIE_CRJ) : (is_unsigned ? RIE_CLGRJ : RIE_CGRJ)); tgen_compare_branch(s, opc, cc, r1, c2, l); return; } if (type == TCG_TYPE_I32) { if (is_unsigned) { opc = RIE_CLIJ; in_range = (uint32_t)c2 == (uint8_t)c2; } else { opc = RIE_CIJ; in_range = (int32_t)c2 == (int8_t)c2; } } else { if (is_unsigned) { opc = RIE_CLGIJ; in_range = (uint64_t)c2 == (uint8_t)c2; } else { opc = RIE_CGIJ; in_range = (int64_t)c2 == (int8_t)c2; } } if (in_range) { tgen_compare_imm_branch(s, opc, cc, r1, c2, l); return; } } cc = tgen_cmp(s, type, c, r1, c2, c2const, false); tgen_branch(s, cc, l); }
1threat
component data vs its props in vuejs : <p>The official documentation says that there could be a <code>data</code> and a <code>props</code> option in a component.</p> <p>For me it seems a sort of excessive functionality.</p> <p>Why do I need both properties and data in my component? Which goals they are aimed?</p>
0debug
How do I get sqlite to work in my c++ project? : I am trying to use sqlite in my linux c++ project and I have installed sqlite using apt-get sqlite3 but now I need to get sqlite included in my project but I don't know how to do this. How do I get sqlite to be included in my project? I'm using clion if that helps at all.
0debug
How to obtain the gradients in keras? : <p>I am attempting to debug a <code>keras</code> model that I have built. It seems that my gradients are exploding, or there is a division by 0 or some such. It would be convenient to be able to inspect the various gradients as they back-propagate through the network. Something like the following would be ideal:</p> <pre><code>model.evaluate(np.array([[1,2]]), np.array([[1]])) #gives the loss model.evaluate_gradient(np.array([[1,2]]), np.array([[1]]), layer=2) #gives the doutput/dloss at layer 2 for the given input model.evaluate_weight_gradient(np.array([[1,2]]), np.array([[1]]), layer=2) #gives the dweight/dloss at layer 2 for the given input </code></pre>
0debug
How do i add more than 1 to i every time my for loop runs? : import java.util.Scanner; public class TxFnd { public static void main(String [] args){ int i; for(i=75000;i<125001;i++){ System.out.println(i); System.out.println(""); } } }
0debug
How can I compare a letter from a string in C? : <pre><code>char* str = "Hello" if ( str[0] == 'a' ) { printf("OK"); } </code></pre> <p>I tried this but get an error, how am i suppose to comapre them?</p>
0debug
I want to run these command in a single run. : ssh $1 cd /mk/dist/mktdata vi /mk/disk/master $2 How to resolve this problem so that in a single run all three line get exceuted.
0debug
I'm having trouble linking my css file to my html. I'm learning how to code : link rel="stylesheet" type="text/css" href="haiku-styles-shaun.css" /> I created the css folder and named it. I added this to my header in html but the changes aren't happening.
0debug
void qtest_qmp(QTestState *s, const char *fmt, ...) { va_list ap; bool has_reply = false; int nesting = 0; va_start(ap, fmt); socket_sendf(s->qmp_fd, fmt, ap); va_end(ap); while (!has_reply || nesting > 0) { ssize_t len; char c; len = read(s->qmp_fd, &c, 1); if (len == -1 && errno == EINTR) { continue; switch (c) { case '{': nesting++; has_reply = true; break; case '}': nesting--; break;
1threat
Draw geom_tile borders inside squares to prevent overlap : <p>I would like to be able to draw borders on <code>geom_tile</code> that do not overlap so that borders can convey their own information without confusing the viewer with disappearing borders.</p> <pre><code>library(ggplot2) state &lt;- data.frame(p=runif(100), x=1:10, y=rep(1:10, each=10), z=rep(1:5, each=20)) ggplot(state, aes(x, y)) + geom_tile(aes(fill = p, color=as.factor(z)), size=2) </code></pre> <p><a href="https://i.stack.imgur.com/6TGew.png" rel="noreferrer"><img src="https://i.stack.imgur.com/6TGew.png" alt="geom_tile plot with overlapping borders"></a></p> <p>I trust you can see how confusing overlapping borders can be.</p>
0debug
how to get dateseparator from current date in delphi 5 : I am trying to get date separator from current date which format is set cenz republic which is 9.3.2017. when i use dateseparator which is inbuilt in delphi but it always return '/' as date separator instead of '.' what shall i do to get date separator of current date format.
0debug
MS sql query to get average of sum column : MS sql query to get average of sum column I have Volume column which group in 5 minutes gap and sum of Volume column Now I want average of SumVolume column I tried here to do but its coming from Volume Column I want from SumVolume Column [enter image description here][1] [enter image description here][2] I want average value from SumVolume column [1]: https://i.stack.imgur.com/SplKw.png [2]: https://i.stack.imgur.com/Jrebn.png
0debug
Moving a docker-compose container to openshift V3 : <p>I would like to move the Omnibus gitlab docker image to openshift V3, so I've got the dockerfile and docker-compose files @ <a href="https://gitlab.com/gitlab-org/omnibus-gitlab/tree/master/docker" rel="noreferrer">https://gitlab.com/gitlab-org/omnibus-gitlab/tree/master/docker</a>. What is the best way for having a scalable openshift v3 pod ? As the command oc import docker-compose is experimental so I stuck and lost in the process of building a reliable solution. Thanks Herve</p>
0debug
static void disas_arm_insn(DisasContext *s, unsigned int insn) { unsigned int cond, val, op1, i, shift, rm, rs, rn, rd, sh; TCGv_i32 tmp; TCGv_i32 tmp2; TCGv_i32 tmp3; TCGv_i32 addr; TCGv_i64 tmp64; if (arm_dc_feature(s, ARM_FEATURE_M)) { goto illegal_op; } cond = insn >> 28; if (cond == 0xf){ ARCH(5); if (((insn >> 25) & 7) == 1) { if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { goto illegal_op; } if (disas_neon_data_insn(s, insn)) { goto illegal_op; } return; } if ((insn & 0x0f100000) == 0x04000000) { if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { goto illegal_op; } if (disas_neon_ls_insn(s, insn)) { goto illegal_op; } return; } if ((insn & 0x0f000e10) == 0x0e000a00) { if (disas_vfp_insn(s, insn)) { goto illegal_op; } return; } if (((insn & 0x0f30f000) == 0x0510f000) || ((insn & 0x0f30f010) == 0x0710f000)) { if ((insn & (1 << 22)) == 0) { if (!arm_dc_feature(s, ARM_FEATURE_V7MP)) { goto illegal_op; } } ARCH(5TE); return; } if (((insn & 0x0f70f000) == 0x0450f000) || ((insn & 0x0f70f010) == 0x0650f000)) { ARCH(7); return; } if (((insn & 0x0f700000) == 0x04100000) || ((insn & 0x0f700010) == 0x06100000)) { if (!arm_dc_feature(s, ARM_FEATURE_V7MP)) { goto illegal_op; } return; } if ((insn & 0x0ffffdff) == 0x01010000) { ARCH(6); if (((insn >> 9) & 1) != s->bswap_code) { qemu_log_mask(LOG_UNIMP, "arm: unimplemented setend\n"); goto illegal_op; } return; } else if ((insn & 0x0fffff00) == 0x057ff000) { switch ((insn >> 4) & 0xf) { case 1: ARCH(6K); gen_clrex(s); return; case 4: case 5: ARCH(7); return; case 6: gen_lookup_tb(s); return; default: goto illegal_op; } } else if ((insn & 0x0e5fffe0) == 0x084d0500) { if (IS_USER(s)) { goto illegal_op; } ARCH(6); gen_srs(s, (insn & 0x1f), (insn >> 23) & 3, insn & (1 << 21)); return; } else if ((insn & 0x0e50ffe0) == 0x08100a00) { int32_t offset; if (IS_USER(s)) goto illegal_op; ARCH(6); rn = (insn >> 16) & 0xf; addr = load_reg(s, rn); i = (insn >> 23) & 3; switch (i) { case 0: offset = -4; break; case 1: offset = 0; break; case 2: offset = -8; break; case 3: offset = 4; break; default: abort(); } if (offset) tcg_gen_addi_i32(addr, addr, offset); tmp = tcg_temp_new_i32(); gen_aa32_ld32u(tmp, addr, get_mem_index(s)); tcg_gen_addi_i32(addr, addr, 4); tmp2 = tcg_temp_new_i32(); gen_aa32_ld32u(tmp2, addr, get_mem_index(s)); if (insn & (1 << 21)) { switch (i) { case 0: offset = -8; break; case 1: offset = 4; break; case 2: offset = -4; break; case 3: offset = 0; break; default: abort(); } if (offset) tcg_gen_addi_i32(addr, addr, offset); store_reg(s, rn, addr); } else { tcg_temp_free_i32(addr); } gen_rfe(s, tmp, tmp2); return; } else if ((insn & 0x0e000000) == 0x0a000000) { int32_t offset; val = (uint32_t)s->pc; tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, val); store_reg(s, 14, tmp); offset = (((int32_t)insn) << 8) >> 8; val += (offset << 2) | ((insn >> 23) & 2) | 1; val += 4; gen_bx_im(s, val); return; } else if ((insn & 0x0e000f00) == 0x0c000100) { if (arm_dc_feature(s, ARM_FEATURE_IWMMXT)) { if (extract32(s->c15_cpar, 1, 1)) { if (!disas_iwmmxt_insn(s, insn)) { return; } } } } else if ((insn & 0x0fe00000) == 0x0c400000) { ARCH(5TE); } else if ((insn & 0x0f000010) == 0x0e000010) { } else if ((insn & 0x0ff10020) == 0x01000000) { uint32_t mask; uint32_t val; if (IS_USER(s)) return; mask = val = 0; if (insn & (1 << 19)) { if (insn & (1 << 8)) mask |= CPSR_A; if (insn & (1 << 7)) mask |= CPSR_I; if (insn & (1 << 6)) mask |= CPSR_F; if (insn & (1 << 18)) val |= mask; } if (insn & (1 << 17)) { mask |= CPSR_M; val |= (insn & 0x1f); } if (mask) { gen_set_psr_im(s, mask, 0, val); } return; } goto illegal_op; } if (cond != 0xe) { s->condlabel = gen_new_label(); arm_gen_test_cc(cond ^ 1, s->condlabel); s->condjmp = 1; } if ((insn & 0x0f900000) == 0x03000000) { if ((insn & (1 << 21)) == 0) { ARCH(6T2); rd = (insn >> 12) & 0xf; val = ((insn >> 4) & 0xf000) | (insn & 0xfff); if ((insn & (1 << 22)) == 0) { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, val); } else { tmp = load_reg(s, rd); tcg_gen_ext16u_i32(tmp, tmp); tcg_gen_ori_i32(tmp, tmp, val << 16); } store_reg(s, rd, tmp); } else { if (((insn >> 12) & 0xf) != 0xf) goto illegal_op; if (((insn >> 16) & 0xf) == 0) { gen_nop_hint(s, insn & 0xff); } else { val = insn & 0xff; shift = ((insn >> 8) & 0xf) * 2; if (shift) val = (val >> shift) | (val << (32 - shift)); i = ((insn & (1 << 22)) != 0); if (gen_set_psr_im(s, msr_mask(s, (insn >> 16) & 0xf, i), i, val)) { goto illegal_op; } } } } else if ((insn & 0x0f900000) == 0x01000000 && (insn & 0x00000090) != 0x00000090) { op1 = (insn >> 21) & 3; sh = (insn >> 4) & 0xf; rm = insn & 0xf; switch (sh) { case 0x0: if (op1 & 1) { tmp = load_reg(s, rm); i = ((op1 & 2) != 0); if (gen_set_psr(s, msr_mask(s, (insn >> 16) & 0xf, i), i, tmp)) goto illegal_op; } else { rd = (insn >> 12) & 0xf; if (op1 & 2) { if (IS_USER(s)) goto illegal_op; tmp = load_cpu_field(spsr); } else { tmp = tcg_temp_new_i32(); gen_helper_cpsr_read(tmp, cpu_env); } store_reg(s, rd, tmp); } break; case 0x1: if (op1 == 1) { ARCH(4T); tmp = load_reg(s, rm); gen_bx(s, tmp); } else if (op1 == 3) { ARCH(5); rd = (insn >> 12) & 0xf; tmp = load_reg(s, rm); gen_helper_clz(tmp, tmp); store_reg(s, rd, tmp); } else { goto illegal_op; } break; case 0x2: if (op1 == 1) { ARCH(5J); tmp = load_reg(s, rm); gen_bx(s, tmp); } else { goto illegal_op; } break; case 0x3: if (op1 != 1) goto illegal_op; ARCH(5); tmp = load_reg(s, rm); tmp2 = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp2, s->pc); store_reg(s, 14, tmp2); gen_bx(s, tmp); break; case 0x4: { uint32_t c = extract32(insn, 8, 4); if (!arm_dc_feature(s, ARM_FEATURE_CRC) || op1 == 0x3 || (c & 0xd) != 0) { goto illegal_op; } rn = extract32(insn, 16, 4); rd = extract32(insn, 12, 4); tmp = load_reg(s, rn); tmp2 = load_reg(s, rm); if (op1 == 0) { tcg_gen_andi_i32(tmp2, tmp2, 0xff); } else if (op1 == 1) { tcg_gen_andi_i32(tmp2, tmp2, 0xffff); } tmp3 = tcg_const_i32(1 << op1); if (c & 0x2) { gen_helper_crc32c(tmp, tmp, tmp2, tmp3); } else { gen_helper_crc32(tmp, tmp, tmp2, tmp3); } tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp3); store_reg(s, rd, tmp); break; } case 0x5: ARCH(5TE); rd = (insn >> 12) & 0xf; rn = (insn >> 16) & 0xf; tmp = load_reg(s, rm); tmp2 = load_reg(s, rn); if (op1 & 2) gen_helper_double_saturate(tmp2, cpu_env, tmp2); if (op1 & 1) gen_helper_sub_saturate(tmp, cpu_env, tmp, tmp2); else gen_helper_add_saturate(tmp, cpu_env, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(s, rd, tmp); break; case 7: { int imm16 = extract32(insn, 0, 4) | (extract32(insn, 8, 12) << 4); switch (op1) { case 1: ARCH(5); gen_exception_insn(s, 4, EXCP_BKPT, syn_aa32_bkpt(imm16, false), default_exception_el(s)); break; case 2: ARCH(7); if (IS_USER(s)) { goto illegal_op; } gen_hvc(s, imm16); break; case 3: ARCH(6K); if (IS_USER(s)) { goto illegal_op; } gen_smc(s); break; default: goto illegal_op; } break; } case 0x8: case 0xa: case 0xc: case 0xe: ARCH(5TE); rs = (insn >> 8) & 0xf; rn = (insn >> 12) & 0xf; rd = (insn >> 16) & 0xf; if (op1 == 1) { tmp = load_reg(s, rm); tmp2 = load_reg(s, rs); if (sh & 4) tcg_gen_sari_i32(tmp2, tmp2, 16); else gen_sxth(tmp2); tmp64 = gen_muls_i64_i32(tmp, tmp2); tcg_gen_shri_i64(tmp64, tmp64, 16); tmp = tcg_temp_new_i32(); tcg_gen_extrl_i64_i32(tmp, tmp64); tcg_temp_free_i64(tmp64); if ((sh & 2) == 0) { tmp2 = load_reg(s, rn); gen_helper_add_setq(tmp, cpu_env, tmp, tmp2); tcg_temp_free_i32(tmp2); } store_reg(s, rd, tmp); } else { tmp = load_reg(s, rm); tmp2 = load_reg(s, rs); gen_mulxy(tmp, tmp2, sh & 2, sh & 4); tcg_temp_free_i32(tmp2); if (op1 == 2) { tmp64 = tcg_temp_new_i64(); tcg_gen_ext_i32_i64(tmp64, tmp); tcg_temp_free_i32(tmp); gen_addq(s, tmp64, rn, rd); gen_storeq_reg(s, rn, rd, tmp64); tcg_temp_free_i64(tmp64); } else { if (op1 == 0) { tmp2 = load_reg(s, rn); gen_helper_add_setq(tmp, cpu_env, tmp, tmp2); tcg_temp_free_i32(tmp2); } store_reg(s, rd, tmp); } } break; default: goto illegal_op; } } else if (((insn & 0x0e000000) == 0 && (insn & 0x00000090) != 0x90) || ((insn & 0x0e000000) == (1 << 25))) { int set_cc, logic_cc, shiftop; op1 = (insn >> 21) & 0xf; set_cc = (insn >> 20) & 1; logic_cc = table_logic_cc[op1] & set_cc; if (insn & (1 << 25)) { val = insn & 0xff; shift = ((insn >> 8) & 0xf) * 2; if (shift) { val = (val >> shift) | (val << (32 - shift)); } tmp2 = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp2, val); if (logic_cc && shift) { gen_set_CF_bit31(tmp2); } } else { rm = (insn) & 0xf; tmp2 = load_reg(s, rm); shiftop = (insn >> 5) & 3; if (!(insn & (1 << 4))) { shift = (insn >> 7) & 0x1f; gen_arm_shift_im(tmp2, shiftop, shift, logic_cc); } else { rs = (insn >> 8) & 0xf; tmp = load_reg(s, rs); gen_arm_shift_reg(tmp2, shiftop, tmp, logic_cc); } } if (op1 != 0x0f && op1 != 0x0d) { rn = (insn >> 16) & 0xf; tmp = load_reg(s, rn); } else { TCGV_UNUSED_I32(tmp); } rd = (insn >> 12) & 0xf; switch(op1) { case 0x00: tcg_gen_and_i32(tmp, tmp, tmp2); if (logic_cc) { gen_logic_CC(tmp); } store_reg_bx(s, rd, tmp); break; case 0x01: tcg_gen_xor_i32(tmp, tmp, tmp2); if (logic_cc) { gen_logic_CC(tmp); } store_reg_bx(s, rd, tmp); break; case 0x02: if (set_cc && rd == 15) { if (IS_USER(s)) { goto illegal_op; } gen_sub_CC(tmp, tmp, tmp2); gen_exception_return(s, tmp); } else { if (set_cc) { gen_sub_CC(tmp, tmp, tmp2); } else { tcg_gen_sub_i32(tmp, tmp, tmp2); } store_reg_bx(s, rd, tmp); } break; case 0x03: if (set_cc) { gen_sub_CC(tmp, tmp2, tmp); } else { tcg_gen_sub_i32(tmp, tmp2, tmp); } store_reg_bx(s, rd, tmp); break; case 0x04: if (set_cc) { gen_add_CC(tmp, tmp, tmp2); } else { tcg_gen_add_i32(tmp, tmp, tmp2); } store_reg_bx(s, rd, tmp); break; case 0x05: if (set_cc) { gen_adc_CC(tmp, tmp, tmp2); } else { gen_add_carry(tmp, tmp, tmp2); } store_reg_bx(s, rd, tmp); break; case 0x06: if (set_cc) { gen_sbc_CC(tmp, tmp, tmp2); } else { gen_sub_carry(tmp, tmp, tmp2); } store_reg_bx(s, rd, tmp); break; case 0x07: if (set_cc) { gen_sbc_CC(tmp, tmp2, tmp); } else { gen_sub_carry(tmp, tmp2, tmp); } store_reg_bx(s, rd, tmp); break; case 0x08: if (set_cc) { tcg_gen_and_i32(tmp, tmp, tmp2); gen_logic_CC(tmp); } tcg_temp_free_i32(tmp); break; case 0x09: if (set_cc) { tcg_gen_xor_i32(tmp, tmp, tmp2); gen_logic_CC(tmp); } tcg_temp_free_i32(tmp); break; case 0x0a: if (set_cc) { gen_sub_CC(tmp, tmp, tmp2); } tcg_temp_free_i32(tmp); break; case 0x0b: if (set_cc) { gen_add_CC(tmp, tmp, tmp2); } tcg_temp_free_i32(tmp); break; case 0x0c: tcg_gen_or_i32(tmp, tmp, tmp2); if (logic_cc) { gen_logic_CC(tmp); } store_reg_bx(s, rd, tmp); break; case 0x0d: if (logic_cc && rd == 15) { if (IS_USER(s)) { goto illegal_op; } gen_exception_return(s, tmp2); } else { if (logic_cc) { gen_logic_CC(tmp2); } store_reg_bx(s, rd, tmp2); } break; case 0x0e: tcg_gen_andc_i32(tmp, tmp, tmp2); if (logic_cc) { gen_logic_CC(tmp); } store_reg_bx(s, rd, tmp); break; default: case 0x0f: tcg_gen_not_i32(tmp2, tmp2); if (logic_cc) { gen_logic_CC(tmp2); } store_reg_bx(s, rd, tmp2); break; } if (op1 != 0x0f && op1 != 0x0d) { tcg_temp_free_i32(tmp2); } } else { op1 = (insn >> 24) & 0xf; switch(op1) { case 0x0: case 0x1: sh = (insn >> 5) & 3; if (sh == 0) { if (op1 == 0x0) { rd = (insn >> 16) & 0xf; rn = (insn >> 12) & 0xf; rs = (insn >> 8) & 0xf; rm = (insn) & 0xf; op1 = (insn >> 20) & 0xf; switch (op1) { case 0: case 1: case 2: case 3: case 6: tmp = load_reg(s, rs); tmp2 = load_reg(s, rm); tcg_gen_mul_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); if (insn & (1 << 22)) { ARCH(6T2); tmp2 = load_reg(s, rn); tcg_gen_sub_i32(tmp, tmp2, tmp); tcg_temp_free_i32(tmp2); } else if (insn & (1 << 21)) { tmp2 = load_reg(s, rn); tcg_gen_add_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); } if (insn & (1 << 20)) gen_logic_CC(tmp); store_reg(s, rd, tmp); break; case 4: ARCH(6); tmp = load_reg(s, rs); tmp2 = load_reg(s, rm); tmp64 = gen_mulu_i64_i32(tmp, tmp2); gen_addq_lo(s, tmp64, rn); gen_addq_lo(s, tmp64, rd); gen_storeq_reg(s, rn, rd, tmp64); tcg_temp_free_i64(tmp64); break; case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: tmp = load_reg(s, rs); tmp2 = load_reg(s, rm); if (insn & (1 << 22)) { tcg_gen_muls2_i32(tmp, tmp2, tmp, tmp2); } else { tcg_gen_mulu2_i32(tmp, tmp2, tmp, tmp2); } if (insn & (1 << 21)) { TCGv_i32 al = load_reg(s, rn); TCGv_i32 ah = load_reg(s, rd); tcg_gen_add2_i32(tmp, tmp2, tmp, tmp2, al, ah); tcg_temp_free_i32(al); tcg_temp_free_i32(ah); } if (insn & (1 << 20)) { gen_logicq_cc(tmp, tmp2); } store_reg(s, rn, tmp); store_reg(s, rd, tmp2); break; default: goto illegal_op; } } else { rn = (insn >> 16) & 0xf; rd = (insn >> 12) & 0xf; if (insn & (1 << 23)) { int op2 = (insn >> 8) & 3; op1 = (insn >> 21) & 0x3; switch (op2) { case 0: if (op1 == 1) { goto illegal_op; } ARCH(8); break; case 1: goto illegal_op; case 2: ARCH(8); break; case 3: if (op1) { ARCH(6K); } else { ARCH(6); } break; } addr = tcg_temp_local_new_i32(); load_reg_var(s, addr, rn); if (op2 == 0) { if (insn & (1 << 20)) { tmp = tcg_temp_new_i32(); switch (op1) { case 0: gen_aa32_ld32u(tmp, addr, get_mem_index(s)); break; case 2: gen_aa32_ld8u(tmp, addr, get_mem_index(s)); break; case 3: gen_aa32_ld16u(tmp, addr, get_mem_index(s)); break; default: abort(); } store_reg(s, rd, tmp); } else { rm = insn & 0xf; tmp = load_reg(s, rm); switch (op1) { case 0: gen_aa32_st32(tmp, addr, get_mem_index(s)); break; case 2: gen_aa32_st8(tmp, addr, get_mem_index(s)); break; case 3: gen_aa32_st16(tmp, addr, get_mem_index(s)); break; default: abort(); } tcg_temp_free_i32(tmp); } } else if (insn & (1 << 20)) { switch (op1) { case 0: gen_load_exclusive(s, rd, 15, addr, 2); break; case 1: gen_load_exclusive(s, rd, rd + 1, addr, 3); break; case 2: gen_load_exclusive(s, rd, 15, addr, 0); break; case 3: gen_load_exclusive(s, rd, 15, addr, 1); break; default: abort(); } } else { rm = insn & 0xf; switch (op1) { case 0: gen_store_exclusive(s, rd, rm, 15, addr, 2); break; case 1: gen_store_exclusive(s, rd, rm, rm + 1, addr, 3); break; case 2: gen_store_exclusive(s, rd, rm, 15, addr, 0); break; case 3: gen_store_exclusive(s, rd, rm, 15, addr, 1); break; default: abort(); } } tcg_temp_free_i32(addr); } else { rm = (insn) & 0xf; addr = load_reg(s, rn); tmp = load_reg(s, rm); tmp2 = tcg_temp_new_i32(); if (insn & (1 << 22)) { gen_aa32_ld8u(tmp2, addr, get_mem_index(s)); gen_aa32_st8(tmp, addr, get_mem_index(s)); } else { gen_aa32_ld32u(tmp2, addr, get_mem_index(s)); gen_aa32_st32(tmp, addr, get_mem_index(s)); } tcg_temp_free_i32(tmp); tcg_temp_free_i32(addr); store_reg(s, rd, tmp2); } } } else { int address_offset; bool load = insn & (1 << 20); bool doubleword = false; rn = (insn >> 16) & 0xf; rd = (insn >> 12) & 0xf; if (!load && (sh & 2)) { ARCH(5TE); if (rd & 1) { goto illegal_op; } load = (sh & 1) == 0; doubleword = true; } addr = load_reg(s, rn); if (insn & (1 << 24)) gen_add_datah_offset(s, insn, 0, addr); address_offset = 0; if (doubleword) { if (!load) { tmp = load_reg(s, rd); gen_aa32_st32(tmp, addr, get_mem_index(s)); tcg_temp_free_i32(tmp); tcg_gen_addi_i32(addr, addr, 4); tmp = load_reg(s, rd + 1); gen_aa32_st32(tmp, addr, get_mem_index(s)); tcg_temp_free_i32(tmp); } else { tmp = tcg_temp_new_i32(); gen_aa32_ld32u(tmp, addr, get_mem_index(s)); store_reg(s, rd, tmp); tcg_gen_addi_i32(addr, addr, 4); tmp = tcg_temp_new_i32(); gen_aa32_ld32u(tmp, addr, get_mem_index(s)); rd++; } address_offset = -4; } else if (load) { tmp = tcg_temp_new_i32(); switch (sh) { case 1: gen_aa32_ld16u(tmp, addr, get_mem_index(s)); break; case 2: gen_aa32_ld8s(tmp, addr, get_mem_index(s)); break; default: case 3: gen_aa32_ld16s(tmp, addr, get_mem_index(s)); break; } } else { tmp = load_reg(s, rd); gen_aa32_st16(tmp, addr, get_mem_index(s)); tcg_temp_free_i32(tmp); } if (!(insn & (1 << 24))) { gen_add_datah_offset(s, insn, address_offset, addr); store_reg(s, rn, addr); } else if (insn & (1 << 21)) { if (address_offset) tcg_gen_addi_i32(addr, addr, address_offset); store_reg(s, rn, addr); } else { tcg_temp_free_i32(addr); } if (load) { store_reg(s, rd, tmp); } } break; case 0x4: case 0x5: goto do_ldst; case 0x6: case 0x7: if (insn & (1 << 4)) { ARCH(6); rm = insn & 0xf; rn = (insn >> 16) & 0xf; rd = (insn >> 12) & 0xf; rs = (insn >> 8) & 0xf; switch ((insn >> 23) & 3) { case 0: op1 = (insn >> 20) & 7; tmp = load_reg(s, rn); tmp2 = load_reg(s, rm); sh = (insn >> 5) & 7; if ((op1 & 3) == 0 || sh == 5 || sh == 6) goto illegal_op; gen_arm_parallel_addsub(op1, sh, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(s, rd, tmp); break; case 1: if ((insn & 0x00700020) == 0) { tmp = load_reg(s, rn); tmp2 = load_reg(s, rm); shift = (insn >> 7) & 0x1f; if (insn & (1 << 6)) { if (shift == 0) shift = 31; tcg_gen_sari_i32(tmp2, tmp2, shift); tcg_gen_andi_i32(tmp, tmp, 0xffff0000); tcg_gen_ext16u_i32(tmp2, tmp2); } else { if (shift) tcg_gen_shli_i32(tmp2, tmp2, shift); tcg_gen_ext16u_i32(tmp, tmp); tcg_gen_andi_i32(tmp2, tmp2, 0xffff0000); } tcg_gen_or_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(s, rd, tmp); } else if ((insn & 0x00200020) == 0x00200000) { tmp = load_reg(s, rm); shift = (insn >> 7) & 0x1f; if (insn & (1 << 6)) { if (shift == 0) shift = 31; tcg_gen_sari_i32(tmp, tmp, shift); } else { tcg_gen_shli_i32(tmp, tmp, shift); } sh = (insn >> 16) & 0x1f; tmp2 = tcg_const_i32(sh); if (insn & (1 << 22)) gen_helper_usat(tmp, cpu_env, tmp, tmp2); else gen_helper_ssat(tmp, cpu_env, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(s, rd, tmp); } else if ((insn & 0x00300fe0) == 0x00200f20) { tmp = load_reg(s, rm); sh = (insn >> 16) & 0x1f; tmp2 = tcg_const_i32(sh); if (insn & (1 << 22)) gen_helper_usat16(tmp, cpu_env, tmp, tmp2); else gen_helper_ssat16(tmp, cpu_env, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(s, rd, tmp); } else if ((insn & 0x00700fe0) == 0x00000fa0) { tmp = load_reg(s, rn); tmp2 = load_reg(s, rm); tmp3 = tcg_temp_new_i32(); tcg_gen_ld_i32(tmp3, cpu_env, offsetof(CPUARMState, GE)); gen_helper_sel_flags(tmp, tmp3, tmp, tmp2); tcg_temp_free_i32(tmp3); tcg_temp_free_i32(tmp2); store_reg(s, rd, tmp); } else if ((insn & 0x000003e0) == 0x00000060) { tmp = load_reg(s, rm); shift = (insn >> 10) & 3; if (shift != 0) tcg_gen_rotri_i32(tmp, tmp, shift * 8); op1 = (insn >> 20) & 7; switch (op1) { case 0: gen_sxtb16(tmp); break; case 2: gen_sxtb(tmp); break; case 3: gen_sxth(tmp); break; case 4: gen_uxtb16(tmp); break; case 6: gen_uxtb(tmp); break; case 7: gen_uxth(tmp); break; default: goto illegal_op; } if (rn != 15) { tmp2 = load_reg(s, rn); if ((op1 & 3) == 0) { gen_add16(tmp, tmp2); } else { tcg_gen_add_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); } } store_reg(s, rd, tmp); } else if ((insn & 0x003f0f60) == 0x003f0f20) { tmp = load_reg(s, rm); if (insn & (1 << 22)) { if (insn & (1 << 7)) { gen_revsh(tmp); } else { ARCH(6T2); gen_helper_rbit(tmp, tmp); } } else { if (insn & (1 << 7)) gen_rev16(tmp); else tcg_gen_bswap32_i32(tmp, tmp); } store_reg(s, rd, tmp); } else { goto illegal_op; } break; case 2: switch ((insn >> 20) & 0x7) { case 5: if (((insn >> 6) ^ (insn >> 7)) & 1) { goto illegal_op; } tmp = load_reg(s, rm); tmp2 = load_reg(s, rs); tmp64 = gen_muls_i64_i32(tmp, tmp2); if (rd != 15) { tmp = load_reg(s, rd); if (insn & (1 << 6)) { tmp64 = gen_subq_msw(tmp64, tmp); } else { tmp64 = gen_addq_msw(tmp64, tmp); } } if (insn & (1 << 5)) { tcg_gen_addi_i64(tmp64, tmp64, 0x80000000u); } tcg_gen_shri_i64(tmp64, tmp64, 32); tmp = tcg_temp_new_i32(); tcg_gen_extrl_i64_i32(tmp, tmp64); tcg_temp_free_i64(tmp64); store_reg(s, rn, tmp); break; case 0: case 4: if (insn & (1 << 7)) { goto illegal_op; } tmp = load_reg(s, rm); tmp2 = load_reg(s, rs); if (insn & (1 << 5)) gen_swap_half(tmp2); gen_smul_dual(tmp, tmp2); if (insn & (1 << 22)) { TCGv_i64 tmp64_2; tmp64 = tcg_temp_new_i64(); tmp64_2 = tcg_temp_new_i64(); tcg_gen_ext_i32_i64(tmp64, tmp); tcg_gen_ext_i32_i64(tmp64_2, tmp2); tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); if (insn & (1 << 6)) { tcg_gen_sub_i64(tmp64, tmp64, tmp64_2); } else { tcg_gen_add_i64(tmp64, tmp64, tmp64_2); } tcg_temp_free_i64(tmp64_2); gen_addq(s, tmp64, rd, rn); gen_storeq_reg(s, rd, rn, tmp64); tcg_temp_free_i64(tmp64); } else { if (insn & (1 << 6)) { tcg_gen_sub_i32(tmp, tmp, tmp2); } else { gen_helper_add_setq(tmp, cpu_env, tmp, tmp2); } tcg_temp_free_i32(tmp2); if (rd != 15) { tmp2 = load_reg(s, rd); gen_helper_add_setq(tmp, cpu_env, tmp, tmp2); tcg_temp_free_i32(tmp2); } store_reg(s, rn, tmp); } break; case 1: case 3: if (!arm_dc_feature(s, ARM_FEATURE_ARM_DIV)) { goto illegal_op; } if (((insn >> 5) & 7) || (rd != 15)) { goto illegal_op; } tmp = load_reg(s, rm); tmp2 = load_reg(s, rs); if (insn & (1 << 21)) { gen_helper_udiv(tmp, tmp, tmp2); } else { gen_helper_sdiv(tmp, tmp, tmp2); } tcg_temp_free_i32(tmp2); store_reg(s, rn, tmp); break; default: goto illegal_op; } break; case 3: op1 = ((insn >> 17) & 0x38) | ((insn >> 5) & 7); switch (op1) { case 0: ARCH(6); tmp = load_reg(s, rm); tmp2 = load_reg(s, rs); gen_helper_usad8(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); if (rd != 15) { tmp2 = load_reg(s, rd); tcg_gen_add_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); } store_reg(s, rn, tmp); break; case 0x20: case 0x24: case 0x28: case 0x2c: ARCH(6T2); shift = (insn >> 7) & 0x1f; i = (insn >> 16) & 0x1f; if (i < shift) { goto illegal_op; } i = i + 1 - shift; if (rm == 15) { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } else { tmp = load_reg(s, rm); } if (i != 32) { tmp2 = load_reg(s, rd); tcg_gen_deposit_i32(tmp, tmp2, tmp, shift, i); tcg_temp_free_i32(tmp2); } store_reg(s, rd, tmp); break; case 0x12: case 0x16: case 0x1a: case 0x1e: case 0x32: case 0x36: case 0x3a: case 0x3e: ARCH(6T2); tmp = load_reg(s, rm); shift = (insn >> 7) & 0x1f; i = ((insn >> 16) & 0x1f) + 1; if (shift + i > 32) goto illegal_op; if (i < 32) { if (op1 & 0x20) { gen_ubfx(tmp, shift, (1u << i) - 1); } else { gen_sbfx(tmp, shift, i); } } store_reg(s, rd, tmp); break; default: goto illegal_op; } break; } break; } do_ldst: sh = (0xf << 20) | (0xf << 4); if (op1 == 0x7 && ((insn & sh) == sh)) { goto illegal_op; } rn = (insn >> 16) & 0xf; rd = (insn >> 12) & 0xf; tmp2 = load_reg(s, rn); if ((insn & 0x01200000) == 0x00200000) { i = get_a32_user_mem_index(s); } else { i = get_mem_index(s); } if (insn & (1 << 24)) gen_add_data_offset(s, insn, tmp2); if (insn & (1 << 20)) { tmp = tcg_temp_new_i32(); if (insn & (1 << 22)) { gen_aa32_ld8u(tmp, tmp2, i); } else { gen_aa32_ld32u(tmp, tmp2, i); } } else { tmp = load_reg(s, rd); if (insn & (1 << 22)) { gen_aa32_st8(tmp, tmp2, i); } else { gen_aa32_st32(tmp, tmp2, i); } tcg_temp_free_i32(tmp); } if (!(insn & (1 << 24))) { gen_add_data_offset(s, insn, tmp2); store_reg(s, rn, tmp2); } else if (insn & (1 << 21)) { store_reg(s, rn, tmp2); } else { tcg_temp_free_i32(tmp2); } if (insn & (1 << 20)) { store_reg_from_load(s, rd, tmp); } break; case 0x08: case 0x09: { int j, n, loaded_base; bool exc_return = false; bool is_load = extract32(insn, 20, 1); bool user = false; TCGv_i32 loaded_var; if (insn & (1 << 22)) { if (IS_USER(s)) goto illegal_op; if (is_load && extract32(insn, 15, 1)) { exc_return = true; } else { user = true; } } rn = (insn >> 16) & 0xf; addr = load_reg(s, rn); loaded_base = 0; TCGV_UNUSED_I32(loaded_var); n = 0; for(i=0;i<16;i++) { if (insn & (1 << i)) n++; } if (insn & (1 << 23)) { if (insn & (1 << 24)) { tcg_gen_addi_i32(addr, addr, 4); } else { } } else { if (insn & (1 << 24)) { tcg_gen_addi_i32(addr, addr, -(n * 4)); } else { if (n != 1) tcg_gen_addi_i32(addr, addr, -((n - 1) * 4)); } } j = 0; for(i=0;i<16;i++) { if (insn & (1 << i)) { if (is_load) { tmp = tcg_temp_new_i32(); gen_aa32_ld32u(tmp, addr, get_mem_index(s)); if (user) { tmp2 = tcg_const_i32(i); gen_helper_set_user_reg(cpu_env, tmp2, tmp); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp); } else if (i == rn) { loaded_var = tmp; loaded_base = 1; } else { store_reg_from_load(s, i, tmp); } } else { if (i == 15) { val = (long)s->pc + 4; tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, val); } else if (user) { tmp = tcg_temp_new_i32(); tmp2 = tcg_const_i32(i); gen_helper_get_user_reg(tmp, cpu_env, tmp2); tcg_temp_free_i32(tmp2); } else { tmp = load_reg(s, i); } gen_aa32_st32(tmp, addr, get_mem_index(s)); tcg_temp_free_i32(tmp); } j++; if (j != n) tcg_gen_addi_i32(addr, addr, 4); } } if (insn & (1 << 21)) { if (insn & (1 << 23)) { if (insn & (1 << 24)) { } else { tcg_gen_addi_i32(addr, addr, 4); } } else { if (insn & (1 << 24)) { if (n != 1) tcg_gen_addi_i32(addr, addr, -((n - 1) * 4)); } else { tcg_gen_addi_i32(addr, addr, -(n * 4)); } } store_reg(s, rn, addr); } else { tcg_temp_free_i32(addr); } if (loaded_base) { store_reg(s, rn, loaded_var); } if (exc_return) { tmp = load_cpu_field(spsr); gen_set_cpsr(tmp, CPSR_ERET_MASK); tcg_temp_free_i32(tmp); s->is_jmp = DISAS_UPDATE; } } break; case 0xa: case 0xb: { int32_t offset; val = (int32_t)s->pc; if (insn & (1 << 24)) { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, val); store_reg(s, 14, tmp); } offset = sextract32(insn << 2, 0, 26); val += offset + 4; gen_jmp(s, val); } break; case 0xc: case 0xd: case 0xe: if (((insn >> 8) & 0xe) == 10) { if (disas_vfp_insn(s, insn)) { goto illegal_op; } } else if (disas_coproc_insn(s, insn)) { goto illegal_op; } break; case 0xf: gen_set_pc_im(s, s->pc); s->svc_imm = extract32(insn, 0, 24); s->is_jmp = DISAS_SWI; break; default: illegal_op: gen_exception_insn(s, 4, EXCP_UDEF, syn_uncategorized(), default_exception_el(s)); break; } } }
1threat
Run dotnet 1.1 using docker : <p>I'm trying to run an .NET Core app on my mac. I'm using VS Core and upgraded the project to .NET 1.1. Everything works fine when I run it through VSCode however when I get to run it using Docker it fails.</p> <p>I do the following steps:</p> <pre><code>dotnet publish -c Release -o out docker build -t myApp . </code></pre> <p>The Dockerfile looks like this:</p> <pre><code>FROM microsoft/dotnet:1.1.0-preview1-runtime WORKDIR /service COPY out ./service/ ENTRYPOINT ["dotnet", "myApp.dll"] </code></pre> <p>Essentially I'm following the steps from <a href="https://github.com/dotnet/dotnet-docker" rel="noreferrer">https://github.com/dotnet/dotnet-docker</a> . I'm getting all the time the following error:</p> <blockquote> <p>Did you mean to run dotnet SDK commands? Please install dotnet SDK from: <a href="http://go.microsoft.com/fwlink/?LinkID=798306&amp;clcid=0x409" rel="noreferrer">http://go.microsoft.com/fwlink/?LinkID=798306&amp;clcid=0x409</a></p> </blockquote> <p>I'm not sure what I am missing here...</p>
0debug
EntityFramework Multiple Where : <p>I am wondering, if I use multiple <code>Where(...)</code> methods one after the other, is EntityFramework smart enough to combine it in a resulting query. Let's say I have:</p> <pre><code>context.Items .Where(item =&gt; item.Number &gt; 0) .Where(item =&gt; item.Number &lt; 5) .ToList(); </code></pre> <p>Will the resulting SQL query be the same as if I write:</p> <pre><code>context.Items .Where(item =&gt; item.Number &gt; 0 &amp;&amp; item.Number &lt; 5) .ToList(); </code></pre> <p>Are there any behind-the-scenes optimizations for multiple Where clause?</p>
0debug
IntelliJ Shorten Command Line for Cucumber Tests : <p>I've encountered an issue running Cucumber tests in IntelliJ. When I try to run a feature or scenario, I get the following error:</p> <pre><code>"Error running 'Feature &lt;feature&gt;': Command line is too long. Shorten command line for Feature: &lt;feature&gt; or also for Cucumber java default configuration" </code></pre> <p>I know as part of IntelliJ's <a href="https://blog.jetbrains.com/idea/2017/10/intellij-idea-2017-3-eap-configurable-command-line-shortener-and-more/" rel="noreferrer">2017.3 release</a>, they added support for a "Shorten Command Line" option in the Run/Debug Configurations. However, if I compare the default configs, I don't see it as part of the Cucumber Java configuration, but I do see it in the JUnit configuration for example.</p> <p>I don't get the popup tip that others have mentioned about the dynamic .classpath, I'm assuming because of this new release. Any ideas?</p>
0debug
static void test_qga_invalid_args(gconstpointer fix) { const TestFixture *fixture = fix; QDict *ret, *error; const gchar *class, *desc; ret = qmp_fd(fixture->fd, "{'execute': 'guest-ping', " "'arguments': {'foo': 42 }}"); g_assert_nonnull(ret); error = qdict_get_qdict(ret, "error"); class = qdict_get_try_str(error, "class"); desc = qdict_get_try_str(error, "desc"); g_assert_cmpstr(class, ==, "GenericError"); g_assert_cmpstr(desc, ==, "QMP input object member 'foo' is unexpected"); QDECREF(ret); }
1threat
How do you in C++ of returning a default type for a class : <p>I have a class which contains a variable (apple). How can i configure the class so by default the return type if (const char *), any suggestions please?</p> <pre><code>class myClass { public char *apple; } int main() { myClass c; printf("%s\r\n",c); } </code></pre>
0debug
static void rbd_aio_bh_cb(void *opaque) { RBDAIOCB *acb = opaque; if (acb->cmd == RBD_AIO_READ) { qemu_iovec_from_buf(acb->qiov, 0, acb->bounce, acb->qiov->size); } qemu_vfree(acb->bounce); acb->common.cb(acb->common.opaque, (acb->ret > 0 ? 0 : acb->ret)); qemu_bh_delete(acb->bh); acb->bh = NULL; qemu_aio_release(acb); }
1threat
void kqemu_cpu_interrupt(CPUState *env) { #if defined(_WIN32) CancelIo(kqemu_fd); #endif }
1threat
Must websockets have heartbeats? : <p>When I read about websockets, heartbeats are usually mentioned as a must have. MDN even writes about a <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers#Pings_and_Pongs_The_Heartbeat_of_WebSockets" rel="noreferrer">special opcode for heartbeats</a>.</p> <p>But are heartbeats a mandatory part of websockets? Do I <em>have to</em> implement it or else my websockets will be terminated by the browsers or some other standards?</p>
0debug
saving login details in sql server database : I am new to programming. I am creating a project in which i want to store login details into database but i am using Combobox list because there are various types of user and for that particular selected user i want to get the info store in my database. My form looks like this... User Id : Textbox Password : Textbox User Type : ComboBoxlist In that ComboBoxlist there are 3 users. So, how do i store the above mentioned details of login into my database. I hope i have framed the question in the right way...:) Thank You !!
0debug
How find data type of premtive variable in java : <p>How get premtive variable data type in print statment . tell method that tell about data type of variable?</p>
0debug
static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDisplay *display, const uint8_t *buf, int buf_size, int top_bottom, int non_mod) { DVBSubContext *ctx = avctx->priv_data; DVBSubRegion *region = get_region(ctx, display->region_id); const uint8_t *buf_end = buf + buf_size; uint8_t *pbuf; int x_pos, y_pos; int i; uint8_t map2to4[] = { 0x0, 0x7, 0x8, 0xf}; uint8_t map2to8[] = {0x00, 0x77, 0x88, 0xff}; uint8_t map4to8[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}; uint8_t *map_table; #if 0 av_dlog(avctx, "DVB pixel block size %d, %s field:\n", buf_size, top_bottom ? "bottom" : "top"); for (i = 0; i < buf_size; i++) { if (i % 16 == 0) av_dlog(avctx, "0x%8p: ", buf+i); av_dlog(avctx, "%02x ", buf[i]); if (i % 16 == 15) av_dlog(avctx, "\n"); } if (i % 16) av_dlog(avctx, "\n"); #endif if (region == 0) return; pbuf = region->pbuf; region->dirty = 1; x_pos = display->x_pos; y_pos = display->y_pos; if ((y_pos & 1) != top_bottom) y_pos++; while (buf < buf_end) { if (x_pos > region->width || y_pos > region->height) { av_log(avctx, AV_LOG_ERROR, "Invalid object location!\n"); return; } switch (*buf++) { case 0x10: if (region->depth == 8) map_table = map2to8; else if (region->depth == 4) map_table = map2to4; else map_table = NULL; x_pos += dvbsub_read_2bit_string(pbuf + (y_pos * region->width) + x_pos, region->width - x_pos, &buf, buf_end - buf, non_mod, map_table); break; case 0x11: if (region->depth < 4) { av_log(avctx, AV_LOG_ERROR, "4-bit pixel string in %d-bit region!\n", region->depth); return; } if (region->depth == 8) map_table = map4to8; else map_table = NULL; x_pos += dvbsub_read_4bit_string(pbuf + (y_pos * region->width) + x_pos, region->width - x_pos, &buf, buf_end - buf, non_mod, map_table); break; case 0x12: if (region->depth < 8) { av_log(avctx, AV_LOG_ERROR, "8-bit pixel string in %d-bit region!\n", region->depth); return; } x_pos += dvbsub_read_8bit_string(pbuf + (y_pos * region->width) + x_pos, region->width - x_pos, &buf, buf_end - buf, non_mod, NULL); break; case 0x20: map2to4[0] = (*buf) >> 4; map2to4[1] = (*buf++) & 0xf; map2to4[2] = (*buf) >> 4; map2to4[3] = (*buf++) & 0xf; break; case 0x21: for (i = 0; i < 4; i++) map2to8[i] = *buf++; break; case 0x22: for (i = 0; i < 16; i++) map4to8[i] = *buf++; break; case 0xf0: x_pos = display->x_pos; y_pos += 2; break; default: av_log(avctx, AV_LOG_INFO, "Unknown/unsupported pixel block 0x%x\n", *(buf-1)); } } }
1threat
i cant import a database from sql server to phpmyadmin , error 1064 , plz heeelp : consulta SQL: Documentación USE [master] GO CREATE DATABASE [sistema de ventas] ON PRIMARY ( NAME = N'sistema de ventas', FILENAME = N'C:\MSSQL10.SQLEXPRESS56\MSSQL\DATA\sistema de ventas.mdf' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ) LOG ON ( NAME = N'sistema de ventas_log', FILENAME = N'C:\MSSQL10.SQLEXPRESS56\MSSQL\DATA\sistema de ventas_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%) GO ALTER DATABASE [sistema de ventas] SET COMPATIBILITY_LEVEL = 100 GO IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled')) begin EXEC [sistema de ventas].[dbo].[sp_fulltext_database] @action = 'enable' end GO ALTER DATABASE [sistema de ventas] SET ANSI_NULL_DEFAULT OFF GO ALTER DATABASE [sistema de ventas] SET ANSI_NULLS OFF GO ALTER DATABASE [sistema de ventas] SET ANSI_PADDING OFF GO ALTER DATABASE [sistema de ventas] SET ANSI_WARNINGS OFF GO ALTER DATABASE [sistema de ventas] SET ARITHABORT OFF GO ALTER DATABASE [sistema de ventas] SET AUTO_CLOSE OFF GO ALTER DATABASE [sistema de ventas] SET AUTO_SHRINK OFF GO ALTER DATABASE [sistema de ventas] SET AUTO_UPDATE_STATISTICS ON GO ALTER DATABASE [sistema de ventas] SET CURSOR_CLOSE_ON_COMMIT OFF GO ALTER DATABASE [sistema de ventas] SET CURSOR_DEFAULT GLOBAL GO ALTER DATABASE [sistema de ventas] SET CONCAT_NULL_YIELDS_NULL OFF GO ALTER DATABASE [sistema de ventas] SET NUMERIC_ROUNDABORT OFF GO ALTER DATABASE [sistema de ventas] SET QUOTED_IDENTIFIER OFF GO ALTER DATABASE [sistema de ventas] SET RECURSIVE_TRIGGERS OFF GO ALTER DATABASE [sistema de ventas] SET DISABLE_BROKER GO ALTER DATABASE [sistema de ventas] SET AUTO_UPDATE_STATISTICS_ASYNC OFF GO ALTER DATABASE [sistema de ventas] SET DATE_CORRELATION_OPTIMIZATION OFF GO ALTER DATABASE [sistema de ventas] SET TRUSTWORTHY OFF GO ALTER DATABASE [sistema de ventas] SET ALLOW_SNAPSHOT_ISOLATION OFF GO ALTER DATABASE [sistema de ventas] SET PARAMETERIZATION SIMPLE GO ALTER DATABASE [sistema de ventas] SET READ_COMMITTED_SNAPSHOT OFF GO ALTER DATABASE [sistema de ventas] SET HONOR_BROKER_PRIORITY OFF GO ALTER DATABASE [sistema de ventas] SET RECOVERY SIMPLE GO ALTER DATABASE [sistema de ventas] SET MULTI_USER GO ALTER DATABASE [sistema de ventas] SET PAGE_VERIFY CHECKSUM GO ALTER DATABASE [sistema de ventas] SET DB_CHAINING OFF GO USE [sistema de ventas] GO /****** Object: Table [dbo].[articulo] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[articulo]( [idarticulo] [int] IDENTITY(1,1) NOT NULL, [codigo] [varchar](50) NOT NULL, [nombre] [varchar](50) NOT NULL, [descripcion] [varchar](3000) NOT NULL, [proveedor] [varchar](50) NOT NULL, [idcategoria] [int] NOT NULL, [idpresentacion] [int] NOT NULL, CONSTRAINT [PK_artc] PRIMARY KEY CLUSTERED ( [idarticulo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO /****** Object: Table [dbo].[categoria] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[categoria]( [idcategoria] [int] IDENTITY(1,1) NOT NULL, [nombre] [varchar](50) NOT NULL, [descripcion] [varchar](50) NOT NULL, CONSTRAINT [PK_categori] PRIMARY KEY CLUSTERED ( [idcategoria] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO /****** Object: Table [dbo].[detalle_venta] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[detalle_venta]( [iddetalle_venta] [int] IDENTITY(1,1) NOT NULL, [idventa] [int] NOT NULL, [iddetalle_ingreso] [int] NOT NULL, [cantidad] [int] NOT NULL, [precio_venta] [money] NOT NULL, [descuento] [money] NOT NULL, CONSTRAINT [PK_detalle_vent] PRIMARY KEY CLUSTERED ( [iddetalle_venta] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[detalleingreso] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[detalleingreso]( [iddetalle_ingreso] [int] IDENTITY(1,1) NOT NULL, [idingreso] [int] NOT NULL, [idarticulo] [int] NOT NULL, [precio_compra] [money] NOT NULL, [precio_venta] [money] NOT NULL, [stockinicial] [int] NOT NULL, [stockactual] [int] NOT NULL, CONSTRAINT [PK_detalleingre] PRIMARY KEY CLUSTERED ( [iddetalle_ingreso] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[ingreso] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[ingreso]( [idingreso] [int] IDENTITY(1,1) NOT NULL, [idtrabajador] [int] NOT NULL, [tipo_comprobante] [varchar](50) NOT NULL, [serie] [varchar](50) NOT NULL, [correlativo] [varchar](50) NOT NULL, [igv] [varchar](50) NOT NULL, [fecha] [date] NOT NULL, [estado] [varchar](7) NULL, CONSTRAINT [PK_ingresooo] PRIMARY KEY CLUSTERED ( [idingreso] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO /****** Object: Table [dbo].[presentacion] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[presentacion]( [idpresentacion] [int] IDENTITY(1,1) NOT NULL, [nombre] [varchar](50) NOT NULL, [descripcion] [varchar](50) NOT NULL, CONSTRAINT [PK_Table_1] PRIMARY KEY CLUSTERED ( [idpresentacion] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO /****** Object: Table [dbo].[Table_2] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[Table_2]( [idcliente] [int] IDENTITY(1,1) NOT NULL, [nombre] [varchar](50) NOT NULL, [apellido] [varchar](50) NOT NULL, [sexo] [varchar](50) NOT NULL, [fecha_nacimiento] [date] NOT NULL, [numdocumento] [varchar](50) NOT NULL, [direccion] [varchar](50) NULL, [telefono] [varchar](50) NULL, [email] [varchar](50) NULL, CONSTRAINT [PK_Table_22] PRIMARY KEY CLUSTERED ( [idcliente] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO /****** Object: Table [dbo].[trabajador] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[trabajador]( [idtrabajador] [int] IDENTITY(1,1) NOT NULL, [nombre] [varchar](50) NULL, [apellido] [varchar](50) NULL, [sexo] [varchar](50) NULL, [fecha_nac] [date] NULL, [num_documento] [varchar](50) NULL, [direccion] [varchar](150) NULL, [telefono] [varchar](50) NULL, [email] [varchar](50) NULL, [acceso] [varchar](50) NOT NULL, [usuario] [varchar](50) NOT NULL, [password] [varchar](50) NOT NULL, CONSTRAINT [PK_trabajad] PRIMARY KEY CLUSTERED ( [idtrabajador] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO /****** Object: Table [dbo].[venta] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[venta]( [idventa] [int] IDENTITY(1,1) NOT NULL, [idcliente] [int] NOT NULL, [idtrabajador] [int] NOT NULL, [fecha] [date] NOT NULL, [serie] [varchar](50) NOT NULL, [correlativo] [varchar](50) NOT NULL, [tipo_comprobante] [varchar](50) NOT NULL, [igv] [decimal](4, 2) NOT NULL, CONSTRAINT [PK_venta] PRIMARY KEY CLUSTERED ( [idventa] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO SET IDENTITY_INSERT [dbo].[venta] OFF ALTER TABLE [dbo].[articulo] WITH CHECK ADD CONSTRAINT [FK_artc_categori] FOREIGN KEY([idcategoria]) REFERENCES [dbo].[categoria] ([idcategoria]) GO ALTER TABLE [dbo].[articulo] CHECK CONSTRAINT [FK_artc_categori] GO ALTER TABLE [dbo].[articulo] WITH CHECK ADD CONSTRAINT [FK_articulo_presentacion] FOREIGN KEY([idpresentacion]) REFERENCES [dbo].[presentacion] ([idpresentacion]) GO ALTER TABLE [dbo].[articulo] CHECK CONSTRAINT [FK_articulo_presentacion] GO ALTER TABLE [dbo].[detalle_venta] WITH CHECK ADD CONSTRAINT [FK_detalle_venta_detalleingreso] FOREIGN KEY([iddetalle_ingreso]) REFERENCES [dbo].[detalleingreso] ([iddetalle_ingreso]) GO ALTER TABLE [dbo].[detalle_venta] CHECK CONSTRAINT [FK_detalle_venta_detalleingreso] GO ALTER TABLE [dbo].[detalle_venta] WITH CHECK ADD CONSTRAINT [FK_detalle_venta_venta] FOREIGN KEY([idventa]) REFERENCES [dbo].[venta] ([idventa]) GO ALTER TABLE [dbo].[detalle_venta] CHECK CONSTRAINT [FK_detalle_venta_venta] GO ALTER TABLE [dbo].[detalleingreso] WITH CHECK ADD CONSTRAINT [FK_detalleingre_artc] FOREIGN KEY([idarticulo]) REFERENCES [dbo].[articulo] ([idarticulo]) GO ALTER TABLE [dbo].[detalleingreso] CHECK CONSTRAINT [FK_detalleingre_artc] GO ALTER TABLE [dbo].[detalleingreso] WITH CHECK ADD CONSTRAINT [FK_detalleingreso_ingreso] FOREIGN KEY([idingreso]) REFERENCES [dbo].[ingreso] ([idingreso]) GO ALTER TABLE [dbo].[detalleingreso] CHECK CONSTRAINT [FK_detalleingreso_ingreso] GO ALTER TABLE [dbo].[ingreso] WITH CHECK ADD CONSTRAINT [FK_ingreso_trabajador] FOREIGN KEY([idtrabajador]) REFERENCES [dbo].[trabajador] ([idtrabajador]) GO ALTER TABLE [dbo].[ingreso] CHECK CONSTRAINT [FK_ingreso_trabajador] GO ALTER TABLE [dbo].[venta] WITH CHECK ADD CONSTRAINT [FK_venta_Table_2] FOREIGN KEY([idcliente]) REFERENCES [dbo].[Table_2] ([idcliente]) GO ALTER TABLE [dbo].[venta] CHECK CONSTRAINT [FK_venta_Table_2] GO /****** Object: StoredProcedure [dbo].[mpsyp] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[mpsyp] @textobuscar int as select a.nombre as Articulo, di.stockactual ,d.precio_venta from detalle_venta d inner join detalleingreso di on d.iddetalle_ingreso=di.iddetalle_ingreso inner join articulo a on di.idarticulo=a.idarticulo inner join venta v on v.idventa = d.idventa where a.nombre=@textobuscar GO /****** Object: StoredProcedure [dbo].[spanular_ingreso] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Procedimiento anular Ingreso create proc [dbo].[spanular_ingreso] @idingreso int as update ingreso set estado='ANULADO' where idingreso=@idingreso GO /****** Object: StoredProcedure [dbo].[spbuscar_articulo_nombre] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Buscar Artículo Nombre CREATE proc [dbo].[spbuscar_articulo_nombre] @textobuscar varchar(50) as SELECT articulo.idarticulo,articulo.codigo,articulo.nombre, articulo.descripcion,articulo.idcategoria, categoria.nombre AS Categoria, articulo.idpresentacion, presentacion.nombre AS Presentacion, articulo.proveedor FROM articulo INNER JOIN categoria ON dbo.articulo.idcategoria = dbo.categoria.idcategoria INNER JOIN presentacion ON articulo.idpresentacion = presentacion.idpresentacion where articulo.nombre like @textobuscar + '%' GO /****** Object: StoredProcedure [dbo].[spbuscar_categoria_nombre] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Buscar Categoría Nombre create proc [dbo].[spbuscar_categoria_nombre] @textobuscar varchar(50) as select * from categoria where nombre like @textobuscar + '%' GO /****** Object: StoredProcedure [dbo].[spbuscar_cliente_apellidos] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Buscar Cliente Apellidos CREATE proc [dbo].[spbuscar_cliente_apellidos] @textobuscar varchar(50) as SELECT * FROM Table_2 where apellido like @textobuscar + '%' GO /****** Object: StoredProcedure [dbo].[spbuscar_cliente_num_documento] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Buscar Cliente Num Documento CREATE proc [dbo].[spbuscar_cliente_num_documento] @textobuscar varchar(8) as SELECT * FROM Table_2 where numdocumento like @textobuscar + '%' GO /****** Object: StoredProcedure [dbo].[spbuscar_ingreso_fecha] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[spbuscar_ingreso_fecha] -- Procedimiento Buscar ingreso por fecha @textobuscar varchar(50), @textobuscar2 varchar(50) as SELECT i.idingreso, (t.apellido +' '+ t.nombre) as Trabajador, i.fecha, i.tipo_comprobante, i.serie, i.correlativo, i.estado, sum(d.precio_compra* d.stockinicial) as Total,i.igv FROM detalleingreso d INNER JOIN ingreso i ON d.idingreso = i.idingreso INNER JOIN trabajador t ON i.idtrabajador = t.idtrabajador group by i.idingreso, t.apellido +' '+ t.nombre, i.fecha, i.tipo_comprobante, i.serie, i.correlativo, i.estado,i.igv having i.fecha>=@textobuscar and i.fecha<=@textobuscar2 GO /****** Object: StoredProcedure [dbo].[spbuscar_presentacion_nombre] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Buscar Presentación Nombre create proc [dbo].[spbuscar_presentacion_nombre] @textobuscar varchar(50) as select * from presentacion where nombre like @textobuscar + '%' GO /****** Object: StoredProcedure [dbo].[spbuscar_trabajador_apellidos] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Buscar Trabajador Apellidos create proc [dbo].[spbuscar_trabajador_apellidos] @textobuscar varchar(50) as SELECT * FROM trabajador where apellido like @textobuscar + '%' GO /****** Object: StoredProcedure [dbo].[spbuscar_trabajador_num_documento] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Buscar Trababajador Num Documento create proc [dbo].[spbuscar_trabajador_num_documento] @textobuscar varchar(8) as SELECT * FROM trabajador where num_documento like @textobuscar + '%' GO /****** Object: StoredProcedure [dbo].[spbuscar_venta_fecha] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Buscar venta por fecha CREATE proc [dbo].[spbuscar_venta_fecha] @textobuscar varchar(50), @textobuscar2 varchar(50) as SELECT v.idventa, (t.apellido +' '+ t.nombre) as Trabajador, (c.apellido + ' ' + c.nombre) as Cliente, v.fecha, v.tipo_comprobante, v.serie, v.correlativo,v.igv, sum((d.precio_venta* d.cantidad)-d.descuento) as Total FROM detalle_venta d INNER JOIN venta v ON d.idventa = v.idventa INNER JOIN Table_2 c ON v.idcliente = c.idcliente INNER JOIN trabajador t ON v.idtrabajador = t.idtrabajador group by v.idventa, t.apellido +' '+ t.nombre, c.apellido+' '+c.nombre, v.fecha, v.tipo_comprobante, v.serie, v.correlativo , v.igv having v.fecha>=@textobuscar and v.fecha<=@textobuscar2 GO /****** Object: StoredProcedure [dbo].[spbuscararticulo_venta_codigo] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Mostrar Artículos para la venta por Código CREATE proc [dbo].[spbuscararticulo_venta_codigo] @textobuscar varchar(50) as select a.Idarticulo,a.Codigo,a.Nombre,c.nombre as Categoria, p.nombre as Presentacion,d.stockactual,d.precio_compra, d.precio_venta from articulo a inner join categoria c on a.idcategoria=c.idcategoria inner join presentacion p on a.idpresentacion = p.idpresentacion inner join detalleingreso d on a.idarticulo=d.idarticulo inner join ingreso i on i.idingreso=d.idingreso where a.codigo=@textobuscar and d.stockactual>0 and i.estado<>'ANULADO' GO /****** Object: StoredProcedure [dbo].[spbuscararticulo_venta_nombre] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Mostrar Artículos para la venta por nombre CREATE proc [dbo].[spbuscararticulo_venta_nombre] @textobuscar varchar(50) as select d.iddetalle_ingreso,a.Codigo,a.Nombre,c.nombre as Categoria, p.nombre as Presentacion,d.stockactual,d.precio_compra, d.precio_venta from articulo a inner join categoria c on a.idcategoria=c.idcategoria inner join presentacion p on a.idpresentacion = p.idpresentacion inner join detalleingreso d on a.idarticulo=d.idarticulo inner join ingreso i on i.idingreso=d.idingreso where a.nombre like @textobuscar + '%' and d.stockactual>0 and i.estado<>'ANULADO' GO /****** Object: StoredProcedure [dbo].[spdisminuir_stock] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Procedimiento almacenado para disminuir stock CREATE proc [dbo].[spdisminuir_stock] @iddetalle_ingreso int, @cantidad int as update detalleingreso set stockactual=stockactual-@cantidad where iddetalle_ingreso=@iddetalle_ingreso GO /****** Object: StoredProcedure [dbo].[speditar_articulo] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Editar Artículo CREATE proc [dbo].[speditar_articulo] @idarticulo int output, @codigo varchar(50), @nombre varchar(50), @descripcion varchar(1024), @prov varchar(150), @idcategoria int , @idpresentacion int as update articulo set codigo=@codigo,nombre=@nombre, descripcion=@descripcion,proveedor=@prov, idcategoria=@idcategoria, idpresentacion=@idpresentacion where idarticulo=@idarticulo GO /****** Object: StoredProcedure [dbo].[speditar_categoria] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Editar Categoría CREATE proc [dbo].[speditar_categoria] @idcategoria int , @nombre varchar(50), @descripcion varchar(256) as update categoria set nombre=@nombre, descripcion=@descripcion where idcategoria=@idcategoria GO /****** Object: StoredProcedure [dbo].[speditar_cliente] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Editar Cliente CREATE proc [dbo].[speditar_cliente] @idcliente int, @nombre varchar(20), @apellidos varchar(40), @sexo varchar(1), @fecha_nacimiento date, @num_documento varchar(8), @direccion varchar(100), @telefono varchar(10), @email varchar(50) as update Table_2 set nombre=@nombre,apellido=@apellidos,sexo=@sexo, fecha_nacimiento=@fecha_nacimiento, numdocumento=@num_documento, direccion=@direccion,telefono=@telefono,email=@email where idcliente=@idcliente GO /****** Object: StoredProcedure [dbo].[speditar_presentacion] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Editar Presentación create proc [dbo].[speditar_presentacion] @idpresentacion int, @nombre varchar(50), @descripcion varchar(256) as update presentacion set nombre=@nombre, descripcion=@descripcion where idpresentacion=@idpresentacion GO /****** Object: StoredProcedure [dbo].[speditar_trabajador] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Editar Trabajador CREATE proc [dbo].[speditar_trabajador] @idtrabajador int, @nombre varchar(20), @apellidos varchar(40), @sexo varchar(1), @fecha_nacimiento date, @num_documento varchar(8), @direccion varchar(100), @telefono varchar(10), @email varchar(50), @acceso varchar (20), @usuario varchar (20), @password varchar(20) as update trabajador set nombre=@nombre,apellido=@apellidos,sexo=@sexo, fecha_nac=@fecha_nacimiento, num_documento=@num_documento, direccion=@direccion,telefono=@telefono,email=@email, acceso=@acceso,usuario=@usuario,password=@password where idtrabajador=@idtrabajador GO /****** Object: StoredProcedure [dbo].[speliminar_articulo] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Eliminar Artículo create proc [dbo].[speliminar_articulo] @idarticulo int as delete from articulo where idarticulo=@idarticulo GO /****** Object: StoredProcedure [dbo].[speliminar_categoria] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Eliminar Categoría create proc [dbo].[speliminar_categoria] @idcategoria int as delete from categoria where idcategoria=@idcategoria GO /****** Object: StoredProcedure [dbo].[speliminar_cliente] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Eliminar Cliente CREATE proc [dbo].[speliminar_cliente] @idcliente int as delete from Table_2 where idcliente=@idcliente GO /****** Object: StoredProcedure [dbo].[speliminar_presentacion] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Eliminar Presentación create proc [dbo].[speliminar_presentacion] @idpresentacion int as delete from presentacion where idpresentacion=@idpresentacion GO /****** Object: StoredProcedure [dbo].[speliminar_trabajador] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Eliminar Trabajador create proc [dbo].[speliminar_trabajador] @idtrabajador int as delete from trabajador where idtrabajador=@idtrabajador GO /****** Object: StoredProcedure [dbo].[speliminar_venta] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Procedimiento eliminar venta create proc [dbo].[speliminar_venta] @idventa int as delete from venta where idventa=@idventa GO /****** Object: StoredProcedure [dbo].[spinsertar_articulo] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[spinsertar_articulo] @idarticulo int output, @codigo varchar(50), @nombre varchar(50), @descripcion varchar(1024), @prov varchar(150), @idcategoria int, @idpresentacion int as insert into articulo(codigo,nombre,descripcion,proveedor,idcategoria,idpresentacion) values ( @codigo,@nombre,@descripcion,@prov,@idcategoria,@idpresentacion) GO /****** Object: StoredProcedure [dbo].[spinsertar_categoria] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[spinsertar_categoria] @idcategoria int output, @nombre varchar(50), @descripcion varchar(256) as insert into categoria (nombre,descripcion) values (@nombre,@descripcion) GO /****** Object: StoredProcedure [dbo].[spinsertar_cliente] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO /****** Object: StoredProcedure [dbo].[spinsertar_detalle_ingreso] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Procedimiento Insertar detalles de los ingresos CREATE proc [dbo].[spinsertar_detalle_ingreso] @iddetalle_ingreso int output, @idingreso int, @idarticulo int, @precio_compra money, @precio_venta money, @stock_inicial int, @stock_actual int as insert into detalleingreso (idingreso,idarticulo,precio_compra, precio_venta,stockinicial,stockactual) values (@idingreso,@idarticulo,@precio_compra, @precio_venta,@stock_inicial,@stock_actual) GO /****** Object: StoredProcedure [dbo].[spinsertar_detalle_venta] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Procedimiento Insertar detalles de las ventas create proc [dbo].[spinsertar_detalle_venta] @iddetalle_venta int output, @idventa int, @iddetalle_ingreso int, @cantidad int, @precio_venta money, @descuento money as insert into detalle_venta (idventa,iddetalle_ingreso,cantidad, precio_venta,descuento) values (@idventa,@iddetalle_ingreso,@cantidad, @precio_venta,@descuento) GO /****** Object: StoredProcedure [dbo].[spinsertar_ingreso] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Insertar ingreso CREATE proc [dbo].[spinsertar_ingreso] @idingreso int=null output, @idtrabajador int, @fecha date, @tipo_comprobante varchar(20), @serie varchar(4), @correlativo varchar(7), @igv decimal(4,2), @estado varchar(7) as insert into ingreso(idtrabajador,fecha,tipo_comprobante,serie,correlativo,igv,estado) values (@idtrabajador,@fecha,@tipo_comprobante,@serie,@correlativo,@igv,@estado) --Obteniendo el codigo autogenerado del ingreso SET @idingreso = @@IDENTITY GO /****** Object: StoredProcedure [dbo].[splogin] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO /****** Object: StoredProcedure [dbo].[spmostrar_categoria] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Procedimiento Mostrar create proc [dbo].[spmostrar_categoria] as select * from categoria order by idcategoria desc GO /****** Object: StoredProcedure [dbo].[spmostrar_cliente] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Procedimiento Mostrar Cliente CREATE proc [dbo].[spmostrar_cliente] as SELECT top 100 * FROM Table_2 order by apellido asc GO /****** Object: StoredProcedure [dbo].[spmostrar_detalle_ingreso] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --mostrar detalle de los ingresos CREATE proc [dbo].[spmostrar_detalle_ingreso] @textobuscar int as select d.idarticulo,a.nombre as Articulo,d.precio_compra, d.precio_venta,d.stockinicial,d.stockactual,i.igv, (d.stockinicial*d.precio_compra) as Subtotal from detalleingreso d inner join articulo a on d.idarticulo=a.idarticulo inner join ingreso i on i.idingreso = d.idingreso where d.idingreso=@textobuscar GO /****** Object: StoredProcedure [dbo].[spmostrar_detalle_venta] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --mostrar detalle de las ventas CREATE proc [dbo].[spmostrar_detalle_venta] @textobuscar int as select d.iddetalle_ingreso,a.nombre as Articulo, d.cantidad,d.precio_venta,d.descuento, ((d.precio_venta*d.cantidad)-d.descuento) as Subtotal,v.igv from detalle_venta d inner join detalleingreso di on d.iddetalle_ingreso=di.iddetalle_ingreso inner join articulo a on di.idarticulo=a.idarticulo inner join venta v on v.idventa = d.idventa where d.idventa=@textobuscar GO /****** Object: StoredProcedure [dbo].[spmostrar_ingreso] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[spmostrar_ingreso] as SELECT top 100 i.idingreso, (t.apellido +' '+ t.nombre) as Trabajador, i.fecha, i.tipo_comprobante, i.serie, i.correlativo,i.igv, i.estado, sum(d.precio_compra* d.stockinicial) as Total FROM detalleingreso d INNER JOIN ingreso i ON d.idingreso = i.idingreso INNER JOIN trabajador t ON i.idtrabajador = t.idtrabajador group by i.idingreso, t.apellido +' '+ t.nombre, i.fecha, i.tipo_comprobante, i.serie, i.correlativo, i.estado,i.igv order by i.idingreso desc GO /****** Object: StoredProcedure [dbo].[spmostrar_presentacion] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Procedimiento Mostrar create proc [dbo].[spmostrar_presentacion] as select * from presentacion order by idpresentacion desc GO /****** Object: StoredProcedure [dbo].[spmostrar_trabajador] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Procedimiento Mostrar Trabajador create proc [dbo].[spmostrar_trabajador] as SELECT * FROM trabajador order by apellido asc GO /****** Object: StoredProcedure [dbo].[spmostrar_venta] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Procedimiento Mostrar Venta CREATE proc [dbo].[spmostrar_venta] as SELECT top 100 v.idventa, (t.apellido +' '+ t.nombre) as Trabajador, (c.apellido + ' ' + c.nombre) as cliente, v.fecha, v.tipo_comprobante, v.serie, v.correlativo,v.igv, sum((d.precio_venta* d.cantidad)-d.descuento) as Total FROM detalle_venta d INNER JOIN venta v ON d.idventa = v.idventa INNER JOIN table_2 c ON v.idcliente = c.idcliente INNER JOIN trabajador t ON v.idtrabajador = t.idtrabajador group by v.idventa, t.apellido +' '+ t.nombre, c.apellido+' '+c.nombre, v.fecha, v.tipo_comprobante, v.serie, v.correlativo,v.igv order by v.idventa desc GO /****** Object: StoredProcedure [dbo].[spreporte_venta] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[spreporte_venta] @idventa int as SELECT v.idventa, (t.apellido +' '+ t.nombre) as Trabajador, (c.apellido + ' ' + c.nombre) as Table_2, c.direccion,c.telefono,c.numdocumento, v.fecha, v.tipo_comprobante, v.serie, v.correlativo, v.estado,a.nombre,v.igv, d.precio_venta,d.cantidad,d.descuento FROM detalle_venta d inner join detalleingreso di on d.iddetalle_ingreso=di.iddetalle_ingreso inner join articulo a on di.idarticulo=a.idarticulo INNER JOIN venta v ON d.idventa = v.idventa INNER JOIN Table_2 c ON v.idcliente = c.idcliente INNER JOIN trabajador t ON v.idtrabajador = t.idtrabajador where v.idventa=@idventa GO USE [master] GO ALTER DATABASE [sistema de ventas] SET READ_WRITE GO MySQL ha dicho: Documentación #1064 - Algo está equivocado en su sintax cerca '[master] GO CREATE DATABASE [sistema de ventas] ON PRIMARY ( NAME = N's' en la linea 1
0debug
void AUD_register_card (const char *name, QEMUSoundCard *card) { audio_init (); card->name = qemu_strdup (name); memset (&card->entries, 0, sizeof (card->entries)); LIST_INSERT_HEAD (&glob_audio_state.card_head, card, entries); }
1threat
What does ngInject do in the following piece of code? : <p>AngularJS controller code:</p> <pre><code>function AuthConfig($stateProvider, $httpProvider) { 'ngInject'; // Define the routes $stateProvider .state('app.login', { url: '/login', templateUrl: 'auth/auth.html', title: 'Sign in' }) .state('app.register', { url: '/register', templateUrl: 'auth/auth.html', title: 'Sign up' }); }; export default AuthConfig; </code></pre> <p>I am not able to figure out what is the use of ngInject. Could someone please help me?</p>
0debug
static void encode_refpass(Jpeg2000T1Context *t1, int width, int height, int *nmsedec, int bpno) { int y0, x, y, mask = 1 << (bpno + NMSEDEC_FRACBITS); for (y0 = 0; y0 < height; y0 += 4) for (x = 0; x < width; x++) for (y = y0; y < height && y < y0+4; y++) if ((t1->flags[y+1][x+1] & (JPEG2000_T1_SIG | JPEG2000_T1_VIS)) == JPEG2000_T1_SIG){ int ctxno = ff_jpeg2000_getrefctxno(t1->flags[y+1][x+1]); *nmsedec += getnmsedec_ref(t1->data[y][x], bpno + NMSEDEC_FRACBITS); ff_mqc_encode(&t1->mqc, t1->mqc.cx_states + ctxno, t1->data[y][x] & mask ? 1:0); t1->flags[y+1][x+1] |= JPEG2000_T1_REF; } }
1threat
Analog TrimLeft C# function : <p>How can I remove leading zeros from a string such as '0097619896'?</p>
0debug
Running xUnit on Visual Studio for Mac : <p>I am currently evaluating Visual Studio for Mac. And I ran into a little problem. It won't detect any of my xUnit unit tests. On the Windows version of VS, the tests are automatically picked up when I click on "Run all Tests". But with this version, it's not. Are there any instructions on how to setup xUnit to work inside Visual Studio for Mac? </p> <p>Thanks for the help! ;0)</p>
0debug
static int usb_host_auto_scan(void *opaque, int bus_num, int addr, char *port, int class_id, int vendor_id, int product_id, const char *product_name, int speed) { struct USBAutoFilter *f; struct USBHostDevice *s; if (class_id == 9) return 0; QTAILQ_FOREACH(s, &hostdevs, next) { f = &s->match; if (f->bus_num > 0 && f->bus_num != bus_num) { continue; } if (f->addr > 0 && f->addr != addr) { continue; } if (f->port != NULL && (port == NULL || strcmp(f->port, port) != 0)) { continue; } if (f->vendor_id > 0 && f->vendor_id != vendor_id) { continue; } if (f->product_id > 0 && f->product_id != product_id) { continue; } if (s->fd != -1) { return 0; } DPRINTF("husb: auto open: bus_num %d addr %d\n", bus_num, addr); usb_host_open(s, bus_num, addr, port, product_name, speed); break; } return 0; }
1threat
int get_async_context_id(void) { return async_context->id; }
1threat
cell.delegate = self does't work in swift : I am trying to use https://github.com/MortimerGoro/MGSwipeTableCell this library to make custom swipe cell. However, cell.delegate = self keep giving me error saying that "Cannot assign value of type 'AlarmTableViewController' to type 'MGSwipeTableCellDelegate?'" but even if I insert ' as! MGSwipeTableCellDelegate' it makes fatal error: unexpectedly found nil while unwrapping an Optional value. ``` class AlarmTableViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { ``` ``` func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell{ let reuseIdentifier = "programmaticCell" var cell = tableView.dequeueReusableCell(withIdentifier: reuseIdentifier, for: indexPath) as! MGSwipeTableCell cell.textLabel!.text = "Title" cell.delegate = self as! MGSwipeTableCellDelegate //optional return cell } ``` In my storyboard I've set cell's custom class as MGSwipeTableCell and its Identifier as programmaticCell. Please help me. table view is driving me crazy.
0debug
Greetings, I am devising a project to compare user results to standard results. My algorithm wont run exactly the way I wish it would (scoring system) : The problem with my code is that it simply will not run in the way I wish it would. It will only read from the first "while" & "if" condition. It simply doesn't recognize the other conditions. The age and score will be provided from an external source, therefore this is just an algorithm/scoring system for the tool. public class algorithm_tester { int score; int age; public static void main(String[] args) { int score = 0; int age = 0; while (age <30) { if(score <15) { System.out.println("Your Score Is Slightly Abnormal For Your Age."); } else if(score <10) { System.out.println("Your Results Are Rather Low. Therefore, We Recommend You Seek Medical Advice."); } else if(score <8){ System.out.println("Your Results Suggest Severe Cognitive Impairment. You Must Seek Medical Attention Immediately."); } else { System.out.println("Well Done! You Scored Very Well."); } while (age <40) { if (score < 14) { System.out.println("Your Results Are Slightly Abnormal For Your Age."); } else if(score < 10) { System.out.println("We Recommend You Seek Medical Advice As Your Results Are Quite Low."); } else if(score <7) { System.out.println("Your Score Is Very Low. We Believe You May Have Experienced Majoe Cognitive Impairment. We Recommend You Seek Immediate Medical Attention."); } else { System.out.println("Well Done! You Have Shown No Evidence Cognitive Impairment"); } while (age < 60) { if (score < 12) { System.out.println("Your Results Are Slightly Abnormal For Your Age."); } else if(score < 9) { System.out.println("Your Score is Very Low. We Believe This Is Due To Minor Cognitive impairment. We Recommend You Seek Medical Advice."); } else if(score < 6) { System.out.println("Your Results Have Led Us to Believe You Have Suffered Severe Cognitive Impairment. You Must Seek Medical Attention Immediately."); } else { System.out.println("Congratulations! Your Results Were Excellent. You Have Shown No Evidence Of Cognitive Impairment"); } while (age < 80) { if (score < 10) { System.out.println("Your Results Are Slightly Abnormal For Your Age."); } else if(score < 7) { System.out.println("Your Score is Very Low. We Believe This Is Due To Minor Cognitive impairment. We Recommend You Seek Medical Advice."); } else if(score < 5) { System.out.println("Your Results Have Led Us to Believe You Have Suffered Severe Cognitive Impairment. You Must Seek Medical Attention Immediately."); } else { System.out.println("Congratulations! Your Results Were Excellent. You Have Shown No Evidence Of Cognitive Impairment"); } while (age > 80) { if (score < 10) { System.out.println("Your Results Are Slightly Abnormal For Your Age."); } else if(score < 6) { System.out.println("Your Score is Very Low. We Believe This Is Due To Minor Cognitive impairment. We Recommend You Seek Medical Advice."); } else if(score < 4) { System.out.println("Your Results Have Led Us to Believe You Have Suffered Severe Cognitive Impairment. You Must Seek Medical Attention Immediately."); } else { System.out.println("Congratulations! Your Results Were Excellent. You Have Shown No Evidence Of Cognitive Impairment"); } } } } } } } }
0debug
av_cold void ff_vp8dsp_init_arm(VP8DSPContext *dsp) { int cpu_flags = av_get_cpu_flags(); if (have_armv6(cpu_flags)) ff_vp8dsp_init_armv6(dsp); if (have_neon(cpu_flags)) ff_vp8dsp_init_neon(dsp); }
1threat
static int hnm_read_packet(AVFormatContext *s, AVPacket *pkt) { Hnm4DemuxContext *hnm = s->priv_data; AVIOContext *pb = s->pb; int ret = 0; uint32_t superchunk_size, chunk_size; uint16_t chunk_id; if (hnm->currentframe == hnm->frames || pb->eof_reached) return AVERROR_EOF; if (hnm->superchunk_remaining == 0) { superchunk_size = avio_rl24(pb); avio_skip(pb, 1); hnm->superchunk_remaining = superchunk_size - 4; } chunk_size = avio_rl24(pb); avio_skip(pb, 1); chunk_id = avio_rl16(pb); avio_skip(pb, 2); if (chunk_size > hnm->superchunk_remaining) { av_log(s, AV_LOG_ERROR, "invalid chunk size: %u, offset: %u\n", chunk_size, (int) avio_tell(pb)); avio_skip(pb, hnm->superchunk_remaining - 8); hnm->superchunk_remaining = 0; } switch (chunk_id) { case HNM4_CHUNK_ID_PL: case HNM4_CHUNK_ID_IZ: case HNM4_CHUNK_ID_IU: avio_seek(pb, -8, SEEK_CUR); ret += av_get_packet(pb, pkt, chunk_size); hnm->superchunk_remaining -= chunk_size; if (chunk_id == HNM4_CHUNK_ID_IZ || chunk_id == HNM4_CHUNK_ID_IU) hnm->currentframe++; break; case HNM4_CHUNK_ID_SD: avio_skip(pb, chunk_size - 8); hnm->superchunk_remaining -= chunk_size; break; default: av_log(s, AV_LOG_WARNING, "unknown chunk found: %d, offset: %d\n", chunk_id, (int) avio_tell(pb)); avio_skip(pb, chunk_size - 8); hnm->superchunk_remaining -= chunk_size; break; } return ret; }
1threat
static int vmdk_write_extent(VmdkExtent *extent, int64_t cluster_offset, int64_t offset_in_cluster, QEMUIOVector *qiov, uint64_t qiov_offset, uint64_t n_bytes, uint64_t offset) { int ret; VmdkGrainMarker *data = NULL; uLongf buf_len; QEMUIOVector local_qiov; struct iovec iov; int64_t write_offset; int64_t write_end_sector; if (extent->compressed) { void *compressed_data; if (!extent->has_marker) { ret = -EINVAL; goto out; } buf_len = (extent->cluster_sectors << 9) * 2; data = g_malloc(buf_len + sizeof(VmdkGrainMarker)); compressed_data = g_malloc(n_bytes); qemu_iovec_to_buf(qiov, qiov_offset, compressed_data, n_bytes); ret = compress(data->data, &buf_len, compressed_data, n_bytes); g_free(compressed_data); if (ret != Z_OK || buf_len == 0) { ret = -EINVAL; goto out; } data->lba = offset >> BDRV_SECTOR_BITS; data->size = buf_len; n_bytes = buf_len + sizeof(VmdkGrainMarker); iov = (struct iovec) { .iov_base = data, .iov_len = n_bytes, }; qemu_iovec_init_external(&local_qiov, &iov, 1); } else { qemu_iovec_init(&local_qiov, qiov->niov); qemu_iovec_concat(&local_qiov, qiov, qiov_offset, n_bytes); } write_offset = cluster_offset + offset_in_cluster, ret = bdrv_co_pwritev(extent->file->bs, write_offset, n_bytes, &local_qiov, 0); write_end_sector = DIV_ROUND_UP(write_offset + n_bytes, BDRV_SECTOR_SIZE); if (extent->compressed) { extent->next_cluster_sector = write_end_sector; } else { extent->next_cluster_sector = MAX(extent->next_cluster_sector, write_end_sector); } if (ret < 0) { goto out; } ret = 0; out: g_free(data); if (!extent->compressed) { qemu_iovec_destroy(&local_qiov); } return ret; }
1threat
Subtotal and total count in table javascript : Hello<br>I will need your support to count subtotal and total in html table (without buttons). **Formulas of table:**<br> Subtotal: 1st column * 2nd column (inputs) <br> Total: Sum of subtotals `<table rowspan="0" id="res">`<br> <br> Here is my table on jsfidle.<br> https://jsfiddle.net/Lm6mf95z/ <br> E.G. screen of example: [image of table explain][1] Big thanks! [1]: https://i.stack.imgur.com/Ghc7P.png
0debug
static int pc_boot_set(void *opaque, const char *boot_device) { return set_boot_dev(opaque, boot_device); }
1threat
Search Youtube video through android app : <p>I am making app that search Yoututbe video through the app. But it throw exception on <code>SearchListResponse searchResponse = search.execute();</code> How to resolve this problem. Please help</p> <p>below is my exception that raise during search perform</p> <pre><code> 05-07 12:26:33.163 26111-26111/com.dp.videostoreadmin W/System.err: android.os.NetworkOnMainThreadException 05-07 12:26:33.164 26111-26111/com.dp.videostoreadmin W/System.err: at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1273) 05-07 12:26:33.164 26111-26111/com.dp.videostoreadmin W/System.err: at java.net.InetAddress.lookupHostByName(InetAddress.java:431) 05-07 12:26:33.164 26111-26111/com.dp.videostoreadmin W/System.err: at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252) 05-07 12:26:33.164 26111-26111/com.dp.videostoreadmin W/System.err: at java.net.InetAddress.getAllByName(InetAddress.java:215) 05-07 12:26:33.164 26111-26111/com.dp.videostoreadmin W/System.err: at com.android.okhttp.internal.Network$1.resolveInetAddresses(Network.java:29) 05-07 12:26:33.164 26111-26111/com.dp.videostoreadmin W/System.err: at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:188) 05-07 12:26:33.164 26111-26111/com.dp.videostoreadmin W/System.err: at com.android.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:157) 05-07 12:26:33.164 26111-26111/com.dp.videostoreadmin W/System.err: at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:100) 05-07 12:26:33.164 26111-26111/com.dp.videostoreadmin W/System.err: at com.android.okhttp.internal.http.HttpEngine.createNextConnection(HttpEngine.java:357) 05-07 12:26:33.164 26111-26111/com.dp.videostoreadmin W/System.err: at com.android.okhttp.internal.http.HttpEngine.nextConnection(HttpEngine.java:340) 05-07 12:26:33.164 26111-26111/com.dp.videostoreadmin W/System.err: at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:330) 05-07 12:26:33.164 26111-26111/com.dp.videostoreadmin W/System.err: at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:248) 05-07 12:26:33.164 26111-26111/com.dp.videostoreadmin W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:437) 05-07 12:26:33.164 26111-26111/com.dp.videostoreadmin W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:114) 05-07 12:26:33.164 26111-26111/com.dp.videostoreadmin W/System.err: at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.connect(DelegatingHttpsURLConnection.java:89) 05-07 12:26:33.164 26111-26111/com.dp.videostoreadmin W/System.err: at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java) 05-07 12:26:33.164 26111-26111/com.dp.videostoreadmin W/System.err: at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:93) 05-07 12:26:33.164 26111-26111/com.dp.videostoreadmin W/System.err: at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:981) 05-07 12:26:33.164 26111-26111/com.dp.videostoreadmin W/System.err: at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419) 05-07 12:26:33.165 26111-26111/com.dp.videostoreadmin W/System.err: at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352) 05-07 12:26:33.165 26111-26111/com.dp.videostoreadmin W/System.err: at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469) 05-07 12:26:33.165 26111-26111/com.dp.videostoreadmin W/System.err: at com.dp.videostoreadmin.MainActivity.displaySearchResult(MainActivity.java:62) 05-07 12:26:33.165 26111-26111/com.dp.videostoreadmin W/System.err: at com.dp.videostoreadmin.MainActivity.access$000(MainActivity.java:22) 05-07 12:26:33.165 26111-26111/com.dp.videostoreadmin W/System.err: at com.dp.videostoreadmin.MainActivity$1.onClick(MainActivity.java:40) 05-07 12:26:33.165 26111-26111/com.dp.videostoreadmin W/System.err: at android.view.View.performClick(View.java:5204) 05-07 12:26:33.165 26111-26111/com.dp.videostoreadmin W/System.err: at android.view.View$PerformClick.run(View.java:21153) 05-07 12:26:33.165 26111-26111/com.dp.videostoreadmin W/System.err: at android.os.Handler.handleCallback(Handler.java:739) 05-07 12:26:33.165 26111-26111/com.dp.videostoreadmin W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95) 05-07 12:26:33.165 26111-26111/com.dp.videostoreadmin W/System.err: at android.os.Looper.loop(Looper.java:148) 05-07 12:26:33.165 26111-26111/com.dp.videostoreadmin W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5417) 05-07 12:26:33.165 26111-26111/com.dp.videostoreadmin W/System.err: at java.lang.reflect.Method.invoke(Native Method) 05-07 12:26:33.165 26111-26111/com.dp.videostoreadmin W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 05-07 12:26:33.165 26111-26111/com.dp.videostoreadmin W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) </code></pre> <p>below is my code</p> <pre><code>import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import java.io.IOException; import com.google.api.client.googleapis.json.GoogleJsonResponseException; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.javanet.NetHttpTransport; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.services.youtube.YouTube; import com.google.api.services.youtube.model.SearchListResponse; import com.google.api.services.youtube.model.SearchResult; import java.util.List; public class MainActivity extends AppCompatActivity { private static final String YOUTUBE_API_KEY = "AIzaSyCxmfKGyNqlQIEtY0XWxGzC4QHX08BWmks"; EditText searchText; Button submit; private static YouTube youtube; private static final long NUMBER_OF_VIDEOS_RETURNED = 25; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); searchText = (EditText) findViewById(R.id.editText); submit = (Button) findViewById(R.id.submit); submit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { displaySearchResult(); } }); } private void displaySearchResult() { try { youtube = new YouTube.Builder(new NetHttpTransport(), new JacksonFactory(), new HttpRequestInitializer() { public void initialize(HttpRequest request) throws IOException { } }).setApplicationName("VideoStoreAdmin").build(); YouTube.Search.List search = youtube.search().list("id,snippet"); search.setKey(YOUTUBE_API_KEY); search.setQ(searchText.getText().toString()); search.setType("video"); search.setFields("items(id/kind,id/videoId,snippet/title,snippet/publishedAt,snippet/thumbnails/default/url),nextPageToken"); search.setMaxResults(NUMBER_OF_VIDEOS_RETURNED); // Call the API and print results. SearchListResponse searchResponse = search.execute(); List&lt;SearchResult&gt; searchResultList = searchResponse.getItems(); if (searchResultList != null) { Log.d("TAG",searchResultList.toString()); } } catch (GoogleJsonResponseException e) { System.err.println("There was a service error: " + e.getDetails().getCode() + " : " + e.getDetails().getMessage()); } catch (IOException e) { System.err.println("There was an IO error: " + e.getCause() + " : " + e.getMessage()); } catch (Throwable t) { t.printStackTrace(); } } /* * Prompt the user to enter a query term and return the user-specified term. */ } </code></pre>
0debug
static DriveInfo *blockdev_init(QDict *bs_opts, BlockInterfaceType type, DriveMediaType media) { const char *buf; const char *file = NULL; const char *serial; int ro = 0; int bdrv_flags = 0; int on_read_error, on_write_error; DriveInfo *dinfo; ThrottleConfig cfg; int snapshot = 0; bool copy_on_read; int ret; Error *error = NULL; QemuOpts *opts; const char *id; bool has_driver_specific_opts; BlockDriver *drv = NULL; id = qdict_get_try_str(bs_opts, "id"); opts = qemu_opts_create(&qemu_common_drive_opts, id, 1, &error); if (error_is_set(&error)) { qerror_report_err(error); error_free(error); return NULL; } qemu_opts_absorb_qdict(opts, bs_opts, &error); if (error_is_set(&error)) { qerror_report_err(error); error_free(error); return NULL; } if (id) { qdict_del(bs_opts, "id"); } has_driver_specific_opts = !!qdict_size(bs_opts); snapshot = qemu_opt_get_bool(opts, "snapshot", 0); ro = qemu_opt_get_bool(opts, "read-only", 0); copy_on_read = qemu_opt_get_bool(opts, "copy-on-read", false); file = qemu_opt_get(opts, "file"); serial = qemu_opt_get(opts, "serial"); if ((buf = qemu_opt_get(opts, "discard")) != NULL) { if (bdrv_parse_discard_flags(buf, &bdrv_flags) != 0) { error_report("invalid discard option"); return NULL; } } if (qemu_opt_get_bool(opts, "cache.writeback", true)) { bdrv_flags |= BDRV_O_CACHE_WB; } if (qemu_opt_get_bool(opts, "cache.direct", false)) { bdrv_flags |= BDRV_O_NOCACHE; } if (qemu_opt_get_bool(opts, "cache.no-flush", false)) { bdrv_flags |= BDRV_O_NO_FLUSH; } #ifdef CONFIG_LINUX_AIO if ((buf = qemu_opt_get(opts, "aio")) != NULL) { if (!strcmp(buf, "native")) { bdrv_flags |= BDRV_O_NATIVE_AIO; } else if (!strcmp(buf, "threads")) { } else { error_report("invalid aio option"); return NULL; } } #endif if ((buf = qemu_opt_get(opts, "format")) != NULL) { if (is_help_option(buf)) { error_printf("Supported formats:"); bdrv_iterate_format(bdrv_format_print, NULL); error_printf("\n"); return NULL; } drv = bdrv_find_format(buf); if (!drv) { error_report("'%s' invalid format", buf); return NULL; } } memset(&cfg, 0, sizeof(cfg)); cfg.buckets[THROTTLE_BPS_TOTAL].avg = qemu_opt_get_number(opts, "throttling.bps-total", 0); cfg.buckets[THROTTLE_BPS_READ].avg = qemu_opt_get_number(opts, "throttling.bps-read", 0); cfg.buckets[THROTTLE_BPS_WRITE].avg = qemu_opt_get_number(opts, "throttling.bps-write", 0); cfg.buckets[THROTTLE_OPS_TOTAL].avg = qemu_opt_get_number(opts, "throttling.iops-total", 0); cfg.buckets[THROTTLE_OPS_READ].avg = qemu_opt_get_number(opts, "throttling.iops-read", 0); cfg.buckets[THROTTLE_OPS_WRITE].avg = qemu_opt_get_number(opts, "throttling.iops-write", 0); cfg.buckets[THROTTLE_BPS_TOTAL].max = qemu_opt_get_number(opts, "throttling.bps-total-max", 0); cfg.buckets[THROTTLE_BPS_READ].max = qemu_opt_get_number(opts, "throttling.bps-read-max", 0); cfg.buckets[THROTTLE_BPS_WRITE].max = qemu_opt_get_number(opts, "throttling.bps-write-max", 0); cfg.buckets[THROTTLE_OPS_TOTAL].max = qemu_opt_get_number(opts, "throttling.iops-total-max", 0); cfg.buckets[THROTTLE_OPS_READ].max = qemu_opt_get_number(opts, "throttling.iops-read-max", 0); cfg.buckets[THROTTLE_OPS_WRITE].max = qemu_opt_get_number(opts, "throttling.iops-write-max", 0); cfg.op_size = qemu_opt_get_number(opts, "throttling.iops-size", 0); if (!check_throttle_config(&cfg, &error)) { error_report("%s", error_get_pretty(error)); error_free(error); return NULL; } on_write_error = BLOCKDEV_ON_ERROR_ENOSPC; if ((buf = qemu_opt_get(opts, "werror")) != NULL) { if (type != IF_IDE && type != IF_SCSI && type != IF_VIRTIO && type != IF_NONE) { error_report("werror is not supported by this bus type"); return NULL; } on_write_error = parse_block_error_action(buf, 0); if (on_write_error < 0) { return NULL; } } on_read_error = BLOCKDEV_ON_ERROR_REPORT; if ((buf = qemu_opt_get(opts, "rerror")) != NULL) { if (type != IF_IDE && type != IF_VIRTIO && type != IF_SCSI && type != IF_NONE) { error_report("rerror is not supported by this bus type"); return NULL; } on_read_error = parse_block_error_action(buf, 1); if (on_read_error < 0) { return NULL; } } dinfo = g_malloc0(sizeof(*dinfo)); dinfo->id = g_strdup(qemu_opts_id(opts)); dinfo->bdrv = bdrv_new(dinfo->id); dinfo->bdrv->open_flags = snapshot ? BDRV_O_SNAPSHOT : 0; dinfo->bdrv->read_only = ro; dinfo->type = type; dinfo->refcount = 1; if (serial != NULL) { dinfo->serial = g_strdup(serial); } QTAILQ_INSERT_TAIL(&drives, dinfo, next); bdrv_set_on_error(dinfo->bdrv, on_read_error, on_write_error); if (throttle_enabled(&cfg)) { bdrv_io_limits_enable(dinfo->bdrv); bdrv_set_io_limits(dinfo->bdrv, &cfg); } switch(type) { case IF_IDE: case IF_SCSI: case IF_XEN: case IF_NONE: dinfo->media_cd = media == MEDIA_CDROM; break; case IF_SD: case IF_FLOPPY: case IF_PFLASH: case IF_MTD: case IF_VIRTIO: break; default: abort(); } if (!file || !*file) { if (has_driver_specific_opts) { file = NULL; } else { return dinfo; } } if (snapshot) { bdrv_flags &= ~BDRV_O_CACHE_MASK; bdrv_flags |= (BDRV_O_SNAPSHOT|BDRV_O_CACHE_WB|BDRV_O_NO_FLUSH); } if (copy_on_read) { bdrv_flags |= BDRV_O_COPY_ON_READ; } if (runstate_check(RUN_STATE_INMIGRATE)) { bdrv_flags |= BDRV_O_INCOMING; } if (media == MEDIA_CDROM) { ro = 1; } else if (ro == 1) { if (type != IF_SCSI && type != IF_VIRTIO && type != IF_FLOPPY && type != IF_NONE && type != IF_PFLASH) { error_report("read-only not supported by this bus type"); goto err; } } bdrv_flags |= ro ? 0 : BDRV_O_RDWR; if (ro && copy_on_read) { error_report("warning: disabling copy_on_read on read-only drive"); } QINCREF(bs_opts); ret = bdrv_open(dinfo->bdrv, file, bs_opts, bdrv_flags, drv, &error); if (ret < 0) { error_report("could not open disk image %s: %s", file ?: dinfo->id, error_get_pretty(error)); goto err; } if (bdrv_key_required(dinfo->bdrv)) autostart = 0; QDECREF(bs_opts); qemu_opts_del(opts); return dinfo; err: qemu_opts_del(opts); QDECREF(bs_opts); bdrv_unref(dinfo->bdrv); g_free(dinfo->id); QTAILQ_REMOVE(&drives, dinfo, next); g_free(dinfo); return NULL; }
1threat
i want on click screen close sidebar : <div class="col-6 text-left"> <!-- <span class="toggle-div toggle-btn" onclick="openNav()" id="nav-toggle"> --> <span class="toggle-div toggle-btn" onclick="openNav()" id="nav-toggle"> <i class="fa fa-bars"></i> </span> </div> <div class="sidebar" id="sidebar"> <a href="javascript:void(0)" class="closebtn" onclick="closeNav()" >×</a> <div class="sidebar-img"><a href="home_page.html"><img src="../assets/images/sidebar-img.png"></a></div> <div class="side-menus-list"> <ul id="" class=" "> <h6 class="sidebar-head "><li>Menu</li></h6> <li class="sidebar-menu"> <a class=" menu-text-color" href="single_post.html"> <span class="svg-block"> <svg class="svg-icon" xmlns="http://www.w3.org/2000/svg" id="noun_Newspaper_772219_1_" viewBox="0 0 19.911 17.219" width="19.911" height="17.219" data-name="noun_Newspaper_772219 (1)"> <g id="Group_44" data-name="Group 44"> <path class="icon-color" id="Path_62" fill="#454545" transform="translate(-8.9 -14.5)" d="M 27.137 14.5 H 13.484 a 1.687 1.687 0 0 0 -1.7 1.7 v 0.728 H 10.6 a 1.687 1.687 0 0 0 -1.7 1.7 V 29.73 a 1.976 1.976 0 0 0 1.867 1.989 H 26.822 a 2 2 0 0 0 1.989 -1.989 V 16.2 A 1.667 1.667 0 0 0 27.137 14.5 Z M 11.786 29.8 a 0.881 0.881 0 0 1 -0.291 0.679 a 1.057 1.057 0 0 1 -0.7 0.267 A 0.992 0.992 0 0 1 9.87 29.73 V 18.623 A 0.715 0.715 0 0 1 10.6 17.9 h 1.188 Z m 16.079 -0.073 a 1.025 1.025 0 0 1 -1.019 1.019 H 12.514 a 3.436 3.436 0 0 0 0.194 -0.437 v -0.049 c 0.024 -0.049 0.024 -0.121 0.049 -0.194 v -0.049 c 0 -0.073 0.024 -0.146 0.024 -0.243 V 16.2 a 0.715 0.715 0 0 1 0.728 -0.728 h 13.63 a 0.715 0.715 0 0 1 0.728 0.728 Z" data-name="Path 62" /> <path class="icon-color" id="Path_63" fill="#454545" transform="translate(-45.789 -30.862)" d="M 62.79 36.1 h -4.7 a 0.485 0.485 0 1 0 0 0.97 h 4.7 a 0.485 0.485 0 1 0 0 -0.97 Z" data-name="Path 63" /> <path class="icon-color" id="Path_64" fill="#454545" transform="translate(-45.789 -39.573)" d="M 62.79 47.6 h -4.7 a 0.485 0.485 0 1 0 0 0.97 h 4.7 a 0.485 0.485 0 1 0 0 -0.97 Z" data-name="Path 64" /> <path class="icon-color" id="Path_65" fill="#454545" transform="translate(-25.565 -48.284)" d="M 42.565 59.1 H 31.385 a 0.485 0.485 0 0 0 0 0.97 h 11.18 a 0.485 0.485 0 1 0 0 -0.97 Z" data-name="Path 65" /> <path class="icon-color" id="Path_66" fill="#454545" transform="translate(-45.789 -22.075)" d="M 62.79 24.5 h -4.7 a 0.485 0.485 0 1 0 0 0.97 h 4.7 a 0.485 0.485 0 1 0 0 -0.97 Z" data-name="Path 66" /> <path class="icon-color" id="Path_67" fill="#454545" transform="translate(-25.565 -57.071)" d="M 42.565 70.7 H 31.385 a 0.485 0.485 0 1 0 0 0.97 h 11.18 a 0.485 0.485 0 1 0 0 -0.97 Z" data-name="Path 67" /> <path class="icon-color" id="Path_68" fill="#454545" transform="translate(-25.565 -22.075)" d="M 31.385 31.072 h 4.268 a 0.486 0.486 0 0 0 0.485 -0.485 v -5.6 a 0.486 0.486 0 0 0 -0.485 -0.485 H 31.385 a 0.486 0.486 0 0 0 -0.485 0.485 v 5.6 A 0.486 0.486 0 0 0 31.385 31.072 Z m 0.485 -5.6 h 3.3 V 30.1 h -3.3 Z" data-name="Path 68" /> </g> </svg> </span> Home </a> </li> </ul> </div> <script type="text/javascript"> function openNav() { document.getElementById("sidebar").style.width = "200px"; } function closeNav() { document.getElementById("sidebar").style.width = "0"; } </script>
0debug
How to configure service provider with spring-security-saml2 to consume EncryptedAssertions? : <p>I am using this excellent repo <a href="https://github.com/vdenotaris/spring-boot-security-saml-sample" rel="noreferrer">vdenotaris/spring-boot-security-saml-sample</a> as a guide and I am trying to set it up to verify and decrypt incoming SAML messages that contain <code>EncryptedAssertion</code>.</p> <p>The idP's metadata defines the signing and encrypting key in the XML. That is setup in the service provider.</p> <pre><code>@Bean public ExtendedMetadata extendedMetadata() { ExtendedMetadata extendedMetadata = new ExtendedMetadata(); extendedMetadata.setIdpDiscoveryEnabled(false); extendedMetadata.setSignMetadata(false); extendedMetadata.setEcpEnabled(true); return extendedMetadata; } @Bean @Qualifier("metadata") public CachingMetadataManager metadata() throws MetadataProviderException { List&lt;MetadataProvider&gt; providers = new ArrayList&lt;MetadataProvider&gt;(); try { ClasspathResource metadata = new ClasspathResource("/metadata/the-idp-metadata.xml"); Timer timer = new Timer(true); ResourceBackedMetadataProvider provider = new ResourceBackedMetadataProvider(timer, metadata); provider.setParserPool(ParserPoolHolder.getPool()); provider.initialize(); ExtendedMetadataDelegate exMetadataDelegate = new ExtendedMetadataDelegate(provider, extendedMetadata()); exMetadataDelegate.setMetadataTrustCheck(true); exMetadataDelegate.setMetadataRequireSignature(false); providers.add(exMetadataDelegate); } catch(ResourceException ex) { throw new MetadataProviderException(ex.getMessage(), ex); } CachingMetadataManager cmm = new CachingMetadataManager(providers); cmm.setRefreshCheckInterval(0); return cmm; } </code></pre> <p>When I manually send it a sample of a SAML message that has an encrypted assertion it fails with the following message.</p> <pre><code>org.springframework.security.authentication.AuthenticationServiceException: Incoming SAML message is invalid at org.springframework.security.saml.SAMLProcessingFilter.attemptAuthentication(SAMLProcessingFilter.java:91) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:212) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:186) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:74) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.saml.metadata.MetadataGeneratorFilter.doFilter(MetadataGeneratorFilter.java:87) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) Caused by: org.opensaml.common.SAMLException: Unsupported request at org.springframework.security.saml.processor.SAMLProcessorImpl.getBinding(SAMLProcessorImpl.java:265) at org.springframework.security.saml.processor.SAMLProcessorImpl.retrieveMessage(SAMLProcessorImpl.java:172) at org.springframework.security.saml.SAMLProcessingFilter.attemptAuthentication(SAMLProcessingFilter.java:80) ... 53 common frames omitted </code></pre> <p>I've read here <a href="https://docs.spring.io/spring-security-saml/docs/current/reference/html/configuration-metadata.html#configuration-metadata-extended" rel="noreferrer">Metadata Configuration</a> that you can configure the signing and encryption key that the idp uses in order for the assertion to be decrypted (at least that is what I am assuming).</p> <p>Is that the correct way to go about having the service consume <code>EncryptedAssertion</code>s? I keep hitting this invalid message wall and not finding a good solid tutorial or documentation that explicitly describe how to handle this. Also unsure if the solution lies in the <code>WebSSOProfileConsumerImpl</code> class that I have to modify?</p> <p>Any help or examples would be greatly appreciated.</p>
0debug
Hii guys ,i have been trying to solve a problem where from a given list you have to remove a given element. list1=[0,1,2,2,3,0,4,2], remove_element=2 : def fun(list1,remove_element): if len(list1)==0: return 0 for i in range(len(list1)): if remove_element==list1[i]: list1.remove(remove_element) return list1 here is the error i get: <pre> Traceback (most recent call last): File "<pyshell#205>", line 1, in <module> print(fun(list1,remove_element)) File "<pyshell#204>", line 5, in fun if remove_element==list1[i]: IndexError: list index out of range </pre>
0debug
R Studio: Date is getting converted to number, while making html of datafrane : While converting the data frame to HTML, Date is getting converted to a number. How to keep it date only?
0debug
connection.query('SELECT * FROM users WHERE username = ' + input_string)
1threat
React: set focus on componentDidMount, how to do it with hooks? : <p>In React, with classes I can set the focus to an input when the component loads, something like this:</p> <pre><code>class Foo extends React.Component { txt1 = null; componentDidMount() { this.txt1.focus(); } render() { return ( &lt;input type="text" ref={e =&gt; this.txt1 = e}/&gt; ); } } </code></pre> <p>I'm trying to rewrite this component using the new <a href="https://reactjs.org/docs/hooks-intro.html" rel="noreferrer">hooks proposal</a>.</p> <p>I suppose I should use <a href="https://reactjs.org/docs/hooks-effect.html" rel="noreferrer"><code>useEffect</code></a> instead of <code>componentDidMount</code>, but how can I rewrite the focus logic?</p>
0debug
How do I make an auto popup box for my website? : <p>I have looked everywhere to get a good popup box that auto pops up when the page loads but had no luck. I want a auto popup box that is centered and has overlay and that auto pops up. I want a popup box like this: <a href="http://imgur.com/A0NIPny" rel="nofollow">http://imgur.com/A0NIPny</a></p> <p>Can you tell me the code for it and how to do it?? Sorry I'm kinda new at html and stuff but I know the basics and no I don't wanna use WordPress for this</p>
0debug
Executing program gives int cannot be converted into java.lang.string : <p>I am currently using BlueJ (forced to by the module tutor, I hate it) and I'm having an error come up every time I attempt to execute the code.</p> <blockquote> <p>incompatible types: java.lang.String cannot be converted into int</p> </blockquote> <p>My code is as follows:</p> <pre><code>public class middle { public static void main (String[] args) { String numeroUno = args[0]; String numeroDos = args[1]; String numeroTres = args[2]; double num1 = Double.parseDouble(args[0]); double num2 = Double.parseDouble(args[1]); double num3 = Double.parseDouble(args[2]); middle(num1, num2, num3); } public static void middle(double n1, double n2, double n3) { double [] values = {n1, n2, n3}; double newarr; boolean sorted = false; while(!sorted) { sorted = true; for(int i=0; i&lt;values.length-1; i++) { if(values[i] &gt; values[i+1]) { double swapsies = values[i+1]; values[i+1] = values[i]; values[i] = swapsies; sorted = false; } } } System.out.print(values[1] + " is between " + values[0] + " and " + values[2]); } } </code></pre> <p>Firstly my question is where have I made the error, but secondly, is there another way to structure this code i.e completely rewrite it to achieve the same thing. I'm not really used to writing code this way and I'm having a hard time with OOP. The object of this particular exercise is to write code that will return the middle value number from what the user has input.</p> <p>Thanks!</p>
0debug
def max_sum(tri, n): if n > 1: tri[1][1] = tri[1][1]+tri[0][0] tri[1][0] = tri[1][0]+tri[0][0] for i in range(2, n): tri[i][0] = tri[i][0] + tri[i-1][0] tri[i][i] = tri[i][i] + tri[i-1][i-1] for j in range(1, i): if tri[i][j]+tri[i-1][j-1] >= tri[i][j]+tri[i-1][j]: tri[i][j] = tri[i][j] + tri[i-1][j-1] else: tri[i][j] = tri[i][j]+tri[i-1][j] return (max(tri[n-1]))
0debug
how to remove nun numeric item form array javascript : how to remove nun numeric item form array javascript. Is there anything wrong in this answer function filterNumbersFromArray(arr) { // Write the code that goes here arr = arr.filter((item) => { return (typeof item == 'number') }) console.log(arr); this.arr = arr; } var arr = [1, 'a', 'b', 2,false,0,5]; filterNumbersFromArray(arr); for (var i = 0; i < arr.length; i++) console.log(arr[i]);
0debug
GDB complaining about missing raise.c : <p>I'm getting an an annoying error every time gdb catches an exception. I've run the following example program</p> <pre><code>#include &lt;stdexcept&gt; int main() { throw std::invalid_argument(""); return 0; } </code></pre> <p>And the result from running gdb is</p> <pre><code>terminate called after throwing an instance of 'std::invalid_argument' what(): Program received signal SIGABRT, Aborted. __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. </code></pre> <p>It's not all that bad, as I do get the information I need, it's just bugging me...</p> <p>Do anyone know how to fix this?</p>
0debug
Compiling Python to WebAssembly : <p>I have read that it is possible to convert Python 2.7 code to Web Assembly, but I cannot find a definitive guide on how to to so.</p> <p>So far I have compiled a C program to Web Assembly using Emscripten and all its necessary components, so I know it is working (guide used: <a href="http://webassembly.org/getting-started/developers-guide/" rel="noreferrer">http://webassembly.org/getting-started/developers-guide/</a>)</p> <p>What are the steps I must take in order to do this on an Ubuntu machine? Do I have to convert the python code to LLVM bitcode then compile it using Emscripten? If so, how would I achieve this?</p>
0debug
Python script search a text file for a word : <p>I'm writing a Python script. I need to search a text file for a word that end by " s , es or ies " and the word must be greater than three letters , need to konw number of words and the word it-self .....it's hard task i cant work with it, please help me</p>
0debug
How create static functions/objects in javascript/nodejs (ES6) : <p>I want to create a static class using Javascript/Node JS. I used google but i can't find any usefull example.</p> <p>I want to create in Javascript ES6 something like this (C#):</p> <pre><code>public static MyStaticClass { public static void someMethod() { //do stuff here } } </code></pre> <p>For now, I have this class, but I think that this code will creates a new instance every time that it be called from "require".</p> <pre><code>function MyStaticClass() { let someMethod = () =&gt; { //do some stuff } } var myInstance = new MyStaticClass(); module.exports = factory; </code></pre>
0debug
struct omap_lcd_panel_s *omap_lcdc_init(MemoryRegion *sysmem, hwaddr base, qemu_irq irq, struct omap_dma_lcd_channel_s *dma, omap_clk clk) { struct omap_lcd_panel_s *s = (struct omap_lcd_panel_s *) g_malloc0(sizeof(struct omap_lcd_panel_s)); s->irq = irq; s->dma = dma; s->sysmem = sysmem; omap_lcdc_reset(s); memory_region_init_io(&s->iomem, NULL, &omap_lcdc_ops, s, "omap.lcdc", 0x100); memory_region_add_subregion(sysmem, base, &s->iomem); s->con = graphic_console_init(NULL, 0, &omap_ops, s); return s; }
1threat
static bool iscsi_allocationmap_is_allocated(IscsiLun *iscsilun, int64_t sector_num, int nb_sectors) { unsigned long size; if (iscsilun->allocationmap == NULL) { return true; } size = DIV_ROUND_UP(sector_num + nb_sectors, iscsilun->cluster_sectors); return !(find_next_bit(iscsilun->allocationmap, size, sector_num / iscsilun->cluster_sectors) == size); }
1threat
How to extract from a string : How can I write a query to extract something like that: If i have John Snow or Ananana Bacarara... i want to get the results John or Ananana. I tried a lot of things with substr but still didn't get to a solution..
0debug
Replace line containing string with Python : <p>I'm trying to search through a file for a line that contain certain text and then replace that entire line with a new line.</p> <p>I'm trying to use:</p> <pre><code>pattern = "Hello" file = open('C:/rtemp/output.txt','w') for line in file: if pattern in line: line = "Hi\n" file.write(line) </code></pre> <p>I get an error saying:</p> <pre><code>io.UnsupportedOperation: not readable </code></pre> <p>I'm not sure what I'm doing wrong, please can someone assist.</p>
0debug
How to replace special character in a file using Python? : <p>I have data like this in file. I want replace the backslash from the entire data. I tried to use replace function after reading this text file but could not get the result. Could you please help.</p> <pre><code>[{"Name": "Segment1", "Value": 14.0, "Categories": "{\"MILL CREEK\": 0.0, \"FAIRPORT\": 1.0, \"PENNINGTON\": 0.0, \"GREENWICH\": 0.0 </code></pre>
0debug
Searching whole word in vim - alternative to \<\> : There are several answers on how to search a whole word in vim. For example, this link http://stackoverflow.com/questions/15288155/how-to-do-whole-word-search-similar-to-grep-w-in-vim answers it. I am wondering is there any alternative to `\<word\>` in vim to search whole word?
0debug
ES6 Tail Recursion Optimisation Stack Overflow : <p>Having read <a href="http://www.2ality.com/2015/06/tail-call-optimization.html" rel="noreferrer">Dr Rauschmayer's description</a> of recursive tail call optimisation in es6, I've since been trying to recreate the 'zero-stack' execution of the recursive factorial function he details.<br/><br/> Using the Chrome debugger to step between stack frames, I'm seeing that the tail optimisation is not occurring and a stack frame is being created for each recursion.<br/><br/> I've also tried to test the optimisation by calling the function without the debugger, but instead passing <code>100000</code> to the factorial function. This throws a 'maximum stack' error, which implies that it is, in fact, not optimised.</p> <p>Here is my code:</p> <pre><code>const factorial = (n, acc = 1) =&gt; n &lt;= 1 ? acc : factorial(n - 1, n * acc) console.log( factorial(100000) ) </code></pre> <p>Result:</p> <pre><code>Uncaught RangeError: Maximum call stack size exceeded </code></pre>
0debug
i want to display a product in recycerview with volley : I tryed a lot of online codes. { "total": 3, "per_page": 10, "current_page": 1, "last_page": 1, "next_page_url": null, "prev_page_url": null, "from": 1, "to": 3, "data": [ { "product_id": 31, "image": "http://celebauc.com/app/uploads/funkymobile.jpg", "location": "mumbai", "price": "400.0000", "status": 1, "name": "Itarsia", "description": "mouse", "discount": {} }, { "product_id": 13, "image": "http://celebauc.com/app/uploads/funkymobile.jpg", "location": "Mumbai", "price": "100.0000", "status": 1, "name": "Dynamic Website", "description": "d s das asf sdfsdf sdf sdfs fsdfsd f fsd fsdf dsfsdf", "discount": {} } ] } This is my JSON object. please help me to display this in recycle view . as a grid layout.
0debug
How to debug a gulp task with VSCode : <p>I need to debug a command <code>gulp start</code> with VScode (I got some mapping error with babel during transpilation that I don't understand yet...). The VSCode debug default configuration aims to launch <code>node app.js</code>. How to modify it to trigger the <code>gulp command</code>?</p> <p>Here is the default configuration. If anyone has hint of how can I do that, I'll be in your debt :)</p> <pre><code>{ "version": "0.2.0", "configurations": [ { "name": "Lancer", "type": "node", "request": "launch", "program": "${workspaceRoot}/app.js", "stopOnEntry": false, "args": [], "cwd": "${workspaceRoot}", "preLaunchTask": null, "runtimeExecutable": null, "runtimeArgs": [ "--nolazy" ], "env": { "NODE_ENV": "development" }, "externalConsole": false, "sourceMaps": false, "outDir": null }, { "name": "Attacher", "type": "node", "request": "attach", "port": 5858, "address": "localhost", "restart": false, "sourceMaps": false, "outDir": null, "localRoot": "${workspaceRoot}", "remoteRoot": null } ] } </code></pre>
0debug
Filter DDL based on selection of other DDL : <p>If I have a dropdownlist that looks like this:</p> <pre><code>&lt;select class="form-control" id="FirstDDL" name="FirstDDL"&gt; &lt;option value="1"&gt;Option1&lt;/option&gt; &lt;option value="2"&gt;Option2&lt;/option&gt; &lt;option value="3"&gt;Option3&lt;/option&gt; &lt;/select&gt; </code></pre> <p>And another dropdownlist that looks like this:</p> <pre><code>&lt;select class="form-control" id="SecondDDL" name="SecondDDL"&gt; &lt;option value=""&gt;Select Option&lt;/option&gt; &lt;optgroup label="Option1"&gt; &lt;option value="12"&gt;SubOption1Value1&lt;/option&gt; &lt;option value="13"&gt;SubOption1Value2&lt;/option&gt; &lt;option value="14"&gt;SubOption1Value3&lt;/option&gt; &lt;/optgroup&gt; &lt;optgroup label="Option2"&gt; &lt;option value="49"&gt;SubOption2Value1&lt;/option&gt; &lt;option value="50"&gt;SubOption2Value2&lt;/option&gt; &lt;option value="51"&gt;SubOption2Value3&lt;/option&gt; &lt;/optgroup&gt; &lt;optgroup label="Option3"&gt; &lt;option value="33"&gt;SubOption3Value1&lt;/option&gt; &lt;option value="34"&gt;SubOption3Value2&lt;/option&gt; &lt;option value="35"&gt;SubOption3Value3&lt;/option&gt; &lt;/optgroup&gt; &lt;/select&gt; </code></pre> <p>Now, based on the selection of the first dropdownlist, I want the second dropdownlist to be filtered.</p> <p>So if I select <code>Option1</code> in the first dropdownlist.. then the second dropdownlist should show only the options under <code>&lt;optgroup label="Option1"&gt;</code></p> <p>I have this so far:</p> <pre><code>$(document).ready(function () { $("#FirstDDL").change(function () { var selectedOption = $("option:selected", this); var selectedText = selectedOption.val(); switch (selectedText) { case 1: // here is where I need to set the values of the second dropdownlist } }); }); </code></pre> <p>Any help is appreciated.</p>
0debug
static int dc1394_read_header(AVFormatContext *c) { dc1394_data* dc1394 = c->priv_data; dc1394camera_list_t *list; int res, i; const struct dc1394_frame_format *fmt = NULL; const struct dc1394_frame_rate *fps = NULL; if (dc1394_read_common(c, &fmt, &fps) != 0) return -1; dc1394->d = dc1394_new(); if (dc1394_camera_enumerate(dc1394->d, &list) != DC1394_SUCCESS || !list) { av_log(c, AV_LOG_ERROR, "Unable to look for an IIDC camera.\n"); if (list->num == 0) { av_log(c, AV_LOG_ERROR, "No cameras found.\n"); dc1394->camera = dc1394_camera_new (dc1394->d, list->ids[0].guid); if (list->num > 1) { av_log(c, AV_LOG_INFO, "Working with the first camera found\n"); dc1394_camera_free_list (list); if (dc1394->camera->bmode_capable>0) { dc1394_video_set_operation_mode(dc1394->camera, DC1394_OPERATION_MODE_1394B); i = DC1394_ISO_SPEED_800; } else { i = DC1394_ISO_SPEED_400; for (res = DC1394_FAILURE; i >= DC1394_ISO_SPEED_MIN && res != DC1394_SUCCESS; i--) { res=dc1394_video_set_iso_speed(dc1394->camera, i); if (res != DC1394_SUCCESS) { av_log(c, AV_LOG_ERROR, "Couldn't set ISO Speed\n"); goto out_camera; if (dc1394_video_set_mode(dc1394->camera, fmt->frame_size_id) != DC1394_SUCCESS) { av_log(c, AV_LOG_ERROR, "Couldn't set video format\n"); goto out_camera; if (dc1394_video_set_framerate(dc1394->camera,fps->frame_rate_id) != DC1394_SUCCESS) { av_log(c, AV_LOG_ERROR, "Couldn't set framerate %d \n",fps->frame_rate); goto out_camera; if (dc1394_capture_setup(dc1394->camera, 10, DC1394_CAPTURE_FLAGS_DEFAULT)!=DC1394_SUCCESS) { av_log(c, AV_LOG_ERROR, "Cannot setup camera \n"); goto out_camera; if (dc1394_video_set_transmission(dc1394->camera, DC1394_ON) !=DC1394_SUCCESS) { av_log(c, AV_LOG_ERROR, "Cannot start capture\n"); goto out_camera; return 0; out_camera: dc1394_capture_stop(dc1394->camera); dc1394_video_set_transmission(dc1394->camera, DC1394_OFF); dc1394_camera_free (dc1394->camera); out: dc1394_free(dc1394->d); return -1;
1threat