id stringlengths 5 11 | text stringlengths 0 146k | title stringclasses 1
value |
|---|---|---|
doc_41700 | The problem occurs when I scroll down the ListView and, when I try to get to the top of it, instead of scrolling up, it invokes the Refresh listener. So the movement is stuck.
This is the activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<me.dkzwm.widget.srl.SmoothRefreshLayout
android:id="@+id/smoothRefre... | |
doc_41701 | public String[] wordsWithout(String[] words, String target) {
String store[] = null;
for(int i = 0; i < words.length; i = i +1){
store = new String[words.length];
if(!words[i].equals(target)){
store[i] = words[i];
}
}
return store;
}
A: You are initializing the res... | |
doc_41702 | The program I am writing ask for an amount of shoes that are going to be purchased, then based on amount of shoes a discount is given, 0%, 15%, or 25%.
I have it all written so that the right price appears in a label, the only thing I need to do is make the according radiobutton check itself ( 0%, 15%, or 25%)
Can some... | |
doc_41703 | I'm sorry if there is already an answer somewhere.
Global objective
I aim to create my questionnaires in libreoffice ( I need to print it, it's not for an online survey), and secondly to use it in a R shiny app I've created for register the collected answers and to export the data.
I want to create the fields in R (que... | |
doc_41704 |
// Main Javascript
//Variables to use
var canvas;
var context;
var ball;
canvas = documnet.getElementById("canvas");
context = canvas.getcontext("2d");
//Creates my ball function based off of what is on canvas for ball
ball = new Ball();
Well my ball is not showing up on screen and I am pretty sure I hav... | |
doc_41705 | Anyway, my question is I have a resource I'm receiving from the API. It's static, and the only actions available to it are index and show. I receieve the index action fine and can list them, but linking to the show pages results in a blank white screen. I put a couple console.log calls in the angular show controller to... | |
doc_41706 |
}
When a service is started, I pass an intent to startService function. When service is restarted by the OS due to Sticky flag, is that very same intent that I passed to it to start the service be passed to onStartCommand again or will it be null?
A: Intent is only passed again if you request START_REDELIVER_INTENT
... | |
doc_41707 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Button
import tkinter as tk
from tkinter.filedialog import askopenfilename
figure, ax1 = plt.subplots()
class Index(object):
def next(self,event):
root = tk.Tk()
root.withdraw()
file_name = askopenfilename(... | |
doc_41708 | A little background: in one of my projects I use StructureMap container and dynamic type as a clean way to dispatch method calls at runtime. After updating StructureMap container to the newer version(3), some of my unit-tests started to hang eternally.
To reproduce the problem I created 2 maximally simplified unit-tes... | |
doc_41709 | Thus my question is: is there a way to suppress all message boxes created by the .Raise method for a certain range of code? I've tried Application.DisplayAlerts = False but the alerts from .Raise are still displayed.
Thanks!
A: On Error GoTo 0 restores the normal error handling. You use it to cancel a previously set O... | |
doc_41710 | I couldn't find anything relevant about delegation or about referencing a view controller by anything other than its subclass name. So in my latest attempt, I tried referring to the other child of the parent object. Here's the relevant code:
protocol TableViewSelectionDelegate: AnyObject {
func didSelectInTableView... | |
doc_41711 | This container image is hosting ASP.NET Web API application using ASP.net 4.6.1 framework.
I ran following commands:
*
*docker container ls - to list conatiners
*docker exec -i -t a1da40af6b3c powershell
But nothing happens (as shown in the image). Am i missing anything?
A: ISE hosted powershell does not work pro... | |
doc_41712 | Is it possible to drop that constraints without specifying the exact constraint name ?
For example, something like this (which doesn't work)
ALTER TABLE DOC_OBGS_10 DROP CONSTRAINT LIKE 'FK__DOC_OBGS___kntr%'
The problem is that we have a lot of databases with this table and I need to remove all the constraints from t... | |
doc_41713 |
*
*Does it means that it is calling the "another method"?
*Does it means it is overwriting or overridding the "another method"?
*Does it means that it is called by the "another method"?
I am really confused.
A:
"If doSomethings(), that has no exception handling code, trails a method that throws an exception, ... | |
doc_41714 | Example: Francisco changes the wording of a popup dialog, and commits his changes. A very simple change, what could possibly go wrong? I get the latest code. I see the new code in my IDE (VS2010), and run it. When I view that dialog, it does not have the new wording, even though I can see the new wording in my fil... | |
doc_41715 | TypeError: 'ptsize' is an invalid keyword argument for this function
This is weird because it works in Python 3.3 but I develop in 3.4.1 at home so is there a way to fix this and make it backwards compatible with 3.3?
The first line with the problem:
font.render_to(Display.screen, (680,130), "1", (random.randint(0,25... | |
doc_41716 | I've been messing around with bitwise and logical operators for a little bit (no pun intended) and I understand how they function.
The shift operators x >> 3 and x << 3 shift the bits of x three spaces left and right respectively, and I know we can use operators like ^ | and & for messing around with manipulating bits.... | |
doc_41717 | // Each of These Expressions Work Perfect Separately!
// All Sequences start with | pipe. Followed by
boost::regex expr {"(\\|[0-9]{2})"}; // 2 Digits only.
boost::regex expr {"(\\|[A-Z]{1,2}+[0-9]{1,2})"}; // 1 or 2 Uppercase Chars and 1 or 2 Digits.
boost::regex expr {"(\\|[A-Z]{2})(?!\\d)"}; ... | |
doc_41718 |
*
*stating PDO is slightly faster/a little bit slower
*saying PDO helps prevent SQL-injections, but only if you use prepared queries
*and also saying using prepared queries is bad, as it is damn slow
So, what is actually true? Especially, what are the best practices when using PDO and both speed and security mat... | |
doc_41719 |
I tried to add a RelativeLayout parent and use
android:layout_below="@+id/coordinatorlayout" for the
NestedScrollView,but this make the content of NestedScrollView not
showing up.
Fragment layout Code :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/and... | |
doc_41720 |
var showDate = new Date();
var months = ["Januari", "Februari", "March", "April", "May", "June","July", "Augusti", "September", "October", "November", "December"];
var theForm = '<form class="" action="insert.php" method="post"><input id="day"type="checkbox" name="day" value=""><br><input id="btn" t... | |
doc_41721 | The problem is below.
Given an array of integers, return indices of the two numbers such that they add up to a specific target.
The way I solved it by looping through the element and storing the diff between target and element as key and index of the current element in a map.
Then later on when the diff appears in the ... | |
doc_41722 | If you run it, you will see that the Z coordinate is the good one for the second graph but not for the same. But the Z values that should be taken by the function format_coord that I provide to ax.format_coord are updated between my two plots.
Then, I am not sure to understand this behavior.
How can I fix it ?
As a sid... | |
doc_41723 | What I tried is that I first detect players via the yolov3 model. Once I get the Bounding boxes for the player, I make a player crop which is basically the section of the image where the detected player is. I pass that sub-image of the player to a function find_dominant_color(image) which is supposed to return the most... | |
doc_41724 | Below given is my code
let startdate = this.$store.getters.getDateRange.start
let endDate = this.$store.getters.getDateRange.end
let compareStart = startdate
compareStart.setDate(startdate.getDate() - 7)
let compareEnd = endDate
compareEnd.setDate(endDate.getDate() + 7)
While setDate function is executed, the store v... | |
doc_41725 | I would like to know this because in a huge rails app when developers start adding "resources :objects", it gets loads of unnecessary routes created at run time, I am not sure whether this hits the performance, but still the curiosity.
A: I found a gem that seems to do this: amatsuda/traceroute. I haven't tried it mys... | |
doc_41726 |
A: I agree with Marc, generally the best place to find the solution for 3'rd party controls is their documentation and forums; here is a code snippet from devexpress forum post -
<Window x:Class="DXGrid_ChangeRowAppearance.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xm... | |
doc_41727 | Unfortunately, at the moment we have to do a lot of effort to exchange data between these two worlds. I.e., we have to write wrapping classes in C++/CLI for each of the C++ classes. For (virtually) any required setting (Properties) in the C#-"world" there is a copy in the C++ world (a header file) and an explicit conve... | |
doc_41728 | model.load_state_dict(checkpoint['state_dict'])
model.eval()
with torch.no_grad():
dvectors = model.generateDVec(x)
the generateDVec():
def generateDVec(self, x):
batch_size, num_chunks, features = x.shape
x = x.reshape((batch_size * num_chunks, 1, features))
embeddings = self.encoder(x) # TODO
e... | |
doc_41729 | I'm having problems typing the value is never correct!
It always ends up increasing a zero or decreasing as you type, I believe it may be because of the mask, how can I solve this?
Here at Google exactly how it should work.
Or this one: MelhorCambio
Here my code:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jque... | |
doc_41730 | sbt -Dlogback.configurationFile=/path/to/log/file/app-logger.xml run
Is there a way that I could set this programmatically? I mean I would like to just say
sbt run
and it picks up automagically the app-logger.xml by itself via the application.
A: This is how I do it!
def loadLogger() = Option(System.getProperty("... | |
doc_41731 |
A: C++ is still a statically typed language with the auto type specifier because auto denotes that the type will be inferred by the compiler at compile time. Rather then at run time in dynamically typed languages.
A:
So can C++ still be considered as a statically typed language?
Yes, because this code snippet st... | |
doc_41732 | export class UserService extends Repository<User> {
// ... my other service methods
}
After that I'm trying to call the repository findOne method from service (userService.findOne(...)), but I have a TypeORM error:
TypeError: Cannot read property 'findOne' of undefined
at UserService.Repository.findOne (node_m... | |
doc_41733 | The data base is set up @ /Users/demet8/postgres/data.
I check to make sure postgresql is running with
ps aux | grep postgres
demet8 9851 0.0 0.1 614276 1184 ?? Ss 12:40PM 0:00.24 postgres: autovacuum launcher process
demet8 9850 0.0 0.0 614020 436 ?? Ss 12:40PM 0:00.91 postgres: wa... | |
doc_41734 | My chart is similar to the example below except that I have columns and rows of charts. The columns are based on one variable and the rows are based on other variables. These are for conditional probabilites. At the moment the column names are automatically provided in the same positions as 'setosa', 'versicolor', and ... | |
doc_41735 | SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse (<anonymous>) at XMLHttpRequest.onLoad (url...
Lets say i got this fetch to my back end Node like this
---FIRST--My constructor
constructor(private userService: UserService, private http: HttpClient) {}
---SECOND--On the ngOninit i evolve all the lo... | |
doc_41736 | t='@abc @def Hello this part is text'
I want to get this:
l=["abc", "def"]
s='Hello this part is text'
I did this:
a=t[t.find(' ',t.rfind('@')):].strip()
s=t[:t.find(' ',t.rfind('@'))].strip()
b=a.split('@')
l=[i.strip() for i in b][1:]
It works for the most part, but it fails when the text part has the '@'.
Eg, w... | |
doc_41737 | sqlite> .schema
CREATE TABLE tz ('id' INT(4),'name' TEXT NOT NULL PRIMARY KEY);
403|Pacific/Honolulu
404|Pacific/Kanton
405|Pacific/Kiritimati
406|Pacific/Kosrae
407|Pacific/Kwajalein
408|Pacific/Majuro
409|Pacific/Marquesas
410|Pacific/Midway
It's not working as expected. When I try to look up based on id it works:
... | |
doc_41738 | How can I use Bower inside my Meteor package to install those basic dependencies?
The "bower.json" example from a "PureScript Book" chapter:
{
"name": "purescript-book-chapter2",
"description": "Chapter 2 - Getting Started",
"keywords": [
"purescript"
],
"ignore": [
...
],
"dependencies": {
"p... | |
doc_41739 | www.youtube.com/watch?v=6Zgp_G5o6Oc
and changing it to
[video]www.youtube.com/watch?v=6Zgp_G5o6Oc[/video]
So should I use preg_replace() or is there a better/easier method?
A: Assuming you have the URL isolated in a variable, just do this:
$taggedUrl = sprintf("[video]%s[/video]", $url);
Or:
$taggedUrl = "[video]" ... | |
doc_41740 | Project1 (Spring boot project)
|
|--build.gradle
|--settings.gradle
|--src/main/kotlin
Project2 (Spring boot project)
|
|--build.gradle
|--settings.gradle
|--src/main/kotlin
Project2 is dependent on Project1. Could someone tell me how to add this dependency (e.g. modify build.gradle and settin... | |
doc_41741 | import org.apache.spark.SparkConf
import org.apache.spark.SparkContext
import org.apache.spark.SparkContext._
import org.apache.spark.rdd.RDD
object pizD {
def filePath = {
new File(this.getClass.getClassLoader.getResource("wikipedia/wikipedia.dat").toURI).getPath
}
def regex(line: String): pichA = {
... | |
doc_41742 | replace_build([], _Inv, _Res).
replace_build([A| B], Inv, Res) :-
replace_build2(A, Inv, Res), replace_build(B, Inv, Res).
replace_build2(_BuildItem, [], _NewInv) :- !.
replace_build2(BuildItem, [BuildItem| T], NewInv) :-
replace_build2(BuildItem, T, NewInv1),
append([empty], NewInv1, NewInv).
replace_b... | |
doc_41743 | file = new File(APP.DIR_APP + APP.IMAGE + "/ok.jpg");
if (file.isFile() && file.exists()) {
Uri uri = Uri.fromFile(file);
Picasso.with(this).load(uri).transform(new ImageRoundCorners()).into(fiv_image_view);
}
and ImageRoundCorners class:
import com.squareup.picasso.Transformation;
public class... | |
doc_41744 |
A: Just do it! :)
And you'll see.
PS
Maybe you should encode some characters like ":", "/" etc
A: Unfortunately, it won't work from a file:// context for a couple reasons:
*
*In most modern browsers, Javascript cookies won't work with the file:// protocol, which is how you would probably authenticate your users. T... | |
doc_41745 | ::stack
0x538548(190c, c1cf0, bffd8, 1800, be6cc, c1b7c)
__SUNW_fini_iostreams+0xc(fe1f15e0, 0, 0, ff, 0, 0)
libCrun.so.1`__1cH__CimplKcplus_fini6F_v_+0x74(4ee1c, 0, fe1ed4c4, 1, bfa70, fe352a00)
libCrun.so.1`_init+0x54(1, 1cc4, fcc35980, fcc37300, fe352a00, 1c00)
libc.so.1`_exithandle+0x40(fcc37580, fcc35980, 1c... | |
doc_41746 |
Edit:
Sorry for my bad english. I want the ListView to be 'non-clickable'. When you put your finger on a item, by default that item is highlighted. When you put your finger away that item returns normal. I do not want this behavior. I want to use that ListView only to show items. When a user put his finger on that ite... | |
doc_41747 | Here is my entire Axios config:
import Axios from 'axios'
import store from '@/store'
const AxiosConfig = Axios.create({
baseURL: process.env.VUE_APP_BASE_API_URL
})
const addToken = (config) => {
const token = store.getters['AuthModule/getAuthToken']
if (token) {
config.headers.Authorization = `... | |
doc_41748 | I have added the parameter in the app/config/config.yml under the parameters key.
I can use it in a Controller using $this->getParameter("PRAMETER_NAME") in an action to do some stuff manually.
I'm writing a command to do the same stuff automatically with a CRON job.
I can't find how to get the parameter in the command... | |
doc_41749 | Everything works OK for all user, except admin.
http://somedomain.com/author/MyUser - OK (non admin user!)
http://somedomain.com/author/?author=1 - OK (admin ID = 1)
http://somedomain.com/author/admin - 404
http://somedomain.com/author/User.Admin - 404
http://somedomain.com/author/AdminNickName - 404
The wp_query a... | |
doc_41750 |
A: <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite thread-count="1" verbose="1" name="SampleSuite-Linear" annotations="JDK" parallel="classes">
<listeners>
<listener class-name="utilities.reporting.ReportNGScreenshot" />
</listeners>
<test n... | |
doc_41751 | public class Personage {
public String name;
public int note1;
public int note2;
public Personage(String name, int note1, int note2){
this.name = name;
this.note1 = note1;
this.note2 = note2;
}
public void display(){
System.out.println("Name : " + name);
System.out.println("Note 1 ... | |
doc_41752 | I thought about some Visibility binding to x:Name="ItemSeparatorBorder" with a Converter that matches the index of the current item to the total count of the ListBox. But I don't know how to implement it and I can't find any good sample.
The code should work on Windows Phone 8.0 / .NET 4.0.
This is my code so far:
... | |
doc_41753 | I don't understand how to specify the JRE version.
I understand I can customize in the plugin's config, something like:
<configuration>
<from>
<image>gcr.io/distroless/java</image>
</from>
</configuration>
but what does that mean in terms of the actual JRE version which will be used ? What if I want say speci... | |
doc_41754 | My need is to have a column where the content is a button.
obviously some think like this will not work
this.columns = [
{
text : 'column1',
width : 120,
sortable : true,
flex: 1,
dataIndex: 'col1'
},{
xtype: 'button',
width : 120
}
... | |
doc_41755 | I followed every steps very carefully but i'm getting a strange error at the end.
let me explain in more details :
This is the code I'm trying to run :
require 'vendor/autoload.php';
use GraphAware\Common\Cypher\Statement;
use GraphAware\Common\Type\Node;
use GraphAware\Reco4PHP\Context\Context;
use GraphAware\Reco... | |
doc_41756 | I've been working on a SkewT diagram using Matplotlib, Metpy, Pandas, and a few others. Whenever I attempt to import metpy,it isn't recognized as a module. Previously when I was working in Thonny I never got an error message in reference to Metpy, but once again Python would crush upon plotting my graph which may mean ... | |
doc_41757 | In Alice, we can use parameters in our YAML file like below:
parameters:
pwd_parameter: anything
My\UserEntity:
#generate 10 users with password equals to my parameter
user_{1..10}:
password: '<{pwd_parameter}>'
Is it possible to use parameters to generate dynamic numbers of fixtures?
The solution I... | |
doc_41758 | The problem I'm getting is that the file is not closed before the code tries to rename it. How can I make sure the word document is closed before trying to rename it?
WordDoc = AppWord.Documents.Open(filepath + filename)
txtFileContents.Text = WordDoc.Content.Text
AppWord.Quit()
ProcessData(txtFileContents.Text, filep... | |
doc_41759 | payload :[[a3An00000009Ej6EAE, a3An00000009EjGEAU, a3An00000009EjBEAU], [45000.0, 50000.0, 12000.0]]
I have more than one array in my incoming data.
I can reference the id value as #[message.payload.id]& put it in the insert statement:
<db:parameterized-query><![CDATA[INSERT INTO HDR_TABLE (ID) VALUES (#[message.pa... | |
doc_41760 | class A {
user_id: number;
// and some other props...
}
class B {
service_name: string;
// and some other props...
}
function log<T>(...T parameters) {
// logging the input parameters
}
log<A>(
A.user_id = 123
);
log<B>(
B.service_name = 'my_service_name';
);
What I have tried so far is... | |
doc_41761 | RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)$ /creatii.php?creatie_thumb=$2&user=$1 [L]
RewriteRule ^([^/]*)/$ /creatiiuser.php?user=$1
i would like this link :
http://creatii.artcrew.ro/creatii.php?creatie_thumb=creatie19&user=dee-dee
to look:
like http://creatii.artcrew.ro/dee-dee/creatie19
well this is fine, it... | |
doc_41762 | My object relationship is as follow:
@Entity
@Table(name="account")
public class User extends Model{
@Id
@Constraints.Required
@Formats.NonEmpty
@MinLength(4)
public String name;
@Constraints.Required
@Email
public String email;
public User(String username, ... | |
doc_41763 | A:Manager
const ManagerSchema = Schema({
name: { type: String, require: true },
family: { type: String, require: true },
userName: { type: String, require: true },
phoneNumber: { type: String, require: true },
password: { type: String, require: true },
isAdmin: { type: Boolean, require: true, default: true... | |
doc_41764 | 1) Is this really asynchronous?
2) Is there a way to know the length of the content even though it is being sent in chunked format? Think progress bars).
3) How can I best monitor progress in order to hold off the program exit until all work is complete.
using System;
using System.IO;
using System.Net.Http;
namespa... | |
doc_41765 | mymatrix <- matrix(c(34,11,65,32,12,9,32,90,21,51,45,23), ncol=3)
colnames(mymatrix) <- c("pos", "neg", "neutr") # class
rownames(mymatrix) <- c("1 -1 0", "-1 -1 0", "0 -1 1", "0 0 1") # patterns
mytable <- as.table(mymatrix)
mytable
# pos neg neutr
# 1 -1 0 34 12 21
# -1 -1 0 11 9 51
# 0 -1 1 65... | |
doc_41766 | >>> import urllib.request
>>> urllib.request.urlopen("https://www.google.com/")
Traceback (most recent call last):
File "C:\Python35\lib\urllib\request.py", line 1254, in do_open
h.request(req.get_method(), req.selector, req.data, headers)
File "C:\Python35\lib\http\client.py", line 1106, in request
self._s... | |
doc_41767 | the image is smaller than the screen, so I have to stretch it.
but it doesn't work if the image is loaded from asset bundle
var styles = StyleSheet.create({
bgImage: {
flex: 1,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'stretch',
resizeMode: 'stretch',
},
welcome: {
fontS... | |
doc_41768 | Am I missing something, or is impossible? I understand that the call chain should be Valve > JAAS > Filter > Servlet, so those requests should be handled by my Valve.
I'm using Payara 5, Form-based authentication, GlassFishValve, and WEB-INF contains a glassfish-web.xml containing
<!DOCTYPE glassfish-web-app PUBLIC "-/... | |
doc_41769 | I use Toad for Oracle as my current IDE.
A: The usual approach is to take a copy of the production database into a test database and apply the script on the test database.
If you don't have a spare test database, you can recreate the DEV db from production (at least the structure) and run the test on your DEV databas... | |
doc_41770 | int main(){
int x = 4;
int y = 3;
int z;
z = x---y;
printf("%d" , z);
return 0;
}
The gcc compiler in Linux Mandriva evaluates it as (x--)-y.
I am confused as to why is it so.
It could have been x - (--y).
I know some of the answers would tell me to look at precede... | |
doc_41771 | status text is displaying in twitter account but it is not uploading/showing video .
here is twitter response.
1470928 byte
object(stdClass)#7 (3) { ["errors"]=> array(1) { [0]=> object(stdClass)#6 (2) { ["code"]=> int(324) ["message"]=> string(35) "Invalid media id 806853054318448640" } } ["httpstatus"]=> int(400... | |
doc_41772 | I'm trying to move all dependent entries from one user to a default one before deleting the user. But even with Promise.all().then() I'm getting an error saying that I still have foreign key constraints preventing me to delete the user (But if i try to delete it manually after that it works fine, because I really moved... | |
doc_41773 | For example,
<LTTextLineHorizontal y0="632.076" y1="638.532" x0="142.518" x1="206.64" width="64.122" height="6.456" bbox="[142.518, 632.076, 206.64, 638.532]" word_margin="0.1"><LTTextBoxHorizontal y0="632.076" y1="638.532" x0="142.518" x1="206.64" width="64.122" height="6.456" bbox="[142.518, 632.076, 206.64, 638.532]... | |
doc_41774 | for (int num = 1; num <= 10; num++)
{
CheckBox checkBox = new CheckBox();
checkBox.Text = "sheet" + num.ToString();
checkBox.Name = "checkbox" + num.ToString();
thelistbox.Items.Add(checkBox);
}
A: The best way to handle this is to create a list of data -- in your case, a list of numbers (or a list of st... | |
doc_41775 | Is it possible to implement a function that can be called from outside the class that adds and/or modifies properties?
Something like this is what I'm thinking of:
class Config
{
const myVar = 'blah';
public static function write( $name, $value )
{
//....
}
}
echo Config::myVar; // Clear
Config... | |
doc_41776 | I'm receiving this error when migrating:
raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.
My DATABASE config for settings.py... | |
doc_41777 | myDir = input('Where do you want to write the file?')
myPath = os.path.join(myDir, 'foobar.txt')
try:
f = open(myPath, 'w')
except not os.path.exists(myDir):
print ('That directory or file does not exist, please try again.')
myPath = os.path.join(myDir, 'foobar.txt')
f.seek(0)
f.write(data)
f.close()
A: T... | |
doc_41778 | In short, given:
trait Drink
final case object Coke extends Drink
final case object Pepsi extends Drink
val drinks = List(Coke,Coke,Pepsi,Coke,Pepsi,Pepsi)
I want:
List( List(Coke,Coke), List(Pepsi), List(Coke), List(Pepsi, Pepsi) )
A: drinks.foldRight[List[List[Drink]](List.empty) {
case (next, (l@(last... | |
doc_41779 | - Covert to all caps
- Covert to all lowercase
- Delete white spaces
- Split words and remove duplicates
- Search for a word in the string
I got the all of them but I can't figure out how to split the words and remove duplicates..
When the 4th choice (“Split Words”) is selected, the words should be put into an array or... | |
doc_41780 | <button name="bottone" onclick=myFunction()>AH-AH</button>
but this is not my case.
<button name="bottone" onclick=myFunction>AH-AH</button>
<p id="demo"></p>
<script>
function myFunction(json) {
var d = new Date();
var n = d.getFullYear();
var ip = json.ip;
document.getElementById("demo").innerHTML ... | |
doc_41781 | Apartment_7-9_01_92.docx
Apartment_7-9_02_192.docx
etc.
I want to remove the last two/three digits before the '.', including the '_' so that I end up with
Apartment_7-9_01.docx
Apartment_7-9_02.docx
Having never really used Powershell, the research I've done so far leads me to something like the below:
Get-ChildItem ... | |
doc_41782 | question
Is there a way to bind the drop function to the appending elements?
code
var UI = {
droppedArea: $('.dropArea'),
initialArea: $('#init-area')
};
UI.droppedArea.droppable({
drop: function(event, ui) {
var dropped = ui.draggable;
var droppedOn = $(this),
/* Rest of the code */... | |
doc_41783 | Below is the code snippet i am using for downloading a text file from dropbox.
void downloadFile()
{
WebClient webClient = new WebClient();
NetworkCredential Credentials = new NetworkCredential(<username>, <password>, "<domain>);
webClient.Proxy = WebRequest.GetSystemWebProxy();
webClient.Proxy.Credentials = Credential... | |
doc_41784 | Currently I have:
func predicate(value: String, op: String, predicate: String) -> [NSPredicate] {
return [NSPredicate(format: "\(value) \(op) %@", predicate)]
}
func predicate(value: String, op: String, predicate: Int) -> [NSPredicate] {
return [NSPredicate(format: "\(value) \(op) %d", predicate)]
}
func pred... | |
doc_41785 | class myclass {
public $name = array();
public function __set($arraykey, $value){
$this->name[$arraykey] = $value;
}
public function __isset($argu){
return isset($this->name[$argu]);
}
public function __unset($argu){
echo "Working: Unset $this->name[$argu]";
u... | |
doc_41786 | Index 1 (Columns: A, B, C)
Index 2 (Columns: A, B, C, D)
Index 3 (Columns: A, B, C, D, E)
Is the most specific one the actual unique index? Or does the definition of uniqueness differ depending about which index DB2 uses to access the table?
I'm a bit confused since, index 1 suggests that as long as my values for A, B... | |
doc_41787 | Currently, I have this one
CREATE TABLE public.orders
(
id SERIAL PRIMARY KEY NOT NULL,
title VARCHAR(100) NOT NULL
);
CREATE UNIQUE INDEX orders_id_uindex ON public.orders (id);
But I need to create the special alphanumeric format for storing this number
like this 5CC806CF751A2.
How can I create this format w... | |
doc_41788 | Unable to load DLL 'Microsoft.CognitiveServices.Speech.core.dll' or
one of its dependencies: The specified module could not be found.
(Exception from HRESULT: 0x8007007E)
Please help Been struggling for straight two weeks with this prob.
A: The Azure Functions doesn't support to load native functions and dynamic ... | |
doc_41789 | Now I would like to concatenate a number to num1
Example -> num1 += 5;
Rather than concatenating like expected, it sets num1 as 0. Same goes for num2
This is my part of code that should set num1 or num2 as 5:
private: System::Void button14_Click(System::Object^ sender, System::EventArgs^ e) {
if (label1->Text == "O... | |
doc_41790 | public class BaseClass { }
public class ClassA : BaseClass
{
public string PropertyA { get; set; }
}
public class ClassB : BaseClass
{
public string PropertyB { get; set; }
}
Code-behind:
public ObservableCollection<BaseClass> Items { get; set; }
public MainWindow()
{
Items = new ObservableCollection<Ba... | |
doc_41791 | #include <iostream>
using namespace std;
int times_ten(int multiply_by_ten)
{
int multiplied_by_ten = 0;
//this multiplies by 10
__asm__("shld %%eax,%1;"
"movl %%eax,%%ebx;"
"shld %%eax,%1;"
"shld %%eax,%1;"
"addl %%ebx,%%eax;"
... | |
doc_41792 | One of them have single image and text.
If I use align=left attribute on image or css float:left, tab height is shrinking to text height. If I do not one of them text begins at the bottom of image. I do not use any additional css attributes, just ones that jQuery sets from js.
I need to put image in top left corner and... | |
doc_41793 | I can bring up the CAS login screen, and after checking the cas.log it authenticates but then seems to lose the principal.
I am using the maven overlay technique which seems good to begin with.
Also had the standard log4j dramas that everyone seems to have.
Have included stacktrace, deployerConfigContext.xml, pom.xml ... | |
doc_41794 | if (doc.DocumentNode.SelectNodes("//br") != null)
{
var nodes = doc.DocumentNode.SelectNodes("//br").ToArray();
foreach (var node in nodes)
{
if (node.PreviousSibling != null && node.PreviousSibling.Name == "br")
{
node.Remove();
}
}
}
With the above code i c... | |
doc_41795 | As there is a space in the file path,below code always return 'Error - File does not Exists'.I tried putting a double quotes around the path and replaces all spaces with %20.unfortunately both did not worked for me
Can some one help me to resolve it?
File Path -
C:/Users/Guest/Documents/Visual Studio 2017/Projects/h... | |
doc_41796 | Thanks.
A: This is allowed. In fact, it's recommended you do this to increase earnings. What violates admob policy is placing two banners in one activity. A user should see one banner at a time. If it is a long screen, you can put one to the top, one to the bottom, so that user can see only one at a time.
Simply put, ... | |
doc_41797 | app.module("MyApp", ['toastr']);
But it doesn't work, the module toastr can not be found! I thought toastr were a AngularJS module?
Anyone who knows how to load the module, or if there are any Angular-directives I can use?
A: Without seeing the instantiation of app, in your example, there's no way for me to know if y... | |
doc_41798 | It all started with a combo box that I populated with this code:
items.Add(new { Text = dr4["item_name"], Value = dr4["item_id"] });
It did the trick and filled the combo box with the 131 rows of item names in the combo box. But while scrolling inside the combo box, I found two items that were occupying two lines. I d... | |
doc_41799 | The phrase I want the regular expressions replace the metacharacter is:
ley+sobre+propiedad+literaria+1847
And the code I use is that below:
$file =~ s/\+/\s/; # --> Replace the +
But it seems to only replace the first metacharacter and the result is:
leysobre+propiedad+literaria+1847
What shoud I use?
A: *
*The \s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.