problem
stringlengths
26
131k
labels
class label
2 classes
what is wrong with this python code? very simple code : <p>for some reason this python code doesn't work. can you please help me? after asking for input it just prints nothing.</p> <p>I need this program to print freezing if the temperature is 0 and if above zero print above freezing and if below zero print below freezing.</p> <pre><code>temp = int(input("What is the temperature?")) if (temp&lt;0): print:"Below freezing" elif (temp&gt;0): print:"Above Freezing" else: print:"Freezing" </code></pre>
0debug
How do i prevent text jumping into another line : I'm trying out some things with a material designe framework but some things just won't work. Here is what i got: [screenshot][1] But i want the text to start on the top and stay there so the text won't jump into another line like in the picture. i hope you guys can help me. [1]: https://i.stack.imgur.com/jsMPx.png
0debug
Conditional Subtraction VBA/Macro : Good day Excelers, Looking for some assistance programming a report. I'm in the early stages. I've hit a wall when attempting to conditionally subtract using VBA. I would like to Subtract 1 from Column C if Column B is greater than 1. Any assistance would be greatly appreciated. The code I have so far is below Sub UniqueContactReport() Columns("Z:AQ").EntireColumn.Delete Columns("X").EntireColumn.Delete Columns("V").EntireColumn.Delete Columns("U").EntireColumn.Delete Columns("J:S").EntireColumn.Delete Columns("A:H").EntireColumn.Delete Dim N As Long, i As Long N = Cells(Rows.Count, "B").End(xlUp).Row For i = N To 1 Step -1 If Cells(i, "B") > 1 And Cells(i, "D") = 0 Then Cells(i, "B").EntireRow.Delete End If Next i End Sub
0debug
Gradle build fails: Unable to find method 'org.gradle.api.tasks.testing.Test.getTestClassesDirs()Lorg/gradle/api/file/FileCollection;' : <p>When i am trying to compile a imported <a href="https://github.com/iammert/AndroidArchitecture.git" rel="noreferrer">project</a> from github, my gradle build always fails with the following exeption.</p> <pre><code>Unable to find method 'org.gradle.api.tasks.testing.Test.getTestClassesDirs()Lorg/gradle/api/file/FileCollection;' Possible causes for this unexpected error include:&lt;ul&gt;&lt;li&gt;Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network)&lt;/li&gt;&lt;li&gt;The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart)&lt;/li&gt;&lt;li&gt;Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.&lt;/li&gt;&lt;/ul&gt;In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes </code></pre> <p>I followed the instructions given but it didn't work out. Additionally i couldn't get any further information about the error by searching it in the internet</p> <p>app\build.gradle: </p> <pre><code> apply plugin: 'com.android.application' android { compileSdkVersion 25 buildToolsVersion "25.0.2" defaultConfig { applicationId "iammert.com.androidarchitecture" minSdkVersion 21 targetSdkVersion 25 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } dataBinding { enabled = true } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) /*androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' })*/ // testCompile 'junit:junit:4.12' //support lib implementation rootProject.ext.supportLibAppCompat implementation rootProject.ext.supportLibDesign implementation rootProject.ext.archRuntime implementation rootProject.ext.archExtension annotationProcessor rootProject.ext.archCompiler implementation rootProject.ext.roomRuntime annotationProcessor rootProject.ext.roomCompiler implementation rootProject.ext.okhttp implementation rootProject.ext.retrofit implementation rootProject.ext.gsonConverter //dagger annotationProcessor rootProject.ext.daggerCompiler implementation rootProject.ext.dagger implementation rootProject.ext.daggerAndroid implementation rootProject.ext.daggerAndroidSupport annotationProcessor rootProject.ext.daggerAndroidProcessor //ui implementation rootProject.ext.picasso } </code></pre> <p>\build.gradle:</p> <pre><code>// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { maven { url 'https://maven.google.com' } jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.0.0-alpha3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() maven { url 'https://maven.google.com' } } } task clean(type: Delete) { delete rootProject.buildDir } ext { supportLibVersion = '25.3.1' daggerVersion = '2.11' retrofitVersion = '2.1.0' gsonConverterVersion = '2.1.0' okhttpVersion = '3.8.0' picassoVersion = '2.5.2' archVersion = '1.0.0-alpha1' supportLibAppCompat = "com.android.support:appcompat-v7:$supportLibVersion" supportLibDesign = "com.android.support:design:$supportLibVersion" archRuntime = "android.arch.lifecycle:runtime:$archVersion" archExtension = "android.arch.lifecycle:extensions:$archVersion" archCompiler = "android.arch.lifecycle:compiler:$archVersion" roomRuntime = "android.arch.persistence.room:runtime:$archVersion" roomCompiler = "android.arch.persistence.room:compiler:$archVersion" dagger = "com.google.dagger:dagger:$daggerVersion" daggerCompiler = "com.google.dagger:dagger-compiler:$daggerVersion" daggerAndroid = "com.google.dagger:dagger-android:$daggerVersion" daggerAndroidSupport = "com.google.dagger:dagger-android-support:$daggerVersion" daggerAndroidProcessor = "com.google.dagger:dagger-android-processor:$daggerVersion" retrofit = "com.squareup.retrofit2:retrofit:$retrofitVersion" gsonConverter = "com.squareup.retrofit2:converter-gson:$gsonConverterVersion" okhttp = "com.squareup.okhttp3:okhttp:$okhttpVersion" picasso = "com.squareup.picasso:picasso:$picassoVersion" } </code></pre> <p>gradle\gradle-wrapper.properties:</p> <pre><code>#Thu May 18 17:31:31 EEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip </code></pre> <p>Does anyone know why this error occures?</p>
0debug
Create quote summary of calculated fields : <p>I have a form that allows users calculate cost of services. I can use the form to output the total price of the selected services via checkbox and input values * the data-price. However, I would also like to create a summary of the services they selected. </p> <p>I sample of the results I am trying to achieve from my provided fiddle:</p> <p>This assumes Text 1 has an input of 3 and the first two checkboxes are checked</p> <pre><code>Quote Text 1 $29.85 Checkbox 1 $19.90 Checkbox 1 $45.95 Total $95.70 </code></pre> <p>I want to use a data attribute (like how I use data-price) inside the input and checkbox fields due to the actual complex of my input labels. </p> <p><a href="https://jsfiddle.net/evvaw9ta/" rel="noreferrer">https://jsfiddle.net/evvaw9ta/</a></p>
0debug
Image Effects of 2016 for Website Banner : <p>I've been searching about the name of this image effect but can't find an answer since I don't really know what to put on the search engine. So I decided to visit here to post a question to you guys hoping that I get an answer. Here is the <a href="http://postimg.org/image/57lz8c1td/" rel="nofollow">image effect</a></p>
0debug
How to check mysql if a string matched with parts from database? : i want to do a kind of blacklist so i store in my database id|value ----------- 1|test.com 2|example@ 3|@another. ... Now i looking for the fastes way to check if a given string (a emailadress for example) matched with a part of the values from the db. For exmple my@mail.com -> no result in db -> no spam example@mail.com -> matched with ID2 -> spam ... Is there a way to do it insider the mysql statement? For the moment i see only the way to load all values in a array an check this, but this way takes a lot of resourses and its really slow. Thanks a lot.
0debug
Flutter: how to load file for testing : <p>File can be read from the directory relative to the dart script file, simply as <code>var file = new File('./fixture/contacts.json')</code>.</p> <p>However the file cannot be read flutter test running inside IDE. </p> <p><a href="https://stackoverflow.com/questions/44816042/flutter-read-text-file-from-assets">Loading as resource</a> (it is not, since I do not want to bundle the test data file in the app) also does not work in test.</p> <p>What is a good way to read file in flutter (for both command line test and IDE test)?</p> <p>Running <code>flutter test</code> is very fast. However testing inside Intellij IDE is ver slow, but it can set debug breakpoint and step into and view variables. So both testing is very useful.</p>
0debug
datatables for bigners in jquery : how can i use data tables of jquery i want to create table in which i use atributes of freegeoip.net my project is to recieve data from freegeoip.net and put it into datatables..here is my code with html i try to save data into html too <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <!DOCTYPE html> <html> <head> <title>idAddress</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> </head> <body> <input id="ip" type="text" name="textField" placeholder="Enter Ip Address"><br/><br/> <input id="button" type="submit" value="submit Adress"> <input id="button2" type="button" value="sent" onclick="cheak()"> <p id="p"></p> <script type="text/javascript"> var ipAdd; window.cond = false; var index = 0; function validateIp(ipAdd) { var save = /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/; return save.test(ipAdd); } function validate() { index++; //for storing data in array . . ipAdd = $("#ip").val(); if (validateEmail(ipAdd)) { console.log("valid"); } else { console.log("invalid"); } } $("#button").bind("click", validate); function cheak(){ var info = []; $.ajax({ url:'https://freegeoip.net/json/'+ipAdd, type:"Get", dataType:'json', success:function(data){ info[index] = JSON.stringify(data); document.getElementById("p").innerHTML = info[index]; }, error: function(XMLHttpRequest, textStatus, errorThrown) { console.log("please cheak your IpAdress"); } }); } </script> </body> </html> <!-- end snippet -->
0debug
static int v9fs_do_mknod(V9fsState *s, V9fsString *path, mode_t mode, dev_t dev) { return s->ops->mknod(&s->ctx, path->data, mode, dev); }
1threat
Class properties must be methods. Expected '(' but instead saw '=' : <p>I have a react app, and I have this code, but it looks like the fetchdata m ethod is full of syntax errors, the first one shown on the title of the question.</p> <p>Whats wrong with the method?</p> <pre><code>import React, { Component } from 'react'; import { Row, Col } from 'antd'; import PageHeader from '../../components/utility/pageHeader'; import Box from '../../components/utility/box'; import LayoutWrapper from '../../components/utility/layoutWrapper.js'; import ContentHolder from '../../components/utility/contentHolder'; import basicStyle from '../../settings/basicStyle'; import IntlMessages from '../../components/utility/intlMessages'; import { adalApiFetch } from '../../adalConfig'; const data = { TenantId: this.this.state.tenantid, TenanrUrl: this.state.tenanturl, TenantPassword: this.state.tenantpassword }; const options = { method: 'post', data: data, config: { headers: { 'Content-Type': 'multipart/form-data' } } }; export default class extends Component { constructor(props) { super(props); this.state = {value: ''}; this.handleChangeTenantUrl = this.handleChangeTenantUrl.bind(this); this.handleChangeTenantPassword = this.handleChangeTenantPassword.bind(this); this.handleChangeTenantId= this.handleChangeTenantId.bind(this); this.handleSubmit = this.handleSubmit.bind(this); } handleChangeTenantUrl(event){ this.setState({tenanturl: event.target.value}); } handleChangeTenantPassword(event){ this.setState({tenantpassword: event.target.value}); } handleChangeTenantId(event){ this.setState({tenantid: event.target.value}); } handleSubmit(event){ alert('A name was submitted: ' + this.state.value); event.preventDefault(); fetchData(); } fetchData = () =&gt; { adalApiFetch(fetch, "/tenant", options) .then(response =&gt; response.json()) .then(responseJson =&gt; { if (!this.isCancelled) { this.setState({ data: responseJson }); } }) .catch(error =&gt; { console.error(error); }); }; upload(e) { let data = new FormData(); //Append files to form data let files = e.target.files; for (let i = 0; i &lt; files.length; i++) { data.append('files', files[i], files[i].name); } let d = { method: 'post', url: API_SERVER, data: data, config: { headers: { 'Content-Type': 'multipart/form-data' }, }, onUploadProgress: (eve) =&gt; { let progress = utility.UploadProgress(eve); if (progress == 100) { console.log("Done"); } else { console.log("Uploading...",progress); } }, }; let req = axios(d); return new Promise((resolve)=&gt;{ req.then((res)=&gt;{ return resolve(res.data); }); }); } render(){ const { data } = this.state; const { rowStyle, colStyle, gutter } = basicStyle; return ( &lt;div&gt; &lt;LayoutWrapper&gt; &lt;PageHeader&gt;{&lt;IntlMessages id="pageTitles.TenantAdministration" /&gt;}&lt;/PageHeader&gt; &lt;Row style={rowStyle} gutter={gutter} justify="start"&gt; &lt;Col md={12} sm={12} xs={24} style={colStyle}&gt; &lt;Box title={&lt;IntlMessages id="pageTitles.TenantAdministration" /&gt;} subtitle={&lt;IntlMessages id="pageTitles.TenantAdministration" /&gt;} &gt; &lt;ContentHolder&gt; &lt;form onSubmit={this.handleSubmit}&gt; &lt;label&gt; TenantId: &lt;input type="text" value={this.state.tenantid} onChange={this.handleChangeTenantId} /&gt; &lt;/label&gt; &lt;label&gt; TenantUrl: &lt;input type="text" value={this.state.tenanturl} onChange={this.handleChangeTenantUrl} /&gt; &lt;/label&gt; &lt;label&gt; TenantPassword: &lt;input type="text" value={this.state.tenantpassword} onChange={this.handleChangeTenantPassword} /&gt; &lt;/label&gt; &lt;label&gt; Certificate: &lt;input onChange = { e =&gt; this.upload(e) } type = "file" id = "files" ref = { file =&gt; this.fileUpload } /&gt; &lt;/label&gt; &lt;input type="submit" value="Submit" /&gt; &lt;/form&gt; &lt;/ContentHolder&gt; &lt;/Box&gt; &lt;/Col&gt; &lt;/Row&gt; &lt;/LayoutWrapper&gt; &lt;/div&gt; ); } } </code></pre>
0debug
How to cache Gradle dependencies inside Gitlab CI : <p>I add cache property inside my <code>gitlab-ci.yml</code> file in my Android project.</p> <pre><code>cache: paths: - .gradle/wrapper - .gradle/caches </code></pre> <p>But in each pipeline when I run <code>./gradlew assemble</code>, It downloads all gradle dependencies which cause slow build time.</p>
0debug
`method_missing': undefined local variable or method `ture' for #<Class:0x007f9922f68110> (NameError) : <p>Hello guys I'm learning how to test code with RSpec and I'm having this error when I try to run Rspec. I think is a bug on Active Record but I search googling and I don't have nothing for help me with this... so my error is this:</p> <pre><code>$ rspec /Users/romenigld/.rvm/gems/ruby-2.3.3/gems/activerecord-4.2.7.1/lib/active_record/dynamic_matchers.rb:26:in `method_missing': undefined local variable or method `ture' for #&lt;Class:0x007f9922f68110&gt; (NameError) from /Users/romenigld/workspace/ebooks/everyday_rails_Testing_with_RSpec/contact_app/app/models/contact.rb:6:in `&lt;class:Contact&gt;' from /Users/romenigld/workspace/ebooks/everyday_rails_Testing_with_RSpec/contact_app/app/models/contact.rb:1:in `&lt;top (required)&gt;' from /Users/romenigld/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require' from /Users/romenigld/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require' from /Users/romenigld/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency' from /Users/romenigld/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require' from /Users/romenigld/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:360:in `require_or_load' from /Users/romenigld/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:494:in `load_missing_constant' from /Users/romenigld/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:184:in `const_missing' from /Users/romenigld/workspace/ebooks/everyday_rails_Testing_with_RSpec/contact_app/spec/models/contact_spec.rb:3:in `&lt;top (required)&gt;' from /Users/romenigld/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `load' from /Users/romenigld/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `block in load' from /Users/romenigld/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency' from /Users/romenigld/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `load' from /Users/romenigld/.rvm/gems/ruby-2.3.3/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105:in `block in load_spec_files' from /Users/romenigld/.rvm/gems/ruby-2.3.3/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105:in `each' from /Users/romenigld/.rvm/gems/ruby-2.3.3/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105:in `load_spec_files' from /Users/romenigld/.rvm/gems/ruby-2.3.3/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:96:in `setup' from /Users/romenigld/.rvm/gems/ruby-2.3.3/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:84:in `run' from /Users/romenigld/.rvm/gems/ruby-2.3.3/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:69:in `run' from /Users/romenigld/.rvm/gems/ruby-2.3.3/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:37:in `invoke' from /Users/romenigld/.rvm/gems/ruby-2.3.3/gems/rspec-core-3.1.7/exe/rspec:4:in `&lt;top (required)&gt;' from /Users/romenigld/.rvm/gems/ruby-2.3.3/bin/rspec:22:in `load' from /Users/romenigld/.rvm/gems/ruby-2.3.3/bin/rspec:22:in `&lt;main&gt;' from /Users/romenigld/.rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in `eval' from /Users/romenigld/.rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in `&lt;main&gt;' </code></pre> <p>My contact_spec.rb</p> <pre><code>require 'rails_helper' describe Contact do it "is valid with a first_name, last_name and email" do contact = Contact.new( first_name: 'Aaron', last_name: 'Sumner', email: 'tester@example.com') expect(contact).to be_valid end it "is invalid without a firstname" do contact = Contact.new(first_name: nil) contact.valid? expect(contact.errors[:first_name]).to include("can't be blank") end it "is invalid without a lastname" do contact = Contact.new(last_name: nil) contact.valid? expect(contact.errors[:last_name]).to include("can't be blank") end it "is invalid without an email address" do end it "is invalid with a duplicate email address" do Contact.create( first_name: 'Joe', last_name: 'Tester', email: 'tester@example.com' ) contact = Contact.new( first_name: 'Jane', last_name: 'Tester', email: 'tester@example.com' ) contact.valid? expect(contact.errors[:email]).to include("has already been taken") end it "returns a contact's full name as a string" do contact = Contact.new( first_name: 'John', last_name: 'Doe', email: 'johndoe@example.com') expect(contact.name).to eq 'John Doe' end it "returns a sorted array of results taht match" do smith = Contact.create( first_name: 'John', last_name: 'Smith', email: 'jsmith@example.com' ) jones = Contact.create( first_name: 'Tim', last_name: 'Jones', email: 'tjones@example.com' ) johnson = Contact.create( first_name: 'John', last_name: 'johnson', email: 'jjohnson@example.com' ) expect(Contact.by_letter("J")).to eq [johnson, jones] end it "omits results that do not match" do smith = Contact.create( first_name: 'John', last_name: 'Smith', email: 'jsmith@example.com' ) jones = Contact.create( first_name: 'Tim', last_name: 'Jones', email: 'tjones@example.com' ) johnson = Contact.create( first_name: 'John', last_name: 'Johnson', email: 'jjohnson@example.com' ) expect(Contact.by_letter("J")).not_to include smith end end </code></pre> <p>My contact.rb</p> <pre><code>class Contact &lt; ActiveRecord::Base has_many :phones #accepts_nested_attributes_for :phones validates :first_name, presence: true validates :last_name, presence: ture validates :email, presence: true, uniqueness: true validates :phones, length: { is: 3 } def name [first_name, last_name].join('') end def self.by_letter(letter) where("last_name LIKE ?", "#{letter}%").order(:last_name) end end </code></pre> <p>If someone can help me I will appreciate!</p>
0debug
How to make a picture to cover the width of a div : <p>On this <a href="http://rainmakercorp.ch/" rel="nofollow noreferrer">website</a> I would like to fit the picture for the entire div width. (If you scroll down you'll see the blog section)</p> <p>As you can see from the <a href="https://i.stack.imgur.com/VYzaV.png" rel="nofollow noreferrer">picture</a> there are some white space on left and right.</p> <p>How can I achieve this?</p> <p>Note: I can't edit the HTML structure of the website. I can only work via CSS or JS.</p> <p>Many many thanks</p>
0debug
/c.xhtml @23,45 value="#{Bonjour.nom}": Target Unreachable, identifier 'Bonjour' resolved to null : <p>I work in eclipse and GlassFish, but when I run my XHTML page this error appears: "/c.xhtml @23,45 value="#{Bonjour.nom}": Target Unreachable, identifier 'Bonjour' resolved to null"</p> <pre><code>this is the first page &lt;!DOCTYPE html&gt; </code></pre> <p> <pre><code>xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"&gt; &lt;h:head&gt; &lt;title&gt;Ins�rer le titre ici&lt;/title&gt; &lt;/h:head&gt; &lt;h:body&gt; &lt;h1&gt;Premier exemple JSF 2.0 - bonjour.xhtml&lt;/h1&gt; &lt;h:form&gt; &lt;h:inputText value="#{Bonjour.nom}"&gt; &lt;/h:inputText&gt; &lt;h:commandButton value="Souhaiter la Bienvenue" action="d"&gt;&lt;/h:commandButton&gt; &lt;/h:form&gt; &lt;/h:body&gt; </code></pre> <p> this is the code of the target page </p> <p> <pre><code>xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"&gt; &lt;h:head&gt; &lt;title&gt;Ins�rer le titre ici&lt;/title&gt; &lt;/h:head&gt; &lt;h:body&gt; &lt;h1&gt;Premier exemple JSF 2.0 - bienvenue.xhtml&lt;/h1&gt; &lt;p&gt;Bienvenue #{Bonjour.nom} !&lt;/p&gt; &lt;/h:body&gt; </code></pre> <p> the code of web.xml: </p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; </code></pre> <p>http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"> Poject_JSF</p> <pre><code>&lt;!-- Changer cette valeur à "Production" lors du déploiement final de l'application --&gt; &lt;context-param&gt; &lt;param-name&gt;javax.faces.PROJECT_STAGE&lt;/param-name&gt; &lt;param-value&gt;Development&lt;/param-value&gt; &lt;/context-param&gt; &lt;!-- Déclaration du contrôleur central de JSF : la FacesServlet --&gt; &lt;servlet&gt; &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt; &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt; &lt;load-on-startup&gt;1&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;!-- Mapping : association des requêtes dont le fichier porte l'extension .xhtml à la FacesServlet --&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt; &lt;url-pattern&gt;*.xhtml&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; </code></pre> <p></p>
0debug
webpack ERROR in CommonsChunkPlugin: While running in normal mode it's not allowed to use a non-entry chunk : <p>So When I try to split my application into 1 application.js file and 1 libraries.js file, everything works fine. When I try to split it up into 1 application.js file and 2 libraries.js files, I get this error when building:</p> <p><code>ERROR in CommonsChunkPlugin: While running in normal mode it's not allowed to use a non-entry chunk (libraries-react)</code></p> <p>Anyone know what might be causing this error?</p> <p>My configuration for webpack is</p> <pre><code>var webpack = require("webpack"); var ExtractTextPlugin = require("extract-text-webpack-plugin"); var extractSass = new ExtractTextPlugin('main.css'); module.exports = { module: { loaders: [{ test: /\.jsx$/, loader: 'babel', exclude: ['./node_modules'], query: { presets: ['react', 'es2015'] } }, { test: /\.scss$/, loader: extractSass.extract(['css', 'sass']) }, { test: /\.html$/, loader: 'file?name=[name].[ext]' }, { test: /\/misc\/.*\.js$/, loader: 'file?name=/misc/[name].[ext]' }, { test: /\.(png|jpg|jpeg|)$/, loader: 'file?name=/images/[name].[ext]' }] }, plugins: [ extractSass, new webpack.optimize.CommonsChunkPlugin('libraries-core', 'libraries-core.js'), new webpack.optimize.CommonsChunkPlugin('libraries-react', 'libraries-react.js') ], entry: { //3rd party libraries 'libraries-core': [ 'lodash', 'superagent', 'bluebird', 'eventemitter3', 'object-assign', 'schema-inspector', 'jsuri', 'store-cacheable', 'immutable' ], 'libraries-react': [ 'react', 'react-dom', 'react-router', 'nucleus-react' ], //application code application: './web/app/application.jsx', //mocks 'mocked-api': './web/app/mock/api.js', 'mocked-local-storage': './web/app/mock/local-storage.js' }, output: { path: './web/build', publicPath: '/build', filename: '[name].js' } } </code></pre>
0debug
static int read_rle_sgi(const SGIInfo *sgi_info, AVPicture *pict, ByteIOContext *f) { uint8_t *dest_row, *rle_data = NULL; unsigned long *start_table, *length_table; int y, z, xsize, ysize, zsize, tablen; long start_offset, run_length; int ret = 0; xsize = sgi_info->xsize; ysize = sgi_info->ysize; zsize = sgi_info->zsize; rle_data = av_malloc(xsize); url_fseek(f, SGI_HEADER_SIZE, SEEK_SET); tablen = ysize * zsize * sizeof(long); start_table = (unsigned long *)av_malloc(tablen); length_table = (unsigned long *)av_malloc(tablen); if (!get_buffer(f, (uint8_t *)start_table, tablen)) { ret = -1; goto fail; } if (!get_buffer(f, (uint8_t *)length_table, tablen)) { ret = -1; goto fail; } for (z = 0; z < zsize; z++) { for (y = 0; y < ysize; y++) { dest_row = pict->data[0] + (ysize - 1 - y) * (xsize * zsize); start_offset = BE_32(&start_table[y + z * ysize]); run_length = BE_32(&length_table[y + z * ysize]); if (url_ftell(f) != start_offset) { url_fseek(f, start_offset, SEEK_SET); } get_buffer(f, rle_data, run_length); expand_rle_row(dest_row, rle_data, z, zsize); } } fail: av_free(start_table); av_free(length_table); av_free(rle_data); return ret; }
1threat
static int kvm_get_xsave(CPUState *env) { #ifdef KVM_CAP_XSAVE struct kvm_xsave* xsave; int ret, i; uint16_t cwd, swd, twd, fop; if (!kvm_has_xsave()) { return kvm_get_fpu(env); } xsave = qemu_memalign(4096, sizeof(struct kvm_xsave)); ret = kvm_vcpu_ioctl(env, KVM_GET_XSAVE, xsave); if (ret < 0) { qemu_free(xsave); return ret; } cwd = (uint16_t)xsave->region[0]; swd = (uint16_t)(xsave->region[0] >> 16); twd = (uint16_t)xsave->region[1]; fop = (uint16_t)(xsave->region[1] >> 16); env->fpstt = (swd >> 11) & 7; env->fpus = swd; env->fpuc = cwd; for (i = 0; i < 8; ++i) { env->fptags[i] = !((twd >> i) & 1); } env->mxcsr = xsave->region[XSAVE_MXCSR]; memcpy(env->fpregs, &xsave->region[XSAVE_ST_SPACE], sizeof env->fpregs); memcpy(env->xmm_regs, &xsave->region[XSAVE_XMM_SPACE], sizeof env->xmm_regs); env->xstate_bv = *(uint64_t *)&xsave->region[XSAVE_XSTATE_BV]; memcpy(env->ymmh_regs, &xsave->region[XSAVE_YMMH_SPACE], sizeof env->ymmh_regs); qemu_free(xsave); return 0; #else return kvm_get_fpu(env); #endif }
1threat
Differences between Akka HTTP and Netty : <p>Can someone please explain the major differences between <a href="http://doc.akka.io/docs/akka-http/current/java/http/index.html" rel="noreferrer">Akka HTTP</a> and <a href="https://netty.io/" rel="noreferrer">Netty</a>? Netty offers other protocols like FTP as well. Akka HTTP can be used in Scala and Java and is <a href="http://doc.akka.io/docs/akka-http/current/java/http/introduction.html" rel="noreferrer">build on the actor model</a>. But apart from this both are asynchronous. When would I use Akka HTTP and when Netty? What are the typical use cases for both?</p>
0debug
Check if key in json has another keys within in Python : Im trying to print my json content. I know how to print just keys and values but I want to have access to the objects within the keys too. This is my code: json_mini = json.loads('{"one" : {"testing" : 39, "this": 17}, "two" : "2", "three" : "3"}') for index, value in json_mini.items(): print index, value if value.items(): for ind2, val2 in value.items(): print ind2, val2 which gives me this error: `AttributeError: 'unicode' object has no attribute 'items'` How to iterate over it? So I can do some process on each separate key and value?
0debug
static void cuvid_flush(AVCodecContext *avctx) { CuvidContext *ctx = avctx->priv_data; AVHWDeviceContext *device_ctx = (AVHWDeviceContext*)ctx->hwdevice->data; AVCUDADeviceContext *device_hwctx = device_ctx->hwctx; CUcontext dummy, cuda_ctx = device_hwctx->cuda_ctx; CUVIDSOURCEDATAPACKET seq_pkt = { 0 }; int ret; ctx->ever_flushed = 1; ret = CHECK_CU(cuCtxPushCurrent(cuda_ctx)); if (ret < 0) goto error; av_fifo_freep(&ctx->frame_queue); ctx->frame_queue = av_fifo_alloc(MAX_FRAME_COUNT * sizeof(CuvidParsedFrame)); if (!ctx->frame_queue) { av_log(avctx, AV_LOG_ERROR, "Failed to recreate frame queue on flush\n"); return; } if (ctx->cudecoder) { cuvidDestroyDecoder(ctx->cudecoder); ctx->cudecoder = NULL; } if (ctx->cuparser) { cuvidDestroyVideoParser(ctx->cuparser); ctx->cuparser = NULL; } ret = CHECK_CU(cuvidCreateVideoParser(&ctx->cuparser, &ctx->cuparseinfo)); if (ret < 0) goto error; seq_pkt.payload = ctx->cuparse_ext.raw_seqhdr_data; seq_pkt.payload_size = ctx->cuparse_ext.format.seqhdr_data_length; if (seq_pkt.payload && seq_pkt.payload_size) { ret = CHECK_CU(cuvidParseVideoData(ctx->cuparser, &seq_pkt)); if (ret < 0) goto error; } ret = CHECK_CU(cuCtxPopCurrent(&dummy)); if (ret < 0) goto error; ctx->prev_pts = INT64_MIN; ctx->decoder_flushing = 0; return; error: av_log(avctx, AV_LOG_ERROR, "CUDA reinit on flush failed\n"); }
1threat
SQL Query to convert single row from multiple tables into a single row in table??? : I have 7 tables with same structure. And each table has 2 columns,In these one column is join key( but not a primary key) and 2nd column is Unique. Below is the requirement mentioned for 2 tables. But we need to develop for 7 tables. TAB1: ===== CITY NAME HYD RAMU HYD KRISH TAB1: ===== CITY NAME HYD RAJ HYD KRISH OUTPUT: ======= CITY EXIST1 EXIST2 HYD RAMU NUKLL HYD NULL RAJ HYD KRISH KRISH PLEASE HELP ME TO DEVELOP QUERY ON THIS.
0debug
void ff_jpegls_init_state(JLSState *state){ int i; state->twonear = state->near * 2 + 1; state->range = ((state->maxval + state->twonear - 1) / state->twonear) + 1; for(state->qbpp = 0; (1 << state->qbpp) < state->range; state->qbpp++); if(state->bpp < 8) state->limit = 16 + 2 * state->bpp - state->qbpp; else state->limit = (4 * state->bpp) - state->qbpp; for(i = 0; i < 367; i++) { state->A[i] = FFMAX((state->range + 32) >> 6, 2); state->N[i] = 1; } }
1threat
static void test_hbitmap_iter_past(TestHBitmapData *data, const void *unused) { hbitmap_test_init(data, L3, 0); hbitmap_test_set(data, 0, L3); hbitmap_test_check(data, L3); }
1threat
int object_property_get_enum(Object *obj, const char *name, const char *typename, Error **errp) { StringOutputVisitor *sov; StringInputVisitor *siv; char *str; int ret; ObjectProperty *prop = object_property_find(obj, name, errp); EnumProperty *enumprop; if (prop == NULL) { return 0; } if (!g_str_equal(prop->type, typename)) { error_setg(errp, "Property %s on %s is not '%s' enum type", name, object_class_get_name( object_get_class(obj)), typename); return 0; } enumprop = prop->opaque; sov = string_output_visitor_new(false); object_property_get(obj, string_output_get_visitor(sov), name, errp); str = string_output_get_string(sov); siv = string_input_visitor_new(str); string_output_visitor_cleanup(sov); visit_type_enum(string_input_get_visitor(siv), &ret, enumprop->strings, NULL, name, errp); g_free(str); string_input_visitor_cleanup(siv); return ret; }
1threat
static av_cold int smvjpeg_decode_init(AVCodecContext *avctx) { SMVJpegDecodeContext *s = avctx->priv_data; AVCodec *codec; AVDictionary *thread_opt = NULL; int ret = 0; s->frames_per_jpeg = 0; s->picture[0] = av_frame_alloc(); if (!s->picture[0]) return AVERROR(ENOMEM); s->picture[1] = av_frame_alloc(); if (!s->picture[1]) return AVERROR(ENOMEM); s->jpg.picture_ptr = s->picture[0]; if (avctx->extradata_size >= 4) s->frames_per_jpeg = AV_RL32(avctx->extradata); if (s->frames_per_jpeg <= 0) { av_log(avctx, AV_LOG_ERROR, "Invalid number of frames per jpeg.\n"); ret = -1; } codec = avcodec_find_decoder(AV_CODEC_ID_MJPEG); if (!codec) { av_log(avctx, AV_LOG_ERROR, "MJPEG codec not found\n"); ret = -1; } s->avctx = avcodec_alloc_context3(codec); av_dict_set(&thread_opt, "threads", "1", 0); s->avctx->refcounted_frames = 1; s->avctx->flags = avctx->flags; s->avctx->idct_algo = avctx->idct_algo; if (ff_codec_open2_recursive(s->avctx, codec, &thread_opt) < 0) { av_log(avctx, AV_LOG_ERROR, "MJPEG codec failed to open\n"); ret = -1; } av_dict_free(&thread_opt); return ret; }
1threat
Can we deploy a C# 7 web app to Azure using Kudu? : <p>Since Visual Studio 2017 is released and we can use the new C# 7 features I expected this will work when deploying on Azure Web apps.</p> <p>Unfortunately we're seeing compile errors when using continuous deployment (kudu git deploy) so it seems Azure doesn't support the new toolchain yet.</p> <p>Is there anything we can do to get this to work now (besides publishing the assemblies directly)?</p>
0debug
how can I make a bookmark that installs jquery? : <p>how can I make a bookmark that installs jquery?</p> <p>so that when I am in the developer console, I can call jquery functions from whatever websites i'm on?</p>
0debug
Angular Build Process to hash the File Name of Asset and Resource Folders : <p>I have an <strong>Angular 4.4.6</strong> application and I build this using <strong>Angular CLI 1.0.1</strong>. </p> <p>The problem I have is, apart from "inline.bundle.js", "main.bundle", "polyfills.bundle.js", "styles.bundle.js", "vendor.bundle.js" files names, all other File Names in "<strong>assets</strong>" and "<strong>resources</strong>" folder <strong>are NOT hashed</strong> when I build the application.</p> <p>Since the file name is not hashed the request URLs for these files remain same and hence the browsers takes these files from cache it self and new changes are not reflecting.</p> <p>Can somebody help how I can hash all the file names of "assests" and "resources" folders as well to avoid caching of these files ?</p> <p>Build Command: ng build --prod --aot --no-sourcemap --output-hash=all</p> <p>OS: Windows 10</p> <p>Thanks </p>
0debug
static void usb_msd_set_bootindex(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { USBDevice *dev = USB_DEVICE(obj); MSDState *s = USB_STORAGE_DEV(dev); int32_t boot_index; Error *local_err = NULL; visit_type_int32(v, name, &boot_index, &local_err); if (local_err) { goto out; } check_boot_index(boot_index, &local_err); if (local_err) { goto out; } s->conf.bootindex = boot_index; if (s->scsi_dev) { object_property_set_int(OBJECT(s->scsi_dev), boot_index, "bootindex", &error_abort); } out: if (local_err) { error_propagate(errp, local_err); } }
1threat
Ruby - counting number of string occurence in a string/array : This code returns the word with the most occurences in a given string. But, it's not working if there's for exemple two string equals to the max. For exemple, if i was adding 3 'cool' to the text, it would still return : The words with the most frequencies is 'really' with a frequency of 4. Even if cool is also equal to 4. t1 = "This is a really really really cool experiment cool really " frequency = Hash.new(0) words = t1.split words.each { |word| frequency[word.downcase] += 1 } frequency = frequency.map.max_by {|k, v| v } puts "The words with the most frequencies is '#{frequency[0]}' with a frequency of #{frequency[1]}." i'm expecting to be able to return all word(s) with the max occurences from a given string. It would be nice if you guys could tell me if those method would work on a array too instead of a string because im still learning that some methods wont work on different type of data and i might have to use this code on arrays. Thanks !
0debug
static void test_validate_union_native_list(TestInputVisitorData *data, const void *unused) { UserDefNativeListUnion *tmp = NULL; Visitor *v; Error *err = NULL; v = validate_test_init(data, "{ 'type': 'integer', 'data' : [ 1, 2 ] }"); visit_type_UserDefNativeListUnion(v, &tmp, NULL, &err); g_assert(!err); qapi_free_UserDefNativeListUnion(tmp); }
1threat
Unable to reverse all the characters in the below code along with spaces : The code below reverses all the characters in a sentence.But it is unable to do so.This is a kid stuff but at this moment it's not compiling.Can anyone figure out the issue Let's say: "Smart geeks are fast coders".The below code should reverse as following: "trams skeeg era tsaf sredoc" function solution(S) { var result = false; if(S.length === 1) { result = S; } if(S.length > 1 && S.length < 100) { var wordsArray = S.split(" "); var wordsCount = wordsAray.length; var reverseWordsString = ''; for(var i=0; i<wordsCount; i++) { if(i > 0) { reverseWordsString = reverseWordsString + ' '; } reverseWordsString = reverseWordsString + wordsAray[i].split("").reverse().join(""); } result = reverseWordsString; } return result; }
0debug
How to compare value 3.0.1 with 3.0.2 where these two numeric values are in String ? : <p>I have 3.0.1 and 3.0.2 in string data type java. Now I want to check which value is larger therefore I was converting these two into float using Float.parseFloat(str).</p> <p>But Its throwing number format exception.</p> <p>Any Help?</p> <p>Thanks Pravin</p>
0debug
How should I refer to inner enums (defined within an entity) from a JPQL query using Hibernate? : <p>I have an entity class as follows:</p> <pre><code>package stuff; @Entity class Thing { @Id @GeneratedValue private Long id; @Basic @Enumerated private State state; public enum State { AWESOME, LAME } } </code></pre> <p>How can I select all Things with state AWESOME using JPQL and Hibernate?</p> <pre><code>select t from Thing t where t.state=stuff.Thing.State.AWESOME </code></pre> <p>...gives the error...</p> <pre><code>org.hibernate.hql.internal.ast.QuerySyntaxException: Invalid path: 'stuff.Thing.State.AWESOME' </code></pre>
0debug
static int cirrus_bitblt_common_patterncopy(CirrusVGAState *s, bool videosrc) { uint32_t patternsize; uint8_t *dst; uint8_t *src; dst = s->vga.vram_ptr + s->cirrus_blt_dstaddr; if (videosrc) { switch (s->vga.get_bpp(&s->vga)) { case 8: patternsize = 64; break; case 15: case 16: patternsize = 128; break; case 24: case 32: default: patternsize = 256; break; } s->cirrus_blt_srcaddr &= ~(patternsize - 1); if (s->cirrus_blt_srcaddr + patternsize > s->vga.vram_size) { return 0; } src = s->vga.vram_ptr + s->cirrus_blt_srcaddr; } else { src = s->cirrus_bltbuf; } if (blit_is_unsafe(s, true)) { return 0; } (*s->cirrus_rop) (s, dst, src, s->cirrus_blt_dstpitch, 0, s->cirrus_blt_width, s->cirrus_blt_height); cirrus_invalidate_region(s, s->cirrus_blt_dstaddr, s->cirrus_blt_dstpitch, s->cirrus_blt_width, s->cirrus_blt_height); return 1; }
1threat
static void qdm2_decode_fft_packets(QDM2Context *q) { int i, j, min, max, value, type, unknown_flag; GetBitContext gb; if (q->sub_packet_list_B[0].packet == NULL) return; q->fft_coefs_index = 0; for (i = 0; i < 5; i++) q->fft_coefs_min_index[i] = -1; for (i = 0, max = 256; i < q->sub_packets_B; i++) { QDM2SubPacket *packet = NULL; for (j = 0, min = 0; j < q->sub_packets_B; j++) { value = q->sub_packet_list_B[j].packet->type; if (value > min && value < max) { min = value; packet = q->sub_packet_list_B[j].packet; } } max = min; if (!packet) return; if (i == 0 && (packet->type < 16 || packet->type >= 48 || fft_subpackets[packet->type - 16])) return; init_get_bits(&gb, packet->data, packet->size * 8); if (packet->type >= 32 && packet->type < 48 && !fft_subpackets[packet->type - 16]) unknown_flag = 1; else unknown_flag = 0; type = packet->type; if ((type >= 17 && type < 24) || (type >= 33 && type < 40)) { int duration = q->sub_sampling + 5 - (type & 15); if (duration >= 0 && duration < 4) qdm2_fft_decode_tones(q, duration, &gb, unknown_flag); } else if (type == 31) { for (j = 0; j < 4; j++) qdm2_fft_decode_tones(q, j, &gb, unknown_flag); } else if (type == 46) { for (j = 0; j < 6; j++) q->fft_level_exp[j] = get_bits(&gb, 6); for (j = 0; j < 4; j++) qdm2_fft_decode_tones(q, j, &gb, unknown_flag); } } for (i = 0, j = -1; i < 5; i++) if (q->fft_coefs_min_index[i] >= 0) { if (j >= 0) q->fft_coefs_max_index[j] = q->fft_coefs_min_index[i]; j = i; } if (j >= 0) q->fft_coefs_max_index[j] = q->fft_coefs_index; }
1threat
static int process_audio_header_elements(AVFormatContext *s) { int inHeader = 1; EaDemuxContext *ea = s->priv_data; ByteIOContext *pb = &s->pb; int compression_type; ea->num_channels = 1; while (inHeader) { int inSubheader; uint8_t byte; byte = get_byte(pb); switch (byte) { case 0xFD: av_log (s, AV_LOG_INFO, "entered audio subheader\n"); inSubheader = 1; while (inSubheader) { uint8_t subbyte; subbyte = get_byte(pb); switch (subbyte) { case 0x82: ea->num_channels = read_arbitary(pb); av_log (s, AV_LOG_INFO, "num_channels (element 0x82) set to 0x%08x\n", ea->num_channels); break; case 0x83: compression_type = read_arbitary(pb); av_log (s, AV_LOG_INFO, "compression_type (element 0x83) set to 0x%08x\n", compression_type); break; case 0x85: ea->num_samples = read_arbitary(pb); av_log (s, AV_LOG_INFO, "num_samples (element 0x85) set to 0x%08x\n", ea->num_samples); break; case 0x8A: av_log (s, AV_LOG_INFO, "element 0x%02x set to 0x%08x\n", subbyte, read_arbitary(pb)); av_log (s, AV_LOG_INFO, "exited audio subheader\n"); inSubheader = 0; break; case 0xFF: av_log (s, AV_LOG_INFO, "end of header block reached (within audio subheader)\n"); inSubheader = 0; inHeader = 0; break; default: av_log (s, AV_LOG_INFO, "element 0x%02x set to 0x%08x\n", subbyte, read_arbitary(pb)); break; } } break; case 0xFF: av_log (s, AV_LOG_INFO, "end of header block reached\n"); inHeader = 0; break; default: av_log (s, AV_LOG_INFO, "header element 0x%02x set to 0x%08x\n", byte, read_arbitary(pb)); break; } } ea->audio_codec = CODEC_ID_ADPCM_EA; return 1; }
1threat
Does yarn add package --build-from-source behave like npm install package --build-from-source when passing node-gyp flags to packages? : <p>It looks like <code>yarn</code> does not pass node-gyp flags to native packages the way <code>npm</code> does.</p> <p>For example when attempting to install sqlite3@3.1.6 with:</p> <pre><code>npm install sqlite3@3.1.6 \ --build-from-source \ --sqlite_libname=sqlcipher \ --sqlite=`brew --prefix` \ --verbose </code></pre> <p>we get a successful installation of sqlite3 with sqlcipher extensions, due to passing <code>--sqlite_libname</code> and <code>--sqlite</code>, which are <a href="https://github.com/mapbox/node-sqlite3/blob/d18c1e97de9478aab27067638899b068e6d8ed03/binding.gyp#L3" rel="noreferrer">specified</a> in sqlite3's <code>binding.gyp</code>.</p> <p>But, when attempting to use <code>yarn</code>, and running what I would think to be the equivalent command, it looks like the flags aren't honored:</p> <pre><code>yarn add sqlite3@3.1.6 \ --force \ --build-from-source \ --sqlite_libname=sqlcipher \ --sqlite=`brew --prefix` \ --verbose </code></pre> <p>With <code>npm</code> unrecognized command line arguments are converted to gyp flags. </p> <p>With <code>yarn</code> that doesn't seem to work.</p> <p>Is there a way to get this functionality with <code>yarn</code>?</p>
0debug
static target_ulong put_tce_emu(sPAPRTCETable *tcet, target_ulong ioba, target_ulong tce) { sPAPRTCE *tcep; if (ioba >= tcet->window_size) { hcall_dprintf("spapr_vio_put_tce on out-of-boards IOBA 0x" TARGET_FMT_lx "\n", ioba); return H_PARAMETER; } tcep = tcet->table + (ioba >> SPAPR_TCE_PAGE_SHIFT); tcep->tce = tce; return H_SUCCESS; }
1threat
How can I make user not allow to resize textarea? : <p>I have textarea in my website and i want to make user not allow to resize this textarea. But I use this languages only : php - html - jquery - javascript</p>
0debug
Alphabetical Palindrome Trinagle in Python : The word is "racecar" and this is the triangle I'm supposed to get:- e cec aceca racecar I'm using python 2.7 I'm trying to make it using for loops. Thank you.
0debug
how to send mail the fastest with linux : <p>What is the way of sending the fastest mail? I'm using mailx but the fastest comes in 2 min.</p> <pre><code>mailx -r "from" -s "UNIX OPERATIONS ALARM----&gt;$ipNo1 $subject alarmi hk." "to" </code></pre>
0debug
.net Core on Windows vs Linux : <p>ASP.Net Core runs on both Windows and Linux Docker containers. Considering Linux hosts are cheaper than Windows hosts, what is the benefit of running your app on IIS/Windows vs Nginx/Linux if one doesn't require the full .Net framework?</p>
0debug
static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, AVPacket *pkt) { unsigned char chunk_preamble[CHUNK_PREAMBLE_SIZE]; int chunk_type; int chunk_size; unsigned char opcode_preamble[OPCODE_PREAMBLE_SIZE]; unsigned char opcode_type; unsigned char opcode_version; int opcode_size; unsigned char scratch[1024]; int i, j; int first_color, last_color; int audio_flags; unsigned char r, g, b; unsigned int width, height; chunk_type = load_ipmovie_packet(s, pb, pkt); if (chunk_type != CHUNK_DONE) return chunk_type; if (avio_feof(pb)) return CHUNK_EOF; if (avio_read(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) != CHUNK_PREAMBLE_SIZE) return CHUNK_BAD; chunk_size = AV_RL16(&chunk_preamble[0]); chunk_type = AV_RL16(&chunk_preamble[2]); av_log(s->avf, AV_LOG_TRACE, "chunk type 0x%04X, 0x%04X bytes: ", chunk_type, chunk_size); switch (chunk_type) { case CHUNK_INIT_AUDIO: av_log(s->avf, AV_LOG_TRACE, "initialize audio\n"); break; case CHUNK_AUDIO_ONLY: av_log(s->avf, AV_LOG_TRACE, "audio only\n"); break; case CHUNK_INIT_VIDEO: av_log(s->avf, AV_LOG_TRACE, "initialize video\n"); break; case CHUNK_VIDEO: av_log(s->avf, AV_LOG_TRACE, "video (and audio)\n"); break; case CHUNK_SHUTDOWN: av_log(s->avf, AV_LOG_TRACE, "shutdown\n"); break; case CHUNK_END: av_log(s->avf, AV_LOG_TRACE, "end\n"); break; default: av_log(s->avf, AV_LOG_TRACE, "invalid chunk\n"); chunk_type = CHUNK_BAD; break; } while ((chunk_size > 0) && (chunk_type != CHUNK_BAD)) { if (avio_feof(pb)) { chunk_type = CHUNK_EOF; break; } if (avio_read(pb, opcode_preamble, CHUNK_PREAMBLE_SIZE) != CHUNK_PREAMBLE_SIZE) { chunk_type = CHUNK_BAD; break; } opcode_size = AV_RL16(&opcode_preamble[0]); opcode_type = opcode_preamble[2]; opcode_version = opcode_preamble[3]; chunk_size -= OPCODE_PREAMBLE_SIZE; chunk_size -= opcode_size; if (chunk_size < 0) { av_log(s->avf, AV_LOG_TRACE, "chunk_size countdown just went negative\n"); chunk_type = CHUNK_BAD; break; } av_log(s->avf, AV_LOG_TRACE, " opcode type %02X, version %d, 0x%04X bytes: ", opcode_type, opcode_version, opcode_size); switch (opcode_type) { case OPCODE_END_OF_STREAM: av_log(s->avf, AV_LOG_TRACE, "end of stream\n"); avio_skip(pb, opcode_size); break; case OPCODE_END_OF_CHUNK: av_log(s->avf, AV_LOG_TRACE, "end of chunk\n"); avio_skip(pb, opcode_size); break; case OPCODE_CREATE_TIMER: av_log(s->avf, AV_LOG_TRACE, "create timer\n"); if ((opcode_version > 0) || (opcode_size != 6)) { av_log(s->avf, AV_LOG_TRACE, "bad create_timer opcode\n"); chunk_type = CHUNK_BAD; break; } if (avio_read(pb, scratch, opcode_size) != opcode_size) { chunk_type = CHUNK_BAD; break; } s->frame_pts_inc = ((uint64_t)AV_RL32(&scratch[0])) * AV_RL16(&scratch[4]); break; case OPCODE_INIT_AUDIO_BUFFERS: av_log(s->avf, AV_LOG_TRACE, "initialize audio buffers\n"); if (opcode_version > 1 || opcode_size > 10 || opcode_size < 6) { av_log(s->avf, AV_LOG_TRACE, "bad init_audio_buffers opcode\n"); chunk_type = CHUNK_BAD; break; } if (avio_read(pb, scratch, opcode_size) != opcode_size) { chunk_type = CHUNK_BAD; break; } s->audio_sample_rate = AV_RL16(&scratch[4]); audio_flags = AV_RL16(&scratch[2]); s->audio_channels = (audio_flags & 1) + 1; s->audio_bits = (((audio_flags >> 1) & 1) + 1) * 8; if ((opcode_version == 1) && (audio_flags & 0x4)) s->audio_type = AV_CODEC_ID_INTERPLAY_DPCM; else if (s->audio_bits == 16) s->audio_type = AV_CODEC_ID_PCM_S16LE; else s->audio_type = AV_CODEC_ID_PCM_U8; av_log(s->avf, AV_LOG_TRACE, "audio: %d bits, %d Hz, %s, %s format\n", s->audio_bits, s->audio_sample_rate, (s->audio_channels == 2) ? "stereo" : "mono", (s->audio_type == AV_CODEC_ID_INTERPLAY_DPCM) ? "Interplay audio" : "PCM"); break; case OPCODE_START_STOP_AUDIO: av_log(s->avf, AV_LOG_TRACE, "start/stop audio\n"); avio_skip(pb, opcode_size); break; case OPCODE_INIT_VIDEO_BUFFERS: av_log(s->avf, AV_LOG_TRACE, "initialize video buffers\n"); if ((opcode_version > 2) || (opcode_size > 8) || opcode_size < 4 || opcode_version == 2 && opcode_size < 8 ) { av_log(s->avf, AV_LOG_TRACE, "bad init_video_buffers opcode\n"); chunk_type = CHUNK_BAD; break; } if (avio_read(pb, scratch, opcode_size) != opcode_size) { chunk_type = CHUNK_BAD; break; } width = AV_RL16(&scratch[0]) * 8; height = AV_RL16(&scratch[2]) * 8; if (width != s->video_width) { s->video_width = width; s->changed++; } if (height != s->video_height) { s->video_height = height; s->changed++; } if (opcode_version < 2 || !AV_RL16(&scratch[6])) { s->video_bpp = 8; } else { s->video_bpp = 16; } av_log(s->avf, AV_LOG_TRACE, "video resolution: %d x %d\n", s->video_width, s->video_height); break; case OPCODE_UNKNOWN_06: case OPCODE_UNKNOWN_0E: case OPCODE_UNKNOWN_10: case OPCODE_UNKNOWN_12: case OPCODE_UNKNOWN_13: case OPCODE_UNKNOWN_14: case OPCODE_UNKNOWN_15: av_log(s->avf, AV_LOG_TRACE, "unknown (but documented) opcode %02X\n", opcode_type); avio_skip(pb, opcode_size); break; case OPCODE_SEND_BUFFER: av_log(s->avf, AV_LOG_TRACE, "send buffer\n"); avio_skip(pb, opcode_size); s->send_buffer = 1; break; case OPCODE_AUDIO_FRAME: av_log(s->avf, AV_LOG_TRACE, "audio frame\n"); s->audio_chunk_offset = avio_tell(pb); s->audio_chunk_size = opcode_size; avio_skip(pb, opcode_size); break; case OPCODE_SILENCE_FRAME: av_log(s->avf, AV_LOG_TRACE, "silence frame\n"); avio_skip(pb, opcode_size); break; case OPCODE_INIT_VIDEO_MODE: av_log(s->avf, AV_LOG_TRACE, "initialize video mode\n"); avio_skip(pb, opcode_size); break; case OPCODE_CREATE_GRADIENT: av_log(s->avf, AV_LOG_TRACE, "create gradient\n"); avio_skip(pb, opcode_size); break; case OPCODE_SET_PALETTE: av_log(s->avf, AV_LOG_TRACE, "set palette\n"); if (opcode_size > 0x304 || opcode_size < 4) { av_log(s->avf, AV_LOG_TRACE, "demux_ipmovie: set_palette opcode with invalid size\n"); chunk_type = CHUNK_BAD; break; } if (avio_read(pb, scratch, opcode_size) != opcode_size) { chunk_type = CHUNK_BAD; break; } first_color = AV_RL16(&scratch[0]); last_color = first_color + AV_RL16(&scratch[2]) - 1; if ( (first_color > 0xFF) || (last_color > 0xFF) || (last_color - first_color + 1)*3 + 4 > opcode_size) { av_log(s->avf, AV_LOG_TRACE, "demux_ipmovie: set_palette indexes out of range (%d -> %d)\n", first_color, last_color); chunk_type = CHUNK_BAD; break; } j = 4; for (i = first_color; i <= last_color; i++) { r = scratch[j++] * 4; g = scratch[j++] * 4; b = scratch[j++] * 4; s->palette[i] = (0xFFU << 24) | (r << 16) | (g << 8) | (b); s->palette[i] |= s->palette[i] >> 6 & 0x30303; } s->has_palette = 1; break; case OPCODE_SET_PALETTE_COMPRESSED: av_log(s->avf, AV_LOG_TRACE, "set palette compressed\n"); avio_skip(pb, opcode_size); break; case OPCODE_SET_DECODING_MAP: av_log(s->avf, AV_LOG_TRACE, "set decoding map\n"); s->decode_map_chunk_offset = avio_tell(pb); s->decode_map_chunk_size = opcode_size; avio_skip(pb, opcode_size); break; case OPCODE_VIDEO_DATA_11: av_log(s->avf, AV_LOG_TRACE, "set video data\n"); s->frame_format = 0x11; s->video_chunk_offset = avio_tell(pb); s->video_chunk_size = opcode_size; avio_skip(pb, opcode_size); break; default: av_log(s->avf, AV_LOG_TRACE, "*** unknown opcode type\n"); chunk_type = CHUNK_BAD; break; } } if (s->avf->nb_streams == 1 && s->audio_type) init_audio(s->avf); s->next_chunk_offset = avio_tell(pb); if ((chunk_type == CHUNK_VIDEO) || (chunk_type == CHUNK_AUDIO_ONLY)) chunk_type = load_ipmovie_packet(s, pb, pkt); return chunk_type; }
1threat
static void virtio_blk_dma_restart_cb(void *opaque, int running, RunState state) { VirtIOBlock *s = opaque; if (!running) return; if (!s->bh) { s->bh = qemu_bh_new(virtio_blk_dma_restart_bh, s); qemu_bh_schedule(s->bh); } }
1threat
static int add_shorts_metadata(const uint8_t **buf, int count, const char *name, const char *sep, TiffContext *s) { char *ap; int i; int *sp = av_malloc(count * sizeof(int)); if (!sp) return AVERROR(ENOMEM); for (i = 0; i < count; i++) sp[i] = tget_short(buf, s->le); ap = shorts2str(sp, count, sep); av_freep(&sp); if (!ap) return AVERROR(ENOMEM); av_dict_set(&s->picture.metadata, name, ap, AV_DICT_DONT_STRDUP_VAL); return 0; }
1threat
void av_dump_format(AVFormatContext *ic, int index, const char *url, int is_output) { int i; uint8_t *printed = ic->nb_streams ? av_mallocz(ic->nb_streams) : NULL; if (ic->nb_streams && !printed) return; av_log(NULL, AV_LOG_INFO, "%s #%d, %s, %s '%s':\n", is_output ? "Output" : "Input", index, is_output ? ic->oformat->name : ic->iformat->name, is_output ? "to" : "from", url); dump_metadata(NULL, ic->metadata, " "); if (!is_output) { av_log(NULL, AV_LOG_INFO, " Duration: "); if (ic->duration != AV_NOPTS_VALUE) { int hours, mins, secs, us; int64_t duration = ic->duration + (ic->duration <= INT64_MAX - 5000 ? 5000 : 0); secs = duration / AV_TIME_BASE; us = duration % AV_TIME_BASE; mins = secs / 60; secs %= 60; hours = mins / 60; mins %= 60; av_log(NULL, AV_LOG_INFO, "%02d:%02d:%02d.%02d", hours, mins, secs, (100 * us) / AV_TIME_BASE); } else { av_log(NULL, AV_LOG_INFO, "N/A"); } if (ic->start_time != AV_NOPTS_VALUE) { int secs, us; av_log(NULL, AV_LOG_INFO, ", start: "); secs = ic->start_time / AV_TIME_BASE; us = llabs(ic->start_time % AV_TIME_BASE); av_log(NULL, AV_LOG_INFO, "%d.%06d", secs, (int) av_rescale(us, 1000000, AV_TIME_BASE)); } av_log(NULL, AV_LOG_INFO, ", bitrate: "); if (ic->bit_rate) av_log(NULL, AV_LOG_INFO, "%"PRId64" kb/s", (int64_t)ic->bit_rate / 1000); else av_log(NULL, AV_LOG_INFO, "N/A"); av_log(NULL, AV_LOG_INFO, "\n"); } for (i = 0; i < ic->nb_chapters; i++) { AVChapter *ch = ic->chapters[i]; av_log(NULL, AV_LOG_INFO, " Chapter #%d:%d: ", index, i); av_log(NULL, AV_LOG_INFO, "start %f, ", ch->start * av_q2d(ch->time_base)); av_log(NULL, AV_LOG_INFO, "end %f\n", ch->end * av_q2d(ch->time_base)); dump_metadata(NULL, ch->metadata, " "); } if (ic->nb_programs) { int j, k, total = 0; for (j = 0; j < ic->nb_programs; j++) { AVDictionaryEntry *name = av_dict_get(ic->programs[j]->metadata, "name", NULL, 0); av_log(NULL, AV_LOG_INFO, " Program %d %s\n", ic->programs[j]->id, name ? name->value : ""); dump_metadata(NULL, ic->programs[j]->metadata, " "); for (k = 0; k < ic->programs[j]->nb_stream_indexes; k++) { dump_stream_format(ic, ic->programs[j]->stream_index[k], index, is_output); printed[ic->programs[j]->stream_index[k]] = 1; } total += ic->programs[j]->nb_stream_indexes; } if (total < ic->nb_streams) av_log(NULL, AV_LOG_INFO, " No Program\n"); } for (i = 0; i < ic->nb_streams; i++) if (!printed[i]) dump_stream_format(ic, i, index, is_output); av_free(printed); }
1threat
Intellij annoying formatting : Does exists solution for change method braces from https://i.stack.imgur.com/EzuY1.png to https://i.stack.imgur.com/iNDx0.png
0debug
static void do_interrupt_real(int intno, int is_int, int error_code, unsigned int next_eip) { SegmentCache *dt; uint8_t *ptr, *ssp; int selector; uint32_t offset, esp; uint32_t old_cs, old_eip; dt = &env->idt; if (intno * 4 + 3 > dt->limit) raise_exception_err(EXCP0D_GPF, intno * 8 + 2); ptr = dt->base + intno * 4; offset = lduw(ptr); selector = lduw(ptr + 2); esp = env->regs[R_ESP]; ssp = env->segs[R_SS].base; if (is_int) old_eip = next_eip; else old_eip = env->eip; old_cs = env->segs[R_CS].selector; esp -= 2; stw(ssp + (esp & 0xffff), compute_eflags()); esp -= 2; stw(ssp + (esp & 0xffff), old_cs); esp -= 2; stw(ssp + (esp & 0xffff), old_eip); env->regs[R_ESP] = (env->regs[R_ESP] & ~0xffff) | (esp & 0xffff); env->eip = offset; env->segs[R_CS].selector = selector; env->segs[R_CS].base = (uint8_t *)(selector << 4); env->eflags &= ~(IF_MASK | TF_MASK | AC_MASK | RF_MASK); }
1threat
C++ boolalpha confusion : <p>Hi anyone can explain the following c++ code result?</p> <pre><code>input: true false 1 output: false, true, true, #include &lt;iostream&gt; using namespace std; int main () { bool c1, c2, c3; cin &gt;&gt; c1 &gt;&gt; c2 &gt;&gt; c3; cout &lt;&lt; boolalpha &lt;&lt; c1 &lt;&lt; ", " &lt;&lt; c2 &lt;&lt; ", " &lt;&lt; c3 &lt;&lt; ", " &lt;&lt; endl;//LINE I return 0; } </code></pre>
0debug
static off_t v9fs_synth_telldir(FsContext *ctx, V9fsFidOpenState *fs) { V9fsSynthOpenState *synth_open = fs->private; return synth_open->offset; }
1threat
How to compare the length of a list in html/template in golang? : <p>I am trying to compare the length of a list in golang html/template. But it is loading forever in html.</p> <pre><code>{{ $length := len .SearchData }} {{ if eq $length "0" }} Sorry. No matching results found {{ end }} </code></pre> <p>Could anyone help me with this?</p>
0debug
compare one value with four tables : <p>I am trying to compare ssn with four tables to find any unmatched ssn. i need assistance with sql query. thanks in advance</p>
0debug
how to Load a file in parallel arrays in java : i have a file that has 30 line of: month-day-year- gas price ex: May 02, 1994 1.04 can someone tell me how to load this file in a parallel arrays of months , days, price in java? because after this i will have to display the lowest price , and also the highest price, and the average price for each month can someone help please
0debug
static void qemu_rbd_parse_filename(const char *filename, QDict *options, Error **errp) { const char *start; char *p, *buf, *keypairs; char *found_str; size_t max_keypair_size; Error *local_err = NULL; if (!strstart(filename, "rbd:", &start)) { error_setg(errp, "File name must start with 'rbd:'"); return; } max_keypair_size = strlen(start) + 1; buf = g_strdup(start); keypairs = g_malloc0(max_keypair_size); p = buf; found_str = qemu_rbd_next_tok(RBD_MAX_POOL_NAME_SIZE, p, '/', "pool name", &p, &local_err); if (local_err) { goto done; } if (!p) { error_setg(errp, "Pool name is required"); goto done; } qemu_rbd_unescape(found_str); qdict_put(options, "pool", qstring_from_str(found_str)); if (strchr(p, '@')) { found_str = qemu_rbd_next_tok(RBD_MAX_IMAGE_NAME_SIZE, p, '@', "object name", &p, &local_err); if (local_err) { goto done; } qemu_rbd_unescape(found_str); qdict_put(options, "image", qstring_from_str(found_str)); found_str = qemu_rbd_next_tok(RBD_MAX_SNAP_NAME_SIZE, p, ':', "snap name", &p, &local_err); if (local_err) { goto done; } qemu_rbd_unescape(found_str); qdict_put(options, "snapshot", qstring_from_str(found_str)); } else { found_str = qemu_rbd_next_tok(RBD_MAX_IMAGE_NAME_SIZE, p, ':', "object name", &p, &local_err); if (local_err) { goto done; } qemu_rbd_unescape(found_str); qdict_put(options, "image", qstring_from_str(found_str)); } if (!p) { goto done; } found_str = qemu_rbd_next_tok(RBD_MAX_CONF_NAME_SIZE, p, '\0', "configuration", &p, &local_err); if (local_err) { goto done; } p = found_str; while (p) { char *name, *value; name = qemu_rbd_next_tok(RBD_MAX_CONF_NAME_SIZE, p, '=', "conf option name", &p, &local_err); if (local_err) { break; } if (!p) { error_setg(errp, "conf option %s has no value", name); break; } qemu_rbd_unescape(name); value = qemu_rbd_next_tok(RBD_MAX_CONF_VAL_SIZE, p, ':', "conf option value", &p, &local_err); if (local_err) { break; } qemu_rbd_unescape(value); if (!strcmp(name, "conf")) { qdict_put(options, "conf", qstring_from_str(value)); } else if (!strcmp(name, "id")) { qdict_put(options, "user" , qstring_from_str(value)); } else { char *tmp = g_malloc0(max_keypair_size); if (keypairs[0]) { snprintf(tmp, max_keypair_size, ":%s=%s", name, value); pstrcat(keypairs, max_keypair_size, tmp); } else { snprintf(keypairs, max_keypair_size, "%s=%s", name, value); } g_free(tmp); } } if (keypairs[0]) { qdict_put(options, "keyvalue-pairs", qstring_from_str(keypairs)); } done: if (local_err) { error_propagate(errp, local_err); } g_free(buf); g_free(keypairs); return; }
1threat
How to use backgroundworker with main thread functions? : I have some functions in my main thread, and I want to use them in the BackGroundWorker, the problem is that I can't reach to text boxes. I've seen many solutions but non of them worked. I've tried to implement some functions I've seen on web, unfortunately due to my newbie skills, can't apply them.. public void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) {Teste();} public void Teste() { tbtatual.Text = "12"; } My main problem is not do this, but if I can figure this out, I can implement the rest of my code. Thank you for reading fellows. Best regards and great coding!
0debug
static int conditional_wait(DBDMA_channel *ch) { dbdma_cmd *current = &ch->current; uint16_t wait; uint16_t sel_mask, sel_value; uint32_t status; int cond; DBDMA_DPRINTF("conditional_wait\n"); wait = le16_to_cpu(current->command) & WAIT_MASK; switch(wait) { case WAIT_NEVER: return 0; case WAIT_ALWAYS: return 1; } status = be32_to_cpu(ch->regs[DBDMA_STATUS]) & DEVSTAT; sel_mask = (be32_to_cpu(ch->regs[DBDMA_WAIT_SEL]) >> 16) & 0x0f; sel_value = be32_to_cpu(ch->regs[DBDMA_WAIT_SEL]) & 0x0f; cond = (status & sel_mask) == (sel_value & sel_mask); switch(wait) { case WAIT_IFSET: if (cond) return 1; return 0; case WAIT_IFCLR: if (!cond) return 1; return 0; } return 0; }
1threat
Using docker-compose to set containers timezones : <p>I have a docker-compose file running a few Dockerfiles to create my containers. I don't want to edit my Dockerfiles to set timezones because they could change at any time by members of my team and I have a docker-compose.override.yml file to make local environment changes. However, one of my containers (a Selenium based one) seems to not pull host time zone and that causes problems for me. Based on that I want to enforce timezones on all my containers. In my Dockerfiles right now I do</p> <pre><code>ENV TZ=America/Denver RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &amp;&amp; echo $TZ &gt; /etc/timezone </code></pre> <p>And everything works fine. How do I replicate the same command in docker-compose syntax?</p>
0debug
Pytorch doesn't support one-hot vector? : <p>I am very confused by how Pytorch deals with one-hot vectors. In this <a href="https://pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html" rel="noreferrer">tutorial</a>, the neural network will generate a one-hot vector as its output. As far as I understand, the schematic structure of the neural network in the tutorial should be like:</p> <p><a href="https://i.stack.imgur.com/1v35k.png" rel="noreferrer"><img src="https://i.stack.imgur.com/1v35k.png" alt="enter image description here"></a></p> <p>However, the <code>labels</code> are not in one-hot vector format. I get the following <code>size</code></p> <pre><code>print(labels.size()) print(outputs.size()) output&gt;&gt;&gt; torch.Size([4]) output&gt;&gt;&gt; torch.Size([4, 10]) </code></pre> <p>Miraculously, I they pass the <code>outputs</code> and <code>labels</code> to <code>criterion=CrossEntropyLoss()</code>, there's no error at all.</p> <pre><code>loss = criterion(outputs, labels) # How come it has no error? </code></pre> <h2>My hypothesis:</h2> <p>Maybe pytorch automatically convert the <code>labels</code> to one-hot vector form. So, I try to convert labels to one-hot vector before passing it to the loss function.</p> <pre><code>def to_one_hot_vector(num_class, label): b = np.zeros((label.shape[0], num_class)) b[np.arange(label.shape[0]), label] = 1 return b labels_one_hot = to_one_hot_vector(10,labels) labels_one_hot = torch.Tensor(labels_one_hot) labels_one_hot = labels_one_hot.type(torch.LongTensor) loss = criterion(outputs, labels_one_hot) # Now it gives me error </code></pre> <p>However, I got the following error</p> <blockquote> <p>RuntimeError: multi-target not supported at /opt/pytorch/pytorch/aten/src/THCUNN/generic/ClassNLLCriterion.cu:15</p> </blockquote> <p>So, one-hot vectors are not supported in <code>Pytorch</code>? How does <code>Pytorch</code> calculates the <code>cross entropy</code> for the two tensor <code>outputs = [1,0,0],[0,0,1]</code> and <code>labels = [0,2]</code> ? It doesn't make sense to me at all at the moment.</p>
0debug
static void usbredir_buffered_bulk_packet(void *priv, uint64_t id, struct usb_redir_buffered_bulk_packet_header *buffered_bulk_packet, uint8_t *data, int data_len) { USBRedirDevice *dev = priv; uint8_t status, ep = buffered_bulk_packet->endpoint; void *free_on_destroy; int i, len; DPRINTF("buffered-bulk-in status %d ep %02X len %d id %"PRIu64"\n", buffered_bulk_packet->status, ep, data_len, id); if (dev->endpoint[EP2I(ep)].type != USB_ENDPOINT_XFER_BULK) { ERROR("received buffered-bulk packet for non bulk ep %02X\n", ep); free(data); return; } if (dev->endpoint[EP2I(ep)].bulk_receiving_started == 0) { DPRINTF("received buffered-bulk packet on not started ep %02X\n", ep); free(data); return; } len = dev->endpoint[EP2I(ep)].max_packet_size; status = usb_redir_success; free_on_destroy = NULL; for (i = 0; i < data_len; i += len) { if (len >= (data_len - i)) { len = data_len - i; status = buffered_bulk_packet->status; free_on_destroy = data; } bufp_alloc(dev, data + i, len, status, ep, free_on_destroy); } if (dev->endpoint[EP2I(ep)].pending_async_packet) { USBPacket *p = dev->endpoint[EP2I(ep)].pending_async_packet; dev->endpoint[EP2I(ep)].pending_async_packet = NULL; usbredir_buffered_bulk_in_complete(dev, p, ep); usb_packet_complete(&dev->dev, p); } }
1threat
Extract Last Word in String with Swift : <p>What is the way of extracting last word in a String in Swift? So if I have "Lorem ipsum dolor sit amet", return "amet". What is the most efficient way of doing this?</p>
0debug
void ff_avg_h264_qpel4_mc02_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_vt_and_aver_dst_4x4_msa(src - (stride * 2), stride, dst, stride); }
1threat
Check if value is not on the list : <p>I don't want values from the <code>List&lt;string&gt;</code> to be used. </p> <p>For <code>List&lt;string&gt;</code> I have a function:</p> <pre><code>private List&lt;string&gt; GetManualColumns() { List&lt;string&gt; listColumns = new List&lt;string&gt;(); listColumns.Add("USER_KEY"); listColumns.Add("USER_NAME"); return listColumns; } </code></pre> <p>I need to iterate to specific values (column names), but they must not be in the list from function <code>GetManualColumns()</code>.</p> <p>How to do this?</p> <p>I need something like:</p> <pre><code>if(col not in GetManualColumns()) { } </code></pre>
0debug
How not to mess up a customers SQL Database? : next week I will create some simple Select Queries for PowerBI for a new customer who wants to have more insight in his business. Until now I have only done this for our own company. I am afraid that by installing the SQL Server Management Studio and building some queries in Management Studio I might (in a freak accident scenario) damage his database. I know this is unlikely. However I do not really want to mess with his configuration. I also do not want to give him any ground to argument against me if anything unrelated does not work afterwards. What would be a reasonable way to get my queries without really touching his database ? I thought of using a 3rd party frontend like Heidi SQL or FlySpeed SQL (even better because you cannot do admin tasks with it). I cannot just start with PowerBI because I need to analyze his DB first (scroll through tables etc). Also I thought of making a backup of his DB first but that involves playing around with Management Studio. Thanks in advance for any suggestions!
0debug
calculating current year and previous year and inserting it into a table in sql server : I have a data range in a table from '2014-06-01' to '2016-06-01'. How to show the values for current date and previous date in a table. Example: The value for the date '2015-01-01'(current year date) is 100 and in '2014-01-01'(previous year date) is 200. So the table values should be Row1. Date -2015-01-01, PreviousYear-200,CurrentYear-100 Row2. Date -2015-02-01 ... upto.. RowN. Date -2016-01-01 Please help.
0debug
unable to update on server bt it is working fine on localhost : not working real server but its working fine on localhost > $res=mysql_query("UPDATE ".$table_name." SET item_name='".$name."' > ,item_description='".$item."' ,item_price='".$price."' WHERE > id='".$id."'");
0debug
Error <indentifier> expected : could anyone help me fix this? Im trying to create a basic android app that opens a website on startup. This is my code so far, but im getting a "error <indentifier> expected" error. Im coding in android studio. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> package com.cryptocrea.sitr; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } string urel = "http://cryptocrea.com/"; Webview view = (Webview) this.findViewById(R.id.webview); // view.getsettings().setJavaScriptEnabled(true); view.loadUrl(urel); } <!-- end snippet -->
0debug
Node, Sequelize, Mysql - How to define collation and charset to models? : <p>Im using sequelize /w node and node-mysql.</p> <p>I create models using the sequelize-cli, and this is the result:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>'use strict'; module.exports = function(sequelize, DataTypes) { let songs = sequelize.define('songs', { name: DataTypes.STRING, link: DataTypes.STRING, artist: DataTypes.STRING, lyrics: DataTypes.TEXT, writer: DataTypes.STRING, composer: DataTypes.STRING }); return songs; };</code></pre> </div> </div> </p> <p>I want to be able to define collation and charset to each property of the model. the default collation is 'latin1_swedish_ci', and i need it in 'utf-8'.</p> <p>Anyone? Tnx </p>
0debug
<Grid> in material ui causes horizontal scroll- React : <p>i'm using material ui version 1. installed by this command:</p> <pre><code>npm install -S material-ui@next </code></pre> <p>every time i wanna use , an unwanted horizontal scroll appears in page. for example this is a simple code:</p> <pre><code>import React from 'react'; import PropTypes from 'prop-types'; import { withStyles, createStyleSheet } from 'material-ui/styles'; import Paper from 'material-ui/Paper'; import Grid from 'material-ui/Grid'; /* project imports */ import NavMenu from './Page-Parts/NavMenu'; import LoginPanel from './Login-Parts/LoginPanel'; const styleSheet = createStyleSheet('FullWidthGrid', theme =&gt; ({ root: { flexGrow: 1, marginTop: 0, }, paper: { padding: 16, textAlign: 'center', color: theme.palette.text.secondary, marginTop: "3rem" }, })); function Login(props){ const classes = props.classes; return ( &lt;div className={classes.root}&gt; &lt;Grid container gutter={24} justify='center'&gt; &lt;Grid item xs={12} md={12} sm={12} lg={12}&gt; &lt;NavMenu/&gt; &lt;/Grid&gt; &lt;Grid item xs={6} sm={6} md={6} lg={6}&gt; &lt;Paper className={classes.paper}&gt; &lt;LoginPanel /&gt; &lt;/Paper&gt; &lt;/Grid&gt; &lt;/Grid&gt; &lt;/div&gt; ); } Login.propTypes = { classes: PropTypes.object.isRequired, }; export default withStyles(styleSheet)(Login); </code></pre> <p>i can't use bootstrap or any other grid layout options because they're in conflict with this library. this code example isn't a big deal but when i use in other parts of a component(for example in drawer), horizontal scroll appears makes the ui ugly NavMenu and LoginPanel are some self-made components and they're ok. using them without don't cause horizontal scroll</p>
0debug
Template specialization vs. Function overloading : <p>The question is pretty simple. Is there any difference between:</p> <pre><code>template &lt;typename T&gt; T add(T a, T b) { return a + b; } template &lt;&gt; int add&lt;int&gt;(int a, int b) { return a + b; //no reason to specialize, but still... } </code></pre> <p>And:</p> <pre><code>template &lt;typename T&gt; T add(T a, T b) { return a + b; } int add(int a, int b) { return a + b; //no reason to overload, but still... } </code></pre> <p>They seem to be the same.</p>
0debug
ip_input(struct mbuf *m) { Slirp *slirp = m->slirp; register struct ip *ip; int hlen; DEBUG_CALL("ip_input"); DEBUG_ARG("m = %p", m); DEBUG_ARG("m_len = %d", m->m_len); if (m->m_len < sizeof (struct ip)) { return; } ip = mtod(m, struct ip *); if (ip->ip_v != IPVERSION) { goto bad; } hlen = ip->ip_hl << 2; if (hlen<sizeof(struct ip ) || hlen>m->m_len) { goto bad; } if(cksum(m,hlen)) { goto bad; } NTOHS(ip->ip_len); if (ip->ip_len < hlen) { goto bad; } NTOHS(ip->ip_id); NTOHS(ip->ip_off); if (m->m_len < ip->ip_len) { goto bad; } if (m->m_len > ip->ip_len) m_adj(m, ip->ip_len - m->m_len); if (ip->ip_ttl == 0) { icmp_send_error(m, ICMP_TIMXCEED, ICMP_TIMXCEED_INTRANS, 0, "ttl"); goto bad; } if (ip->ip_off &~ IP_DF) { register struct ipq *fp; struct qlink *l; for (l = slirp->ipq.ip_link.next; l != &slirp->ipq.ip_link; l = l->next) { fp = container_of(l, struct ipq, ip_link); if (ip->ip_id == fp->ipq_id && ip->ip_src.s_addr == fp->ipq_src.s_addr && ip->ip_dst.s_addr == fp->ipq_dst.s_addr && ip->ip_p == fp->ipq_p) goto found; } fp = NULL; found: ip->ip_len -= hlen; if (ip->ip_off & IP_MF) ip->ip_tos |= 1; else ip->ip_tos &= ~1; ip->ip_off <<= 3; if (ip->ip_tos & 1 || ip->ip_off) { ip = ip_reass(slirp, ip, fp); if (ip == NULL) return; m = dtom(slirp, ip); } else if (fp) ip_freef(slirp, fp); } else ip->ip_len -= hlen; switch (ip->ip_p) { case IPPROTO_TCP: tcp_input(m, hlen, (struct socket *)NULL, AF_INET); break; case IPPROTO_UDP: udp_input(m, hlen); break; case IPPROTO_ICMP: icmp_input(m, hlen); break; default: m_free(m); } return; bad: m_free(m); }
1threat
hi,can anyone help how to push the data in xml view into the newly created json model? : can anyone help how to push the data in xml view into the newly created json model,i have created the comboBox and retrieved the data from json model and also created the text area when i select the item in combo box and insert data into the text area and submit a button both the data should be pushed to newly created json model in sapweb ide ui5
0debug
C program with a function which checks if integer A contains integer B ( let's say, A=2345, B=4, in which case it int A does contain int B ) : #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int funkcija(int num, int num2) { int doesContain; if (doesContain == 1) return 1; else return 0; } int main(void) { int num, num2; scanf("%d", num); scanf("%d", num2); printf("%d", funkcija(num, num2)); return 0; } So basically, I need to make a function which takes number 1 and number 2, checks if number2 is in number1, then returns 0 or 1. So for example, if number 1 is let's say '2452325678', and number 2 is '7', number 1 DOES contain number 2 and the statement is true. But if num1 is '2134' and num2 is '5', the statement is false. It needs to be done PRIMITIVELY, without arrays and whatnot. The professor is basically testing your ability to make an algorithm, and considering I wasn't @ the last lecture due to illness, and I have practice work tomorrow which I need to pass, you can see why I'm in a pickle here. I need any help I can get with the algorithm, I myself am completely lost on how to do it, thanks!
0debug
void visit_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp) { int64_t value; if (v->type_size) { v->type_size(v, obj, name, errp); } else if (v->type_uint64) { v->type_uint64(v, obj, name, errp); } else { value = *obj; v->type_int64(v, &value, name, errp); *obj = value; } }
1threat
How to check if Apple Maps is installed : <p>Anyone aware how to check whether Apple Maps is installed or not? I could not find anything in the docs.</p> <p>With iOS10 users can delete the Apple Maps application. While for Google Maps we can use <code>UIApplication.shared.canOpenURL()</code> to check if it's installed. I am not aware of such a thing exists to check for Apple Maps.</p> <p>Of course one can check if opening a <code>MKMapItem</code> with <code>mapItem.openInMaps()</code> fails - but that does not help for checking in advance.</p>
0debug
How to remove characters from a column and then split the column in R : <p>I have a df called <code>Violations</code>. One of its columns, <code>Violations$Location</code>, has lat, long coordinates written like this for eg.: <code>POINT (-7423249 453982)</code>. I just want to remove the <code>"POINT "</code> and the brackets. </p> <p>I've tried <code>gsub</code> but that always converts the result into a character and when I try to return that into a dataframe it makes a messy horizontal dataframe.</p> <p>The outcome I want is to have one column called <code>lat</code> with rows such as this: <code>-742349</code> and another column called <code>long</code> with the columns written as <code>453982</code>. How do I do this? </p>
0debug
I'm trying to get the title for this website using BeautifulSoup but i keep getting a type error, how do i fix this? : import requests import bs4 as BeautifulSoup page = requests.get('https://www.basketball-reference.com/friv/dailyleaders.fcgi') soup = BeautifulSoup( page.content, 'html-parser') print (soup.title) I've done a similar code to this for class, however im trying to make a webscraper of my own to get the name of the website and the leading scorers in the NBA daily. but the first stwp i'm stuck on is getting the title of the page.
0debug
How to install pymysql on AWS lambda : <p>I've looked <a href="https://github.com/cleesmith/get_html_head_title_tag" rel="noreferrer">here</a> and <a href="http://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html" rel="noreferrer">here</a> as I've been trying to work out how to get <code>pymysql</code> running on AWS lambda. The examples I've looked at so far are extremely complex, and with the GitHub tutorial I got as far as IAM before I started running into permissions errors I didn't know how to solve. </p> <p>Literally, all I want to be able to do is call <code>import pymysql</code> within the prebuilt AWS lambda console template. </p> <p>It seems like a simple problem, but I'm having a hard time finding a clear, step-by-step work through of how to get new dependencies to work for my lambda function. Ideally the example would <em>not</em> by via AWS CLI, since apparently there is a console option and this seems like it would take some of the headache out of the process. </p> <p>Cheers,</p> <p>Aaron </p>
0debug
void ptimer_run(ptimer_state *s, int oneshot) { bool was_disabled = !s->enabled; if (was_disabled && s->period == 0) { fprintf(stderr, "Timer with period zero, disabling\n"); return; } s->enabled = oneshot ? 2 : 1; if (was_disabled) { s->next_event = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); ptimer_reload(s); } }
1threat
void FUNC(ff_simple_idct_put)(uint8_t *dest_, int line_size, DCTELEM *block) { pixel *dest = (pixel *)dest_; int i; line_size /= sizeof(pixel); for (i = 0; i < 8; i++) FUNC(idctRowCondDC)(block + i*8); for (i = 0; i < 8; i++) FUNC(idctSparseColPut)(dest + i, line_size, block + i); }
1threat
static int read_password(char *buf, int buf_size) { uint8_t ch; int i, ret; printf("password: "); fflush(stdout); term_init(); i = 0; for(;;) { ret = read(0, &ch, 1); if (ret == -1) { if (errno == EAGAIN || errno == EINTR) { continue; } else { break; } } else if (ret == 0) { ret = -1; break; } else { if (ch == '\r') { ret = 0; break; } if (i < (buf_size - 1)) buf[i++] = ch; } } term_exit(); buf[i] = '\0'; printf("\n"); return ret; }
1threat
Problems with Uploading Script : <p>I have a simple script that can upload files on my server and insert the details into database.</p> <p>With code below I am getting two errors..</p> <ol> <li><p>"Notice: Undefined variable: sExt in" .. I tried to fix the issue with if empty statement, but without sucess..</p></li> <li><p>Script import numbers (1,2,3...) into Mysql if the upload filed is empty.... I tried to fix the issue with the code below, but also without success..</p> <p>"if($_FILES['files']['name']!="")"...</p></li> </ol> <p>Any advice? </p> <p>Thank you..</p> <p>My code:</p> <pre><code>&lt;?php include_once('db.php'); if (isset($_FILES['files'])) { $uploadedFiles = array(); foreach ($_FILES['files']['tmp_name'] as $key =&gt; $tmp_name) { $errors = array(); $file_name = md5(uniqid("") . time()); $file_size = $_FILES['files']['size'][$key]; $file_tmp = $_FILES['files']['tmp_name'][$key]; $file_type = $_FILES['files']['type'][$key]; if($file_type == "image/gif"){ $sExt = ".gif"; } elseif($file_type == "image/jpeg" || $file_type == "image/pjpeg"){ $sExt = ".jpg"; } elseif($file_type == "image/png" || $file_type == "image/x-png"){ $sExt = ".png"; } if (!in_array($sExt, array('.gif','.jpg','.png'))) { $errors[] = "Image types alowed are (.gif, .jpg, .png) only!"; } if ($file_size &gt; 2097152000) { $errors[] = 'File size must be less than 2 MB'; } $query = "INSERT into user_pics (`person_id`,`pic_name`,`pic_type`) VALUES('1','$file_name','$sExt')"; $result = mysqli_query($link,$query); $desired_dir = "user_data/"; if (empty($errors)) { if (is_dir($desired_dir) == false) { mkdir("$desired_dir", 0700); } if (move_uploaded_file($file_tmp, "$desired_dir/" . $file_name . $sExt)) { $uploadedFiles[$key] = array($file_name . $sExt, 1); } else { echo "Files Uploaded !" . $_FILES['files']['name'][$key]; $uploadedFiles[$key] = array($_FILES['files']['name'][$key], 0); } } else { print_r($errors); } } foreach ($uploadedFiles as $key =&gt; $row) { if (!empty($row[1])) { $codestr = '$file' . ($key+1) . ' = $row[0];'; eval ($codestr); } else { $codestr = '$file' . ($key+1) . ' = NULL;'; eval ($codestr); } } } ?&gt; &lt;form action="" method="POST" enctype="multipart/form-data"&gt; &lt;input type="file" name="files[]" accept="image/*"&gt; &lt;br/&gt; &lt;input type="file" name="files[]" accept="image/*"&gt; &lt;br/&gt;&lt;br/&gt; &lt;input type="submit"/&gt; &lt;/form&gt; </code></pre>
0debug
Supporting Multiple Screens single layout : <p>I'm developing an app in android and I have to support all different screen sizes and density. Without created different folder for layout : layout-small layout-large and layout.</p>
0debug
Inner Join of three tables with dirty data in MS SQL : I have three tables, T1, T2, T3 T1 has fields A, B, C T2 has fields C, D, E T3 has fields E, F, G The idea is to inner join all of them to get table T T must have fields A, B, C, D, E, F, G I already now how to do the join of three tables, the problem is that the field E that is supposed to link T2 and T3 is very noisy, it supposed to be a numerical value, but it has all sort of values (text, punctuation, etc) how would I use an if statement to do the inner join. Thanks Platform MS SQL
0debug
static void cpu_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); CPUClass *k = CPU_CLASS(klass); k->class_by_name = cpu_common_class_by_name; k->reset = cpu_common_reset; k->get_arch_id = cpu_common_get_arch_id; k->get_paging_enabled = cpu_common_get_paging_enabled; k->get_memory_mapping = cpu_common_get_memory_mapping; k->write_elf32_qemunote = cpu_common_write_elf32_qemunote; k->write_elf32_note = cpu_common_write_elf32_note; k->write_elf64_qemunote = cpu_common_write_elf64_qemunote; k->write_elf64_note = cpu_common_write_elf64_note; k->gdb_read_register = cpu_common_gdb_read_register; k->gdb_write_register = cpu_common_gdb_write_register; dc->realize = cpu_common_realizefn; dc->no_user = 1; }
1threat
How should I use ArrayList<HashMap<String, String>> for adding text data as well as images? : Please help me out guys! What I am trying to do is create an android application to store and retrieve user details. I had completed developing the logic for storing the details. But while retrieving I am a bit confused regarding how to add images as well as other text data into a single ArrayList<HashMap<String, String>>.
0debug
value of steps per epoch passed to keras fit generator function : <p>What is the need for setting <code>steps_per_epoch</code> value when calling the function fit_generator() when ideally it should be <code>number of total samples/ batch size</code>? </p>
0debug
postgresql password encryption whether to use crypt or not : I have gone through postgresql crypt() function documentation . This function is provided as extension for postgresql . If i migrate my data to another database will the passwords still be evaluated properly or not ?. using same encryption algorithms. crypt function stores the salt in the encrypted sting itself
0debug
What is the time complexity of the following code in which a variable jumps multiple of 2? : int i, j, k = 0; for (i = n/2; i <= n; i++) { for (j = 2; j <= n; j = j * 2) { k = k + n/2; } } Here the outer loop runs exactly n/2 times and then in the inner loop runs for the input 2,4,6,8.... upto n(if even) else runs upto n-1(if n is odd)
0debug
static ssize_t local_llistxattr(FsContext *ctx, const char *path, void *value, size_t size) { ssize_t retval; ssize_t actual_len = 0; char *orig_value, *orig_value_start; char *temp_value, *temp_value_start; ssize_t xattr_len, parsed_len = 0, attr_len; if (ctx->fs_sm != SM_MAPPED) { return llistxattr(rpath(ctx, path), value, size); } xattr_len = llistxattr(rpath(ctx, path), value, 0); orig_value = qemu_malloc(xattr_len); xattr_len = llistxattr(rpath(ctx, path), orig_value, xattr_len); temp_value = qemu_mallocz(xattr_len); temp_value_start = temp_value; orig_value_start = orig_value; while (xattr_len > parsed_len) { attr_len = strlen(orig_value) + 1; if (strncmp(orig_value, "user.virtfs.", 12) != 0) { strcat(temp_value, orig_value); temp_value += attr_len; actual_len += attr_len; } parsed_len += attr_len; orig_value += attr_len; } if (!size) { retval = actual_len; goto out; } else if (size >= actual_len) { memset(value, 0, size); memcpy(value, temp_value_start, actual_len); retval = actual_len; goto out; } errno = ERANGE; retval = -1; out: qemu_free(orig_value_start); qemu_free(temp_value_start); return retval; }
1threat
static inline void FUNC(idctSparseColPut)(pixel *dest, int line_size, DCTELEM *col) { int a0, a1, a2, a3, b0, b1, b2, b3; INIT_CLIP; IDCT_COLS; dest[0] = CLIP((a0 + b0) >> COL_SHIFT); dest += line_size; dest[0] = CLIP((a1 + b1) >> COL_SHIFT); dest += line_size; dest[0] = CLIP((a2 + b2) >> COL_SHIFT); dest += line_size; dest[0] = CLIP((a3 + b3) >> COL_SHIFT); dest += line_size; dest[0] = CLIP((a3 - b3) >> COL_SHIFT); dest += line_size; dest[0] = CLIP((a2 - b2) >> COL_SHIFT); dest += line_size; dest[0] = CLIP((a1 - b1) >> COL_SHIFT); dest += line_size; dest[0] = CLIP((a0 - b0) >> COL_SHIFT); }
1threat
What's wrong? I can't seem to close this code out : <p>I cant figure out how to close this out properly, no matter where i add a bracket it breaks the code. I appreciate the help, thanks :)</p> <pre><code> int NewID = Convert.ToInt32(Adapter.InsertQuery()); // new relationship id if (!Session.GetHabbo().Relationships.ContainsKey(Them)) Session.GetHabbo().Relationships.Add(Them, new Relationship(NewID, Them, 3)); // create the relationship Session.GetHabbo().GetMessenger().UpdateFriend(Them, Session, true); } else { Habbo Habbo = PlusEnvironment.GetHabboById(Them); if (Habbo != null) { MessengerBuddy Bud = null; if (Session.GetHabbo().GetMessenger().TryGetFriend(Them, out Bud)) Session.SendMessage(new FriendListUpdateComposer(Session, Bud)); } } return false; } </code></pre> <p>P.S I'm still new to this.</p>
0debug
What's the docker-compose equivalent of docker run --init? : <p>According to <a href="https://github.com/krallin/tini#using-tini" rel="noreferrer">https://github.com/krallin/tini#using-tini</a>, tini is built into docker, and can be used by passing the <code>--init</code> flag to <code>docker run</code>. In my case I'm using docker-compose and don't invoke <code>docker run</code> directly. How can I pass this flag?</p>
0debug
What is the correct way of fetching data from web api periodically in background even if android app is closed? : I want to create an android app which should fetch data from a WEB-API after equal intervals of time (lets say after every five minutes) even if my app is closed. Also it should generate the notifications if new data is fetched. What is the correct way to do it ?? Do I need to you background service and call a thread from onStartCommand and fetch data in that thread with some sleep time ???
0debug
How can i add custome field in wordpress in post in twenty seventeen theme : I am looking for solution to find out my problem on how to add custome field in post in twenty seventeen theme in wordpress. Help me solve out this problem in wordpress twenty seventeen theme.
0debug
Can I make a application frontend for smartphones using Python? : <p>I've done a little predictive program with Python and I would like to transform it in an application for smartphones. Can I accomplish it with Python itself, or should I use another language? If yes, what APIs would you recommend for that?</p> <p>Thanks</p>
0debug
C++ Verify the first input of two on the same line : <pre><code>string a, b; cin &gt;&gt; a &gt;&gt; b; if (a == "yes") break; ... </code></pre> <p>Why does this not work the way it looks like it should work? If the user enters "yes please" or "yes" the program should break out of whatever loop it's in, but that's not what happens. The console just prints a line feed and waits. What am I doing wrong here?</p>
0debug
static int pl110_init(SysBusDevice *dev) { pl110_state *s = FROM_SYSBUS(pl110_state, dev); memory_region_init_io(&s->iomem, &pl110_ops, s, "pl110", 0x1000); sysbus_init_mmio(dev, &s->iomem); sysbus_init_irq(dev, &s->irq); qdev_init_gpio_in(&s->busdev.qdev, pl110_mux_ctrl_set, 1); s->con = graphic_console_init(pl110_update_display, pl110_invalidate_display, NULL, NULL, s); return 0; }
1threat
external link does not work in IIS express. How do I get links to reach internet? : Ok so when you click a link in my web app it just adds to the URL to the end. like so "http://localhost:8080/http//:www.youtube.com". I'm using visual studio .netto make web rest APIs. The web app lunches on IIS express 10. the home page URL is "http://localhost:8080/index.html".
0debug