variables

Illegal character with Blue J

纵饮孤独 提交于 2020-01-05 05:42:04
问题 Program public class Project_X { public static void main(String[] args){ byte x; int a=270; double b =128.128; System.out.println("int converted to byte"); x=(byte) a; System.out.println("a and x "+ a +" "+x); System.out.println("double converted to int"); a=(int) b; System.out.println("b and a "+ b +" "+a); System.out.println("n double converted to byte"); x=(byte) b; System.out.println("b and x "+b +" "+x); } } error get illegal character:\160 回答1: You copy-pasted the program code using a

Choosing when to instantiate classes

ぐ巨炮叔叔 提交于 2020-01-05 05:11:53
问题 I recently wrote a class for an assignment in which I had to store names in an ArrayList (in java). I initialized the ArrayList as an instance variable private ArrayList<String> names . Later when I checked my work against the solution, I noticed that they had initialized their ArrayList in the run() method instead. I thought about this for a bit and I kind of feel it might be a matter of taste, but in general how does one choose in situations like this? Does one take up less memory or

use variable in excel formula

余生颓废 提交于 2020-01-05 04:37:08
问题 I'm trying to make an automated sum based on an increasing number of rows. Here is my sample of code but I'm stuck as I don't know the syntax to include a variable in the formula of a cell. Sheets("Orderboek").Select Range("H" & (rOi + 1)).FormulaR1C1 = "=Sum(H3:H"&rOi&")" My variables are declared as follows: Dim i As Integer, a As Range 'i= index a een gebied Dim prText As String 'product text Dim rOi As Long 'rij nummer in orderboek Dim rng, sumrng As Excel.Range Dim r As Long 'rij number

SSIS: import MAX(filename) from folder

谁都会走 提交于 2020-01-05 04:14:12
问题 I need to pick one .csv file from \\\Share\Folder\ with max filename for further import to SQL. File name is alphanumerical, e.g. ABC_DE_FGHIJKL_MNO_PQRST_U-1234567.csv , where numerical part will vary, but I need the only max one each time the package runs. Constraints: no write access on that SQL server, I use ##Temp table for import and this is the least desirable method for filename processing (no for each loops on this server). Ideally it will be function/expr-based variable (combined

String Contatenation with primitives in java

风流意气都作罢 提交于 2020-01-05 00:48:34
问题 I just recently started learning Basics in Java, and was testing around initializing a string variable by concatenating primitive variables. public class Main{ public static void main(String[] args){ byte lbyte = 3; short lshort = 1; int lint = 1; long llong = 0; float lfloat = 2.0f; double ldouble = lfloat; char lchar = 'H'; boolean lbool = true; String lstring = " w0r1d "; String lOutput = lchar+lbyte+lshort+lint+llong+lstring+ldouble+' '+lbool; System.out.println(lOutput); } } In this code

Setting variables in a KSH spawned process

泄露秘密 提交于 2020-01-04 16:57:50
问题 I have a lengthy menu script that relies on a few command outputs for it's variables. These commands take several seconds to run each and I would like to spawn new processes to set these variables. It would look something like this: VAR1=`somecommand` & VAR2=`somecommand` & ... wait echo $VAR1 $VAR2 The problem is that the processes are spawned and die with those variables they set. I realize that I can do this by sending these to a file and then reading that but I would like to do it without

Dynamic SQL with variables inside a view (SQL Server)

末鹿安然 提交于 2020-01-04 15:30:25
问题 Hello I'm essentially trying to do this inside a new view window in SQL Server 2008: declare @var = (select db from databases); exec ('select name from ' + @var ' + .dbo.Names); This view actually runs in SQL Server but I cannot save it (it gives me an error), I could potentially just create a table returning function, do all of this same stuff in it and return the table and create a view that basically takes everything from that table but I was unsure of performance hits that could occur

Run 3 variables at once in a python for loop.

只愿长相守 提交于 2020-01-04 14:19:17
问题 For loop with multiple variables in python 2.7. Hello, I am not certain how to go about this, I have a function that goes to a site and downloads a .csv file. It saves the .csv file in a particular format: name_uniqueID_dataType.csv. here is the code import requests name = "name1" id = "id1" dataType = "type1" def downloadData(): URL = "http://www.website.com/data/%s" %name #downloads the file from the website. The last part of the URL is the name r = requests.get(URL) with open("data/%s_%s_

SSIS expression previous date without DateAdd()

心不动则不痛 提交于 2020-01-04 14:18:15
问题 Currently developing a package that passes an expression from a previous date to a filename. The current code I have is the following as a string variable: (DT_WSTR,20)DATEPART("YYYY",Dateadd("DD",-1,dateadd("MM",datediff("MM", (DT_DATE) "1900-01-01",getdate())-2, (DT_DATE) "1900-01-01"))) + RIGHT("0"+(DT_WSTR,20)DATEPART("MM",Dateadd("DD",-1,dateadd("MM",datediff("MM", (DT_DATE) "1900-01-01",getdate())-5, (DT_DATE) "1900-01-01"))),2) + "01" This currently produces the output of: 20171101

can variables be set randomly when declaring them again?

五迷三道 提交于 2020-01-04 13:45:06
问题 In my method, I declare some variables, including int blockCount; . I call this method more than once. Using the Xcode debugger, I found out that after the second time the method was called, the value of blockCount was set to 364265, while it was set to 2, just a few milliseconds earlier. It's not a real problem, since I can just set it to 0 or any other number I'd like, but is it bad programming habit to have a certain variable declared over and over again? I'm quite new to programming, and