problem
stringlengths
26
131k
labels
class label
2 classes
static void nographic_update(void *opaque) { uint64_t interval = GUI_REFRESH_INTERVAL; qemu_flush_coalesced_mmio_buffer(); qemu_mod_timer(nographic_timer, interval + qemu_get_clock(rt_clock)); }
1threat
static void i6300esb_pc_init(PCIBus *pci_bus) { I6300State *d; uint8_t *pci_conf; if (!pci_bus) { fprintf(stderr, "wdt_i6300esb: no PCI bus in this machine\n"); return; } d = (I6300State *) pci_register_device (pci_bus, "i6300esb_wdt", sizeof (I6300State), -1, i6300esb_config_read, i6300esb_config_write); d->reboot_enabled = 1; d->clock_scale = CLOCK_SCALE_1KHZ; d->int_type = INT_TYPE_IRQ; d->free_run = 0; d->locked = 0; d->enabled = 0; d->timer = qemu_new_timer(vm_clock, i6300esb_timer_expired, d); d->timer1_preload = 0xfffff; d->timer2_preload = 0xfffff; d->stage = 1; d->unlock_state = 0; d->previous_reboot_flag = 0; pci_conf = d->dev.config; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_ESB_9); pci_config_set_class(pci_conf, PCI_CLASS_SYSTEM_OTHER); pci_conf[0x0e] = 0x00; pci_register_bar(&d->dev, 0, 0x10, PCI_ADDRESS_SPACE_MEM, i6300esb_map); register_savevm("i6300esb_wdt", -1, sizeof(I6300State), i6300esb_save, i6300esb_load, d); }
1threat
Filter prometheus results by metric value, not by label value : <p>Because <a href="https://stackoverflow.com/questions/38783424/prometheus-topk-returns-more-results-than-expected">Prometheus topk returns more results than expected</a>, and because <a href="https://github.com/prometheus/prometheus/issues/586" rel="noreferrer">https://github.com/prometheus/prometheus/issues/586</a> requires client-side processing that has not yet been made available via <a href="https://github.com/grafana/grafana/issues/7664" rel="noreferrer">https://github.com/grafana/grafana/issues/7664</a>, I'm trying to pursue a different near-term work-around to my similar problem.</p> <p>In my particular case most of the metric values that I want to graph will be zero most of the time. Only when they are above zero are they interesting.</p> <p>I can find ways to write prometheus queries to filter data points based on the value of a <em>label</em>, but I haven't yet been able to find a way to tell prometheus to return time series data points only if the value of the <em>metric</em> meets a certain condition. In my case, I want to filter for a value greater than zero.</p> <p>Can I add a condition to a prometheus query that filters data points based on the metric value? If so, where can I find an example of the syntax to do that?</p>
0debug
AWS Elastic Beanstalk: Add custom logs to CloudWatch? : <p>How to add custom logs to CloudWatch? Defaults logs are sent but how to add a custom one?</p> <p>I already added a file like this: (in .ebextensions) </p> <pre><code>files: "/opt/elasticbeanstalk/tasks/bundlelogs.d/applogs.conf" : mode: "000755" owner: root group: root content: | /var/app/current/logs/* "/opt/elasticbeanstalk/tasks/taillogs.d/cloud-init.conf" : mode: "000755" owner: root group: root content: | /var/app/current/logs/* </code></pre> <p>As I did bundlelogs.d and taillogs.d these custom logs are now tailed or retrieved from the console or web, that's nice but they don't persist and are not sent on CloudWatch.</p> <p>In CloudWatch I have the defaults logs like<br> <code>/aws/elasticbeanstalk/InstanceName/var/log/eb-activity.log</code><br> And I want to have another one like this<br> <code>/aws/elasticbeanstalk/InstanceName/var/app/current/logs/mycustomlog.log</code></p>
0debug
Capturing a lambda in another lambda can violate const qualifiers : <p>Consider the following code:</p> <pre><code>int x = 3; auto f1 = [x]() mutable { return x++; }; auto f2 = [f1]() { return f1(); }; </code></pre> <p>This will not compile, because <code>f1()</code> is not const, and <code>f2</code> is not declared as mutable. Does this mean that if I have a library function that accepts an arbitrary function argument and captures it in a lambda, I always need to make that lambda mutable, because I don't know what users can pass in? Notably, wrapping <code>f1</code> in <code>std::function</code> seems to resolve this problem (how?).</p>
0debug
Overwrite only some partitions in a partitioned spark Dataset : <p>How can we overwrite a partitioned dataset, but only the partitions we are going to change? For example, recomputing last week daily job, and only overwriting last week of data.</p> <p>Default Spark behaviour is to overwrite the whole table, even if only some partitions are going to be written.</p>
0debug
How to fix C3861: '...': identifier not found : <p>I want to create a game minesweeper using visual studio. Project visual c++ Win32 Console Application. Source file C++ file(.cpp) This is my source code</p> <pre><code>#define _CRT_SECURE_NO_WARNINGS #include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;cstdlib&gt; #include &lt;conio.h&gt; #include &lt;time.h&gt; int menu()//menampilkan menu { int x; printf("\nThe Minesweeper for You\n\n"); printf("&lt;&lt;Main Menu&gt;&gt;\n\n"); printf("1.Start\n"); printf("2.Exit\n\n"); printf("Masukkan pilihan : "); scanf("%i", &amp;x); while ((x&lt;1) || (x&gt;2)) { printf("Pilihan Invalid !\n"); printf("Masukkan pilihan : \n"); scanf("%i", &amp;x); } printf("\n"); return x; } void cek(int board[15][15], int revealed[15][15], int x, int y)//mengecek saat board[x][y] berisi 0 { //Kamus lokal int i, j; revealed[x][y] = 1; //Algoritma for (i = x - 1; i&lt;x + 2; i++) { for (j = y - 1; j&lt;y + 2; j++) { if (i &gt;= 0 &amp;&amp; j &gt;= 0 &amp;&amp; i&lt;15 &amp;&amp; j&lt;15) { if (revealed[i][j] == 0 &amp;&amp; board[i][j] != 0) { revealed[i][j] = 1; } } } } for (i = x - 1; i&lt;x + 2; i++) { for (j = y - 1; j&lt;y + 2; j++) { if (i &gt;= 0 &amp;&amp; j &gt;= 0 &amp;&amp; i&lt;15 &amp;&amp; j&lt;15) { if (revealed[i][j] == 0 &amp;&amp; board[i][j] == 0) { cek(board, revealed, i, j); } } } } } int klik(int board[15][15], int revealed[15][15], char kondisi[15][15]) { //Kamus lokal int a, b, x, y, q, z; //Algoritma do { printf("X: "); scanf("%i", &amp;y); printf("y: "); scanf("%i", &amp;x); } while (x&lt;1 || y&lt;1 || x&gt;15 || y&gt;15); x--; y--;//konfersi ke matriks yg dari 0 sampai 14 if (kondisi[x][y] == 'F') { } else if (board[x][y] == 9) { for (a = 0; a&lt;15; a++)for (b = 0; b&lt;15; b++) { if (board[a][b] == 9)revealed[a][b] = 1; } z = 1; } else if (board[x][y] == 0) { revealed[x][y] = 1; //revealed 1 terbuka cek(board, revealed, x, y); } else{ revealed[x][y] = 1; } for (a = 0; a&lt;15; a++) { for (b = 0; b&lt;15; b++) if (revealed[a][b] == 1) { switch (board[a][b]) { case 0: kondisi[a][b] = '0'; break; case 1: kondisi[a][b] = '1'; break; case 2: kondisi[a][b] = '2'; break; case 3: kondisi[a][b] = '3'; break; case 4: kondisi[a][b] = '4'; break; case 5: kondisi[a][b] = '5'; break; case 6: kondisi[a][b] = '6'; break; case 7: kondisi[a][b] = '7'; break; case 8: kondisi[a][b] = '8'; break; case 9: kondisi[a][b] = '#'; break; } } } q = jumlhbuka(revealed, kondisi); if (z == 1){ return 1; } else if (q &gt;= 200){ z = 2; } else{ z = 0; } return z; } int jumlhbuka(int revealed[15][15], char kondisi[15][15]) { int a, b, q = 0; for (a = 0; a&lt;15; a++) { for (b = 0; b&lt;15; b++) { if (revealed[a][b] == 1 &amp;&amp; kondisi[a][b] != '#'){ q = q + 1; } } } return q; } void flag(char kondisi[15][15], int revealed[15][15]) { //Kamus lokal int x, y; //Algoritma do { printf("X: "); scanf("%i", &amp;y); printf("y: "); scanf("%i", &amp;x); } while (x&lt;1 || y&lt;1 || x&gt;15 || y&gt;15); if (revealed[x - 1][y - 1] == 0)//board = 0 tertutup { kondisi[x - 1][y - 1] = 'F'; } } void rflag(char kondisi[15][15], int revealed[15][15]) { //Kamus lokal int x, y; //Algoritma do { printf("X: "); scanf("%i", &amp;y); printf("y: "); scanf("%i", &amp;x); } while (x&lt;1 || y&lt;1 || x&gt;15 || y&gt;15); if (kondisi[x - 1][y - 1] == 'F') //jika kondisinya sedang flag { kondisi[x - 1][y - 1] = '_'; } } void random(int A[15][15]) { //Kamus lokal srand((unsigned)time(NULL)); int a, b, c = 0; //Algoritma for (a = 0; a&lt;15; a++){ for (b = 0; b&lt;15; b++){ A[a][b] = 0; } } while (c&lt;25) { for (a = 0; a&lt;15 &amp;&amp; c&lt;25; a++) { for (b = 0; b&lt;15 &amp;&amp; c&lt;25; b++) { if (A[a][b] != 9) { A[a][b] = rand() % 10; if (A[a][b] == 9){ c++; } else{ A[a][b] = 0; } } } } } } void PasangBom(int board[15][15])//mengisi board dengan 0-9. 9 maka berisi bom dan 0 maka kosong { //Kamus lokal int x, y, a, i, j; a = 25; //Algoritma random(board);//isi board dengan 9 sebagai bom dan yang lain 0; for (x = 0; x&lt;15; x++) for (y = 0; y&lt;15; y++) if (board[y][x] == 9) { if ((y - 1) &gt;= 0) if (board[y - 1][x] != 9) board[y - 1][x]++; if ((y - 1) &gt;= 0 &amp;&amp; (x - 1) &gt;= 0) if (board[y - 1][x - 1] != 9) board[y - 1][x - 1]++; if ((x - 1) &gt;= 0) if (board[y][x - 1] != 9) board[y][x - 1]++; if ((y + 1) &lt; 15) if (board[y + 1][x] != 9) board[y + 1][x]++; if ((y + 1) &lt; 15 &amp;&amp; (x + 1) &lt; 15) if (board[y + 1][x + 1] != 9) board[y + 1][x + 1]++; if ((x + 1) &lt; 15) if (board[y][x + 1] != 9) board[y][x + 1]++; if ((y - 1) &gt;= 0 &amp;&amp; (x + 1) &lt; 15) if (board[y - 1][x + 1] != 9) board[y - 1][x + 1]++; if ((y + 1) &lt; 15 &amp;&amp; (x - 1) &gt;= 0) if (board[y + 1][x - 1] != 9) board[y + 1][x - 1]++; } } void Tampilkar(char x[15][15]) { //Kamus lokal int a = 0; int b = 0; //Algoritma printf(" y\\x"); while (b&lt;15) { if (b&lt;9){ printf("_%i__", b + 1); } else{ printf("%i__", b + 1); } b = b + 1; } printf("\n"); while (a&lt;15) { b = 0; if (a&lt;9){ printf(" %i", a + 1); } else{ printf("%i", a + 1); } while (b&lt;15){ printf("_|_%c", x[a][b]); b = b + 1; } printf("_|\n"); a = a + 1; } printf("\n"); } void Tampilang(int x[15][15]) { //Kamus lokal int a = 0; int b = 0; //Algoritma printf(" y\\x"); while (b&lt;15) { if (b&lt;9){ printf("_%i__", b + 1); } else{ printf("%i__", b + 1); } b = b + 1; } printf("\n"); while (a&lt;15) { b = 0; if (a&lt;9){ printf(" %i", a + 1); } else{ printf("%i", a + 1); } while (b&lt;15){ printf(" | %i", x[a][b]); b = b + 1; } printf(" |\n"); a = a + 1; } printf("\n"); } void start() { //Kamus lokal int a, b, x, y, z, jbuka; int jk = 0;//jumlah klik, int dead = 0;//0 masih main, 1 kalah, 2 menang , 4 keluar(stop) int board[15][15]; int revealed[15][15]; char kondisi[15][15]; //Algoritma PasangBom(board); for (a = 0; a&lt;15; a++)for (b = 0; b&lt;15; b++)revealed[a][b] = 0;//mengkosongkan parameter buka for (a = 0; a&lt;15; a++)for (b = 0; b&lt;15; b++)kondisi[a][b] = '_';//mengkosongkan tampilan awal Tampilkar(kondisi); while (dead == 0) { do{ printf("1.Klik\n"); printf("2.Flag\n"); printf("3.Remove Flag\n"); printf("4.Stop\n"); printf("Masukkan pilihan : "); scanf("%i", &amp;z); } while (z&lt;1 || (z&gt;4 &amp;&amp; z != 2357)); switch (z) { case 1: dead = klik(board, revealed, kondisi); jk++; break; case 2: flag(kondisi, revealed); jk++; break; case 3: rflag(kondisi, revealed); jk++; break; case 4: system("cls"); dead = 4; break; case 2357: //Cheat untuk melihat seluruh isi bom di minesweeper bila user memasukkan angka 2357 Tampilang(board); break; } if (z != 4) Tampilkar(kondisi); } jbuka = jumlhbuka(revealed, kondisi); if (dead == 1) { printf("\nANDA MENGENAI BOMB!!! \n\n"); } else if (dead == 2) { printf("\nANDA MENANG!!! :)\n\n"); } system("cls"); } int main() { int a, x; a = 1; while (a == 1) { printf("========================================\n"); printf(" # # # # # ##### ##### SWEEPER\n"); printf(" ## ## # ## # # # SWEEPER\n"); printf(" # # # # # # # # ##### ##### SWEEPER\n"); printf(" # # # # # ## # # SWEEPER\n"); printf(" # # # # # ##### ##### SWEEPER\n"); printf("========================================\n\n"); x = menu(); switch (x){ case 1: system("cls"); start(); break; case 2: system("cls"); a = 0; printf("\nThanks for Playing Our Game!!!\n\n"); } } } </code></pre> <p>And i get this error Error C3861: 'jumlhbuka': identifier not found I try googling how to fix C3861 snd try the solution still failed :( Please help me to fix it, i hope someone can fix it Thanks guys :) </p>
0debug
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
1threat
How to compile C++ codes in Linux with source files hidden? : <p>Is there anyway to compile C++ source files in Linux and make these files unreadable to users? Either have the files encrypted or read them into memory is acceptable. We are developing a Linux based software and we don't want our users to have direct access to our source code files.</p>
0debug
Wich graphical libraries are used by Node-red to draw drag & drop nodes and also their connections : Wich graphical libraries are used by Node-red to draw drag & drop nodes and also their connections. I need to design a similar UI and found node red the best of all. This is why I'm asking this question. Thanks
0debug
geom_blank drops NA : <p>Using <code>geom_blank</code> I want to add some new factor levels, but I can't seem to do this <em>and</em> keep the <code>NA</code> level</p> <pre><code>library('ggplot2') pl &lt;- ggplot(data.frame(x = factor(c(1:2, NA)), y = 1), aes(x, y)) + geom_point() pl </code></pre> <p><a href="https://i.stack.imgur.com/DrAES.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DrAES.png" alt="enter image description here"></a></p> <pre><code>pl + geom_blank(data = data.frame(x = addNA(factor(c(0:3, NA))), y = 1)) </code></pre> <p><a href="https://i.stack.imgur.com/eFlWE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eFlWE.png" alt="enter image description here"></a></p> <p>I would like to have the x at 0,1,2,3,NA using <code>geom_blank</code></p>
0debug
C++ Debug Assertion Failed Vector Subscript out of range : <p>i've got some code that i've written using a 2d vector instead of a 2d array however when i go to run it all it says is "vector subscript out of range". any help is appreciated.</p> <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; using namespace std; int mapx, mapy = 5; vector&lt;vector&lt;int&gt;&gt; map(mapx, vector&lt;int&gt; (mapy, 0)); int i, x; int main(){ for (i = 0; i &lt; map.size(); i++){ for (x = 0; x &lt; map[i].size(); x++) { map[i][x] = i + x; } } cout &lt;&lt; map[0][0]; cin &gt;&gt; i; return 0; } </code></pre>
0debug
static void FUNC(dequant)(int16_t *coeffs, int16_t log2_size) { int shift = 15 - BIT_DEPTH - log2_size; int x, y; int size = 1 << log2_size; if (shift > 0) { int offset = 1 << (shift - 1); for (y = 0; y < size; y++) { for (x = 0; x < size; x++) { *coeffs = (*coeffs + offset) >> shift; coeffs++; } } } else { for (y = 0; y < size; y++) { for (x = 0; x < size; x++) { *coeffs = *coeffs << -shift; coeffs++; } } } }
1threat
How to pin a website to windows taskbar programmatically using javascript? : <p>I can't use drag and drop method. I have gone through the jquery pinify plugin, but what I understood is that, it only encourage user to pin website using drag and drop using intelligent popups rather than doing it on it's own. Is this even possible?</p>
0debug
Angular MatPaginator not working : <p>I have 2 components. Both have mat-table and paginators and pagination is working for one component and not working for the other component though the code is similar. Below is my html:</p> <pre><code>&lt;div class="mat-elevation-z8"&gt; &lt;mat-table [dataSource]="dataSource" matSort&gt; &lt;ng-container matColumnDef="col1"&gt; &lt;mat-header-cell *matHeaderCellDef mat-sort-header&gt; Column1 &lt;/mat-header-cell&gt; &lt;mat-cell *matCellDef="let row"&gt; {{row.col1}} &lt;/mat-cell&gt; &lt;/ng-container&gt; &lt;ng-container matColumnDef="col2"&gt; &lt;mat-header-cell *matHeaderCellDef mat-sort-header&gt; Column2 &lt;/mat-header-cell&gt; &lt;mat-cell *matCellDef="let row"&gt; {{row.col2}} &lt;/mat-cell&gt; &lt;/ng-container&gt; &lt;!-- Different columns goes here --&gt; &lt;mat-header-row *matHeaderRowDef="displayedColumns"&gt;&lt;/mat-header-row&gt; &lt;mat-row *matRowDef="let row; columns: displayedColumns;"&gt; &lt;/mat-row&gt; &lt;/mat-table&gt; &lt;mat-paginator #scheduledOrdersPaginator [pageSizeOptions]="[5, 10, 20]"&gt;&lt;/mat-paginator&gt; &lt;/div&gt; </code></pre> <p>And below is my code in component.ts:</p> <pre><code>dataSource: MatTableDataSource&lt;any&gt;; displayedColumns = ['col1', 'col2', ... ]; @ViewChild('scheduledOrdersPaginator') paginator: MatPaginator; @ViewChild(MatSort) sort: MatSort; ngOnInit(): void { // Load data this.dataSource = new MatTableDataSource(somearray); this.dataSource.paginator = this.paginator; this.dataSource.sort = this.sort; } </code></pre> <p>Similar code is working for the other component and table is getting rendered with the pagination properly, no clue what's wrong with this code.</p> <p>Any help would be really appreciated</p>
0debug
How to use arrays in VBA functions? : <p>I need to do public function that takes values from certain array and computes f(x) function for every x, where f(x) = x^3 + 1/5x +2. <a href="http://i.stack.imgur.com/k8yrC.jpg" rel="nofollow">this is what I am doing but doesnt work</a> </p>
0debug
Local Server for Gaming C# : <p>[C#] Hello all, I am curious on how I can go about creating my own local server and allowing people outside to connect an return data stored on it. I am not looking for an "XNA" solution. I would like to kind of digest the bare bones of client to server. Here is an outline for what I am looking for:</p> <p>My PC [Server] -> Constantly Updates/Receives Player data so it can be obtained by other PC's. Stores data from other clients.</p> <p>[Client PC] -> Writes to server (Creates new player data/updates) and obtains further information to update visuals, other players, etc. </p>
0debug
static void e1000_reset(void *opaque) { E1000State *d = opaque; qemu_del_timer(d->autoneg_timer); memset(d->phy_reg, 0, sizeof d->phy_reg); memmove(d->phy_reg, phy_reg_init, sizeof phy_reg_init); memset(d->mac_reg, 0, sizeof d->mac_reg); memmove(d->mac_reg, mac_reg_init, sizeof mac_reg_init); d->rxbuf_min_shift = 1; memset(&d->tx, 0, sizeof d->tx); if (d->nic->nc.link_down) { e1000_link_down(d); } d->mac_reg[RA] = 0; d->mac_reg[RA + 1] = E1000_RAH_AV; for (i = 0; i < 4; i++) { d->mac_reg[RA] |= macaddr[i] << (8 * i); d->mac_reg[RA + 1] |= (i < 2) ? macaddr[i + 4] << (8 * i) : 0; } }
1threat
wrap code in R Studio text editor : <p>How can one wrap commands within a lengthy line of code in the text editor in RStudio such that RStudio recognizes it as the continuation of a single piece of code? Currently, my code is 1 incredibly long line that is difficult to manage. With my current RStudio configuration, "Enter" seems to establish a new and separate line of code (without an indent) that RStudio doesn't process correctly because it begins with a "+".</p> <p>Soft wrap (auto wrap based upon width of the text editor window) is not what I'm looking for.</p> <p>Example what what I'm trying to achieve:</p> <pre><code>ggplot(C, aes(x=Tenure, y = Count, color=Gender, shape=Gender)) + geom_point(size=1) + geom_smooth(aes(fill=Gender)) + labs(x="Tenure", y="Closeness") + ggtitle("Title") </code></pre> <p>Shift + Enter and Control + Enter are not doing the trick.</p>
0debug
StackOverflowError when calling method of subclass object? : <p>Executing the Test class gives a StackOverFlow error :( </p> <p>Parent class : </p> <pre><code>package Pack; public class Alpha { protected void sayHi() { System.out.println("Hi...from Alpha"); } } </code></pre> <p>Child class : </p> <pre><code>import Pack.Alpha; public class AlphaSub extends Alpha { AlphaSub sb=new AlphaSub() ; void hi() { sb.sayHi() ; } } </code></pre> <p>Test class : </p> <pre><code>public class test { public static void main(String[] args) { AlphaSub ob=new AlphaSub() ; ob.hi() ; } </code></pre> <p>}</p>
0debug
Capture updated text from h tag after change in input field : <p>I am new to Javascript.So please excuse me if I am asking anything silly. I have a sample Shiny application <a href="https://avinashr.shinyapps.io/statistics_dashboard/" rel="nofollow noreferrer">Statistics Dashboard</a> which can be used to find some basic statistical measures such as Mean, Median etc. for any metric. Users have to upload a csv file based on which the dashboard selects all the numeric variables within the file and provides an option to select any numeric variable to analyze as a dropdown. I want to add a javascript code in the application which will capture the updated measures (e.g. mean) after a user has selected a particular dimension from the dropdown. For example, suppose the default selected dimension in the dropdown window is "sales" and the corresponding mean is 325. If I select another dimension (suppose) "profit" then the mean changes to 37. Now I want to add a javascript/jquery code which will capture the mean value of 37 when I select "profit" (from "sales") from the dropdown. I have tried the <strong>.change</strong> event to check for the change in the dropdown selection and when there is a change, capture the mean value inside the <strong>h3</strong> tag. However, I am getting the previous mean value instead of the updated one i.e. I am getting 325 instead of 37 when I select "profit" (from "sales"). Hope I am clear on this. </p> <p>Am I using the wrong event? How can I capture anything after a certain action occurs and the values are updated? </p> <p>Feel free to let me know if you need any more details on my query. Looking forward to the help from the community.</p>
0debug
Can a website block user depending on their behaviour or give 404 error to that user? : <ol> <li>Like if user is giving wrong index continues for like SQL injection</li> <li>OR Like if user is giving wrong index continues for like DOS attack</li> <li>Or if i don't want any visitors from certain country I just wanna know weather it's possible or not, if yes how it works?</li> </ol>
0debug
How to bypass ssl certificate checking in java : <p>I want access a SOAP webservice url having https hosted in a remote vm. I am getting an exception while accessing it using HttpURLConnection.</p> <p>Here's my code:</p> <pre><code>import javax.net.ssl.*; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; /** * Created by prasantabiswas on 07/03/17. */ public class Main { public static void main(String [] args) { try { URL url = new URL("https://myhost:8913/myservice/service?wsdl"); HttpURLConnection http = null; if (url.getProtocol().toLowerCase().equals("https")) { trustAllHosts(); HttpsURLConnection https = (HttpsURLConnection) url.openConnection(); https.setHostnameVerifier(DO_NOT_VERIFY); http = https; } else { http = (HttpURLConnection) url.openConnection(); } String SOAPAction=""; // http.setRequestProperty("Content-Length", String.valueOf(b.length)); http.setRequestProperty("Content-Type", "text/xml; charset=utf-8"); http.setRequestProperty("SOAPAction", SOAPAction); http.setRequestMethod("GET"); http.setDoOutput(true); http.setDoInput(true); OutputStream out = http.getOutputStream(); } catch (Exception e) { e.printStackTrace(); } } final static HostnameVerifier DO_NOT_VERIFY = new HostnameVerifier() { public boolean verify(String hostname, SSLSession session) { return true; } }; private static void trustAllHosts() { // Create a trust manager that does not validate certificate chains TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { public java.security.cert.X509Certificate[] getAcceptedIssuers() { return new java.security.cert.X509Certificate[] {}; } public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { } public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { } } }; // Install the all-trusting trust manager try { SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, trustAllCerts, new java.security.SecureRandom()); HttpsURLConnection .setDefaultSSLSocketFactory(sc.getSocketFactory()); } catch (Exception e) { e.printStackTrace(); } } } </code></pre> <p>I'm getting the following exception:</p> <pre><code>javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: Certificates does not conform to algorithm constraints at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1949) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296) at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1509) at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216) at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979) at sun.security.ssl.Handshaker.process_record(Handshaker.java:914) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387) at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1283) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1258) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250) at Main.main(Main.java:35) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) Caused by: java.security.cert.CertificateException: Certificates does not conform to algorithm constraints at sun.security.ssl.AbstractTrustManagerWrapper.checkAlgorithmConstraints(SSLContextImpl.java:1055) at sun.security.ssl.AbstractTrustManagerWrapper.checkAdditionalTrust(SSLContextImpl.java:981) at sun.security.ssl.AbstractTrustManagerWrapper.checkServerTrusted(SSLContextImpl.java:923) at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1491) ... 18 more </code></pre> <p>Tried different solution from the google search, Non of them worked. I want to avoid using keytool because I will be running my tests on different vm.</p> <p>Does anyone have any solution for this?</p>
0debug
int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { AVFrame *frame = data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MJpegDecodeContext *s = avctx->priv_data; const uint8_t *buf_end, *buf_ptr; const uint8_t *unescaped_buf_ptr; int hshift, vshift; int unescaped_buf_size; int start_code; int i, index; int ret = 0; int is16bit; av_dict_free(&s->exif_metadata); av_freep(&s->stereo3d); s->adobe_transform = -1; buf_ptr = buf; buf_end = buf + buf_size; while (buf_ptr < buf_end) { start_code = ff_mjpeg_find_marker(s, &buf_ptr, buf_end, &unescaped_buf_ptr, &unescaped_buf_size); if (start_code < 0) { break; } else if (unescaped_buf_size > INT_MAX / 8) { av_log(avctx, AV_LOG_ERROR, "MJPEG packet 0x%x too big (%d/%d), corrupt data?\n", start_code, unescaped_buf_size, buf_size); return AVERROR_INVALIDDATA; } av_log(avctx, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%"PTRDIFF_SPECIFIER"\n", start_code, buf_end - buf_ptr); ret = init_get_bits8(&s->gb, unescaped_buf_ptr, unescaped_buf_size); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "invalid buffer\n"); goto fail; } s->start_code = start_code; if (s->avctx->debug & FF_DEBUG_STARTCODE) av_log(avctx, AV_LOG_DEBUG, "startcode: %X\n", start_code); if (start_code >= 0xd0 && start_code <= 0xd7) av_log(avctx, AV_LOG_DEBUG, "restart marker: %d\n", start_code & 0x0f); else if (start_code >= APP0 && start_code <= APP15) mjpeg_decode_app(s); else if (start_code == COM) mjpeg_decode_com(s); ret = -1; if (!CONFIG_JPEGLS_DECODER && (start_code == SOF48 || start_code == LSE)) { av_log(avctx, AV_LOG_ERROR, "JPEG-LS support not enabled.\n"); return AVERROR(ENOSYS); } if (avctx->skip_frame == AVDISCARD_ALL) { switch(start_code) { case SOF0: case SOF1: case SOF2: case SOF3: case SOF48: case SOI: case SOS: case EOI: break; default: goto skip; } } switch (start_code) { case SOI: s->restart_interval = 0; s->restart_count = 0; break; case DQT: ff_mjpeg_decode_dqt(s); break; case DHT: if ((ret = ff_mjpeg_decode_dht(s)) < 0) { av_log(avctx, AV_LOG_ERROR, "huffman table decode error\n"); goto fail; } break; case SOF0: case SOF1: s->lossless = 0; s->ls = 0; s->progressive = 0; if ((ret = ff_mjpeg_decode_sof(s)) < 0) goto fail; break; case SOF2: s->lossless = 0; s->ls = 0; s->progressive = 1; if ((ret = ff_mjpeg_decode_sof(s)) < 0) goto fail; break; case SOF3: s->avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS; s->lossless = 1; s->ls = 0; s->progressive = 0; if ((ret = ff_mjpeg_decode_sof(s)) < 0) goto fail; break; case SOF48: s->avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS; s->lossless = 1; s->ls = 1; s->progressive = 0; if ((ret = ff_mjpeg_decode_sof(s)) < 0) goto fail; break; case LSE: if (!CONFIG_JPEGLS_DECODER || (ret = ff_jpegls_decode_lse(s)) < 0) goto fail; break; case EOI: eoi_parser: s->cur_scan = 0; if (!s->got_picture) { av_log(avctx, AV_LOG_WARNING, "Found EOI before any SOF, ignoring\n"); break; } if (s->interlaced) { s->bottom_field ^= 1; if (s->bottom_field == !s->interlace_polarity) break; } if (avctx->skip_frame == AVDISCARD_ALL) { s->got_picture = 0; goto the_end_no_picture; } if ((ret = av_frame_ref(frame, s->picture_ptr)) < 0) return ret; *got_frame = 1; s->got_picture = 0; if (!s->lossless) { int qp = FFMAX3(s->qscale[0], s->qscale[1], s->qscale[2]); int qpw = (s->width + 15) / 16; AVBufferRef *qp_table_buf = av_buffer_alloc(qpw); if (qp_table_buf) { memset(qp_table_buf->data, qp, qpw); av_frame_set_qp_table(data, qp_table_buf, 0, FF_QSCALE_TYPE_MPEG1); } if(avctx->debug & FF_DEBUG_QP) av_log(avctx, AV_LOG_DEBUG, "QP: %d\n", qp); } goto the_end; case SOS: s->cur_scan++; if (avctx->skip_frame == AVDISCARD_ALL) break; if ((ret = ff_mjpeg_decode_sos(s, NULL, 0, NULL)) < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) goto fail; break; case DRI: mjpeg_decode_dri(s); break; case SOF5: case SOF6: case SOF7: case SOF9: case SOF10: case SOF11: case SOF13: case SOF14: case SOF15: case JPG: av_log(avctx, AV_LOG_ERROR, "mjpeg: unsupported coding type (%x)\n", start_code); break; } skip: buf_ptr += (get_bits_count(&s->gb) + 7) / 8; av_log(avctx, AV_LOG_DEBUG, "marker parser used %d bytes (%d bits)\n", (get_bits_count(&s->gb) + 7) / 8, get_bits_count(&s->gb)); } if (s->got_picture && s->cur_scan) { av_log(avctx, AV_LOG_WARNING, "EOI missing, emulating\n"); goto eoi_parser; } av_log(avctx, AV_LOG_FATAL, "No JPEG data found in image\n"); return AVERROR_INVALIDDATA; fail: s->got_picture = 0; return ret; the_end: is16bit = av_pix_fmt_desc_get(s->avctx->pix_fmt)->comp[0].step > 1; if (AV_RB32(s->upscale_h)) { int p; av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVJ444P || avctx->pix_fmt == AV_PIX_FMT_YUV444P || avctx->pix_fmt == AV_PIX_FMT_YUVJ440P || avctx->pix_fmt == AV_PIX_FMT_YUV440P || avctx->pix_fmt == AV_PIX_FMT_YUVA444P || avctx->pix_fmt == AV_PIX_FMT_YUVJ420P || avctx->pix_fmt == AV_PIX_FMT_YUV420P || avctx->pix_fmt == AV_PIX_FMT_YUV420P16|| avctx->pix_fmt == AV_PIX_FMT_YUVA420P || avctx->pix_fmt == AV_PIX_FMT_YUVA420P16|| avctx->pix_fmt == AV_PIX_FMT_GBRP || avctx->pix_fmt == AV_PIX_FMT_GBRAP ); avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift); for (p = 0; p<4; p++) { uint8_t *line = s->picture_ptr->data[p]; int w = s->width; int h = s->height; if (!s->upscale_h[p]) continue; if (p==1 || p==2) { w = AV_CEIL_RSHIFT(w, hshift); h = AV_CEIL_RSHIFT(h, vshift); } if (s->upscale_v[p]) h = (h+1)>>1; av_assert0(w > 0); for (i = 0; i < h; i++) { if (s->upscale_h[p] == 1) { if (is16bit) ((uint16_t*)line)[w - 1] = ((uint16_t*)line)[(w - 1) / 2]; else line[w - 1] = line[(w - 1) / 2]; for (index = w - 2; index > 0; index--) { if (is16bit) ((uint16_t*)line)[index] = (((uint16_t*)line)[index / 2] + ((uint16_t*)line)[(index + 1) / 2]) >> 1; else line[index] = (line[index / 2] + line[(index + 1) / 2]) >> 1; } } else if (s->upscale_h[p] == 2) { if (is16bit) { ((uint16_t*)line)[w - 1] = ((uint16_t*)line)[(w - 1) / 3]; if (w > 1) ((uint16_t*)line)[w - 2] = ((uint16_t*)line)[w - 1]; } else { line[w - 1] = line[(w - 1) / 3]; if (w > 1) line[w - 2] = line[w - 1]; } for (index = w - 3; index > 0; index--) { line[index] = (line[index / 3] + line[(index + 1) / 3] + line[(index + 2) / 3] + 1) / 3; } } line += s->linesize[p]; } } } if (AV_RB32(s->upscale_v)) { int p; av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVJ444P || avctx->pix_fmt == AV_PIX_FMT_YUV444P || avctx->pix_fmt == AV_PIX_FMT_YUVJ422P || avctx->pix_fmt == AV_PIX_FMT_YUV422P || avctx->pix_fmt == AV_PIX_FMT_YUVJ420P || avctx->pix_fmt == AV_PIX_FMT_YUV420P || avctx->pix_fmt == AV_PIX_FMT_YUV440P || avctx->pix_fmt == AV_PIX_FMT_YUVJ440P || avctx->pix_fmt == AV_PIX_FMT_YUVA444P || avctx->pix_fmt == AV_PIX_FMT_YUVA420P || avctx->pix_fmt == AV_PIX_FMT_YUVA420P16|| avctx->pix_fmt == AV_PIX_FMT_GBRP || avctx->pix_fmt == AV_PIX_FMT_GBRAP ); avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift); for (p = 0; p < 4; p++) { uint8_t *dst; int w = s->width; int h = s->height; if (!s->upscale_v[p]) continue; if (p==1 || p==2) { w = AV_CEIL_RSHIFT(w, hshift); h = AV_CEIL_RSHIFT(h, vshift); } dst = &((uint8_t *)s->picture_ptr->data[p])[(h - 1) * s->linesize[p]]; for (i = h - 1; i; i--) { uint8_t *src1 = &((uint8_t *)s->picture_ptr->data[p])[i / 2 * s->linesize[p]]; uint8_t *src2 = &((uint8_t *)s->picture_ptr->data[p])[(i + 1) / 2 * s->linesize[p]]; if (src1 == src2 || i == h - 1) { memcpy(dst, src1, w); } else { for (index = 0; index < w; index++) dst[index] = (src1[index] + src2[index]) >> 1; } dst -= s->linesize[p]; } } } if (s->flipped) { int j; avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift); for (index=0; index<4; index++) { uint8_t *dst = s->picture_ptr->data[index]; int w = s->picture_ptr->width; int h = s->picture_ptr->height; if(index && index<3){ w = AV_CEIL_RSHIFT(w, hshift); h = AV_CEIL_RSHIFT(h, vshift); } if(dst){ uint8_t *dst2 = dst + s->picture_ptr->linesize[index]*(h-1); for (i=0; i<h/2; i++) { for (j=0; j<w; j++) FFSWAP(int, dst[j], dst2[j]); dst += s->picture_ptr->linesize[index]; dst2 -= s->picture_ptr->linesize[index]; } } } } if (s->adobe_transform == 0 && s->avctx->pix_fmt == AV_PIX_FMT_GBRAP) { int w = s->picture_ptr->width; int h = s->picture_ptr->height; for (i=0; i<h; i++) { int j; uint8_t *dst[4]; for (index=0; index<4; index++) { dst[index] = s->picture_ptr->data[index] + s->picture_ptr->linesize[index]*i; } for (j=0; j<w; j++) { int k = dst[3][j]; int r = dst[0][j] * k; int g = dst[1][j] * k; int b = dst[2][j] * k; dst[0][j] = g*257 >> 16; dst[1][j] = b*257 >> 16; dst[2][j] = r*257 >> 16; dst[3][j] = 255; } } } if (s->adobe_transform == 2 && s->avctx->pix_fmt == AV_PIX_FMT_YUVA444P) { int w = s->picture_ptr->width; int h = s->picture_ptr->height; for (i=0; i<h; i++) { int j; uint8_t *dst[4]; for (index=0; index<4; index++) { dst[index] = s->picture_ptr->data[index] + s->picture_ptr->linesize[index]*i; } for (j=0; j<w; j++) { int k = dst[3][j]; int r = (255 - dst[0][j]) * k; int g = (128 - dst[1][j]) * k; int b = (128 - dst[2][j]) * k; dst[0][j] = r*257 >> 16; dst[1][j] = (g*257 >> 16) + 128; dst[2][j] = (b*257 >> 16) + 128; dst[3][j] = 255; } } } if (s->stereo3d) { AVStereo3D *stereo = av_stereo3d_create_side_data(data); if (stereo) { stereo->type = s->stereo3d->type; stereo->flags = s->stereo3d->flags; } av_freep(&s->stereo3d); } av_dict_copy(avpriv_frame_get_metadatap(data), s->exif_metadata, 0); av_dict_free(&s->exif_metadata); the_end_no_picture: av_log(avctx, AV_LOG_DEBUG, "decode frame unused %"PTRDIFF_SPECIFIER" bytes\n", buf_end - buf_ptr); return buf_ptr - buf; }
1threat
static void socket_start_outgoing_migration(MigrationState *s, SocketAddressLegacy *saddr, Error **errp) { QIOChannelSocket *sioc = qio_channel_socket_new(); struct SocketConnectData *data = g_new0(struct SocketConnectData, 1); data->s = s; if (saddr->type == SOCKET_ADDRESS_LEGACY_KIND_INET) { data->hostname = g_strdup(saddr->u.inet.data->host); } qio_channel_set_name(QIO_CHANNEL(sioc), "migration-socket-outgoing"); qio_channel_socket_connect_async(sioc, saddr, socket_outgoing_migration, data, socket_connect_data_free); qapi_free_SocketAddressLegacy(saddr); }
1threat
Invalid access to memory location when deploying Azure web app : <p>I have an Azure web app that I'm deploying from VSTS. This was working fine previously but is now returning with the following:</p> <blockquote> <p>2018-08-07T14:24:57.1655319Z Info: Adding directory (dsadminportal-dev\wwwroot\assets\css\plugins\datapicker).</p> <p>2018-08-07T14:24:58.2654020Z ##[error]Failed to deploy web package to App Service.</p> <p>2018-08-07T14:24:58.2665943Z ##[error] Error: (8/7/2018 2:24:57 PM) An error occurred when the request was processed on the remote computer.</p> <p>Error: An error was encountered when processing operation 'Create Directory' on 'D:\home\site\wwwroot\wwwroot\assets\css\plugins\datapicker'. Error: The error code was 0x800703E6. Error: Invalid access to memory location.</p> <p>at Microsoft.Web.Deployment.NativeMethods.RaiseIOExceptionFromErrorCode(Win32ErrorCode errorCode, String maybeFullPath) at Microsoft.Web.Deployment.FileSystemInfoEx.set_Attributes(FileAttributes value) at Microsoft.Web.Deployment.DirPathProviderBase.Add(DeploymentObject source, Boolean whatIf) Error count: 1.</p> </blockquote> <p>This is to a slot. I deleted the slot and recreated it and it deployed fine first time but subsequent deploys fail with the above error.</p> <p>Any ideas what this means?</p> <p>Thanks</p>
0debug
int avpriv_adx_decode_header(AVCodecContext *avctx, const uint8_t *buf, int bufsize, int *header_size, int *coeff) { int offset, cutoff; if (bufsize < 24) return AVERROR_INVALIDDATA; if (AV_RB16(buf) != 0x8000) return AVERROR_INVALIDDATA; offset = AV_RB16(buf + 2) + 4; if (bufsize >= offset && memcmp(buf + offset - 6, "(c)CRI", 6)) return AVERROR_INVALIDDATA; if (buf[4] != 3 || buf[5] != 18 || buf[6] != 4) { av_log_ask_for_sample(avctx, "unsupported ADX format\n"); return AVERROR_PATCHWELCOME; } avctx->channels = buf[7]; if (avctx->channels > 2) return AVERROR_INVALIDDATA; avctx->sample_rate = AV_RB32(buf + 8); if (avctx->sample_rate < 1 || avctx->sample_rate > INT_MAX / (avctx->channels * BLOCK_SIZE * 8)) return AVERROR_INVALIDDATA; avctx->bit_rate = avctx->sample_rate * avctx->channels * BLOCK_SIZE * 8 / BLOCK_SAMPLES; if (coeff) { cutoff = AV_RB16(buf + 16); ff_adx_calculate_coeffs(cutoff, avctx->sample_rate, COEFF_BITS, coeff); } *header_size = offset; return 0; }
1threat
static inline void RENAME(bgr24ToY_mmx)(uint8_t *dst, const uint8_t *src, int width, enum PixelFormat srcFormat) { if(srcFormat == PIX_FMT_BGR24) { __asm__ volatile( "movq "MANGLE(ff_bgr24toY1Coeff)", %%mm5 \n\t" "movq "MANGLE(ff_bgr24toY2Coeff)", %%mm6 \n\t" : ); } else { __asm__ volatile( "movq "MANGLE(ff_rgb24toY1Coeff)", %%mm5 \n\t" "movq "MANGLE(ff_rgb24toY2Coeff)", %%mm6 \n\t" : ); } __asm__ volatile( "movq "MANGLE(ff_bgr24toYOffset)", %%mm4 \n\t" "mov %2, %%"REG_a" \n\t" "pxor %%mm7, %%mm7 \n\t" "1: \n\t" PREFETCH" 64(%0) \n\t" "movd (%0), %%mm0 \n\t" "movd 2(%0), %%mm1 \n\t" "movd 6(%0), %%mm2 \n\t" "movd 8(%0), %%mm3 \n\t" "add $12, %0 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "pmaddwd %%mm5, %%mm0 \n\t" "pmaddwd %%mm6, %%mm1 \n\t" "pmaddwd %%mm5, %%mm2 \n\t" "pmaddwd %%mm6, %%mm3 \n\t" "paddd %%mm1, %%mm0 \n\t" "paddd %%mm3, %%mm2 \n\t" "paddd %%mm4, %%mm0 \n\t" "paddd %%mm4, %%mm2 \n\t" "psrad $15, %%mm0 \n\t" "psrad $15, %%mm2 \n\t" "packssdw %%mm2, %%mm0 \n\t" "packuswb %%mm0, %%mm0 \n\t" "movd %%mm0, (%1, %%"REG_a") \n\t" "add $4, %%"REG_a" \n\t" " js 1b \n\t" : "+r" (src) : "r" (dst+width), "g" ((x86_reg)-width) : "%"REG_a ); }
1threat
Android Room + AsyncTask : <p>My team have developed a new Android app which makes extensive use of Room.</p> <p>I am unsure whether we are using AsyncTask correctly.</p> <p>We have had to wrap all calls to insert/update/delete in AsyncTasks which results in a huge number of AsyncTasks. All the calls into Room are from background services. There is no direct Room access from activities or fragments - they get everything via LiveData.</p> <p>An example call to insert a row:</p> <pre><code>AsyncTask.execute(() -&gt; myModelDAO.insertInstance(myModel)); </code></pre> <p>With this in the DAO:</p> <pre><code>@Insert void insertInstance(MyModel model); </code></pre>
0debug
How to cancel Alamofire.upload : <p>I am uploading images on server via <code>Alamofire.upload</code> as multipart data. Unlike <code>Alamofire.request</code> it's not returning <code>Request</code> object, which I usually use to cancel requests. </p> <p>But it's very reasonable to be able to cancel such a consuming requests like uploading. What are the options for this in Alamofire?</p>
0debug
static uint8_t get_tlm(Jpeg2000DecoderContext *s, int n) { uint8_t Stlm, ST, SP, tile_tlm, i; bytestream_get_byte(&s->buf); Stlm = bytestream_get_byte(&s->buf); ST = (Stlm >> 4) & 0x03; SP = (Stlm >> 6) & 0x01; tile_tlm = (n - 4) / ((SP + 1) * 2 + ST); for (i = 0; i < tile_tlm; i++) { switch (ST) { case 0: break; case 1: bytestream_get_byte(&s->buf); break; case 2: bytestream_get_be16(&s->buf); break; case 3: bytestream_get_be32(&s->buf); break; } if (SP == 0) { bytestream_get_be16(&s->buf); } else { bytestream_get_be32(&s->buf); } } return 0; }
1threat
How to replace a substring with another string in a column in pandas : <p>I have a column as below:</p> <pre><code>df['name'] 1 react trainer 2 react trainers 3 react trainer's </code></pre> <p>I need to replace the string trainers/trainer's to trainer:</p> <pre><code>1 react trainer 2 react trainer 3 react trainer </code></pre>
0debug
How can I make a c# application outside of visual studio? : <p>I'm very new to programming and I'm teaching myself. I made a calculator for some calculations we do in the lab I work in and wanted to be able to open the app from the computer at work instead of opening it on visual studio from my laptop. Just curious if this is possible, and I've been trying to Google if this is possible but I don't think I'm using the right words in my searches.</p> <p>If this is possible, it'd be awesome if someone could help me out with an explanation or a link to a video or thread that already explains this. </p> <p>Thank you for your time!!</p>
0debug
error while fetching data from DB : I have a table c_question in which I stored questions with autoincrement column _id, question, option1,option2,option3,correct_answer Now I want to retrieve the question on TextView and options on RadioGroup. If user selects correct option then question and options changes in the same XML. Logcat: fatal exception at main ..... cursorIndexOutOfBoundException/// Output showing the last data(Question with options) I entered in DB and if I click any option, the app crashes... Please help :) I'm new to Android SQLite DB// String row="SELECT* FROM c_question"; final Cursor c=db.rawQuery(row, null); c.moveToFirst(); if(c.moveToFirst()) { do { tv1.setText(c.getString(1)); r0=(RadioButton)findViewById(R.id.radio0); r0.setText(c.getString(2)); r1=(RadioButton)findViewById(R.id.radio1); r1.setText(c.getString(3)); r2=(RadioButton)findViewById(R.id.radio2); r2.setText(c.getString(4)); k.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub int idd=r.getCheckedRadioButtonId(); r0=(RadioButton)findViewById(idd); String r=r0.getText().toString(); if(r.equals(c.getString(5))) { Toast.makeText(QuestionsOn.this, "correct!!!", 123).show(); ; } else Toast.makeText(QuestionsOn.this, "Incorrect!!!", 123).show(); } }); } while(c.moveToNext()); }
0debug
Any way to visualize the transform origin point in CSS? : <p>I'm trying to make an object move along an arc, for which I need to set the <code>transform-origin</code> point away from the object itself and then <code>rotate</code> it. So instead of blindly moving the <code>transform-origin</code> point using different lengths and then finally achieving the desired result through trial and error, is there a way to make the point visible to make the process easier?</p>
0debug
php mysql category subcategory list link : <p>I want to like this</p> <p>Category1</p> <p>--Subcat1</p> <p>--Subcat2</p> <p>Category2</p> <p>--Subcat2</p> <p>I have two tables tbl_cat and tbl_subcat</p> <p>tbl_cat(id,cat_name)</p> <p>tbl_subcat(id,<strong>cat_id</strong>,subcat_name) </p> <blockquote> <p>cat_id=tbl_cat.id</p> </blockquote> <p>how to I write the function and display the category and sub-category link </p>
0debug
How to access class probabilities in keras? : <p>I am training a model for which I need to report class probabilities instead of a single classification. I have three classes and each training instance has either of the three classes assigned to it.</p> <p>I am trying to use Keras to create an MLP. But I can't figure how to extract the final class probabilities for each class. I am using this as my base example: <a href="http://machinelearningmastery.com/regression-tutorial-keras-deep-learning-library-python/" rel="noreferrer">http://machinelearningmastery.com/regression-tutorial-keras-deep-learning-library-python/</a></p> <p>Thanks !</p>
0debug
void helper_check_tlb_flush(CPUPPCState *env) { check_tlb_flush(env); }
1threat
static int RENAME(epzs_motion_search4)(MpegEncContext * s, int *mx_ptr, int *my_ptr, int P[10][2], int pred_x, int pred_y, uint8_t *src_data[3], uint8_t *ref_data[3], int stride, int uvstride, int16_t (*last_mv)[2], int ref_mv_scale, uint8_t * const mv_penalty) { int best[2]={0, 0}; int d, dmin; const int shift= 1+s->quarter_sample; uint32_t *map= s->me.map; int map_generation; const int penalty_factor= s->me.penalty_factor; const int size=1; const int h=8; const int ref_mv_stride= s->mb_stride; const int ref_mv_xy= s->mb_x + s->mb_y *ref_mv_stride; me_cmp_func cmp, chroma_cmp; LOAD_COMMON cmp= s->dsp.me_cmp[size]; chroma_cmp= s->dsp.me_cmp[size+1]; map_generation= update_map_generation(s); dmin = 1000000; if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_CLIPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift) }else{ CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift) if(dmin>64*2){ CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift) CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift) CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) CHECK_CLIPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) } } if(dmin>64*4){ CHECK_CLIPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) if(s->end_mb_y == s->mb_height || s->mb_y+1<s->end_mb_y) CHECK_CLIPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) } if(s->me.dia_size==-1) dmin= RENAME(funny_diamond_search)(s, best, dmin, src_data, ref_data, stride, uvstride, pred_x, pred_y, penalty_factor, shift, map, map_generation, size, h, mv_penalty); else if(s->me.dia_size<-1) dmin= RENAME(sab_diamond_search)(s, best, dmin, src_data, ref_data, stride, uvstride, pred_x, pred_y, penalty_factor, shift, map, map_generation, size, h, mv_penalty); else if(s->me.dia_size<2) dmin= RENAME(small_diamond_search)(s, best, dmin, src_data, ref_data, stride, uvstride, pred_x, pred_y, penalty_factor, shift, map, map_generation, size, h, mv_penalty); else dmin= RENAME(var_diamond_search)(s, best, dmin, src_data, ref_data, stride, uvstride, pred_x, pred_y, penalty_factor, shift, map, map_generation, size, h, mv_penalty); *mx_ptr= best[0]; *my_ptr= best[1]; return dmin; }
1threat
static int epic_decode_tile(ePICContext *dc, uint8_t *out, int tile_height, int tile_width, int stride) { int x, y; uint32_t pix; uint32_t *curr_row = NULL, *above_row = NULL, *above2_row; for (y = 0; y < tile_height; y++, out += stride) { above2_row = above_row; above_row = curr_row; curr_row = (uint32_t *) out; for (x = 0, dc->next_run_pos = 0; x < tile_width;) { if (dc->els_ctx.err) return AVERROR_INVALIDDATA; pix = curr_row[x - 1]; if (y >= 1 && x >= 2 && pix != curr_row[x - 2] && pix != above_row[x - 1] && pix != above_row[x - 2] && pix != above_row[x] && !epic_cache_entries_for_pixel(&dc->hash, pix)) { curr_row[x] = epic_decode_pixel_pred(dc, x, y, curr_row, above_row); x++; } else { int got_pixel, run; dc->stack_pos = 0; if (y < 2 || x < 2 || x == tile_width - 1) { run = 1; got_pixel = epic_handle_edges(dc, x, y, curr_row, above_row, &pix); } else got_pixel = epic_decode_run_length(dc, x, y, tile_width, curr_row, above_row, above2_row, &pix, &run); if (!got_pixel && !epic_predict_from_NW_NE(dc, x, y, run, tile_width, curr_row, above_row, &pix)) { uint32_t ref_pix = curr_row[x - 1]; if (!x || !epic_decode_from_cache(dc, ref_pix, &pix)) { pix = epic_decode_pixel_pred(dc, x, y, curr_row, above_row); if (x) { int ret = epic_add_pixel_to_cache(&dc->hash, ref_pix, pix); if (ret) return ret; } } } for (; run > 0; x++, run--) curr_row[x] = pix; } } } return 0; }
1threat
char *spapr_get_cpu_core_type(const char *model) { char *core_type; gchar **model_pieces = g_strsplit(model, ",", 2); core_type = g_strdup_printf("%s-%s", model_pieces[0], TYPE_SPAPR_CPU_CORE); g_strfreev(model_pieces); if (!object_class_by_name(core_type)) { const char *realmodel; g_free(core_type); realmodel = ppc_cpu_lookup_alias(model); if (realmodel) { return spapr_get_cpu_core_type(realmodel); } return NULL; } return core_type; }
1threat
Use plotly offline to generate graphs as images : <p>I am working with plotly offline and am able to generate an html file using</p> <pre><code>plotly.offline.plot({"data": data, "layout": layout}) </code></pre> <p>It works great. The graph is generated correctly and the html file gets saved to my current directory. </p> <p>What I want, though is, using plotly offline, is to have an image (.png, .jpg, etc.) file saved instead. Am I on the right track? What do I need to do from here?</p>
0debug
When should I do feature scaling or Normalisation in Machine learning? : I have a training feature set consisting of 92 features. Out of which 91 features are boolean value 1 or 0. But 1 feature is numerical vary from 3-2000. Will it be good if I do feature scaling on my 92nd feature? If Yes, what are the best possible ways to do it?
0debug
gen_intermediate_code_internal(SuperHCPU *cpu, TranslationBlock *tb, bool search_pc) { CPUState *cs = CPU(cpu); CPUSH4State *env = &cpu->env; DisasContext ctx; target_ulong pc_start; static uint16_t *gen_opc_end; CPUBreakpoint *bp; int i, ii; int num_insns; int max_insns; pc_start = tb->pc; gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE; ctx.pc = pc_start; ctx.flags = (uint32_t)tb->flags; ctx.bstate = BS_NONE; ctx.memidx = (ctx.flags & SR_MD) == 0 ? 1 : 0; ctx.delayed_pc = -1; ctx.tb = tb; ctx.singlestep_enabled = cs->singlestep_enabled; ctx.features = env->features; ctx.has_movcal = (ctx.flags & TB_FLAG_PENDING_MOVCA); ii = -1; num_insns = 0; max_insns = tb->cflags & CF_COUNT_MASK; if (max_insns == 0) max_insns = CF_COUNT_MASK; gen_tb_start(); while (ctx.bstate == BS_NONE && tcg_ctx.gen_opc_ptr < gen_opc_end) { if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) { QTAILQ_FOREACH(bp, &cs->breakpoints, entry) { if (ctx.pc == bp->pc) { tcg_gen_movi_i32(cpu_pc, ctx.pc); gen_helper_debug(cpu_env); ctx.bstate = BS_BRANCH; break; } } } if (search_pc) { i = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; if (ii < i) { ii++; while (ii < i) tcg_ctx.gen_opc_instr_start[ii++] = 0; } tcg_ctx.gen_opc_pc[ii] = ctx.pc; gen_opc_hflags[ii] = ctx.flags; tcg_ctx.gen_opc_instr_start[ii] = 1; tcg_ctx.gen_opc_icount[ii] = num_insns; } if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) gen_io_start(); #if 0 fprintf(stderr, "Loading opcode at address 0x%08x\n", ctx.pc); fflush(stderr); #endif ctx.opcode = cpu_lduw_code(env, ctx.pc); decode_opc(&ctx); num_insns++; ctx.pc += 2; if ((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0) break; if (cs->singlestep_enabled) { break; } if (num_insns >= max_insns) break; if (singlestep) break; } if (tb->cflags & CF_LAST_IO) gen_io_end(); if (cs->singlestep_enabled) { tcg_gen_movi_i32(cpu_pc, ctx.pc); gen_helper_debug(cpu_env); } else { switch (ctx.bstate) { case BS_STOP: case BS_NONE: if (ctx.flags) { gen_store_flags(ctx.flags | DELAY_SLOT_CLEARME); } gen_goto_tb(&ctx, 0, ctx.pc); break; case BS_EXCP: tcg_gen_exit_tb(0); break; case BS_BRANCH: default: break; } } gen_tb_end(tb, num_insns); *tcg_ctx.gen_opc_ptr = INDEX_op_end; if (search_pc) { i = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; ii++; while (ii <= i) tcg_ctx.gen_opc_instr_start[ii++] = 0; } else { tb->size = ctx.pc - pc_start; tb->icount = num_insns; } #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("IN:\n"); log_target_disas(env, pc_start, ctx.pc - pc_start, 0); qemu_log("\n"); } #endif }
1threat
static void ahci_reset_port(AHCIState *s, int port) { AHCIDevice *d = &s->dev[port]; AHCIPortRegs *pr = &d->port_regs; IDEState *ide_state = &d->port.ifs[0]; int i; DPRINTF(port, "reset port\n"); ide_bus_reset(&d->port); ide_state->ncq_queues = AHCI_MAX_CMDS; pr->scr_stat = 0; pr->scr_err = 0; pr->scr_act = 0; d->busy_slot = -1; d->init_d2h_sent = 0; ide_state = &s->dev[port].port.ifs[0]; if (!ide_state->bs) { return; for (i = 0; i < AHCI_MAX_CMDS; i++) { NCQTransferState *ncq_tfs = &s->dev[port].ncq_tfs[i]; if (ncq_tfs->aiocb) { bdrv_aio_cancel(ncq_tfs->aiocb); ncq_tfs->aiocb = NULL; qemu_sglist_destroy(&ncq_tfs->sglist); ncq_tfs->used = 0; s->dev[port].port_state = STATE_RUN; if (!ide_state->bs) { s->dev[port].port_regs.sig = 0; ide_state->status = SEEK_STAT | WRERR_STAT; } else if (ide_state->drive_kind == IDE_CD) { s->dev[port].port_regs.sig = SATA_SIGNATURE_CDROM; ide_state->lcyl = 0x14; ide_state->hcyl = 0xeb; DPRINTF(port, "set lcyl = %d\n", ide_state->lcyl); ide_state->status = SEEK_STAT | WRERR_STAT | READY_STAT; } else { s->dev[port].port_regs.sig = SATA_SIGNATURE_DISK; ide_state->status = SEEK_STAT | WRERR_STAT; ide_state->error = 1; ahci_init_d2h(d);
1threat
static int nbd_co_writev_1(NbdClientSession *client, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov, int offset) { struct nbd_request request = { .type = NBD_CMD_WRITE }; struct nbd_reply reply; ssize_t ret; if (!bdrv_enable_write_cache(client->bs) && (client->nbdflags & NBD_FLAG_SEND_FUA)) { request.type |= NBD_CMD_FLAG_FUA; } request.from = sector_num * 512; request.len = nb_sectors * 512; nbd_coroutine_start(client, &request); ret = nbd_co_send_request(client, &request, qiov, offset); if (ret < 0) { reply.error = -ret; } else { nbd_co_receive_reply(client, &request, &reply, NULL, 0); } nbd_coroutine_end(client, &request); return -reply.error; }
1threat
How to check the network status in react-native app : <p>i am struggling about this point, that if in my mobile i am in poor network connection, Some how i am calling the service, it will take more time to call the service</p> <ul> <li>Is there any possibility to increase the fetch timeout (or)</li> <li><p>How to tell the user that u are in poor internet connection.</p> <p>For checking of internet connection i used the networkInfo, But it help only for connection is there are or not, But it doesn't giving any information about the Speed of the network.</p></li> </ul> <p>If Possible can any one give me suggestions that, How can i solve this, Any help much appreciated I am using the <strong>react-native version:0.29.0</strong></p>
0debug
void sws_freeFilter(SwsFilter *filter) { if (!filter) return; if (filter->lumH) sws_freeVec(filter->lumH); if (filter->lumV) sws_freeVec(filter->lumV); if (filter->chrH) sws_freeVec(filter->chrH); if (filter->chrV) sws_freeVec(filter->chrV); av_free(filter); }
1threat
Need help trying to figure this out : <p>I have been trying to figure this out for 4 days now. I am new to this and just can't this to work like it should. Any help would be appreciated. </p> <p>*Not just looking for the answer</p> <ol> <li>The president of the company wants a list of all orders ever taken. He wants to see the customer name, the last name of the employee who took the order, the shipper who shipped the order, the product that was ordered, the quantity that was ordered, and the date on which the order was placed. [Hint: You will need to join the following tables: Customers, Employees, Shippers, Orders, OrderDetails, Products, and to get all of the necessary information.]</li> </ol>
0debug
How to shallow test a component with an `entryComponents`? : <p>For example, say you have the following component:</p> <pre><code>import { Another } from "./Another"; @Component({ entryComponents: [ Another ] }) export class App {} </code></pre> <p>Even when using <code>NO_ERRORS_SCHEMA</code> I still have to include <code>Another</code> as part of the test declarations:</p> <pre><code>import { ComponentFixture, TestBed } from "@angular/core/testing"; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { App } from "./App"; import { Another } from "./Another"; describe("App", () =&gt; { let comp: App; let fixture: ComponentFixture&lt;App&gt;; beforeEach(() =&gt; { TestBed.configureTestingModule({ declarations: [ App, Another ], schemas: [ NO_ERRORS_SCHEMA ] }); fixture = TestBed.createComponent(App); comp = fixture.componentInstance; }); it("can load instance", () =&gt; { expect(comp).toBeTruthy(); }); }); </code></pre>
0debug
stored procedure_ERROR : create or replace PROCEDURE Getstudentname( @firstname varchar(20), @lastname varchar (20), @e_mail varchar(20) ) as begin insert into TBL_STUDENTS(fanme,lname,email)values(@firstname,@lastname,@e_mail); end; What can be the error in this procedure. Procedure GETSTUDENTNAME compiled Errors: check compiler log And this sql query is also not working giving:- Error report - SQL Error: ORA-00936: missing expression 00936. 00000 - "missing expression" *Cause: *Action:
0debug
How to add spaces between two words using html? : <p>Suppose I have word Abhishek Mane I want to make this as follows Abhishek_____________________________ Mane. Underscore(_) indicates spaces that i want</p>
0debug
static void qtrle_decode_1bpp(QtrleContext *s, int stream_ptr, int row_ptr, int lines_to_change) { int rle_code; int pixel_ptr = 0; int row_inc = s->frame.linesize[0]; unsigned char pi0, pi1; unsigned char *rgb = s->frame.data[0]; int pixel_limit = s->frame.linesize[0] * s->avctx->height; int skip; while (lines_to_change) { CHECK_STREAM_PTR(2); skip = s->buf[stream_ptr++]; rle_code = (signed char)s->buf[stream_ptr++]; if (rle_code == 0) break; if(skip & 0x80) { lines_to_change--; row_ptr += row_inc; pixel_ptr = row_ptr + 2 * (skip & 0x7f); } else pixel_ptr += 2 * skip; CHECK_PIXEL_PTR(0); if (rle_code < 0) { rle_code = -rle_code; CHECK_STREAM_PTR(2); pi0 = s->buf[stream_ptr++]; pi1 = s->buf[stream_ptr++]; CHECK_PIXEL_PTR(rle_code * 2); while (rle_code--) { rgb[pixel_ptr++] = pi0; rgb[pixel_ptr++] = pi1; } } else { rle_code *= 2; CHECK_STREAM_PTR(rle_code); CHECK_PIXEL_PTR(rle_code); while (rle_code--) rgb[pixel_ptr++] = s->buf[stream_ptr++]; } } }
1threat
static int os_host_main_loop_wait(uint32_t timeout) { int ret; glib_select_fill(&nfds, &rfds, &wfds, &xfds, &timeout); if (timeout > 0) { qemu_mutex_unlock_iothread(); } gpollfds_from_select(); ret = g_poll((GPollFD *)gpollfds->data, gpollfds->len, timeout); gpollfds_to_select(ret); if (timeout > 0) { qemu_mutex_lock_iothread(); } glib_select_poll(&rfds, &wfds, &xfds, (ret < 0)); return ret; }
1threat
Core dumped trying to compile C++ Structure : When I try to run the code it asks for the first input, but next it show a core dumped. And I have some doubts, how can I correct that fgets warnings? And please if this code can be optimized please tell me, I`m trying to make efficient code :D Compile with these: g++ -O2 -Wall Proy2.cpp -o Proy2 Code: # include < cstdio > # include < iostream > using namespace std; int main(){ typedef struct PC{ char Brand[20]; char Model[20]; char Serial[20]; char Processor[10]; }; PC PC1[5],*machine; unsigned int i; for(i = 0; i < 4; i++){ cout <<"Insert PC brand: "; fgets(machine->Brand, 20, stdin); fflush(stdin); cout <<"Insert PC model: "; fgets(machine->Model, 20, stdin); fflush(stdin); cout <<"Insert PC serial: "; fgets(machine->Serial, 20, stdin); fflush(stdin); cout <<"Insert PC processor: "; fgets(machine->Processor, 10, stdin); fflush(stdin); printf("PC Brand : %s", PC1[i].Brand); printf("PC Model : %s", PC1[i].Model); printf("PC Serial : %s", PC1[i].Serial); printf("PC Processor: %s", PC1[i].Processor); PC1[i] = *machine; } return 0; }
0debug
uint32_t ff_celt_encode_band(CeltFrame *f, OpusRangeCoder *rc, const int band, float *X, float *Y, int N, int b, uint32_t blocks, float *lowband, int duration, float *lowband_out, int level, float gain, float *lowband_scratch, int fill) { const uint8_t *cache; int dualstereo, split; int imid = 0, iside = 0; int N_B; int B0 = blocks; int time_divide = 0; int recombine = 0; int inv = 0; float mid = 0, side = 0; int longblocks = (B0 == 1); uint32_t cm = 0; split = dualstereo = (Y != NULL); if (N == 1) { int i; float *x = X; for (i = 0; i <= dualstereo; i++) { if (f->remaining2 >= 1<<3) { ff_opus_rc_put_raw(rc, x[0] < 0, 1); f->remaining2 -= 1 << 3; b -= 1 << 3; } x = Y; } if (lowband_out) lowband_out[0] = X[0]; return 1; } if (!dualstereo && level == 0) { int tf_change = f->tf_change[band]; int k; if (tf_change > 0) recombine = tf_change; if (lowband && (recombine || ((N_B & 1) == 0 && tf_change < 0) || B0 > 1)) { int j; for (j = 0; j < N; j++) lowband_scratch[j] = lowband[j]; lowband = lowband_scratch; } for (k = 0; k < recombine; k++) { celt_haar1(X, N >> k, 1 << k); fill = ff_celt_bit_interleave[fill & 0xF] | ff_celt_bit_interleave[fill >> 4] << 2; } blocks >>= recombine; N_B <<= recombine; while ((N_B & 1) == 0 && tf_change < 0) { celt_haar1(X, N_B, blocks); fill |= fill << blocks; blocks <<= 1; N_B >>= 1; time_divide++; tf_change++; } B0 = blocks; if (B0 > 1) celt_deinterleave_hadamard(f->scratch, X, N_B >> recombine, B0 << recombine, longblocks); } cache = ff_celt_cache_bits + ff_celt_cache_index[(duration + 1) * CELT_MAX_BANDS + band]; if (!dualstereo && duration >= 0 && b > cache[cache[0]] + 12 && N > 2) { N >>= 1; Y = X + N; split = 1; duration -= 1; if (blocks == 1) fill = (fill & 1) | (fill << 1); blocks = (blocks + 1) >> 1; } if (split) { int qn; int itheta = celt_calc_theta(X, Y, dualstereo, N); int mbits, sbits, delta; int qalloc; int pulse_cap; int offset; int orig_fill; int tell; pulse_cap = ff_celt_log_freq_range[band] + duration * 8; offset = (pulse_cap >> 1) - (dualstereo && N == 2 ? CELT_QTHETA_OFFSET_TWOPHASE : CELT_QTHETA_OFFSET); qn = (dualstereo && band >= f->intensity_stereo) ? 1 : celt_compute_qn(N, b, offset, pulse_cap, dualstereo); tell = opus_rc_tell_frac(rc); if (qn != 1) { itheta = (itheta*qn + 8192) >> 14; if (dualstereo && N > 2) ff_opus_rc_enc_uint_step(rc, itheta, qn / 2); else if (dualstereo || B0 > 1) ff_opus_rc_enc_uint(rc, itheta, qn + 1); else ff_opus_rc_enc_uint_tri(rc, itheta, qn); itheta = itheta * 16384 / qn; if (dualstereo) { if (itheta == 0) celt_stereo_is_decouple(X, Y, f->block[0].lin_energy[band], f->block[1].lin_energy[band], N); else celt_stereo_ms_decouple(X, Y, N); } } else if (dualstereo) { inv = itheta > 8192; if (inv) { int j; for (j=0;j<N;j++) Y[j] = -Y[j]; } celt_stereo_is_decouple(X, Y, f->block[0].lin_energy[band], f->block[1].lin_energy[band], N); if (b > 2 << 3 && f->remaining2 > 2 << 3) { ff_opus_rc_enc_log(rc, inv, 2); } else { inv = 0; } itheta = 0; } qalloc = opus_rc_tell_frac(rc) - tell; b -= qalloc; orig_fill = fill; if (itheta == 0) { imid = 32767; iside = 0; fill = av_mod_uintp2(fill, blocks); delta = -16384; } else if (itheta == 16384) { imid = 0; iside = 32767; fill &= ((1 << blocks) - 1) << blocks; delta = 16384; } else { imid = celt_cos(itheta); iside = celt_cos(16384-itheta); delta = ROUND_MUL16((N - 1) << 7, celt_log2tan(iside, imid)); } mid = imid / 32768.0f; side = iside / 32768.0f; if (N == 2 && dualstereo) { int c; int sign = 0; float tmp; float *x2, *y2; mbits = b; sbits = (itheta != 0 && itheta != 16384) ? 1 << 3 : 0; mbits -= sbits; c = (itheta > 8192); f->remaining2 -= qalloc+sbits; x2 = c ? Y : X; y2 = c ? X : Y; if (sbits) { sign = x2[0]*y2[1] - x2[1]*y2[0] < 0; ff_opus_rc_put_raw(rc, sign, 1); } sign = 1 - 2 * sign; cm = ff_celt_encode_band(f, rc, band, x2, NULL, N, mbits, blocks, lowband, duration, lowband_out, level, gain, lowband_scratch, orig_fill); y2[0] = -sign * x2[1]; y2[1] = sign * x2[0]; X[0] *= mid; X[1] *= mid; Y[0] *= side; Y[1] *= side; tmp = X[0]; X[0] = tmp - Y[0]; Y[0] = tmp + Y[0]; tmp = X[1]; X[1] = tmp - Y[1]; Y[1] = tmp + Y[1]; } else { float *next_lowband2 = NULL; float *next_lowband_out1 = NULL; int next_level = 0; int rebalance; if (B0 > 1 && !dualstereo && (itheta & 0x3fff)) { if (itheta > 8192) delta -= delta >> (4 - duration); else delta = FFMIN(0, delta + (N << 3 >> (5 - duration))); } mbits = av_clip((b - delta) / 2, 0, b); sbits = b - mbits; f->remaining2 -= qalloc; if (lowband && !dualstereo) next_lowband2 = lowband + N; if (dualstereo) next_lowband_out1 = lowband_out; else next_level = level + 1; rebalance = f->remaining2; if (mbits >= sbits) { cm = ff_celt_encode_band(f, rc, band, X, NULL, N, mbits, blocks, lowband, duration, next_lowband_out1, next_level, dualstereo ? 1.0f : (gain * mid), lowband_scratch, fill); rebalance = mbits - (rebalance - f->remaining2); if (rebalance > 3 << 3 && itheta != 0) sbits += rebalance - (3 << 3); cm |= ff_celt_encode_band(f, rc, band, Y, NULL, N, sbits, blocks, next_lowband2, duration, NULL, next_level, gain * side, NULL, fill >> blocks) << ((B0 >> 1) & (dualstereo - 1)); } else { cm = ff_celt_encode_band(f, rc, band, Y, NULL, N, sbits, blocks, next_lowband2, duration, NULL, next_level, gain * side, NULL, fill >> blocks) << ((B0 >> 1) & (dualstereo - 1)); rebalance = sbits - (rebalance - f->remaining2); if (rebalance > 3 << 3 && itheta != 16384) mbits += rebalance - (3 << 3); cm |= ff_celt_encode_band(f, rc, band, X, NULL, N, mbits, blocks, lowband, duration, next_lowband_out1, next_level, dualstereo ? 1.0f : (gain * mid), lowband_scratch, fill); } } } else { uint32_t q = celt_bits2pulses(cache, b); uint32_t curr_bits = celt_pulses2bits(cache, q); f->remaining2 -= curr_bits; while (f->remaining2 < 0 && q > 0) { f->remaining2 += curr_bits; curr_bits = celt_pulses2bits(cache, --q); f->remaining2 -= curr_bits; } if (q != 0) { cm = celt_alg_quant(rc, X, N, (q < 8) ? q : (8 + (q & 7)) << ((q >> 3) - 1), f->spread, blocks, gain); } } return cm; }
1threat
Difference between using the Stack or the Heap : <p><strong>Are there any problems when using the stack instead of the heap?</strong></p> <p>Basically I want some 200 positions in memory (or more, 1000, who knows, this is hypothetical anyways), I can allocate it in the stack using an array, or on the heap using <code>malloc()</code>. On the heap I have to remember to always <code>free()</code> the memory...but using the stack, as soon as the function returns, all the memory is nicely cleaned for me.</p> <p>I am just wondering if there are any issues with holding large amounts of memory on the stack. As far as I know, the stack and the heap are basically the same, just they sit on opposite sides in a RAM frame, and they grow towards the other, like in the image below.</p> <p><a href="https://i.stack.imgur.com/02kBO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/02kBO.jpg" alt="Stack and Heap"></a></p>
0debug
static void calc_masking(DCAEncContext *c, const int32_t *input) { int i, k, band, ch, ssf; int32_t data[512]; for (i = 0; i < 256; i++) for (ssf = 0; ssf < SUBSUBFRAMES; ssf++) c->masking_curve_cb[ssf][i] = -2047; for (ssf = 0; ssf < SUBSUBFRAMES; ssf++) for (ch = 0; ch < c->fullband_channels; ch++) { const int chi = c->channel_order_tab[ch]; for (i = 0, k = 128 + 256 * ssf; k < 512; i++, k++) data[i] = c->history[k][ch]; for (k -= 512; i < 512; i++, k++) data[i] = input[k * c->channels + chi]; adjust_jnd(c->samplerate_index, data, c->masking_curve_cb[ssf]); } for (i = 0; i < 256; i++) { int32_t m = 2048; for (ssf = 0; ssf < SUBSUBFRAMES; ssf++) if (c->masking_curve_cb[ssf][i] < m) m = c->masking_curve_cb[ssf][i]; c->eff_masking_curve_cb[i] = m; } for (band = 0; band < 32; band++) { c->band_masking_cb[band] = 2048; walk_band_low(c, band, 0, update_band_masking, NULL); walk_band_high(c, band, 0, update_band_masking, NULL); } }
1threat
how to programmatically hide a progress bar using javascript : <p>i am using a progress bar which I want to appear when a button is clicked. After i get a list populated, I want the progress bar to disappear. Below is my code: </p> <pre><code>&lt;div class="progress"&gt;&lt;div class="indeterminate"/&gt;&lt;/div&gt; if (source_names_list.length == 0) { // want progress bar to appear } if (source_names_list.length &gt; 0) { // want the progress bar to disappear } </code></pre> <p>I tried setting the visibility and it doesn't help. i tried adding the progress bar programmatically.</p>
0debug
How to maximise Screen use in Pupeteer ( non-headless ) : <p>I'm testing out puppeteer for chrome browser automation ( previously using selenium but had a few headaches with browser not waiting until page fully loaded ) . </p> <p>When I launch an instance of puppeteer - then it displays the contents taking up less than half the screen with scroll bars. How can I make it take up a full screen?</p> <pre><code>const puppeteer = require('puppeteer'); async function test(){ const browser = await puppeteer.launch({ headless: false, }); const page = await browser.newPage(); await page.goto('http://google.com') } test() </code></pre> <p>The initial page seems to load fine , but as soon as I access a page it makes it scrollable and smaller.</p>
0debug
use Partial in nested property with typescript : <p>Say I have a type like this;</p> <pre><code>interface State { one: string, two: { three: { four: string }, five: string } } </code></pre> <p>I make state Partial like this <code>Partial&lt;State&gt;</code></p> <p>But how can I make on of the nested properties partial, for example if I wanted to make <code>two</code> also partial.</p> <p>How would I do this?</p>
0debug
sdl compile error, cannot open file 'SDL_lib.obj' in vs2005 : When I compile a project with sdl in mvs2005,I encounter the problem. **LINK : fatal error LNK1104: cannot open file 'SDL_lib.obj'** How can I solve the problem?
0debug
Github monorepo as source for AWS CodePipeline : <p>We use the monorepo approach for storing our source in github.</p> <p>Is it currently possible to have CodePipeline trigger only on a commit to a particular subfolder.</p> <p>This is something that is currently possible with TeamCity by setting a filter on the Source Repository but I've seen no example of this with CodePipeline. </p>
0debug
How i load up css file from inside a method ..? : /* This is Controller.java Class .. i want load up another css file from inside a method. I tried blow codes but unluckly dont work.now i how to load up another css file ? [N.B: sorry,for my bad english] @FXML private Button mbut1; @FXML private void menubut1(ActionEvent event) { mbut1.getStylesheets().add(getClass().getResource("dinner.css" ).toExternalForm());
0debug
Play Audio when device in silent mode - ios swift : <p>I am creating an application using xcode 7.1, swift. I want to play an audio. Everything is fine. Now my problem I want to hear sound when the device in silent mode or muted. How can I do it?</p> <p>I am using the following code to play audio</p> <pre><code>currentAudio!.stop() currentAudio = try? AVAudioPlayer(contentsOfURL: NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("sample_audio", ofType: "mp3")!)); currentAudio!.currentTime = 0 currentAudio!.play(); </code></pre>
0debug
How to get all multiplies of a list in an another list? : The problem is indexing. I've tried this code snippet: for i in range(2,len(the_list_im_getting_values_from)): for j in range(0,i+1): index[j] = j for k in range(0,len(index)): the_output_list.append(the_list_im_getting_values_from[index[k]]*the_list_im_getting_values_from[index[k+1]]) k += 1 , but it totally didn't work. How to solve this problem?
0debug
how to implement laravel forget password logic manually in laravel 5.2 : I want to support froget password logic in my website using **laravel 5.2** i don't want to relay on the (out of the box code which comes with laravel by default ) **my question :** how to implement laravel forget password logic manually ... it's will be good if you can give me steps to follow ?
0debug
Laravel Passport Print Personal Access Token : <p>I am using Laravel's passport package to provide token based authentication to my rest api. Right now, I am using <a href="https://laravel.com/docs/5.3/passport#personal-access-tokens">personal access token</a> concept to generate the access token.</p> <p>To generate an access token for a single user, I am using below code to generate a token with name '<strong>android</strong>'.</p> <pre><code> $user = User::create([ 'name' =&gt; $data['name'], 'email' =&gt; $data['email'], 'password' =&gt; bcrypt($data['password']), ]); // Here the access token will be stored in $token variable. $token = $user-&gt;createToken('android')-&gt;accessToken; // Now the $token value would be something like //eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImMyNjI3YzU0YjFhNWIxZTFlMTdkODhmZTk1NzhjNzAzY2QyMTU0MzhlOD... </code></pre> <p>Later on I want to display the <strong>personal access token</strong> on my admin dashboard which I am facing difficulty in getting the generated token again. Tried below code, but couldn't able to get the access token.</p> <pre><code>$user = User::find(1) dd($user-&gt;tokens()) </code></pre> <p>I also tried using passport vue elements, but it is displaying just the access token name, not the actual token.</p> <pre><code>&lt;passport-personal-access-tokens&gt;&lt;/passport-personal-access-tokens&gt; </code></pre> <p>Please help me getting this solved.</p> <p>Thank you</p>
0debug
static void vtd_reset_context_cache(IntelIOMMUState *s) { VTDAddressSpace **pvtd_as; VTDAddressSpace *vtd_as; uint32_t bus_it; uint32_t devfn_it; VTD_DPRINTF(CACHE, "global context_cache_gen=1"); for (bus_it = 0; bus_it < VTD_PCI_BUS_MAX; ++bus_it) { pvtd_as = s->address_spaces[bus_it]; if (!pvtd_as) { continue; } for (devfn_it = 0; devfn_it < VTD_PCI_DEVFN_MAX; ++devfn_it) { vtd_as = pvtd_as[devfn_it]; if (!vtd_as) { continue; } vtd_as->context_cache_entry.context_cache_gen = 0; } } s->context_cache_gen = 1; }
1threat
Rails mailer previews not available from spec/mailers/previews : <p>I would like to be able to preview my emails in the browser.</p> <p>I am using Rspec and have the following preview setup in spec/mailers/previews:</p> <pre><code># Preview all emails at http://localhost:3000/rails/mailers/employee_mailer class EmployeeMailerPreview &lt; ActionMailer::Preview def welcome Notifier.welcome_email(Employee.first) end end </code></pre> <p>When I try to access this I get the following error:</p> <pre><code>AbstractController::ActionNotFound at /rails/mailers/employee_mailer Mailer preview 'employee_mailer' not found </code></pre> <p>However, when I put the code for the preview inside of tests/mailers/previews it works.</p> <p>How can I configure my Rails app to look for the previews inside of spec/mailers/previews?</p>
0debug
static int make_setup_request(AVFormatContext *s, const char *host, int port, int lower_transport, const char *real_challenge) { RTSPState *rt = s->priv_data; int rtx, j, i, err, interleave = 0; RTSPStream *rtsp_st; RTSPMessageHeader reply1, *reply = &reply1; char cmd[2048]; const char *trans_pref; if (rt->transport == RTSP_TRANSPORT_RDT) trans_pref = "x-pn-tng"; else trans_pref = "RTP/AVP"; rt->timeout = 60; for (j = RTSP_RTP_PORT_MIN, i = 0; i < rt->nb_rtsp_streams; ++i) { char transport[2048]; if (lower_transport == RTSP_LOWER_TRANSPORT_UDP && rt->server_type == RTSP_SERVER_WMS) { if (i == 0) { for (rtx = 0; rtx < rt->nb_rtsp_streams; rtx++) { int len = strlen(rt->rtsp_streams[rtx]->control_url); if (len >= 4 && !strcmp(rt->rtsp_streams[rtx]->control_url + len - 4, "/rtx")) break; } if (rtx == rt->nb_rtsp_streams) return -1; rtsp_st = rt->rtsp_streams[rtx]; } else rtsp_st = rt->rtsp_streams[i > rtx ? i : i - 1]; } else rtsp_st = rt->rtsp_streams[i]; if (lower_transport == RTSP_LOWER_TRANSPORT_UDP) { char buf[256]; if (rt->server_type == RTSP_SERVER_WMS && i > 1) { port = reply->transports[0].client_port_min; goto have_port; } if (RTSP_RTP_PORT_MIN != 0) { while (j <= RTSP_RTP_PORT_MAX) { ff_url_join(buf, sizeof(buf), "rtp", NULL, host, -1, "?localport=%d", j); j += 2; if (url_open(&rtsp_st->rtp_handle, buf, URL_RDWR) == 0) goto rtp_opened; } } #if 0 if (url_open(&rtsp_st->rtp_handle, "rtp: err = AVERROR_INVALIDDATA; goto fail; } #endif rtp_opened: port = rtp_get_local_rtp_port(rtsp_st->rtp_handle); have_port: snprintf(transport, sizeof(transport) - 1, "%s/UDP;", trans_pref); if (rt->server_type != RTSP_SERVER_REAL) av_strlcat(transport, "unicast;", sizeof(transport)); av_strlcatf(transport, sizeof(transport), "client_port=%d", port); if (rt->transport == RTSP_TRANSPORT_RTP && !(rt->server_type == RTSP_SERVER_WMS && i > 0)) av_strlcatf(transport, sizeof(transport), "-%d", port + 1); } else if (lower_transport == RTSP_LOWER_TRANSPORT_TCP) { if (rt->server_type == RTSP_SERVER_WMS && s->streams[rtsp_st->stream_index]->codec->codec_type == AVMEDIA_TYPE_DATA) continue; snprintf(transport, sizeof(transport) - 1, "%s/TCP;", trans_pref); if (rt->server_type == RTSP_SERVER_WMS) av_strlcat(transport, "unicast;", sizeof(transport)); av_strlcatf(transport, sizeof(transport), "interleaved=%d-%d", interleave, interleave + 1); interleave += 2; } else if (lower_transport == RTSP_LOWER_TRANSPORT_UDP_MULTICAST) { snprintf(transport, sizeof(transport) - 1, "%s/UDP;multicast", trans_pref); } if (s->oformat) { av_strlcat(transport, ";mode=receive", sizeof(transport)); } else if (rt->server_type == RTSP_SERVER_REAL || rt->server_type == RTSP_SERVER_WMS) av_strlcat(transport, ";mode=play", sizeof(transport)); snprintf(cmd, sizeof(cmd), "Transport: %s\r\n", transport); if (i == 0 && rt->server_type == RTSP_SERVER_REAL && CONFIG_RTPDEC) { char real_res[41], real_csum[9]; ff_rdt_calc_response_and_checksum(real_res, real_csum, real_challenge); av_strlcatf(cmd, sizeof(cmd), "If-Match: %s\r\n" "RealChallenge2: %s, sd=%s\r\n", rt->session_id, real_res, real_csum); } ff_rtsp_send_cmd(s, "SETUP", rtsp_st->control_url, cmd, reply, NULL); if (reply->status_code == 461 && i == 0) { err = 1; goto fail; } else if (reply->status_code != RTSP_STATUS_OK || reply->nb_transports != 1) { err = AVERROR_INVALIDDATA; goto fail; } if (i > 0) { if (reply->transports[0].lower_transport != rt->lower_transport || reply->transports[0].transport != rt->transport) { err = AVERROR_INVALIDDATA; goto fail; } } else { rt->lower_transport = reply->transports[0].lower_transport; rt->transport = reply->transports[0].transport; } if (reply->transports[0].lower_transport != RTSP_LOWER_TRANSPORT_UDP && (lower_transport == RTSP_LOWER_TRANSPORT_UDP)) { url_close(rtsp_st->rtp_handle); rtsp_st->rtp_handle = NULL; } switch(reply->transports[0].lower_transport) { case RTSP_LOWER_TRANSPORT_TCP: rtsp_st->interleaved_min = reply->transports[0].interleaved_min; rtsp_st->interleaved_max = reply->transports[0].interleaved_max; break; case RTSP_LOWER_TRANSPORT_UDP: { char url[1024]; if (reply->transports[0].source[0]) { ff_url_join(url, sizeof(url), "rtp", NULL, reply->transports[0].source, reply->transports[0].server_port_min, NULL); } else { ff_url_join(url, sizeof(url), "rtp", NULL, host, reply->transports[0].server_port_min, NULL); } if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && rtp_set_remote_url(rtsp_st->rtp_handle, url) < 0) { err = AVERROR_INVALIDDATA; goto fail; } if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && s->iformat && CONFIG_RTPDEC) rtp_send_punch_packets(rtsp_st->rtp_handle); break; } case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: { char url[1024], namebuf[50]; struct sockaddr_storage addr; int port, ttl; if (reply->transports[0].destination.ss_family) { addr = reply->transports[0].destination; port = reply->transports[0].port_min; ttl = reply->transports[0].ttl; } else { addr = rtsp_st->sdp_ip; port = rtsp_st->sdp_port; ttl = rtsp_st->sdp_ttl; } getnameinfo((struct sockaddr*) &addr, sizeof(addr), namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST); ff_url_join(url, sizeof(url), "rtp", NULL, namebuf, port, "?ttl=%d", ttl); if (url_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) { err = AVERROR_INVALIDDATA; goto fail; } break; } } if ((err = rtsp_open_transport_ctx(s, rtsp_st))) goto fail; } if (reply->timeout > 0) rt->timeout = reply->timeout; if (rt->server_type == RTSP_SERVER_REAL) rt->need_subscription = 1; return 0; fail: for (i = 0; i < rt->nb_rtsp_streams; i++) { if (rt->rtsp_streams[i]->rtp_handle) { url_close(rt->rtsp_streams[i]->rtp_handle); rt->rtsp_streams[i]->rtp_handle = NULL; } } return err; }
1threat
What technology can mainframe folks learn and work in the future : <p>Can anyone please let me know what technology we can shift after reaching 10 years of experience(I.T) in mainframes. Can we learn the skills Python, Cloud(AWS/AZURE/Openstack), Data science or _ with mainframes?</p> <p>Any suggestions on this.</p>
0debug
why i have "Error:(57, 21) error: reached end of file while parsing" : this is the code i use the android studio > “Error:(57, 21) error: reached end of file while parsing” > “Error:(57, 21) error: reached end of file while parsing” > “Error:(57, 21) error: reached end of file while parsing” > “Error:(57, 21) error: reached end of file while parsing” package com.bilalbenzine.hotel; import android.content.ContentValues; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.os.PersistableBundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.google.android.gms.appindexing.Action; import com.google.android.gms.appindexing.AppIndex; import com.google.android.gms.appindexing.Thing; import com.google.android.gms.common.api.GoogleApiClient; import io.realm.Realm; /** * Created by hmito on 04/04/2017. */ public class add_hotel extends AppCompatActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.add_hotel); final EditText name=(EditText)findViewById(R.id.name_hotel); final EditText place=(EditText)findViewById(R.id.place_hotel); final EditText stars=(EditText)findViewById(R.id.stars); final EditText description=(EditText)findViewById(R.id.description); final Button addhotel=(Button)findViewById(R.id.btn_add_hotel); addhotel.hasOnClickListeners(new View.OnClickListener(){ @Override public void onClick(View view) { hotel hotel = new hotel(); hotel.setName_hotel(name.getText().toString()); hotel.setName_hotel(place.getText().toString()); hotel.setName_hotel(stars.getText().toString()); hotel.setName_hotel(description.getText().toString()); Realm realm = Realm.getInstance(getApplicationContext()); realm.beginTransaction(); realm.copyToRealmOrUpdate(hotel); realm.commitTransaction(); Toast.makeText(add_hotel.this, "The hotel has been successfully added", Toast.LENGTH_SHORT).show(); } ); } } > please help me someone try
0debug
Why does a count formula return 0 when the range of cells are linked to another sheet? : <p>I am trying to count a range of cells that have text in and ignore 0 that is in some of these cells. All of these cells have a link to another cell sheet within the same workbook and so are returning 0 if the linked cell has nothing entered. I have tried COUNTIF, COUNTA and SUMPRODUCT but all return 0</p>
0debug
Need help in writing mssql query : I am having a table having data .. percentage of each students in a school with below columns ... **Class | name | Percentage( % ) ** I need a sql query to get Count of students in each class with below Diff % slabs.Students who had not written exam will have NULL in source table. class| 0-10% | 10%-20% | 20%-30% | >30% | Not written ( NULLS in source table) Can anybody help me in writing query .Thanks in advance
0debug
Flutter - Is it possible to extract data from a Future without using a FutureBuilder? : <p>I'm reading in user-provided input (in this case a zip code) from a <code>TextField</code> that I need to check against a database for validity. However, I need to make an asynchronous database query inside of the submit button's (a <code>RaisedButton</code> in this case) <code>onPressed: () {}</code> lambda function. In most programming languages, this is a fairly straightforward and simple task. The problem I'm running into in Flutter, however, is the fact that <code>Future</code> objects returned from asynchronous database queries can only be consumed by <code>FutureBuilder</code> objects which in turn only return <code>Widget</code> objects. I simply need a <code>String</code> returned that I can then use to either pass to a new route via a <code>MaterialPageRoute</code> object, or display an error to the user without changing routes. Is there any way to do this with Flutter? Returning a Widget is useless to me as I don't want to create a new Widget for display. I am using Flutter 0.3.2 and Dart 2.0.0</p> <p>As a simplified example of where I need to call the database query:</p> <pre><code>@override Widget build(Buildcontext context) { return new Column( mainAxisAlignment: MainAxisAlignment.center, children: &lt;Widget&gt;[ new Container( padding: const EdgeInsets.all(16.0), child: new TextField( keyboardType: TextInputType.number, controller: _controller, decoration: new InputDecoration( hintText: 'Zip Code', ), onSubmitted: (string) { return string; }, ), ), new RaisedButton( onPressed: () { // use regex to test against user input if (_controller.text != null &amp;&amp; _controller.text.isNotEmpty) { RegExp zipCodeRegExp = new RegExp(r"^(\d{5})$"); // if the user input validates... if (zipCodeRegExp.hasMatch(_controller.text)) { zipCode = _controller.text; // need to perform database query here and return a string, not a Widget } else { // an else condition here } } else { // an else condition here } } } ), ], ); } </code></pre> <p>Perhaps I'm not following the "mantra" of Flutter? I appreciate your consideration and input on this.</p>
0debug
Biztalk Design patterns : I am very new to Biztalk. I have been asked to create a application in Biztalk. I am facing some design level challenges. Following are some of them: 1. Best approach in creating a project How to crate Biztalk solution. Means how to create projects. Do we need to create different projects for Maps/Orchestation/pipelines and references. Which is the best approach to develop a project? 2. Can we check in a Biztalk project in TFS How multiple people can work on a single Biztalk solution? Can it be checked in in TFS and multiple people can take it and work on it? How merging will work? 3. Code review Is there any way to review a Biztalk package? What are the best practices? Thanks in advance.
0debug
Can i perform a double divide in sql : Iam trying to double divide but getting no results 6.82 / (X/NULLIF (Y,0)) Pls help!! Thanks
0debug
static void sun4m_common_init(int ram_size, int boot_device, DisplayState *ds, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model, unsigned int machine) { sun4m_hw_init(&hwdefs[machine], ram_size, ds, cpu_model); sun4m_load_kernel(hwdefs[machine].vram_size, ram_size, boot_device, kernel_filename, kernel_cmdline, initrd_filename, hwdefs[machine].machine_id); }
1threat
static void set_kernel_args_old(const struct arm_boot_info *info) { target_phys_addr_t p; const char *s; int initrd_size = info->initrd_size; target_phys_addr_t base = info->loader_start; p = base + KERNEL_ARGS_ADDR; WRITE_WORD(p, 4096); WRITE_WORD(p, info->ram_size / 4096); WRITE_WORD(p, 0); #define FLAG_READONLY 1 #define FLAG_RDLOAD 4 #define FLAG_RDPROMPT 8 WRITE_WORD(p, FLAG_READONLY | FLAG_RDLOAD | FLAG_RDPROMPT); WRITE_WORD(p, (31 << 8) | 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); if (initrd_size) WRITE_WORD(p, info->loader_start + INITRD_LOAD_ADDR); else WRITE_WORD(p, 0); WRITE_WORD(p, initrd_size); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); WRITE_WORD(p, 0); while (p < base + KERNEL_ARGS_ADDR + 256 + 1024) { WRITE_WORD(p, 0); } s = info->kernel_cmdline; if (s) { cpu_physical_memory_write(p, (void *)s, strlen(s) + 1); } else { WRITE_WORD(p, 0); } }
1threat
void ff_acelp_lspd2lpc(const double *lsp, float *lpc) { double pa[6], qa[6]; int i; lsp2polyf(lsp, pa, 5); lsp2polyf(lsp + 1, qa, 5); for (i=4; i>=0; i--) { double paf = pa[i+1] + pa[i]; double qaf = qa[i+1] - qa[i]; lpc[i ] = 0.5*(paf+qaf); lpc[9-i] = 0.5*(paf-qaf); } }
1threat
Need help in json parsing : I am getting data from api and i need to filter the array of dictionary based upon "total_price" tag, now the condition is i want only those flights whose price is between "35.0" to "55.0" { airline = 9W; "available_seats" = "<null>"; bags = ( ); currency = USD; destination = 38551; origin = 39232; "price_details" = { }; "rate_plan_code" = WIP; routes = ( ); taxes = "17.51"; "total_price" = "31.7"; } As the total_price tag is coming as string i am not sure how to filter it using predicate etc. I need to filter the json response itself, no models were created for this api response. Please help
0debug
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
Fire Event from a C# library into a VB Winform program : <p>I am a C# programmer and have made a C# library for handling a tcp/ip chat. Now I have the necessity to use it from a Server VB Winform program. I am pretty sure that this is an easy solution problem but I have been struggling for days. So in the C# I have that class:</p> <pre><code>public class AsynchronousServer { public AsynchronousServer() { } public delegate void ChangedEventHandler(string strMessage); public static event ChangedEventHandler OnNotification; public static event ChangedEventHandler OnAnswerReceived; ... } </code></pre> <p>Now I have to focus on the server program: if that VB program would have been in C# I would have written the code below for connecting the server on a button click</p> <pre><code>public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void btnStart_Click(object sender, RoutedEventArgs e) { AsynchronousServer.OnNotification += AsynchronousServer_OnNotification; AsynchronousServer.OnAnswerReceived += AsynchronousServer_OnAnswerReceived; AsynchronousServer.StartServer(tbxIpAddress.Text,tbxPort.Text); } </code></pre> <p>The same program in VB:</p> <pre><code>Imports SocketLibrary Public Class Form1 Private Sub btnStart_Click(sender As Object, e As EventArgs) Handles btnStart.Click AsynchronousServer.OnNotification &lt;--- member not present AsynchronousServer.OnAnswerReceived &lt;--- member not present AsynchronousServer.StartServer(tbxIpAddress.Text, tbxPort.Text);&lt;-----OK End Sub End Class </code></pre> <p>the problem is that the member AsynchronousServer.OnNotification is not present at all so I can't add the event. I am aware that I might have to add the WithEvents keyword but try as I might I couldn't succed.</p> <p>In short I have to connect that VB winform program to a C# library event which I can't see from my VB class.</p> <p>Thanks for any help</p> <p>Patrick</p>
0debug
Fedration enabled on premise skype for business with bot framework : I have a bot that is successfully running on localhost and also with ngrok and webchat. I know that Skype for business channel can only be enabled for Skype for business online and office 365 online. Now I want to now, can federation enabled on premise Skype for business be integrated with Microsoft bot. Note: Federation enabled on premise Skype for business is on a virtual setup and behind a company firewall. I am confused as I can be found by the employees of other companies who also use Skype for Business then should not on premise Skype be able to connect to Microsoft Bot Connector.
0debug
int vmstate_register_with_alias_id(DeviceState *dev, int instance_id, const VMStateDescription *vmsd, void *opaque, int alias_id, int required_for_version) { SaveStateEntry *se; assert(alias_id == -1 || required_for_version >= vmsd->minimum_version_id); se = g_malloc0(sizeof(SaveStateEntry)); se->version_id = vmsd->version_id; se->section_id = savevm_state.global_section_id++; se->opaque = opaque; se->vmsd = vmsd; se->alias_id = alias_id; if (dev) { char *id = qdev_get_dev_path(dev); if (id) { pstrcpy(se->idstr, sizeof(se->idstr), id); pstrcat(se->idstr, sizeof(se->idstr), "/"); g_free(id); se->compat = g_malloc0(sizeof(CompatEntry)); pstrcpy(se->compat->idstr, sizeof(se->compat->idstr), vmsd->name); se->compat->instance_id = instance_id == -1 ? calculate_compat_instance_id(vmsd->name) : instance_id; instance_id = -1; } } pstrcat(se->idstr, sizeof(se->idstr), vmsd->name); if (instance_id == -1) { se->instance_id = calculate_new_instance_id(se->idstr); } else { se->instance_id = instance_id; } assert(!se->compat || se->instance_id == 0); QTAILQ_INSERT_TAIL(&savevm_state.handlers, se, entry); return 0; }
1threat
Get max value from row of a dataframe in python : <p>This is my dataframe df</p> <pre><code>a b c 1.2 2 0.1 2.1 1.1 3.2 0.2 1.9 8.8 3.3 7.8 0.12 </code></pre> <p>I'm trying to get max value from each row of a dataframe, I m expecting output like this</p> <pre><code>max_value 2 3.2 8.8 7.8 </code></pre> <p>This is what I have tried</p> <pre><code>df[len(df.columns)].argmax() </code></pre> <p>I'm not getting proper output, any help would be much appreciated. Thanks</p>
0debug
How to do this question in R without using loop? : <p>Let's say I have a dataframe like this:</p> <pre><code>df=data.frame("A"=factor(c(1,2,1,4,2)), "date"=factor(c("1999","2000","1999","2001","2001")), "value"=c(10,20,30,40,50)) </code></pre> <p>I need to sum the values in the column "value" if they have the same "A" and "date". So what I need is a dataframe like this:</p> <pre><code>dfnew=data.frame("A"=factor(c(1,2,1,4,2)), "date"=factor(c("1999","2000","1999","2001","2001")), "value"=c(10,20,30,40,50), "sum"=c(40,20,40,40,50)) </code></pre> <p>I can do it with a loop, but it is very slow since my dataset is big. Is there any way to do it faster?</p>
0debug
static int dca_subframe_header(DCAContext *s, int base_channel, int block_index) { int j, k; if (get_bits_left(&s->gb) < 0) return AVERROR_INVALIDDATA; if (!base_channel) { s->subsubframes[s->current_subframe] = get_bits(&s->gb, 2) + 1; s->partial_samples[s->current_subframe] = get_bits(&s->gb, 3); } for (j = base_channel; j < s->prim_channels; j++) { for (k = 0; k < s->subband_activity[j]; k++) s->prediction_mode[j][k] = get_bits(&s->gb, 1); } for (j = base_channel; j < s->prim_channels; j++) { for (k = 0; k < s->subband_activity[j]; k++) { if (s->prediction_mode[j][k] > 0) { s->prediction_vq[j][k] = get_bits(&s->gb, 12); } } } for (j = base_channel; j < s->prim_channels; j++) { for (k = 0; k < s->vq_start_subband[j]; k++) { if (s->bitalloc_huffman[j] == 6) s->bitalloc[j][k] = get_bits(&s->gb, 5); else if (s->bitalloc_huffman[j] == 5) s->bitalloc[j][k] = get_bits(&s->gb, 4); else if (s->bitalloc_huffman[j] == 7) { av_log(s->avctx, AV_LOG_ERROR, "Invalid bit allocation index\n"); return AVERROR_INVALIDDATA; } else { s->bitalloc[j][k] = get_bitalloc(&s->gb, &dca_bitalloc_index, s->bitalloc_huffman[j]); } if (s->bitalloc[j][k] > 26) { return AVERROR_INVALIDDATA; } } } for (j = base_channel; j < s->prim_channels; j++) { for (k = 0; k < s->subband_activity[j]; k++) { s->transition_mode[j][k] = 0; if (s->subsubframes[s->current_subframe] > 1 && k < s->vq_start_subband[j] && s->bitalloc[j][k] > 0) { s->transition_mode[j][k] = get_bitalloc(&s->gb, &dca_tmode, s->transient_huffman[j]); } } } if (get_bits_left(&s->gb) < 0) return AVERROR_INVALIDDATA; for (j = base_channel; j < s->prim_channels; j++) { const uint32_t *scale_table; int scale_sum; memset(s->scale_factor[j], 0, s->subband_activity[j] * sizeof(s->scale_factor[0][0][0]) * 2); if (s->scalefactor_huffman[j] == 6) scale_table = scale_factor_quant7; else scale_table = scale_factor_quant6; scale_sum = 0; for (k = 0; k < s->subband_activity[j]; k++) { if (k >= s->vq_start_subband[j] || s->bitalloc[j][k] > 0) { scale_sum = get_scale(&s->gb, s->scalefactor_huffman[j], scale_sum); s->scale_factor[j][k][0] = scale_table[scale_sum]; } if (k < s->vq_start_subband[j] && s->transition_mode[j][k]) { scale_sum = get_scale(&s->gb, s->scalefactor_huffman[j], scale_sum); s->scale_factor[j][k][1] = scale_table[scale_sum]; } } } for (j = base_channel; j < s->prim_channels; j++) { if (s->joint_intensity[j] > 0) s->joint_huff[j] = get_bits(&s->gb, 3); } if (get_bits_left(&s->gb) < 0) return AVERROR_INVALIDDATA; for (j = base_channel; j < s->prim_channels; j++) { int source_channel; if (s->joint_intensity[j] > 0) { int scale = 0; source_channel = s->joint_intensity[j] - 1; for (k = s->subband_activity[j]; k < s->subband_activity[source_channel]; k++) { scale = get_scale(&s->gb, s->joint_huff[j], 0); scale += 64; s->joint_scale_factor[j][k] = scale; } if (!(s->debug_flag & 0x02)) { av_log(s->avctx, AV_LOG_DEBUG, "Joint stereo coding not supported\n"); s->debug_flag |= 0x02; } } } if (!base_channel && s->prim_channels > 2) { if (s->downmix) { for (j = base_channel; j < s->prim_channels; j++) { s->downmix_coef[j][0] = get_bits(&s->gb, 7); s->downmix_coef[j][1] = get_bits(&s->gb, 7); } } else { int am = s->amode & DCA_CHANNEL_MASK; for (j = base_channel; j < s->prim_channels; j++) { s->downmix_coef[j][0] = dca_default_coeffs[am][j][0]; s->downmix_coef[j][1] = dca_default_coeffs[am][j][1]; } } } if (!base_channel && s->dynrange) s->dynrange_coef = get_bits(&s->gb, 8); if (s->crc_present) { get_bits(&s->gb, 16); } for (j = base_channel; j < s->prim_channels; j++) for (k = s->vq_start_subband[j]; k < s->subband_activity[j]; k++) s->high_freq_vq[j][k] = get_bits(&s->gb, 10); if (!base_channel && s->lfe) { int lfe_samples = 2 * s->lfe * (4 + block_index); int lfe_end_sample = 2 * s->lfe * (4 + block_index + s->subsubframes[s->current_subframe]); float lfe_scale; for (j = lfe_samples; j < lfe_end_sample; j++) { s->lfe_data[j] = get_sbits(&s->gb, 8); } s->lfe_scale_factor = scale_factor_quant7[get_bits(&s->gb, 8)]; lfe_scale = 0.035 * s->lfe_scale_factor; for (j = lfe_samples; j < lfe_end_sample; j++) s->lfe_data[j] *= lfe_scale; } #ifdef TRACE av_log(s->avctx, AV_LOG_DEBUG, "subsubframes: %i\n", s->subsubframes[s->current_subframe]); av_log(s->avctx, AV_LOG_DEBUG, "partial samples: %i\n", s->partial_samples[s->current_subframe]); for (j = base_channel; j < s->prim_channels; j++) { av_log(s->avctx, AV_LOG_DEBUG, "prediction mode:"); for (k = 0; k < s->subband_activity[j]; k++) av_log(s->avctx, AV_LOG_DEBUG, " %i", s->prediction_mode[j][k]); av_log(s->avctx, AV_LOG_DEBUG, "\n"); } for (j = base_channel; j < s->prim_channels; j++) { for (k = 0; k < s->subband_activity[j]; k++) av_log(s->avctx, AV_LOG_DEBUG, "prediction coefs: %f, %f, %f, %f\n", (float) adpcm_vb[s->prediction_vq[j][k]][0] / 8192, (float) adpcm_vb[s->prediction_vq[j][k]][1] / 8192, (float) adpcm_vb[s->prediction_vq[j][k]][2] / 8192, (float) adpcm_vb[s->prediction_vq[j][k]][3] / 8192); } for (j = base_channel; j < s->prim_channels; j++) { av_log(s->avctx, AV_LOG_DEBUG, "bitalloc index: "); for (k = 0; k < s->vq_start_subband[j]; k++) av_log(s->avctx, AV_LOG_DEBUG, "%2.2i ", s->bitalloc[j][k]); av_log(s->avctx, AV_LOG_DEBUG, "\n"); } for (j = base_channel; j < s->prim_channels; j++) { av_log(s->avctx, AV_LOG_DEBUG, "Transition mode:"); for (k = 0; k < s->subband_activity[j]; k++) av_log(s->avctx, AV_LOG_DEBUG, " %i", s->transition_mode[j][k]); av_log(s->avctx, AV_LOG_DEBUG, "\n"); } for (j = base_channel; j < s->prim_channels; j++) { av_log(s->avctx, AV_LOG_DEBUG, "Scale factor:"); for (k = 0; k < s->subband_activity[j]; k++) { if (k >= s->vq_start_subband[j] || s->bitalloc[j][k] > 0) av_log(s->avctx, AV_LOG_DEBUG, " %i", s->scale_factor[j][k][0]); if (k < s->vq_start_subband[j] && s->transition_mode[j][k]) av_log(s->avctx, AV_LOG_DEBUG, " %i(t)", s->scale_factor[j][k][1]); } av_log(s->avctx, AV_LOG_DEBUG, "\n"); } for (j = base_channel; j < s->prim_channels; j++) { if (s->joint_intensity[j] > 0) { int source_channel = s->joint_intensity[j] - 1; av_log(s->avctx, AV_LOG_DEBUG, "Joint scale factor index:\n"); for (k = s->subband_activity[j]; k < s->subband_activity[source_channel]; k++) av_log(s->avctx, AV_LOG_DEBUG, " %i", s->joint_scale_factor[j][k]); av_log(s->avctx, AV_LOG_DEBUG, "\n"); } } if (!base_channel && s->prim_channels > 2 && s->downmix) { av_log(s->avctx, AV_LOG_DEBUG, "Downmix coeffs:\n"); for (j = 0; j < s->prim_channels; j++) { av_log(s->avctx, AV_LOG_DEBUG, "Channel 0, %d = %f\n", j, dca_downmix_coeffs[s->downmix_coef[j][0]]); av_log(s->avctx, AV_LOG_DEBUG, "Channel 1, %d = %f\n", j, dca_downmix_coeffs[s->downmix_coef[j][1]]); } av_log(s->avctx, AV_LOG_DEBUG, "\n"); } for (j = base_channel; j < s->prim_channels; j++) for (k = s->vq_start_subband[j]; k < s->subband_activity[j]; k++) av_log(s->avctx, AV_LOG_DEBUG, "VQ index: %i\n", s->high_freq_vq[j][k]); if (!base_channel && s->lfe) { int lfe_samples = 2 * s->lfe * (4 + block_index); int lfe_end_sample = 2 * s->lfe * (4 + block_index + s->subsubframes[s->current_subframe]); av_log(s->avctx, AV_LOG_DEBUG, "LFE samples:\n"); for (j = lfe_samples; j < lfe_end_sample; j++) av_log(s->avctx, AV_LOG_DEBUG, " %f", s->lfe_data[j]); av_log(s->avctx, AV_LOG_DEBUG, "\n"); } #endif return 0; }
1threat
HTTP/2 or Websockets for low latency client to server messages : <p>I have a requirement to have very low latency for client to server messages in my web application.</p> <p>I have seen several posts on stackoverflow saying it would be preferable to use websockets instead of HTTP for this requirement, but it was quite some time ago.</p> <p>Today, in 2018, with the progress of HTTP/2, is it still worth using websockets for this use case ? </p>
0debug
Java code to find out operative system, : I am very new at coding in Java and I want to write a code to find out my operative system through a dialogue box (Windows 10). I through this code but I am not sure how to completely implement it. Please let me know what I am doing wrong in simple terms as I am a beginner ;D. Thank you in advance.[![enter image description here][1]][1] [1]: https://i.stack.imgur.com/WRupV.png
0debug
static void qxl_create_guest_primary(PCIQXLDevice *qxl, int loadvm, qxl_async_io async) { QXLDevSurfaceCreate surface; QXLSurfaceCreate *sc = &qxl->guest_primary.surface; int size; int requested_height = le32_to_cpu(sc->height); int requested_stride = le32_to_cpu(sc->stride); size = abs(requested_stride) * requested_height; if (size > qxl->vgamem_size) { qxl_set_guest_bug(qxl, "%s: requested primary larger then framebuffer" " size", __func__); if (qxl->mode == QXL_MODE_NATIVE) { qxl_set_guest_bug(qxl, "%s: nop since already in QXL_MODE_NATIVE", __func__); qxl_exit_vga_mode(qxl); surface.format = le32_to_cpu(sc->format); surface.height = le32_to_cpu(sc->height); surface.mem = le64_to_cpu(sc->mem); surface.position = le32_to_cpu(sc->position); surface.stride = le32_to_cpu(sc->stride); surface.width = le32_to_cpu(sc->width); surface.type = le32_to_cpu(sc->type); surface.flags = le32_to_cpu(sc->flags); trace_qxl_create_guest_primary(qxl->id, sc->width, sc->height, sc->mem, sc->format, sc->position); trace_qxl_create_guest_primary_rest(qxl->id, sc->stride, sc->type, sc->flags); surface.mouse_mode = true; surface.group_id = MEMSLOT_GROUP_GUEST; if (loadvm) { surface.flags |= QXL_SURF_FLAG_KEEP_DATA; qxl->mode = QXL_MODE_NATIVE; qxl->cmdflags = 0; qemu_spice_create_primary_surface(&qxl->ssd, 0, &surface, async); if (async == QXL_SYNC) { qxl_create_guest_primary_complete(qxl);
1threat
How to read a zip entry in a zip file, ad nauseum for c# or vb.net : While there is a response to this question using the java libraries (http://stackoverflow.com/questions/11287486/read-a-zip-file-inside-zip-file), I cannot find an example of this anywhere in c# or vb.net. What I have to do for a client is use the .NET 4.5 ZipArchive library to traverse zip files for specific entries. Before anyone asks, the client refuses to allow me to use dotnetzip, because his chief architect has experience with that library and says it is too buggy to be used in a real application. He's pointed out a couple to me, and it doesn't matter what I think anyway! If I have a zip file, that itself contains other zip files, I need a way of opening the inner zip files, and read the entries for that zip file. Eventually I will also have to actually open the zip entry for the zip in a zip, but for now I just have to be able to get at the zipentries of an inner zip file. Here's what I have so far: public string PassThruZipFilter(string[] sfilters, string sfile, bool buseregexp, bool bignorecase, List<ZipArchiveZipFile> alzips) { bool bpassed = true; bool bfound = false; bool berror = false; string spassed = ""; int ifile = 0; try { ZipArchive oarchive = null; ; int izipfiles = 0; if (alzips.Count == 0) { oarchive = ZipFile.OpenRead(sfile); izipfiles = oarchive.Entries.Count; } else { //need to dig into zipfile n times in alzips[i] where n = alzips.Count oarchive = GetNthZipFileEntries(alzips, sfile); <------ NEED TO CREATE THIS FUNCTION! izipfiles = oarchive.Entries.Count; } while (((ifile < izipfiles) & (bfound == false))) { string sfilename = ""; sfilename = oarchive.Entries[ifile].Name; //need to take into account zip files that contain zip files... bfound = PassThruFilter(sfilters, sfilename, buseregexp, bignorecase); if ((bfound == false) && (IsZipFile(sfilename))) { //add this to the zip stack ZipArchiveZipFile ozazp = new ZipArchiveZipFile(alzips.Count, sfile, sfilename); alzips.Add(ozazp); spassed = PassThruZipFilter(sfilters, sfilename, buseregexp, bignorecase, alzips); if (spassed.Equals(sISTRUE)) { bfound = true; } else { if (spassed.Equals(sISFALSE)) { bfound = false; } else { bfound = false; berror = true; } } } ifile += 1; } } catch (Exception oziperror) { berror = true; spassed = oziperror.Message; } if ((bfound == false)) { bpassed = false; } else { bpassed = true; } if (berror == false) { spassed = bpassed.ToString(); } return (spassed); } So the function I have to create is 'GetNthZipFileEntries(List<ZipFileZipEntry>, sfile)', where the ZipFileZipEntry is just a structure that contains an int index, string szipfile, string szipentry. I cannot figure out how read a zip file inside a zip file (or G-d forbid, a zip file inside a zip file inside a zip file...the 'PassThruZipFilter is a function **inside** a recursive function) using .NET 4.5. Obviously microsoft does it, because you can open up a zip file inside a zip file in explorer. Many thanks for anyone that can help. **So, I truly need your help on how to open zip files inside of zip files in .NET 4.5 without writing to the disk**. There are NO examples on the web I can find for this specific purpose. I can find tons of examples for reading zip file entries, but that doesn't help. **To be clear, I cannot use a hard disk to write anything**. I can use a memory stream, but that is the extent of what I can do. **I cannot use the dotnetzip library**, so any comments using that won't help, but of course I'm thankful for any help at all. I could use another library like the Sharp zip libs, but I'd have to convince the client that it is impossible with .NET 4.5.
0debug
static uint64_t imx_serial_read(void *opaque, hwaddr offset, unsigned size) { IMXSerialState *s = (IMXSerialState *)opaque; uint32_t c; DPRINTF("read(offset=%x)\n", offset >> 2); switch (offset >> 2) { case 0x0: c = s->readbuff; if (!(s->uts1 & UTS1_RXEMPTY)) { c |= URXD_CHARRDY; s->usr1 &= ~USR1_RRDY; s->usr2 &= ~USR2_RDR; s->uts1 |= UTS1_RXEMPTY; imx_update(s); qemu_chr_accept_input(s->chr); } return c; case 0x20: return s->ucr1; case 0x21: return s->ucr2; case 0x25: return s->usr1; case 0x26: return s->usr2; case 0x2A: return s->ubmr; case 0x2B: return s->ubrc; case 0x2d: return s->uts1; case 0x24: return s->ufcr; case 0x2c: return s->onems; case 0x22: return s->ucr3; case 0x23: case 0x29: return 0x0; default: IPRINTF("%s: bad offset: 0x%x\n", __func__, (int)offset); return 0; } }
1threat
IdentityServer "invalid_client" error always returned : <p>I'm trying to use IdentityServer3, but don't know why I'm getting "invalid_client" error always, always no matter what I do.</p> <p>This is the code I'm using:</p> <pre><code>//Startup.cs (Auth c# project) public void Configuration(IAppBuilder app) { var inMemoryManager = new InMemoryManager(); var factory = new IdentityServerServiceFactory() .UseInMemoryClients(inMemoryManager.GetClients()) .UseInMemoryScopes(inMemoryManager.GetScopes()) .UseInMemoryUsers(inMemoryManager.GetUsers()); var options = new IdentityServerOptions { Factory = factory, RequireSsl = false }; app.UseIdentityServer(options); } </code></pre> <p>InMemoryManager helper.</p> <pre><code>//InMemoryManager.cs public class InMemoryManager { public List&lt;InMemoryUser&gt; GetUsers() { return new List&lt;InMemoryUser&gt; { new InMemoryUser { Username = "alice", Password = "password", Subject = "2", Claims = new [] { new Claim("User name", "Alice") } } }; } public IEnumerable&lt;Scope&gt; GetScopes() { return new[] { new Scope { Name = "api1", DisplayName = "API 1" } }; } public IEnumerable&lt;Client&gt; GetClients() { return new[] { new Client { ClientName = "Silicon on behalf of Carbon Client", ClientId = "carbon", Enabled = true, //AccessTokenType = AccessTokenType.Reference, Flow = Flows.ResourceOwner, ClientSecrets = new List&lt;Secret&gt; { new Secret("secret".Sha256()) }, AllowedScopes = new List&lt;string&gt; { "api1" } } }; } } </code></pre> <p>This is the result I always get.</p> <p><a href="https://i.stack.imgur.com/sBrOW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/sBrOW.png" alt="Postman error"></a></p> <p>I'm using postman to try the Auth Server, but I always get that error. I've read another solutions but none seeme to works, I don't know what else to try.</p> <p>Cheers.</p>
0debug
How to get uint8_t data of uint32_t : <p>I'm working with a microcontroller where the sensor I'm trying to interface sends uint8_t data. The issue is I can read the pin with a uint32_t function.</p> <p>So I guess I can read the pin with the uint32_t, but I have to "extract" it. But I'm getting nonsense... </p> <pre><code>uint32_t number = 429496729; uint8_t x1 = (number &gt;&gt; (8*0)) &amp; 0xff; uint8_t x2 = (number &gt;&gt; (8*1)) &amp; 0xff; uint8_t x3 = (number &gt;&gt; (8*2)) &amp; 0xff; uint8_t x4 = (number &gt;&gt; (8*3)) &amp; 0xff; </code></pre> <p>printing x3 for instance gives me "™". Same with x1. Whats going on here?</p>
0debug
static void denoise_depth(HQDN3DContext *s, uint8_t *src, uint8_t *dst, uint16_t *line_ant, uint16_t **frame_ant_ptr, int w, int h, int sstride, int dstride, int16_t *spatial, int16_t *temporal, int depth) { long x, y; uint16_t *frame_ant = *frame_ant_ptr; if (!frame_ant) { uint8_t *frame_src = src; *frame_ant_ptr = frame_ant = av_malloc(w*h*sizeof(uint16_t)); for (y = 0; y < h; y++, src += sstride, frame_ant += w) for (x = 0; x < w; x++) frame_ant[x] = LOAD(x); src = frame_src; frame_ant = *frame_ant_ptr; } if (spatial[0]) denoise_spatial(s, src, dst, line_ant, frame_ant, w, h, sstride, dstride, spatial, temporal, depth); else denoise_temporal(src, dst, frame_ant, w, h, sstride, dstride, temporal, depth); emms_c(); }
1threat
How to perform double buffering with atomic pointers? : <p>Atomic newbie here. My code currently looks like this (simplified):</p> <pre class="lang-cpp prettyprint-override"><code>std::atomic&lt;Object*&gt; object; void thread_a() { object.load()-&gt;doSomething(); // (1) } void thread_b() { Object* oldObject = object.load(); Object* newObject = new Object(); // Update new object accordingly... while (!object.compare_exchange_weak(oldObject, newObject)); delete oldObject; } </code></pre> <p>In words, my idea is to let <code>thread_b</code> atomically swap the shared object (double-buffering), while <code>thread_a</code> performs some work on it. My question: can I safely assume that the shared object will be "protected" against data races while <code>thread_a</code> calls <code>doSomething()</code> on it, as done in (1)? </p>
0debug
Trouble at creat a GIT repository in Bluemix : i write this topic for a problem that i have right now while coding on bluemix: When i try to create a GIT repository after creating an Application on bluemix, i receive this message error: "Impossible to connect at IBM DevOps Services. Try later" is this problem know to someone? Thank for answers, Alessandro
0debug
static inline void RENAME(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width) { int i; assert(src1==src2); for(i=0; i<width; i++) { int r= src1[6*i + 0] + src1[6*i + 3]; int g= src1[6*i + 1] + src1[6*i + 4]; int b= src1[6*i + 2] + src1[6*i + 5]; dstU[i]= ((RU*r + GU*g + BU*b)>>(RGB2YUV_SHIFT+1)) + 128; dstV[i]= ((RV*r + GV*g + BV*b)>>(RGB2YUV_SHIFT+1)) + 128; } }
1threat