problem
stringlengths
26
131k
labels
class label
2 classes
static int tcg_match_add2i(TCGType type, tcg_target_long val) { if (facilities & FACILITY_EXT_IMM) { if (type == TCG_TYPE_I32) { return 1; } else if (val >= -0xffffffffll && val <= 0xffffffffll) { return 1; } } return 0; }
1threat
what changes do i need to make in my code to make it fetch the current location of the user rather than predefined latitudes and longitudes? : package com.example.safwan.mypersonal;

import android.support.v4.app.FragmentActivity;
import android.os.Bundle;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {

 private GoogleMap mMap;

 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_maps);
 // Obtain the SupportMapFragment and get notified when the map is ready to be used.
 SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
 .findFragmentById(R.id.map);
 mapFragment.getMapAsync(this);
 } 
 @Override
 public void onMapReady(GoogleMap googleMap) {
 mMap = googleMap;


 // Add a marker in Sydney and move the camera
 LatLng cannaughtplace = new LatLng(28.6315,77.2167);
 mMap.addMarker(new MarkerOptions().position(cannaughtplace).title("Marker in Cannught place"));
 mMap.moveCamera(CameraUpdateFactory.newLatLng(cannaughtplace));
 }
}

0debug
Javascript/JQuery function not triggered after .load : <p>When a user clicks the "search" button in my ASP.NET application, a temporary "spinner" div is loaded. Then when the search (finally) completes, the contents of the spinner div are replaced by the HTML returned by the <code>SubmitSearch</code> method.</p> <pre><code>$("#spinner").load("@Url.Action("SubmitSearch","Search")"); </code></pre> <p>I also have this JavaScript file that is loaded in:</p> <pre><code>$(document).ready(function() { $(".card--result").hover(function () { alert("hover"); $(this).css('cursor', 'pointer'); }); $(".card--result").click(function() { var url = $(this).attr('data-url'); window.open(url, "_self"); }); }); </code></pre> <p>However, the problem is that a div with <code>card--result</code> class is part of the new HTML that gets added to the page after the <code>.load</code> method succeeds. </p> <p><strong>How can I register the <code>.hover</code> and <code>.click</code> functions so that they are actually triggered on the newly loaded HTML elements?</strong></p>
0debug
glide rounded corner transform issue : <p>i use the following code to load an image with rounded corners into imageview using glide:</p> <pre><code>Glide.with(this) .load(url) .listener(new RequestListener&lt;Drawable&gt;() { @Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target&lt;Drawable&gt; target, boolean isFirstResource) { return false; } @Override public boolean onResourceReady(Drawable resource, Object model, Target&lt;Drawable&gt; target, DataSource dataSource, boolean isFirstResource) { return false; } }) .transition(withCrossFade()) .apply(new RequestOptions().transform(new RoundedCorners(50)).error(R.drawable.default_person).skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE)) .into(mBinding.profileImgv); </code></pre> <p><a href="https://i.stack.imgur.com/ccKJC.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ccKJC.png" alt="enter image description here"></a> images get pixelized for some reason. Can somebody tell me where is the problem?</p>
0debug
how to dispaly option sets within a SSRS report : i'm new to Stack overflow and new to ssrs report building. im currently building a report that needs to display each option from and option set in a different column i also need to pull date a last and next date range for each option it is page grouped by a company name and then further grouped by the employee's full name. any help would be very much appreciated. [report table layout][1] [1]: https://i.stack.imgur.com/x3Tbc.png thanks in advance
0debug
Open every folder/subfolder until there are no more VB? : I have code that searches through a particular folder path for excel files and pulls back results. What i can't figure out, is how to select an entire directory and open/search every folder it encounters. The best solution would be an IF statement that opens the folder If it is available, but i am stumped. Thank You in advance. If i need to be more descriptive let me know!
0debug
unicodecsv doesn't read unicode css file : This is the file that I am reading (it is a public dataset free use) http://www.filedropper.com/u_2 This is the way I am reading it import unicodecsv as css def moviesToRDF(csvFilePath): with open(csvFilePath, 'rU') as csvFile: reader = csv.reader(csvFile, encoding='utf-8', delimiter= '|') for row in reader: print row moviesToRDF("u.item") This is the error I am getting: UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 3: invalid continuation byte the value that throws the error is: Misérables, Les What wrong did I do please? (i am using 2.7 python)
0debug
static int mon_init_func(QemuOpts *opts, void *opaque) { CharDriverState *chr; const char *chardev; const char *mode; int flags; mode = qemu_opt_get(opts, "mode"); if (mode == NULL) { mode = "readline"; } if (strcmp(mode, "readline") == 0) { flags = MONITOR_USE_READLINE; } else if (strcmp(mode, "control") == 0) { flags = MONITOR_USE_CONTROL; } else { fprintf(stderr, "unknown monitor mode \"%s\"\n", mode); exit(1); } if (qemu_opt_get_bool(opts, "pretty", 0)) flags |= MONITOR_USE_PRETTY; if (qemu_opt_get_bool(opts, "default", 0)) flags |= MONITOR_IS_DEFAULT; chardev = qemu_opt_get(opts, "chardev"); chr = qemu_chr_find(chardev); if (chr == NULL) { fprintf(stderr, "chardev \"%s\" not found\n", chardev); exit(1); } monitor_init(chr, flags); return 0; }
1threat
What is the diffrence between pass by reference and dynamic memory allocation : <p>I just want to know about the difference between above two.Is there something called dynamic memory allocation because of pass by reference feature by pointers?</p>
0debug
How to convert JOptionPane String Input into an Int? : <p>I am beginning to learn Java and I am stuck on how to receive the user's input as a String and converting it to an int afterwards so I can use If Statements. Thank you for reading guys, good programming for all.</p>
0debug
open webpage inside the HTML Body : <p>I use the following code for open webpage inside the HTML page. <a href="https://i.stack.imgur.com/TPEm3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TPEm3.png" alt="enter image description here"></a></p> <p>but its opening in another tab instead of that html page.</p> <p>I need to open google webpage inside of the HTML body instead of another tab?</p>
0debug
Error unexpected ;; : <p>I can´t found my syntax error:</p> <pre><code>$params['title_header'] = '&lt;a href="/product/'.str_slug($article_info-&gt;name.'/'.$article_info-&gt;article_id.'"&gt;'.$article_info-&gt;name.'&lt;/a&gt; &gt; MODELS'; </code></pre> <p>Can you help me to find him?</p> <p>I´m coding in a laravel controller.php file.</p>
0debug
How can I install Groovy plugin in WebStorm? : <p>I'm developing with WebStorm. I want to have syntax highlighting for Jenkins Groovy pipelines.</p> <p>It's possible to use InteliJ IDEA for editing Jenkinsfiles, but it's obviously inconvenient to switch back and forth between IDEs. </p> <p>Can I install <a href="https://github.com/JetBrains/intellij-community/tree/master/plugins/groovy" rel="noreferrer">Groovy plugin</a> from IntelliJ IDEA Community Edition in WebStorm? If yes - how?</p>
0debug
Finding connected components in a pixel-array : <p>I have a pixel-array like the array below and from that I want to distinguish the two "groups" of 1s. The plan is to do this in a large set of similar pixel-arrays so I need to find a way to do this efficient.</p> <p>Maybe I can add all the 1-positions to a separate array and do some search to find the ones connected, but it should be some better way. Is there any algorithms for finding connected components like this?</p> <pre><code>[ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ] </code></pre>
0debug
subscribe function doesn't work courtly : in this peace of code subscribe function Execute after the last line in loadFromDB function <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> loadFromDB(){ const loading = this.loadingCtrl.create({ content: 'pleas wait' }); loading.present(); this.getInterviewFromDB() .subscribe((data) => { this.events = data; console.log( 'before'); }); this.getMeetingsFromDB().subscribe((data)=>{ this.events.concat(data); }); loading.dismiss(); console.log( 'after'); } <!-- end snippet --> ` the loading is present and dismiss before loading any data from database and this is the output of the log [![enter image description here][1]][1] illustrates that line under the subscribe function Execute after the console.log inside it ...can any body explain to me .. ?! [1]: https://i.stack.imgur.com/0eoif.png
0debug
the counterpart of std::move in boost library : <p>I am trying to use <code>std::move</code> in my codes, but the compiler (g++ 4.4) I am using does not support it. Can <code>boost::move</code> substitute <code>std::move</code> completely? Thanks. </p>
0debug
void virtio_scsi_dataplane_stop(VirtIOSCSI *s) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s))); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s); int i; if (s->dataplane_fenced) { s->dataplane_fenced = false; return; } if (!s->dataplane_started || s->dataplane_stopping) { return; } s->dataplane_stopping = true; assert(s->ctx == iothread_get_aio_context(vs->conf.iothread)); aio_context_acquire(s->ctx); aio_set_event_notifier(s->ctx, &s->ctrl_vring->host_notifier, false, NULL); aio_set_event_notifier(s->ctx, &s->event_vring->host_notifier, false, NULL); for (i = 0; i < vs->conf.num_queues; i++) { aio_set_event_notifier(s->ctx, &s->cmd_vrings[i]->host_notifier, false, NULL); } blk_drain_all(); aio_context_release(s->ctx); virtio_scsi_vring_teardown(s); for (i = 0; i < vs->conf.num_queues + 2; i++) { k->set_host_notifier(qbus->parent, i, false); } k->set_guest_notifiers(qbus->parent, vs->conf.num_queues + 2, false); s->dataplane_stopping = false; s->dataplane_started = false; }
1threat
Instance of an object Java : I have an object called Product and I want to check if a string is the name of an instance of Product class. So, I want to enter by keyboard a word and I want the program to tell me if the word is the instance of the object Product. I tried the next code but it doesn't work. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> Product laptop = new Product(1, "Laptop", "Type", 1350.25, "black"); Product mouse = new Product(2, "Mouse", "Type", 50.50, "black"); String check = new String("laptop"); if(check.equals(instanceof Product)) { System.out.println("Yes it is."); } else { System.out.println("No, it is not."); } <!-- end snippet --> .
0debug
Whats the point of methods and functions in C#? : <p>Sorry if this is a dumb question but I don't really grasp the point of methods/functions in C#. I need some clarification/reasoning. Look at the code for reference</p> <hr> <h2>why do i have to make a method:</h2> <pre><code>string color; if (color == "red") { Text(); } void Text(); { Console.WriteLine("you chose " + color) } </code></pre> <hr> <h2>when you can make it without using a method:</h2> <pre><code>if (color == "red") { Console.WriteLine("you chose red") } </code></pre>
0debug
static void encode_cblk(Jpeg2000EncoderContext *s, Jpeg2000T1Context *t1, Jpeg2000Cblk *cblk, Jpeg2000Tile *tile, int width, int height, int bandpos, int lev) { int pass_t = 2, passno, x, y, max=0, nmsedec, bpno; int64_t wmsedec = 0; for (y = 0; y < height+2; y++) memset(t1->flags[y], 0, (width+2)*sizeof(int)); for (y = 0; y < height; y++){ for (x = 0; x < width; x++){ if (t1->data[y][x] < 0){ t1->flags[y+1][x+1] |= JPEG2000_T1_SGN; t1->data[y][x] = -t1->data[y][x]; } max = FFMAX(max, t1->data[y][x]); } } if (max == 0){ cblk->nonzerobits = 0; bpno = 0; } else{ cblk->nonzerobits = av_log2(max) + 1 - NMSEDEC_FRACBITS; bpno = cblk->nonzerobits - 1; } ff_mqc_initenc(&t1->mqc, cblk->data); for (passno = 0; bpno >= 0; passno++){ nmsedec=0; switch(pass_t){ case 0: encode_sigpass(t1, width, height, bandpos, &nmsedec, bpno); break; case 1: encode_refpass(t1, width, height, &nmsedec, bpno); break; case 2: encode_clnpass(t1, width, height, bandpos, &nmsedec, bpno); break; } cblk->passes[passno].rate = ff_mqc_flush_to(&t1->mqc, cblk->passes[passno].flushed, &cblk->passes[passno].flushed_len); wmsedec += (int64_t)nmsedec << (2*bpno); cblk->passes[passno].disto = wmsedec; if (++pass_t == 3){ pass_t = 0; bpno--; } } cblk->npasses = passno; cblk->ninclpasses = passno; cblk->passes[passno-1].rate = ff_mqc_flush_to(&t1->mqc, cblk->passes[passno-1].flushed, &cblk->passes[passno-1].flushed_len); }
1threat
Aws-elb health check failing at 302 code : <p>Hi i created ALB listener 443 and target group instance on 7070 port (not-ssl)</p> <p>I can access instanceip:7070 without problem , but with <a href="https://elb-dns-name" rel="noreferrer">https://elb-dns-name</a> not able to access.. instance health check also failed with 302 code </p> <p>ALB listener port https and instance is http protocol , </p> <p>when i browse with <a href="https://dns-name" rel="noreferrer">https://dns-name</a> it redirecting to <a href="http://elb-dns-name" rel="noreferrer">http://elb-dns-name</a></p>
0debug
The background music keep restarting. How to stop it. : <p>I create a sharedInstance of a background music and initialize it in the viewDidLoad of the first view controller. But when i change the screen (via segue) and come back to the first screen, the music restart. I believe that's happen because the viewDidLoad it's called again, but i don't want the music to keep restarting every time i comeback to this screen. </p> <p>How can i manage to the music keep playing without interfering? </p>
0debug
static void spapr_dr_connector_class_init(ObjectClass *k, void *data) { DeviceClass *dk = DEVICE_CLASS(k); sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_CLASS(k); dk->reset = reset; dk->realize = realize; dk->unrealize = unrealize; drck->set_isolation_state = set_isolation_state; drck->set_allocation_state = set_allocation_state; drck->release_pending = release_pending; drck->set_signalled = set_signalled; dk->user_creatable = false; }
1threat
Using an interrupt service routine for a PIC24 microcontroller : <p>Need help in writing an interrupt service routine to implement this flow chart for a PIC24FJ64GA102 microcontroller!</p> <p>Thanks in advance for your help!</p> <p>PHOTO LINK FOR THE FLOWCHART ---> <a href="https://ibb.co/j43K149" rel="nofollow noreferrer">https://ibb.co/j43K149</a></p>
0debug
two way to initialize a structure : <p>What's the difference between the two ways of creating a structure?</p> <p>No.1 is right, and No.2 gives the error: </p> <pre><code>reference binding to misaligned address 0x63775f5f00676e6f for type 'const int', which requires 4 byte alignment </code></pre> <p>What's the difference between the two ways of creating a structure?</p> <p>What did the No.2 do?</p> <p>Here is my codes. </p> <p>Thank you.</p> <pre><code>/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class Solution { public: TreeNode* buildTree(vector&lt;int&gt;&amp; preorder, vector&lt;int&gt;&amp; inorder) { if (preorder.size() == 0 || inorder.size() == 0) return nullptr; // # 1 // struct TreeNode *RootTree = new TreeNode(preorder.front()); // # 2 struct TreeNode RootNode(preorder.front()); struct TreeNode *RootTree = &amp;RootNode; return RootTree; } }; </code></pre>
0debug
c++ : Error at compile time during assignement of a std::string to template parameter : i'm facing with something which i'm struggling to understand (and solve). I'm using c++ 11, with visual studio 2013. Here is my context: I would like to call a template method : template<typename T> bool InvokeMyMethod(std::string methodName, T &retValue, int modeType...) and pass it template parameter as return value. In this way, i would call this function using integer, float , std::string parameters. But, when i try to assign std::string to template parameter, i get compile error. Let me to write both .h anc .cpp code: //************ INCLUDE ****** ...include files ... int IncValue(int iParam) { return ++iParam; } float DivValue(float fParam) { return (fParam / 2); } const char* GetHello() { return "Hello\n"; } template<typename T> bool InvokeMyMethod(std::string methodName, T &retValue, int modeType...) { bool bRet = false; switch (modeType) { case 0: // basic { std::cout << " Method " << methodName << " correctly invoked ." << std::endl; bRet = true; } break; case 1: //call int function { va_list args; va_start(args, modeType); int iParam = va_arg(args, int); int result = IncValue(iParam); va_end(args); retValue = result; bRet = true; } break; case 2: // call float function { va_list args; va_start(args, modeType); float fParam = (float)va_arg(args, double); float result = DivValue(fParam); va_end(args); retValue = result; bRet = true; } break; case 3: //call string function { const char *strReturn = GetHello(); std::string sValReturned; sValReturned = strReturn; std::cout << " Template for string : " << typeid(T).name() << std::endl; //HERE IS MY PROBLEM AT COMPILE TIME retValue = sValReturned; // if i comment this line, everything is // ok, otherwise i got compiling error // like: error C2440: '=' : cannot convert // from 'std::string' to 'int' // AND // cannot convert from 'std::string' to // 'float' bRet = true; } break; } return bRet; } //**************** CPP : MAIN ***************** .. include files ... int main() { std::string strMethod = ""; strMethod = "Method_A"; int iResult = 0; int iParam = 10; if (InvokeMyMethod(strMethod, iResult, 1,iParam)) { std::cout << " Invoke Method " << strMethod << " returns : " << iResult << std::endl; } else { std::cout << " Error : Invoke Method " << strMethod << ". Method or Class not found!" << std::endl; } strMethod = "Method_B"; float fResult = 0; float fParam = 9.0f; if (InvokeMyMethod(strMethod, fResult, 2, fParam)) { std::cout << " Invoke Method " << strMethod << " returns : " << fResult << std::endl; } else { std::cout << " Error : Invoke Method " << strMethod << ". Method or Class not found!" << std::endl; } strMethod = "Method_C"; std::string sResult =""; std::string sParam = "Hello"; if (InvokeMyMethod(strMethod, sResult, 3, sParam)) { std::cout << " Invoke Method " << strMethod << " returns : " << sResult << std::endl; } else { std::cout << " Error : Invoke Method " << strMethod << ". Method or Class not found!" << std::endl; } std::cout << "Press any key..."; std::cin.get(); return 0; } When i try to assign (In the .h file, in the template method) the string value to template parameter, i get compile error. error C2440: '=' : cannot convert from 'std::string' to 'int' and cannot convert from 'std::string' to 'float' How i can solve this problem? Thank you in advance Andrea
0debug
static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path, const char *name, V9fsPath *target) { if (ctx->export_flags & V9FS_SM_MAPPED_FILE && local_is_mapped_file_metadata(ctx, name)) { errno = EINVAL; return -1; } if (dir_path) { v9fs_path_sprintf(target, "%s/%s", dir_path->data, name); } else if (strcmp(name, "/")) { v9fs_path_sprintf(target, "%s", name); } else { v9fs_path_sprintf(target, "%s", "."); } return 0; }
1threat
static uint8_t read_u8(uint8_t *data, size_t offset) { return data[offset]; }
1threat
Counting number of methods causing an error in Python : <p>I have a Python log file (let's call it <code>logfile.log</code>) with a bunch of Python errors. There's one particular error being caused by several different methods (let's call it <code>blah blah error</code>). The entries look something like this:</p> <pre><code>CRITICAL - Unexpected Error: blah blah error Traceback (most recent call last): File "example1.py", line 100, in method1 File "example2.py", line 200, in method2 File "example3.py", line 300, in method3 pythonerror.Error: blah blah error </code></pre> <p>In the sample above, the source of the error - <code>method3</code> - can be several different methods. I want to go through the entire log file and count how many times each method appears in one of these errors, if it appears at all. Is this possible using regex? What would I need to do to accomplish this?</p> <p>NOTE: The log file doesn't only contain this particular error, so the method might appear in other errors. I want to get the count of it only if it's within that particular error and only if it's the source of the error (second to last line in the above example).</p>
0debug
Trying to run a Postgres explain analyze statement with rollback : I am building a java program that needs to automatically collect data on SQL statements before scheduling them. The program right now runs an explain statement and parses the results. I need the time parameter, so I need to run as analyze, but I don't want to affect any data, so I need rollback. When I attempt to run this all as a block, as suggested in the PostgreSQL documentation, with: BEGIN; EXPLAIN ANALYZE VERBOSE ...(statement) ROLLBACK; I don't get the results of the explain statement, rather I get that these block of queries didn't affect any rows. So I am not sure the best way to get this data. My thought is perhaps build out a function where the statement is a text argument, and the there's a table returned that's just 1 row/column containing the explain output, but I'm not really a PostgreSQL function whiz so a simpler alternative is preferable. Not really sure how to go about this. Any assistance would be helpful!
0debug
def increment_numerics(test_list, K): res = [str(int(ele) + K) if ele.isdigit() else ele for ele in test_list] return res
0debug
How to get an absolute Url by a route name in Angular 2? : <p>In my Angualar 2 (final) application I need often to create a full (absolute) Url by a route name (like '/products'), e.g. to provide a permalink to a specific page or to open a page from a component in another tab/window.</p> <p>Is any Angular 2 API, which allow to get an absolute Url by a route name? If no, is some known woraround for, e.g. using javascript?</p> <p>I've tried location or PathLocationStrategy (e.g. prepareExternalUrl), but the method returns '/products' instead of e.g. <a href="http://localhost/products" rel="noreferrer">http://localhost/products</a></p>
0debug
i didnt get the datatable format in my page : i added datatable for one page. but its should not get the datatable format <script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/1.10.12/js/dataTables.bootstrap.min.js"></script> <table class="example3" id="example1"> <tr> <td></td> <td></td> </tr> </table> <script> $(document).ready(function() { $('.example3').DataTable(); alert('1234567890'); } ); </script> i got the error like this i checked both the class and id class the are get from the database. if i remove the data also i didnt get the values TypeError: c is undefined ...ldren("th, td").each(function(a,b){var c=o.aoColumns[a];if(c.mData===a){var d=s(... please let me know where i done mistake, because same thing i added for other project i work fine for this project get error
0debug
Cannot implicitly convert System.Eventhandler to System.Window.Form.KeyPressEventHandler : private void grdPOItems_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { int colIndex = grdPOItems.CurrentCell.ColumnIndex; string colName = grdPOItems.Columns[colIndex].Name; if(colName == "Qty" || colName == "Rate") { e.Control.KeyPress += new EventHandler(CheckKey); } } private void CheckKey(object sender, EventArgs e) { if (((e.KeyChar < 48 || e.KeyChar > 57) && e.KeyChar != 8 && e.KeyChar!='.')) { e.Handled = true; } }
0debug
static int modify_current_stream(HTTPContext *c, char *rates) { int i; FFStream *req = c->stream; int action_required = 0; for (i = 0; i < req->nb_streams; i++) { AVCodecContext *codec = &req->streams[i]->codec; switch(rates[i]) { case 0: c->switch_feed_streams[i] = req->feed_streams[i]; break; case 1: c->switch_feed_streams[i] = find_stream_in_feed(req->feed, codec, codec->bit_rate / 2); break; case 2: c->switch_feed_streams[i] = find_stream_in_feed(req->feed, codec, codec->bit_rate / 4); #ifdef WANTS_OFF c->switch_feed_streams[i] = -2; c->feed_streams[i] = -2; #endif break; } if (c->switch_feed_streams[i] >= 0 && c->switch_feed_streams[i] != c->feed_streams[i]) action_required = 1; } return action_required; }
1threat
static void mips_fulong2e_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; char *filename; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *bios = g_new(MemoryRegion, 1); long bios_size; int64_t kernel_entry; qemu_irq *i8259; qemu_irq *cpu_exit_irq; PCIBus *pci_bus; ISABus *isa_bus; I2CBus *smbus; int i; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; MIPSCPU *cpu; CPUMIPSState *env; if (cpu_model == NULL) { cpu_model = "Loongson-2E"; } cpu = cpu_mips_init(cpu_model); if (cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } env = &cpu->env; qemu_register_reset(main_cpu_reset, cpu); ram_size = 256 * 1024 * 1024; bios_size = 1024 * 1024; memory_region_init_ram(ram, NULL, "fulong2e.ram", ram_size, &error_abort); vmstate_register_ram_global(ram); memory_region_init_ram(bios, NULL, "fulong2e.bios", bios_size, &error_abort); vmstate_register_ram_global(bios); memory_region_set_readonly(bios, true); memory_region_add_subregion(address_space_mem, 0, ram); memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios); if (kernel_filename) { loaderparams.ram_size = ram_size; loaderparams.kernel_filename = kernel_filename; loaderparams.kernel_cmdline = kernel_cmdline; loaderparams.initrd_filename = initrd_filename; kernel_entry = load_kernel (env); write_bootloader(env, memory_region_get_ram_ptr(bios), kernel_entry); } else { if (bios_name == NULL) { bios_name = FULONG_BIOSNAME; } filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = load_image_targphys(filename, 0x1fc00000LL, BIOS_SIZE); g_free(filename); } else { bios_size = -1; } if ((bios_size < 0 || bios_size > BIOS_SIZE) && !kernel_filename && !qtest_enabled()) { error_report("Could not load MIPS bios '%s'", bios_name); exit(1); } } cpu_mips_irq_init_cpu(env); cpu_mips_clock_init(env); pci_bus = bonito_init((qemu_irq *)&(env->irq[2])); ide_drive_get(hd, MAX_IDE_BUS); isa_bus = vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 0)); if (!isa_bus) { fprintf(stderr, "vt82c686b_init error\n"); exit(1); } i8259 = i8259_init(isa_bus, env->irq[5]); isa_bus_irqs(isa_bus, i8259); vt82c686b_ide_init(pci_bus, hd, PCI_DEVFN(FULONG2E_VIA_SLOT, 1)); pci_create_simple(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 2), "vt82c686b-usb-uhci"); pci_create_simple(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 3), "vt82c686b-usb-uhci"); smbus = vt82c686b_pm_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 4), 0xeee1, NULL); smbus_eeprom_init(smbus, 1, eeprom_spd, sizeof(eeprom_spd)); pit = pit_init(isa_bus, 0x40, 0, NULL); cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1); DMA_init(0, cpu_exit_irq); isa_create_simple(isa_bus, "i8042"); rtc_init(isa_bus, 2000, NULL); for(i = 0; i < MAX_SERIAL_PORTS; i++) { if (serial_hds[i]) { serial_isa_init(isa_bus, i, serial_hds[i]); } } if (parallel_hds[0]) { parallel_init(isa_bus, 0, parallel_hds[0]); } audio_init(pci_bus); network_init(pci_bus); }
1threat
static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { int n, i, ch, st, pkt_size, ret; const int16_t *samples; int16_t **samples_p; uint8_t *dst; ADPCMEncodeContext *c = avctx->priv_data; uint8_t *buf; samples = (const int16_t *)frame->data[0]; samples_p = (int16_t **)frame->extended_data; st = avctx->channels == 2; if (avctx->codec_id == AV_CODEC_ID_ADPCM_SWF) pkt_size = (2 + avctx->channels * (22 + 4 * (frame->nb_samples - 1)) + 7) / 8; else pkt_size = avctx->block_align; if ((ret = ff_alloc_packet(avpkt, pkt_size))) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n"); return ret; } dst = avpkt->data; switch(avctx->codec->id) { case AV_CODEC_ID_ADPCM_IMA_WAV: { int blocks, j; blocks = (frame->nb_samples - 1) / 8; for (ch = 0; ch < avctx->channels; ch++) { ADPCMChannelStatus *status = &c->status[ch]; status->prev_sample = samples_p[ch][0]; bytestream_put_le16(&dst, status->prev_sample); *dst++ = status->step_index; *dst++ = 0; } if (avctx->trellis > 0) { FF_ALLOC_OR_GOTO(avctx, buf, avctx->channels * blocks * 8, error); for (ch = 0; ch < avctx->channels; ch++) { adpcm_compress_trellis(avctx, &samples_p[ch][1], buf + ch * blocks * 8, &c->status[ch], blocks * 8, 1); } for (i = 0; i < blocks; i++) { for (ch = 0; ch < avctx->channels; ch++) { uint8_t *buf1 = buf + ch * blocks * 8 + i * 8; for (j = 0; j < 8; j += 2) *dst++ = buf1[j] | (buf1[j + 1] << 4); } } av_free(buf); } else { for (i = 0; i < blocks; i++) { for (ch = 0; ch < avctx->channels; ch++) { ADPCMChannelStatus *status = &c->status[ch]; const int16_t *smp = &samples_p[ch][1 + i * 8]; for (j = 0; j < 8; j += 2) { uint8_t v = adpcm_ima_compress_sample(status, smp[j ]); v |= adpcm_ima_compress_sample(status, smp[j + 1]) << 4; *dst++ = v; } } } } break; } case AV_CODEC_ID_ADPCM_IMA_QT: { PutBitContext pb; init_put_bits(&pb, dst, pkt_size * 8); for (ch = 0; ch < avctx->channels; ch++) { ADPCMChannelStatus *status = &c->status[ch]; put_bits(&pb, 9, (status->prev_sample & 0xFFFF) >> 7); put_bits(&pb, 7, status->step_index); if (avctx->trellis > 0) { uint8_t buf[64]; adpcm_compress_trellis(avctx, &samples_p[ch][1], buf, status, 64, 1); for (i = 0; i < 64; i++) put_bits(&pb, 4, buf[i ^ 1]); } else { for (i = 0; i < 64; i += 2) { int t1, t2; t1 = adpcm_ima_qt_compress_sample(status, samples_p[ch][i ]); t2 = adpcm_ima_qt_compress_sample(status, samples_p[ch][i + 1]); put_bits(&pb, 4, t2); put_bits(&pb, 4, t1); } } } flush_put_bits(&pb); break; } case AV_CODEC_ID_ADPCM_SWF: { PutBitContext pb; init_put_bits(&pb, dst, pkt_size * 8); n = frame->nb_samples - 1; put_bits(&pb, 2, 2); for (i = 0; i < avctx->channels; i++) { c->status[i].step_index = av_clip(c->status[i].step_index, 0, 63); put_sbits(&pb, 16, samples[i]); put_bits(&pb, 6, c->status[i].step_index); c->status[i].prev_sample = samples[i]; } if (avctx->trellis > 0) { FF_ALLOC_OR_GOTO(avctx, buf, 2 * n, error); adpcm_compress_trellis(avctx, samples + avctx->channels, buf, &c->status[0], n, avctx->channels); if (avctx->channels == 2) adpcm_compress_trellis(avctx, samples + avctx->channels + 1, buf + n, &c->status[1], n, avctx->channels); for (i = 0; i < n; i++) { put_bits(&pb, 4, buf[i]); if (avctx->channels == 2) put_bits(&pb, 4, buf[n + i]); } av_free(buf); } else { for (i = 1; i < frame->nb_samples; i++) { put_bits(&pb, 4, adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels * i])); if (avctx->channels == 2) put_bits(&pb, 4, adpcm_ima_compress_sample(&c->status[1], samples[2 * i + 1])); } } flush_put_bits(&pb); break; } case AV_CODEC_ID_ADPCM_MS: for (i = 0; i < avctx->channels; i++) { int predictor = 0; *dst++ = predictor; c->status[i].coeff1 = ff_adpcm_AdaptCoeff1[predictor]; c->status[i].coeff2 = ff_adpcm_AdaptCoeff2[predictor]; } for (i = 0; i < avctx->channels; i++) { if (c->status[i].idelta < 16) c->status[i].idelta = 16; bytestream_put_le16(&dst, c->status[i].idelta); } for (i = 0; i < avctx->channels; i++) c->status[i].sample2= *samples++; for (i = 0; i < avctx->channels; i++) { c->status[i].sample1 = *samples++; bytestream_put_le16(&dst, c->status[i].sample1); } for (i = 0; i < avctx->channels; i++) bytestream_put_le16(&dst, c->status[i].sample2); if (avctx->trellis > 0) { n = avctx->block_align - 7 * avctx->channels; FF_ALLOC_OR_GOTO(avctx, buf, 2 * n, error); if (avctx->channels == 1) { adpcm_compress_trellis(avctx, samples, buf, &c->status[0], n, avctx->channels); for (i = 0; i < n; i += 2) *dst++ = (buf[i] << 4) | buf[i + 1]; } else { adpcm_compress_trellis(avctx, samples, buf, &c->status[0], n, avctx->channels); adpcm_compress_trellis(avctx, samples + 1, buf + n, &c->status[1], n, avctx->channels); for (i = 0; i < n; i++) *dst++ = (buf[i] << 4) | buf[n + i]; } av_free(buf); } else { for (i = 7 * avctx->channels; i < avctx->block_align; i++) { int nibble; nibble = adpcm_ms_compress_sample(&c->status[ 0], *samples++) << 4; nibble |= adpcm_ms_compress_sample(&c->status[st], *samples++); *dst++ = nibble; } } break; case AV_CODEC_ID_ADPCM_YAMAHA: n = frame->nb_samples / 2; if (avctx->trellis > 0) { FF_ALLOC_OR_GOTO(avctx, buf, 2 * n * 2, error); n *= 2; if (avctx->channels == 1) { adpcm_compress_trellis(avctx, samples, buf, &c->status[0], n, avctx->channels); for (i = 0; i < n; i += 2) *dst++ = buf[i] | (buf[i + 1] << 4); } else { adpcm_compress_trellis(avctx, samples, buf, &c->status[0], n, avctx->channels); adpcm_compress_trellis(avctx, samples + 1, buf + n, &c->status[1], n, avctx->channels); for (i = 0; i < n; i++) *dst++ = buf[i] | (buf[n + i] << 4); } av_free(buf); } else for (n *= avctx->channels; n > 0; n--) { int nibble; nibble = adpcm_yamaha_compress_sample(&c->status[ 0], *samples++); nibble |= adpcm_yamaha_compress_sample(&c->status[st], *samples++) << 4; *dst++ = nibble; } break; default: return AVERROR(EINVAL); } avpkt->size = pkt_size; *got_packet_ptr = 1; return 0; error: return AVERROR(ENOMEM); }
1threat
how to copy paste cell to 1 column to line 200 by repeating the data copied with VBA on exel : [the first image is my data which is 1 column 10 lines on sheets 1][1] [the second image is after I copy paste from sheet 1, which I ask copy paste from data 10 sheet 1 copied to sheet 2 in column 1 to line 200 by repeating 10 data in colom 1, can you help me? ][2] [1]: https://i.stack.imgur.com/lkUvO.png [2]: https://i.stack.imgur.com/QKCbz.png
0debug
static target_ulong h_rtas(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { target_ulong rtas_r3 = args[0]; uint32_t token = ldl_be_phys(rtas_r3); uint32_t nargs = ldl_be_phys(rtas_r3 + 4); uint32_t nret = ldl_be_phys(rtas_r3 + 8); return spapr_rtas_call(spapr, token, nargs, rtas_r3 + 12, nret, rtas_r3 + 12 + 4*nargs); }
1threat
How to show ~year(s) ~month(s) ~day(s) has been passed using NSdate- swift IOS : <p>I'm playing with swift. I want to show how many years/months/days has been passed since the specific date(NSdate). </p> <p>If the specific date is 08/01/2016 and current date is 08/11/2016, it will show only "10day(s) has been passed". If the specific date is 08/11/2015, it will show "1year(s) 0 month(s) 0day(s)has been passed"</p>
0debug
static size_t handle_aiocb_rw_linear(struct qemu_paiocb *aiocb, char *buf) { size_t offset = 0; size_t len; while (offset < aiocb->aio_nbytes) { if (aiocb->aio_type == QEMU_PAIO_WRITE) len = pwrite(aiocb->aio_fildes, (const char *)buf + offset, aiocb->aio_nbytes - offset, aiocb->aio_offset + offset); else len = pread(aiocb->aio_fildes, buf + offset, aiocb->aio_nbytes - offset, aiocb->aio_offset + offset); if (len == -1 && errno == EINTR) continue; else if (len == -1) { offset = -errno; break; } else if (len == 0) break; offset += len; } return offset; }
1threat
dyld: Library not loaded: /usr/local/opt/openblas/lib/libopenblasp-r0.2.20.dylib : <p>When I run <code>R</code> I get:</p> <pre><code>dyld: Library not loaded: /usr/local/opt/openblas/lib/libopenblasp-r0.2.20.dylib Referenced from: /usr/local/Cellar/r/3.5.0_1/lib/libR.dylib Reason: image not found Abort trap: 6 </code></pre> <p>Indeed the file is absent:</p> <pre><code>ls /usr/local/opt/openblas/lib/libopenblasp-r0.2.20.dylib ls: cannot access '/usr/local/opt/openblas/lib/libopenblasp-r0.2.20.dylib': No such file or directory </code></pre> <p>I'm on macOS 10.13.3 and used <a href="https://brew.sh/" rel="noreferrer">homebrew</a> to install R like this:</p> <pre><code># Java brew cask install java # OpenBLAS (installs gcc and other dependencies) brew install openblas # R language for statistical computing brew install r --with-openblas --with-java # Install XQuartz, needed for R package "Cairo" brew cask install xquartz # Needed for R package "RMySQL" brew install mariadb-connector-c # Needed for R packages: udunits2, units, ggforce brew install udunits </code></pre>
0debug
import heapq as hq def heap_queue_smallest(nums,n): smallest_nums = hq.nsmallest(n, nums) return smallest_nums
0debug
static void decode_rr_divide(CPUTriCoreState *env, DisasContext *ctx) { uint32_t op2; int r1, r2, r3; TCGv temp, temp2; op2 = MASK_OP_RR_OP2(ctx->opcode); r3 = MASK_OP_RR_D(ctx->opcode); r2 = MASK_OP_RR_S2(ctx->opcode); r1 = MASK_OP_RR_S1(ctx->opcode); switch (op2) { case OPC2_32_RR_BMERGE: gen_helper_bmerge(cpu_gpr_d[r3], cpu_gpr_d[r1], cpu_gpr_d[r2]); break; case OPC2_32_RR_BSPLIT: gen_bsplit(cpu_gpr_d[r3], cpu_gpr_d[r3+1], cpu_gpr_d[r1]); break; case OPC2_32_RR_DVINIT_B: gen_dvinit_b(env, cpu_gpr_d[r3], cpu_gpr_d[r3+1], cpu_gpr_d[r1], cpu_gpr_d[r2]); break; case OPC2_32_RR_DVINIT_BU: temp = tcg_temp_new(); temp2 = tcg_temp_new(); tcg_gen_movi_tl(cpu_PSW_AV, 0); if (!tricore_feature(env, TRICORE_FEATURE_131)) { tcg_gen_neg_tl(temp, cpu_gpr_d[r3+1]); tcg_gen_movcond_tl(TCG_COND_LT, temp, cpu_gpr_d[r3+1], cpu_PSW_AV, temp, cpu_gpr_d[r3+1]); tcg_gen_neg_tl(temp2, cpu_gpr_d[r2]); tcg_gen_movcond_tl(TCG_COND_LT, temp2, cpu_gpr_d[r2], cpu_PSW_AV, temp2, cpu_gpr_d[r2]); tcg_gen_setcond_tl(TCG_COND_GE, cpu_PSW_V, temp, temp2); } else { tcg_gen_setcondi_tl(TCG_COND_EQ, cpu_PSW_V, cpu_gpr_d[r2], 0); } tcg_gen_shli_tl(cpu_PSW_V, cpu_PSW_V, 31); tcg_gen_or_tl(cpu_PSW_SV, cpu_PSW_SV, cpu_PSW_V); tcg_gen_shri_tl(temp, cpu_gpr_d[r1], 8); tcg_gen_shli_tl(cpu_gpr_d[r3], cpu_gpr_d[r1], 24); tcg_gen_mov_tl(cpu_gpr_d[r3+1], temp); tcg_temp_free(temp); tcg_temp_free(temp2); break; case OPC2_32_RR_DVINIT_H: gen_dvinit_h(env, cpu_gpr_d[r3], cpu_gpr_d[r3+1], cpu_gpr_d[r1], cpu_gpr_d[r2]); break; case OPC2_32_RR_DVINIT_HU: temp = tcg_temp_new(); temp2 = tcg_temp_new(); tcg_gen_movi_tl(cpu_PSW_AV, 0); if (!tricore_feature(env, TRICORE_FEATURE_131)) { tcg_gen_neg_tl(temp, cpu_gpr_d[r3+1]); tcg_gen_movcond_tl(TCG_COND_LT, temp, cpu_gpr_d[r3+1], cpu_PSW_AV, temp, cpu_gpr_d[r3+1]); tcg_gen_neg_tl(temp2, cpu_gpr_d[r2]); tcg_gen_movcond_tl(TCG_COND_LT, temp2, cpu_gpr_d[r2], cpu_PSW_AV, temp2, cpu_gpr_d[r2]); tcg_gen_setcond_tl(TCG_COND_GE, cpu_PSW_V, temp, temp2); } else { tcg_gen_setcondi_tl(TCG_COND_EQ, cpu_PSW_V, cpu_gpr_d[r2], 0); } tcg_gen_shli_tl(cpu_PSW_V, cpu_PSW_V, 31); tcg_gen_or_tl(cpu_PSW_SV, cpu_PSW_SV, cpu_PSW_V); tcg_gen_mov_tl(temp, cpu_gpr_d[r1]); tcg_gen_shri_tl(cpu_gpr_d[r3+1], temp, 16); tcg_gen_shli_tl(cpu_gpr_d[r3], temp, 16); tcg_temp_free(temp); tcg_temp_free(temp2); break; case OPC2_32_RR_DVINIT: temp = tcg_temp_new(); temp2 = tcg_temp_new(); tcg_gen_setcondi_tl(TCG_COND_EQ, temp, cpu_gpr_d[r2], 0xffffffff); tcg_gen_setcondi_tl(TCG_COND_EQ, temp2, cpu_gpr_d[r1], 0x80000000); tcg_gen_and_tl(temp, temp, temp2); tcg_gen_setcondi_tl(TCG_COND_EQ, temp2, cpu_gpr_d[r2], 0); tcg_gen_or_tl(cpu_PSW_V, temp, temp2); tcg_gen_shli_tl(cpu_PSW_V, cpu_PSW_V, 31); tcg_gen_or_tl(cpu_PSW_SV, cpu_PSW_SV, cpu_PSW_V); tcg_gen_movi_tl(cpu_PSW_AV, 0); tcg_gen_mov_tl(cpu_gpr_d[r3], cpu_gpr_d[r1]); tcg_gen_sari_tl(cpu_gpr_d[r3+1], cpu_gpr_d[r1], 31); tcg_temp_free(temp); tcg_temp_free(temp2); break; case OPC2_32_RR_DVINIT_U: tcg_gen_setcondi_tl(TCG_COND_EQ, cpu_PSW_V, cpu_gpr_d[r2], 0); tcg_gen_shli_tl(cpu_PSW_V, cpu_PSW_V, 31); tcg_gen_or_tl(cpu_PSW_SV, cpu_PSW_SV, cpu_PSW_V); tcg_gen_movi_tl(cpu_PSW_AV, 0); tcg_gen_mov_tl(cpu_gpr_d[r3], cpu_gpr_d[r1]); tcg_gen_movi_tl(cpu_gpr_d[r3+1], 0); break; case OPC2_32_RR_PARITY: gen_helper_parity(cpu_gpr_d[r3], cpu_gpr_d[r1]); break; case OPC2_32_RR_UNPACK: gen_unpack(cpu_gpr_d[r3], cpu_gpr_d[r3+1], cpu_gpr_d[r1]); break; } }
1threat
How can I keep a docker debian container open? : <p>I want to use a debian Docker container to test something, and by this I mean execute some commands in the debian bash console. I tried downloading the image using <code>docker pull debian</code> and then running it using <code>docker run debian</code>, but I get no output. What am I doing wrong? Shouldn't the docker container stay open until I close it?</p>
0debug
static void vhost_client_set_memory(CPUPhysMemoryClient *client, target_phys_addr_t start_addr, ram_addr_t size, ram_addr_t phys_offset, bool log_dirty) { struct vhost_dev *dev = container_of(client, struct vhost_dev, client); ram_addr_t flags = phys_offset & ~TARGET_PAGE_MASK; int s = offsetof(struct vhost_memory, regions) + (dev->mem->nregions + 1) * sizeof dev->mem->regions[0]; uint64_t log_size; int r; dev->mem = g_realloc(dev->mem, s); if (log_dirty) { flags = IO_MEM_UNASSIGNED; } assert(size); if (flags == IO_MEM_RAM) { if (!vhost_dev_cmp_memory(dev, start_addr, size, (uintptr_t)qemu_get_ram_ptr(phys_offset))) { return; } } else { if (!vhost_dev_find_reg(dev, start_addr, size)) { return; } } vhost_dev_unassign_memory(dev, start_addr, size); if (flags == IO_MEM_RAM) { vhost_dev_assign_memory(dev, start_addr, size, (uintptr_t)qemu_get_ram_ptr(phys_offset)); } else { vhost_dev_unassign_memory(dev, start_addr, size); } if (!dev->started) { return; } if (dev->started) { r = vhost_verify_ring_mappings(dev, start_addr, size); assert(r >= 0); } if (!dev->log_enabled) { r = ioctl(dev->control, VHOST_SET_MEM_TABLE, dev->mem); assert(r >= 0); return; } log_size = vhost_get_log_size(dev); #define VHOST_LOG_BUFFER (0x1000 / sizeof *dev->log) if (dev->log_size < log_size) { vhost_dev_log_resize(dev, log_size + VHOST_LOG_BUFFER); } r = ioctl(dev->control, VHOST_SET_MEM_TABLE, dev->mem); assert(r >= 0); if (dev->log_size > log_size + VHOST_LOG_BUFFER) { vhost_dev_log_resize(dev, log_size); } }
1threat
extracting required information from two tables using spark and scala : table 1 col1 col2 col3 ,,,, ,,,, ,,,, a p d b q e c r f d s g table 2 col1 col2 col3 ,,,, ,,,, ,,,, a m s e q l output col1 col2 col3 ,,,, ,,,, ,,,, a m d b q e c r f d s g e q l i created table1 and table2 from csv files and in sql context i tried joining them with full outer join but i could get only the partial answer.
0debug
How to use optional chaining with array in Typescript? : <p>I'm trying to use optional chaining with array instead of object but not sure how to do that:</p> <p>Here's what I'm trying to do <code>myArray.filter(x =&gt; x.testKey === myTestKey)?[0]</code>.</p> <p>But it's giving error like that so how to use it with array.</p>
0debug
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
1threat
array of image url to ui collectionview : I am doing a json quarry to get an array of image urls. I want to display the images on a uicollection view. But I am missing something. I think I have to parse thru the array and set nsurl to each item. Then put each item in nsdata. But I am not sure. I dont want to use 3rd party software either. Here is a sample of my code. - (void)viewDidLoad { [super viewDidLoad]; dispatch_async(kBgQueue, ^{ NSData* data = [NSData dataWithContentsOfURL: coProFeedURL]; [self performSelectorOnMainThread:@selector(fetchedData:) withObject:data waitUntilDone:YES]; }); } ///new return all company data array - (void)fetchedData:(NSData *)responseData { //parse out the json data NSError* error; NSDictionary* json = [NSJSONSerialization JSONObjectWithData:responseData //1 options:kNilOptions error:&error]; NSArray * getProductsArray = [json objectForKey:@"CompanyProduct"]; //2 get all product info NSPredicate *predicate = [NSPredicate predicateWithFormat:@"companyID = %@", passCoData];//added create filter to only selected company NSArray * filteredProductArray = [getProductsArray filteredArrayUsingPredicate:predicate];//only products for selected company ///doing parsing here to get array of image urls finalImageArray = [filteredProductArray allObjects];//original NSLog(@" url images :%@", finalImageArray); //NEED TO GET FINALIMAGEARRAY TO NSURL TYPE AND SET TO IMAGE? } - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return finalImageArray.count; } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { static NSString *identifier = @"Cell";//test form file works ItemCollectionViewCell *cell = (ItemCollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];//test form file works ///then add the finalImageArray? return cell; } Here the output of my finalImageArray that i want to apply to uicollectionview, here is the log data: {( "http://www.test/inventory/images/bball.jpg", "http://www.test/images/bird%20tank_0.jpg" )} So am i missing something like nsurl, or nsdata, or what. How do i get this array of image url to display on a uicollectionview? Thanks for the help!
0debug
Validate data before submitting : <p>I'm new to programming and C#, I'm trying to make a small Electronic Voting System, How can I make the votes invalid when the voter votes an excess number of candidates. For example: The user voted 7 candidates instead of 6 in councilor position, how can I make his vote invalid or doesn't let him to submit his votes till he make it 6.</p> <pre><code> using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication4 { public partial class Frm_voteview : Form { string userid; public Frm_voteview() { InitializeComponent(); SqlConnection con = new SqlConnection(Properties.Settings.Default.VotingSystemv2ConnectionString); con.Open(); } public Frm_voteview(string userid) { InitializeComponent(); SqlConnection con = new SqlConnection(Properties.Settings.Default.VotingSystemv2ConnectionString); con.Open(); this.userid = userid; } SqlConnection con = new SqlConnection(Properties.Settings.Default.VotingSystemv2ConnectionString); private void button3_Click(object sender, EventArgs e) { } private void label3_Click(object sender, EventArgs e) { } private void label5_Click(object sender, EventArgs e) { } private void button7_Click(object sender, EventArgs e) { new Frm_Login().Show(); this.Hide(); } private void button8_Click(object sender, FormClosingEventArgs e) { } private void groupBox1_Enter(object sender, EventArgs e) { } private void Frm_voteview_FormClosing(object sender, FormClosingEventArgs e) { } private void Frm_voteview_Click(object sender, EventArgs e) { } private void btn_submit_Click(object sender, EventArgs e) { con.Open(); if (MessageBox.Show("Confirm and View your Votes?", "Close Application", MessageBoxButtons.YesNo) == DialogResult.Yes) { MessageBox.Show("Voting Successful", "Application Closed!", MessageBoxButtons.OK); using (SqlCommand command = new SqlCommand("UPDATE candidate SET cTally = cTally + 1 where cName like @cname or cName like @vName", con)) { command.Parameters.AddWithValue("@cname", cb_president.Text); command.Parameters.AddWithValue("@vName", cb_vpresident.Text); command.ExecuteNonQuery(); } foreach (object item in lb_councilor.SelectedItems) { using (SqlCommand command = new SqlCommand("UPDATE candidate SET cTally = cTally + 1 where cName like @coname", con)) { command.Parameters.AddWithValue("@coname", (item as DataRowView)["cName"].ToString()); Console.WriteLine((item as DataRowView)["cName"].ToString()); command.ExecuteNonQuery(); } using (SqlCommand command = new SqlCommand("UPDATE voters SET isVoted = 1 where userName like @uname", con)) { command.Parameters.AddWithValue("@uname", userid ); command.ExecuteNonQuery(); } } this.Close(); new Form4().Show(); this.Hide(); } else { this.Activate(); } } private void Frm_voteview_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection(Properties.Settings.Default.VotingSystemv2ConnectionString); con.Open(); // TODO: This line of code loads data into the 'votingSystemv2DataSet7.candidate' table. You can move, or remove it, as needed. this.candidateTableAdapter2.Fill(this.votingSystemv2DataSet7.candidate); // TODO: This line of code loads data into the 'votingSystemv2DataSet5.candidate' table. You can move, or remove it, as needed. this.candidateTableAdapter1.Fill(this.votingSystemv2DataSet5.candidate); // TODO: This line of code loads data into the 'votingSystemv2DataSet4.candidate' table. You can move, or remove it, as needed. this.candidateTableAdapter.Fill(this.votingSystemv2DataSet4.candidate); } private void dgv_councilor_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) { } private void dgv_councilor_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { } private void Frm_voteview_FormClosed(object sender, FormClosedEventArgs e) { SqlConnection con = new SqlConnection(Properties.Settings.Default.VotingSystemv2ConnectionString); // TODO: This line of code loads data into the 'votingSystemv2DataSet7.candidate' table. You can move, or remove it, as needed. this.candidateTableAdapter2.Fill(this.votingSystemv2DataSet7.candidate); // TODO: This line of code loads data into the 'votingSystemv2DataSet5.candidate' table. You can move, or remove it, as needed. this.candidateTableAdapter1.Fill(this.votingSystemv2DataSet5.candidate); // TODO: This line of code loads data into the 'votingSystemv2DataSet4.candidate' table. You can move, or remove it, as needed. this.candidateTableAdapter.Fill(this.votingSystemv2DataSet4.candidate); con.Close(); } private void button1_Click(object sender, EventArgs e) { new Form9().Show(); } private void cb_president_SelectedIndexChanged(object sender, EventArgs e) { } private void lb_councilor_SelectedIndexChanged(object sender, EventArgs e) { } } </code></pre> <p>}</p>
0debug
VB.NET Atribuir vários valores a um objeto : Eu gostaria de criar objetos e atribuir qualquer valor que eu quiser exemplo Dim obj As New Object obj.teste = "teste" obj.teste.teste2 = "teste2" ou entao Dim obj As New Object obj("teste") = "teste" obj("teste")("teste2") = "teste2" é possível fazer isso?
0debug
I need to find a data structure : <p>I need a data structure in java that can store 1 key and 2 pair values. 1 value needs to be a string and the other an int. I will also need to be able to put in and take out values and sort the pairs according to the int value. Please help!</p>
0debug
static void blk_alloc(struct XenDevice *xendev) { struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev); LIST_INIT(&blkdev->inflight); LIST_INIT(&blkdev->finished); LIST_INIT(&blkdev->freelist); blkdev->bh = qemu_bh_new(blk_bh, blkdev); if (xen_mode != XEN_EMULATE) batch_maps = 1; }
1threat
static void fill_slice_long(AVCodecContext *avctx, DXVA_Slice_H264_Long *slice, unsigned position, unsigned size) { const H264Context *h = avctx->priv_data; struct dxva_context *ctx = avctx->hwaccel_context; unsigned list; memset(slice, 0, sizeof(*slice)); slice->BSNALunitDataLocation = position; slice->SliceBytesInBuffer = size; slice->wBadSliceChopping = 0; slice->first_mb_in_slice = (h->mb_y >> FIELD_OR_MBAFF_PICTURE(h)) * h->mb_width + h->mb_x; slice->NumMbsForSlice = 0; slice->BitOffsetToSliceData = get_bits_count(&h->gb); slice->slice_type = ff_h264_get_slice_type(h); if (h->slice_type_fixed) slice->slice_type += 5; slice->luma_log2_weight_denom = h->luma_log2_weight_denom; slice->chroma_log2_weight_denom = h->chroma_log2_weight_denom; if (h->list_count > 0) slice->num_ref_idx_l0_active_minus1 = h->ref_count[0] - 1; if (h->list_count > 1) slice->num_ref_idx_l1_active_minus1 = h->ref_count[1] - 1; slice->slice_alpha_c0_offset_div2 = h->slice_alpha_c0_offset / 2; slice->slice_beta_offset_div2 = h->slice_beta_offset / 2; slice->Reserved8Bits = 0; for (list = 0; list < 2; list++) { unsigned i; for (i = 0; i < FF_ARRAY_ELEMS(slice->RefPicList[list]); i++) { if (list < h->list_count && i < h->ref_count[list]) { const Picture *r = &h->ref_list[list][i]; unsigned plane; fill_picture_entry(&slice->RefPicList[list][i], ff_dxva2_get_surface_index(ctx, r), r->reference == PICT_BOTTOM_FIELD); for (plane = 0; plane < 3; plane++) { int w, o; if (plane == 0 && h->luma_weight_flag[list]) { w = h->luma_weight[i][list][0]; o = h->luma_weight[i][list][1]; } else if (plane >= 1 && h->chroma_weight_flag[list]) { w = h->chroma_weight[i][list][plane-1][0]; o = h->chroma_weight[i][list][plane-1][1]; } else { w = 1 << (plane == 0 ? h->luma_log2_weight_denom : h->chroma_log2_weight_denom); o = 0; } slice->Weights[list][i][plane][0] = w; slice->Weights[list][i][plane][1] = o; } } else { unsigned plane; slice->RefPicList[list][i].bPicEntry = 0xff; for (plane = 0; plane < 3; plane++) { slice->Weights[list][i][plane][0] = 0; slice->Weights[list][i][plane][1] = 0; } } } } slice->slice_qs_delta = 0; slice->slice_qp_delta = h->qscale - h->pps.init_qp; slice->redundant_pic_cnt = h->redundant_pic_count; if (h->slice_type == AV_PICTURE_TYPE_B) slice->direct_spatial_mv_pred_flag = h->direct_spatial_mv_pred; slice->cabac_init_idc = h->pps.cabac ? h->cabac_init_idc : 0; if (h->deblocking_filter < 2) slice->disable_deblocking_filter_idc = 1 - h->deblocking_filter; else slice->disable_deblocking_filter_idc = h->deblocking_filter; slice->slice_id = h->current_slice - 1; }
1threat
Java: Print content from HashMap<String, Object> : <p>I need to print all the contents from the <code>HashMap&lt;String, StudentSchedule&gt;</code> where StudentSchedule is a class that store other objects. In the StudentSchedule, there is a function that prints out some data which I want it to print when the HashMap is printing. I have used the enhanced for loop to print the HashMap, but the values are like object Number. When the values are printing, i want it to print the function that is in StudentSchedule.printSchedule(). I am not sure if that is possible. I think I have made it more complicated that it should be but here is what I have so far:</p> <pre><code>public class StudentSchedule { private Student student; private Course course; private String[] courseDays; private String[] courseTimes; public StudentSchedule(Student student, Course course, String[] courseDays, String[] courseTimes) { this.student = student; this.course = course; this.courseDays = courseDays; this.courseTimes = courseTimes; } public Student getStudent() { return student; } public Course getCourse() { return course; } public String[] getCourseDays() { return courseDays; } public String[] getCourseTimes() { return courseTimes; } public void printSchedule() { System.out.println("\nClass Schedule"); String studentInfo = getStudent().toString(); String courseInfo = getCourse().toString(); String[] courseDays = getCourseDays(); String[] courseTimes = getCourseTimes(); if(courseDays[2] != null &amp;&amp; courseTimes[2] != null) { System.out.println(studentInfo + "\n" + courseInfo + "\n" + courseDays[0] + " -&gt; " + courseTimes[0] + "\n" + courseDays[1] + " -&gt; " + courseTimes[1] + "\n" + courseDays[2] + " -&gt; " + courseTimes[2]); } else { System.out.println(studentInfo + "\n" + courseInfo + "\n" + courseDays[0] + " -&gt; " + courseTimes[0] + "\n" + courseDays[1] + " -&gt; " + courseTimes[1]); } } } </code></pre> <p>ScheduleManager</p> <pre><code>public class ScheduleManager { private HashMap&lt;String, StudentSchedule&gt; allStudentSchedule = new HashMap&lt;&gt;(); public void createSchedule() { Student newStudent = getStudentInfo(); Course newCourse = getCourseInfo(); courseDays = getCourseDays(); courseTimes = getCourseTimes(courseDays); studentSchedule = new StudentSchedule(newStudent, newCourse, courseDays, courseTimes); allStudentSchedule.put(newStudent.getStudentId(), studentSchedule); // testing print schedule studentSchedule.printSchedule(); } private void displaySchedule() { Set&lt;Entry&lt;String,StudentSchedule&gt;&gt; hashSet = allStudentSchedule.entrySet(); for(Entry entry : hashSet ) { System.out.println("Key="+entry.getKey()+", Value="+entry.getValue()); } } .... </code></pre>
0debug
static void memory_region_write_thunk_n(void *_mr, target_phys_addr_t addr, unsigned size, uint64_t data) { MemoryRegion *mr = _mr; if (!memory_region_access_valid(mr, addr, size)) { return; } if (!mr->ops->write) { mr->ops->old_mmio.write[bitops_ffsl(size)](mr->opaque, addr, data); return; } access_with_adjusted_size(addr + mr->offset, &data, size, mr->ops->impl.min_access_size, mr->ops->impl.max_access_size, memory_region_write_accessor, mr); }
1threat
Narrowing down error type in catch : <p>For this piece of code</p> <pre><code>try { throw new CustomError(); } catch (err) { console.log(err.aPropThatDoesNotExistInCustomError); } </code></pre> <p><code>err</code> is <code>any</code> and doesn't trigger type errors. How can it be narrowed down to the type that error is expected to be?</p>
0debug
Using Python to pull files from GitHub : <p>I am trying to find a way to use Python to pull files from a Github account. The only answers I seem to find is from 2013:</p> <pre><code>import requests from os import getcwd url = "https://raw.githubusercontent.com/Nav-aggarwal09/hello-world/master/README.doc" directory = getcwd() filename = directory + 'README.doc' r = requests.get(url) f = open(filename, 'w') f.write(r) </code></pre> <p>The above code does not seem to work. Can someone please tell me how to fix this code or give another way to do it through example? Thank you</p>
0debug
Android console: authentication required : <p>I am trying to run the geo fix command but I am unable to do so because I am greeted by the following message:</p> <p>Android Console: Authentication required Android Console: type 'auth ' to authenticate Android Console: you can find your in '/Users/me/.emulator_console_auth_token'</p> <p>I am on a mac [new user] and I do not know how to access the .emulator_console_auth_token file to delete it.</p> <p>I have tried ~/Users to get to the users folder but it is returning no results. Additionally, the folder with my name does not contain that file. Please help.</p>
0debug
static int ffm_seek(AVFormatContext *s, int stream_index, int64_t wanted_pts, int flags) { FFMContext *ffm = s->priv_data; int64_t pos_min, pos_max, pos; int64_t pts_min, pts_max, pts; double pos1; av_dlog(s, "wanted_pts=%0.6f\n", wanted_pts / 1000000.0); if (ffm->write_index && ffm->write_index < ffm->file_size) { if (get_dts(s, FFM_PACKET_SIZE) < wanted_pts) { pos_min = FFM_PACKET_SIZE; pos_max = ffm->write_index - FFM_PACKET_SIZE; } else { pos_min = ffm->write_index; pos_max = ffm->file_size - FFM_PACKET_SIZE; } } else { pos_min = FFM_PACKET_SIZE; pos_max = ffm->file_size - FFM_PACKET_SIZE; } while (pos_min <= pos_max) { pts_min = get_dts(s, pos_min); pts_max = get_dts(s, pos_max); if (pts_min > wanted_pts || pts_max < wanted_pts) { pos = pts_min > wanted_pts ? pos_min : pos_max; goto found; } pos1 = (double)(pos_max - pos_min) * (double)(wanted_pts - pts_min) / (double)(pts_max - pts_min); pos = (((int64_t)pos1) / FFM_PACKET_SIZE) * FFM_PACKET_SIZE; if (pos <= pos_min) pos = pos_min; else if (pos >= pos_max) pos = pos_max; pts = get_dts(s, pos); if (pts == wanted_pts) { goto found; } else if (pts > wanted_pts) { pos_max = pos - FFM_PACKET_SIZE; } else { pos_min = pos + FFM_PACKET_SIZE; } } pos = (flags & AVSEEK_FLAG_BACKWARD) ? pos_min : pos_max; found: if (ffm_seek1(s, pos) < 0) return -1; ffm->read_state = READ_HEADER; ffm->packet_ptr = ffm->packet; ffm->packet_end = ffm->packet; ffm->first_packet = 1; return 0; }
1threat
static void qtrle_decode_8bpp(QtrleContext *s) { int stream_ptr; int header; int start_line; int lines_to_change; signed char rle_code; int row_ptr, pixel_ptr; int row_inc = s->frame.linesize[0]; unsigned char pi1, pi2, pi3, pi4; unsigned char *rgb = s->frame.data[0]; int pixel_limit = s->frame.linesize[0] * s->avctx->height; if (s->size < 8) return; stream_ptr = 4; CHECK_STREAM_PTR(2); header = BE_16(&s->buf[stream_ptr]); stream_ptr += 2; if (header & 0x0008) { CHECK_STREAM_PTR(8); start_line = BE_16(&s->buf[stream_ptr]); stream_ptr += 4; lines_to_change = BE_16(&s->buf[stream_ptr]); stream_ptr += 4; } else { start_line = 0; lines_to_change = s->avctx->height; } row_ptr = row_inc * start_line; while (lines_to_change--) { CHECK_STREAM_PTR(2); pixel_ptr = row_ptr + (4 * (s->buf[stream_ptr++] - 1)); while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) { if (rle_code == 0) { CHECK_STREAM_PTR(1); pixel_ptr += (4 * (s->buf[stream_ptr++] - 1)); } else if (rle_code < 0) { rle_code = -rle_code; CHECK_STREAM_PTR(4); pi1 = s->buf[stream_ptr++]; pi2 = s->buf[stream_ptr++]; pi3 = s->buf[stream_ptr++]; pi4 = s->buf[stream_ptr++]; CHECK_PIXEL_PTR(rle_code * 4); while (rle_code--) { rgb[pixel_ptr++] = pi1; rgb[pixel_ptr++] = pi2; rgb[pixel_ptr++] = pi3; rgb[pixel_ptr++] = pi4; } } else { rle_code *= 4; CHECK_STREAM_PTR(rle_code); CHECK_PIXEL_PTR(rle_code); while (rle_code--) { rgb[pixel_ptr++] = s->buf[stream_ptr++]; } } } row_ptr += row_inc; } }
1threat
ERROR: update or delete on table "tablename" violates foreign key constraint : <p>I'm trying to delete the parent student or parent course and I get this error: </p> <p><strong>Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table "student" violates foreign key constraint "fkeyvuofq5vwdylcf78jar3mxol" on table "registration"</strong></p> <p>RegistrationId class is a composite key used in Registration class. I'm using Spring data jpa and spring boot.</p> <p>What am I doing wrong? I know that putting cascadetype.all should also remove the children when the parent is deleted but it is giving me an error instead.</p> <pre><code>@Embeddable public class RegistrationId implements Serializable { @JsonIgnoreProperties("notifications") @OneToOne(cascade=CascadeType.ALL) @JoinColumn(name = "student_pcn", referencedColumnName="pcn") private Student student; @JsonIgnoreProperties({"teachers", "states", "reviews"}) @OneToOne(cascade=CascadeType.ALL) @JoinColumn(name = "course_code", referencedColumnName="code") private Course course; </code></pre> <p><br>Registration class</p> <pre><code>@Entity(name = "Registration") @Table(name = "registration") public class Registration { @EmbeddedId private RegistrationId id; </code></pre>
0debug
Include sudo password in linux executable file : <p>I have this code in a linux executable file to start atom from there:</p> <pre><code>#! /bin/bash sudo atom </code></pre> <p>I wanted to include sudo password after that lines of code, so the program will run automatically.</p>
0debug
Get full list of full text search configuration languages : <p><code>to_tsvector()</code> supports several languages: english, german, french ...</p> <p>How to get full list of these languages ?</p>
0debug
static void decode_block_params(DiracContext *s, DiracArith arith[8], DiracBlock *block, int stride, int x, int y) { int i; block->ref = pred_block_mode(block, stride, x, y, DIRAC_REF_MASK_REF1); block->ref ^= dirac_get_arith_bit(arith, CTX_PMODE_REF1); if (s->num_refs == 2) { block->ref |= pred_block_mode(block, stride, x, y, DIRAC_REF_MASK_REF2); block->ref ^= dirac_get_arith_bit(arith, CTX_PMODE_REF2) << 1; } if (!block->ref) { pred_block_dc(block, stride, x, y); for (i = 0; i < 3; i++) block->u.dc[i] += dirac_get_arith_int(arith+1+i, CTX_DC_F1, CTX_DC_DATA); return; } if (s->globalmc_flag) { block->ref |= pred_block_mode(block, stride, x, y, DIRAC_REF_MASK_GLOBAL); block->ref ^= dirac_get_arith_bit(arith, CTX_GLOBAL_BLOCK) << 2; } for (i = 0; i < s->num_refs; i++) if (block->ref & (i+1)) { if (block->ref & DIRAC_REF_MASK_GLOBAL) { global_mv(s, block, x, y, i); } else { pred_mv(block, stride, x, y, i); block->u.mv[i][0] += dirac_get_arith_int(arith + 4 + 2 * i, CTX_MV_F1, CTX_MV_DATA); block->u.mv[i][1] += dirac_get_arith_int(arith + 5 + 2 * i, CTX_MV_F1, CTX_MV_DATA); } } }
1threat
void ff_avg_h264_qpel16_mc32_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_midh_qrt_and_aver_dst_16w_msa(src - (2 * stride) - 2, stride, dst, stride, 16, 1); }
1threat
ModelMapper: matches multiple source property hierarchies : <p>I cannot resolve modelMapper error. Do you have any ideas where is the issue?</p> <p>NB: In view java.sql.Time doesn't have non-argument constructor I didn't find the better way than to write converter</p> <pre><code>org.modelmapper.ConfigurationException: ModelMapper configuration errors: 1) The destination property biz.models.CarWash.setSecondShift()/java.util.Date.setTime() matches multiple source property hierarchies: biz.dto.CarWashDTO.getFirstShift()/java.time.LocalTime.getSecond() biz.dto.CarWashDTO.getSecondShift()/java.time.LocalTime.getSecond() </code></pre> <p>The error was made by this code</p> <pre><code>@SpringBootTest @RunWith(SpringRunner.class) public class CarWashDTO2CarWash { @Autowired protected ModelMapper modelMapper; @Test public void testCarWashDTO2CarWash_allFiledShouldBeConverted(){ CarWashDTO dto = CarWashDTO.builder() .name("SomeName") .address("SomeAddress") .boxCount(2) .firstShift(LocalTime.of(9, 0)) .secondShift(LocalTime.of(20, 0)) .phoneNumber("5700876") .build(); modelMapper.addConverter((Converter&lt;CarWashDTO, CarWash&gt;) mappingContext -&gt; { CarWashDTO source = mappingContext.getSource(); CarWash destination = mappingContext.getDestination(); destination.setId(source.getId()); destination.setFirstShift(source.getFirstShift() == null ? null : Time.valueOf(source.getFirstShift())); destination.setSecondShift(source.getSecondShift() == null ? null : Time.valueOf(source.getSecondShift())); destination.setEnable(true); destination.setAddress(source.getAddress()); destination.setBoxCount(source.getBoxCount()); destination.setName(source.getName()); destination.setDateOfCreation(source.getDateOfCreation()); return destination; }); final CarWash entity = modelMapper.map(dto, CarWash.class); assertNotNull(entity); assertEquals(2, entity.getBoxCount().intValue()); assertEquals("SomeAddress", entity.getAddress()); assertEquals("SomeName", entity.getName()); } </code></pre> <p>}</p> <p>The modelmapper bean is built by the next configuration</p> <pre><code>@Bean public ModelMapper modelMapper(){ return new ModelMapper(); } </code></pre> <p>Dto:</p> <pre><code>public class CarWashDTO { private Long id; private String name; private String address; private String phoneNumber; private Integer boxCount; private LocalTime firstShift; private LocalTime secondShift; private LocalDateTime dateOfCreation; } </code></pre> <p>Entity (firstShift and secondShift have java.sql.Time type):</p> <pre><code>public class CarWash { private Long id; private String name; private String address; private String phoneNumber; private Integer boxCount; private Time firstShift; private Time secondShift; private LocalDateTime dateOfCreation; private Boolean enable; private Owner owner; } </code></pre>
0debug
RStudio - How do I view a certain section of my dataset of people (for example, only females)? : I have a dataset called "data" and I have a column in it called "gender." I want to look at all the data where "gender" = F only. How would I go about doing this in the RStudio console?
0debug
static void opt_qmin(const char *arg) { video_qmin = atoi(arg); if (video_qmin < 0 || video_qmin > 31) { fprintf(stderr, "qmin must be >= 1 and <= 31\n"); exit(1); } }
1threat
Error message "Use of Undeclared identifier "field"" : <p>Im trying to create a button to copy images that are in my application and when I enter the code in Xcode I receive a error messege saying Error message "Use of Undeclared identifier "field"" I've been trying to solve this for several days now and i just can't figure it out #import "ViewController.h"</p> <pre><code>@implementation ViewController -(IBAction)copyimage:(id)sender { pasteboard.string = field.copyimage; } -(IBAction)pasteimage:(id) sender{ } - (void)viewDidLoad { [super viewDidLoad]; pasteboard = [UIPasteboard generalPasteboard]; // Do any additional setup after loading the view, typically from a nib. } </code></pre>
0debug
Can I make auto sum in Sql server?! : I want sum single row in last column in same row like -------------------------------------------------------- Value 1. Value 2. Sum -------------------------------------------------------- 2. 5. ? 5. 10. ? -------------------------------------------------------- I want to sum this values automatically
0debug
Should I add Django admin static files to my git repo? : <p>I ran <code>manage.py collectstatic</code> on my webapp and now I have a new static folder with only Django admin files (so far I've been using just CDNs for my project CSS and JS files). Should I track these admin static files on my git repo? What's the best practise?</p>
0debug
Calling Angular application not from the root path : <p>I created a simple Angular app with some routes inside. Now I am calling it from my browser:</p> <pre><code>http://127.0.0.1:8000/products_whatever </code></pre> <p>For this to work, to my understanding the following is needed:</p> <ol> <li>Web server should be configured to return <code>index.html</code> on request to any relative URL. Index.html, i.e. my Angular app will inspect that local path, figure out if it is valid or not and decide what to do. Is that right?</li> <li>What is the exact mechanism that is used to pass that local relative path to <code>index.html</code>? Is that some special HTTP header?</li> </ol>
0debug
Python program to move mouse cursor doesn't work as expected : I'm creating a program that utilizes the win32api mouse_event to move the mouse cursor to a certain position. However, the program is not working as expected. Any help would be most appreciated. NOTE: I must use win32api and no other library. Take this program for example: import win32api x = 1000 y = 1000 win32api.mouse_event(0x0001, int(x), int(y)) It should move the mouse cursor to the 1000th x and y pixels on the screen but it doesn't.
0debug
static int init_file(AVFormatContext *s, OutputStream *os, int64_t start_ts) { int ret, i; ret = avio_open2(&os->out, os->temp_filename, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL); if (ret < 0) return ret; avio_wb32(os->out, 0); avio_wl32(os->out, MKTAG('m','d','a','t')); for (i = 0; i < os->nb_extra_packets; i++) { AV_WB24(os->extra_packets[i] + 4, start_ts); os->extra_packets[i][7] = (start_ts >> 24) & 0x7f; avio_write(os->out, os->extra_packets[i], os->extra_packet_sizes[i]); } return 0; }
1threat
int64_t qemu_get_clock_ns(QEMUClock *clock) { return 0; }
1threat
error: Target of URI doesn't exist: 'package:test/test.dart' : <p>Since the latest flutter update my tests are broken. It looks like the Dart test framework isn't available anymore:</p> <pre><code>error: Target of URI doesn't exist: 'package:test/test.dart'. </code></pre>
0debug
how can open another activity by action buttons in the dialog box which is opened with a button? : <p>I am trying to make an app where I open a dialog box with a button. Then the dialog box would have two action buttons which opens two different activities.</p>
0debug
static SCSIGenericReq *scsi_find_request(SCSIGenericState *s, uint32_t tag) { return DO_UPCAST(SCSIGenericReq, req, scsi_req_find(&s->qdev, tag)); }
1threat
static void compat_free_buffer(void *opaque, uint8_t *data) { CompatReleaseBufPriv *priv = opaque; priv->avctx.release_buffer(&priv->avctx, &priv->frame); av_freep(&priv); }
1threat
How to pass an object with template function? : <p>Doing my homework, got stuck on the template function part. I have the following <code>main()</code> in my <code>.cpp</code> file:</p> <pre><code>int main() { Pair&lt;char&gt; letters('a', 'd'); cout &lt;&lt; "\nThe first letter is: " &lt;&lt; letters.getFirst(); cout &lt;&lt; "\nThe second letter is: " &lt;&lt; letters.getSecond(); cout &lt;&lt; endl; system("pause"); return 0; } </code></pre> <p>I need to use <code>template</code> to make the <code>class</code> exchageable, and here is what I have in the <code>.h</code> file: </p> <pre><code>template &lt;class T&gt; class Pair { private: T letters; public: T getFirst(); T getSecond(); }; </code></pre> <p>now, in my VS, it says both <code>getFrist()</code> and <code>getSecond()</code> are not found. How am I supposed to pass T as a <code>class</code> in <code>template</code>?</p>
0debug
Downcasting a slice of interfaces to a sub-interface slice : <p>I'm trying to get better at using interfaces in Go to describe specific functionality, and using interface composition to write better, more understandable code. I ran into this problem which seems like it would be a common use case of go interfaces, yet I can't seem to figure out the proper syntax to use for this application. Here's some code to help explain what I am trying to do:</p> <pre><code>// Initializable is an interface to an object that can be initialized. type Initializable interface { Initialize() error } // InitializeAll initializes an array of members. func InitializeAll(members []Initializable) error { for _, member := range members { err := member.Initialize() if err != nil { return err } } return nil } // Host is an interface to an object providing a set of handlers for a web host. type Host interface { Initializable Hostname() string RegisterHandlers(router *mux.Router) } // ConfigureHosts configures a set of hosts and initializes them. func ConfigureHosts(hosts []Host) (*mux.Router, error) { err := InitializeAll(hosts) // compiler error here } </code></pre> <p>This is the error: <code>cannot use hosts (type []Host) as type []Initializable in argument InitializeAll</code>.</p> <p>My initial thought was that I was missing some sort of type downcast, which I know works for single interface objects, but had difficulty casting an array. When I tried doing <code>err := InitializeAll(hosts.([]Initializable))</code>, I got the following error: <code>invalid type assertion: hosts.([]Initializable) (non-interface type []Host on left)</code>.</p> <p>I'd appreciate any ideas as it comes to the design of this code example, and perhaps any suggestions as to proper syntax or some refactoring that I could do to solve this problem. Thanks!</p>
0debug
assigned_dev_msix_mmio_read(void *opaque, target_phys_addr_t addr, unsigned size) { AssignedDevice *adev = opaque; uint64_t val; memcpy(&val, (void *)((uint8_t *)adev->msix_table + addr), size); return val; }
1threat
int ff_hevc_decode_nal_vps(HEVCContext *s) { int i,j; GetBitContext *gb = &s->HEVClc->gb; int vps_id = 0; HEVCVPS *vps; AVBufferRef *vps_buf = av_buffer_allocz(sizeof(*vps)); if (!vps_buf) return AVERROR(ENOMEM); vps = (HEVCVPS*)vps_buf->data; av_log(s->avctx, AV_LOG_DEBUG, "Decoding VPS\n"); vps_id = get_bits(gb, 4); if (vps_id >= MAX_VPS_COUNT) { av_log(s->avctx, AV_LOG_ERROR, "VPS id out of range: %d\n", vps_id); goto err; } if (get_bits(gb, 2) != 3) { av_log(s->avctx, AV_LOG_ERROR, "vps_reserved_three_2bits is not three\n"); goto err; } vps->vps_max_layers = get_bits(gb, 6) + 1; vps->vps_max_sub_layers = get_bits(gb, 3) + 1; vps->vps_temporal_id_nesting_flag = get_bits1(gb); if (get_bits(gb, 16) != 0xffff) { av_log(s->avctx, AV_LOG_ERROR, "vps_reserved_ffff_16bits is not 0xffff\n"); goto err; } if (vps->vps_max_sub_layers > MAX_SUB_LAYERS) { av_log(s->avctx, AV_LOG_ERROR, "vps_max_sub_layers out of range: %d\n", vps->vps_max_sub_layers); goto err; } if (parse_ptl(s, &vps->ptl, vps->vps_max_sub_layers) < 0) goto err; vps->vps_sub_layer_ordering_info_present_flag = get_bits1(gb); i = vps->vps_sub_layer_ordering_info_present_flag ? 0 : vps->vps_max_sub_layers - 1; for (; i < vps->vps_max_sub_layers; i++) { vps->vps_max_dec_pic_buffering[i] = get_ue_golomb_long(gb) + 1; vps->vps_num_reorder_pics[i] = get_ue_golomb_long(gb); vps->vps_max_latency_increase[i] = get_ue_golomb_long(gb) - 1; if (vps->vps_max_dec_pic_buffering[i] > MAX_DPB_SIZE || !vps->vps_max_dec_pic_buffering[i]) { av_log(s->avctx, AV_LOG_ERROR, "vps_max_dec_pic_buffering_minus1 out of range: %d\n", vps->vps_max_dec_pic_buffering[i] - 1); goto err; } if (vps->vps_num_reorder_pics[i] > vps->vps_max_dec_pic_buffering[i] - 1) { av_log(s->avctx, AV_LOG_WARNING, "vps_max_num_reorder_pics out of range: %d\n", vps->vps_num_reorder_pics[i]); if (s->avctx->err_recognition & AV_EF_EXPLODE) goto err; } } vps->vps_max_layer_id = get_bits(gb, 6); vps->vps_num_layer_sets = get_ue_golomb_long(gb) + 1; if (vps->vps_num_layer_sets < 1 || vps->vps_num_layer_sets > 1024 || (vps->vps_num_layer_sets - 1LL) * (vps->vps_max_layer_id + 1LL) > get_bits_left(gb)) { av_log(s->avctx, AV_LOG_ERROR, "too many layer_id_included_flags\n"); goto err; } for (i = 1; i < vps->vps_num_layer_sets; i++) for (j = 0; j <= vps->vps_max_layer_id; j++) skip_bits(gb, 1); vps->vps_timing_info_present_flag = get_bits1(gb); if (vps->vps_timing_info_present_flag) { vps->vps_num_units_in_tick = get_bits_long(gb, 32); vps->vps_time_scale = get_bits_long(gb, 32); vps->vps_poc_proportional_to_timing_flag = get_bits1(gb); if (vps->vps_poc_proportional_to_timing_flag) vps->vps_num_ticks_poc_diff_one = get_ue_golomb_long(gb) + 1; vps->vps_num_hrd_parameters = get_ue_golomb_long(gb); if (vps->vps_num_hrd_parameters > (unsigned)vps->vps_num_layer_sets) { av_log(s->avctx, AV_LOG_ERROR, "vps_num_hrd_parameters %d is invalid\n", vps->vps_num_hrd_parameters); goto err; } for (i = 0; i < vps->vps_num_hrd_parameters; i++) { int common_inf_present = 1; get_ue_golomb_long(gb); if (i) common_inf_present = get_bits1(gb); decode_hrd(s, common_inf_present, vps->vps_max_sub_layers); } } get_bits1(gb); if (get_bits_left(gb) < 0) { av_log(s->avctx, AV_LOG_ERROR, "Overread VPS by %d bits\n", -get_bits_left(gb)); goto err; } if (s->vps_list[vps_id] && !memcmp(s->vps_list[vps_id]->data, vps_buf->data, vps_buf->size)) { av_buffer_unref(&vps_buf); } else { remove_vps(s, vps_id); s->vps_list[vps_id] = vps_buf; } return 0; err: av_buffer_unref(&vps_buf); return AVERROR_INVALIDDATA; }
1threat
How to add two scanner strings together? in 'if' statement : <p>I'm new to Java and I'm trying to add two strings of data together from a scanner object. </p> <p>I'm wanting to say </p> <pre><code>if(age.equals("child")) AND sex.equals("male")) THEN System.out.println etc; </code></pre> <p>This code below is all I have so far. I also have a code: sex.equals("male")</p> <pre><code>if(age.equals("child")){ System.out.println("1. Male child shirts are on the 5th floor"); System.out.println("2. Male child trousers are on the 6th floor"); System.out.println("3. Male child shoes are on the 6th floor"); } </code></pre> <p>I hope this isn't too confusing. I'm new to learning Java and only just learning the terminology. </p> <p>Thanks</p>
0debug
How do you get to convert an excel file into a MySQL file? : <p>I have a 6,5 MB XLSX file and I want to get a MySQL file from it.</p>
0debug
Deep and shallow merge in javascript : <p>What is the difference between deep and shallow merge of objects in javascript? As far as I understand, deep merge recursively copies all the source object enumerable properties into target object. But what does shallow merge do?</p>
0debug
Python3: Extract data from .txt files and take those data in rows and column : I have a set of datas from a .txt file in this format: 30 1 2477.25 0.00 1 M 40 2 11 0.17100 0.08600 0.11500 0.10800 0.05600 0.07500 9.60000 -1009.00000 -1009.00000 -1009.00000 2.70000 36 1 1 a.a.Sbargang 30 1 2477.45 0.00 2 M 40 2 11 0.52100 0.27400 0.35900 -1009.00000 -1009.00000 -1009.00000 14.30000 -1009.00000 -1009.00000 -1009.00000 2.66000 36 1 1 a.a M-gr. The format is quite messy, and I want to make it in rows and columns so my output will be like this: 30 1 2477.25 0.00 1 M 40 2 11 0.17100 0.08600 0.11500 0.10800 0.05600 0.07500 9.60000 -1009.00000 -1009.00000 -1009.00000 2.70000 36 1 1 a.a.Sbargang 30 1 2477.45 0.00 2 M 40 2 11 0.52100 0.27400 0.35900 -1009.0 -1009.0 -1009.00 14.3000 -1009.00000 -1009.00000 -1009.00000 2.66000 36 1 1 a.a M-gr. I am quite new to python and not sure how to write python3 to do this task? Thanks in advance
0debug
In Visual Studio, C++ Build Configuration types are Debug, Debug3D, DebugDLL4, DebugDLL9, DebugDX, dxDebug and etc. What is the difference? : <p>In Visual Studio, C++ Build Configuration types are Debug, Debug3D, DebugDLL4, DebugDLL9, DebugDX, dxDebug and etc. What is the difference?</p>
0debug
Debugging tests with delve : <p>I'm using <strong>"go test -v</strong>" to run bunch of unit tests. I'd like to debug them using delve. When I try to run debugger, I get an <strong>"Can not debug non-main package"</strong> error. So, how can I debug unit tests using delve debugger ?</p>
0debug
replacing ^ in string in JavaScript : <pre><code> var charactersGone = sen.replace(/&amp;|!|^/g, ""); </code></pre> <p>is the code I am trying to use, it works for the ampersand and exclamation mark but the tophat stays whether in multiples or singles.</p>
0debug
Python error in my program opening window : I'm getting an error trying to open a window in python I'm using tkinter so the code looks a bit like this import tikneter Window = Tk() Window.create_rectangle(0, 0, 100, 100) # border around window
0debug
How do I mirror an image right to left : I'm having trouble editing this code on having it mirror an image from left to right because when I received the code it mirrored the image on right to left. public void mirrorVerticalRightToLeft() { Pixel[][] pixels = this.getPixels2D(); Pixel leftPixel = null; Pixel rightPixel = null; int width = pixels[0].length; for (int row = 0; row < pixels.length; row++) { for (int col = 0; col > width/2 ; col++) { leftPixel = pixels[row][col]; rightPixel = pixels[row][col-1-width]; rightPixel.setColor(leftPixel.getColor()); } } }
0debug
JSDoc Comment Folding In VSCode : <p>Is there a way to fold JSDoc-style comment blocks in VSCode v1.25 for JavaScript files? I get normal code collapse offered, but comment blocks seem excluded. Is there a keyboard shortcut that would collapse code even without the GUI handlebars showing?</p> <p><a href="https://i.stack.imgur.com/0pZKz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/0pZKz.png" alt="enter image description here"></a></p>
0debug
React + TypeScript usage of className prop : <p>What is the correct way to type and use the <code>className</code> prop in a custom component? I used to be able to do this:</p> <pre><code>class MyComponent extends React.Component&lt;MyProps, {}&gt; { ... } </code></pre> <p>and then use my component via:</p> <pre><code>&lt;MyComponent className="my-class" /&gt; </code></pre> <p>Note that I would not define <code>className</code> in <code>MyProps</code>, though React was previously typed to support this usage.</p> <p>Now, I am now seeing this type error:</p> <pre><code>Property 'className' does not exist on type 'IntrinsicAttributes &amp; IntrinsicClassAttributes&lt;Component&lt;{}, ComponentState&gt;&gt; &amp; Readonly&lt;{ childr...' </code></pre> <p>What is the correct way to define / type my component that will allow me to use <code>className</code> when using my component?</p>
0debug
Indent text does not work with line brakes : <p>I have here a simple problem but I searched a lot and still didn't find a quick fix to it, I do not want to add a lot of styling because I was looking on a website and I saw that he put line brakes. I will show you 2 images to understand more clearly what I want to say.<a href="https://i.stack.imgur.com/eFdJ7.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eFdJ7.jpg" alt="["></a>]<a href="https://i.stack.imgur.com/GoUDX.jpg" rel="nofollow noreferrer">2</a>]<a href="https://i.stack.imgur.com/GoUDX.jpg" rel="nofollow noreferrer">2</a></p>
0debug
Subclassing NSManagedObject with swift 3 and Xcode 8 beta : <p>I've began to try use Core data with swift 3 and Xcode 8 beta. When I try to generate NSManagedObject subclasses from core data model and Create NSManagedObject subclass… option in Editor menu, Xcode 8 beta generates three files one of them is <strong>_COREDATA_DATAMODELNAME_</strong>+CoreDataModel.swift with the following content:</p> <pre><code>import Foundation import CoreData ___COREDATA_DATAMODEL_MANAGEDOBJECTCLASSES_IMPLEMENTATIONS___ </code></pre> <p>In addition, the content of this file shows two warnings:</p> <pre><code>Expressions are not allowed at the top level. Use of unresolved identifier '___COREDATA_DATAMODEL_MANAGEDOBJECTCLASSES_IMPLEMENTATIONS___' </code></pre> <p>Has anyones faced the same issue? Which is the meaning of this new file?</p> <p>Thanks</p>
0debug
static int mxf_read_index_table_segment(MXFIndexTableSegment *segment, ByteIOContext *pb, int tag) { switch(tag) { case 0x3F05: dprintf(NULL, "EditUnitByteCount %d\n", get_be32(pb)); break; case 0x3F06: dprintf(NULL, "IndexSID %d\n", get_be32(pb)); break; case 0x3F07: dprintf(NULL, "BodySID %d\n", get_be32(pb)); break; case 0x3F0B: dprintf(NULL, "IndexEditRate %d/%d\n", get_be32(pb), get_be32(pb)); break; case 0x3F0C: dprintf(NULL, "IndexStartPosition %lld\n", get_be64(pb)); break; case 0x3F0D: dprintf(NULL, "IndexDuration %lld\n", get_be64(pb)); break; } return 0; }
1threat
Android Kernel Development using linux : <p>I am interested in developing kernel for android phones. I searched on internet about android kernel development and i got how to build kernel on linux machine means only how to use tools for create a custom kernel but i want to know how to write code to make android kernel. How to start with c programming and ALP. Please guide me.</p>
0debug