literals

Using a Scala symbol literal results in NoSuchMethod

血红的双手。 提交于 2019-12-08 01:08:33
问题 I have recently begun using Scala. I've written a DSL in it which can be used to describe a processing pipeline in medici. In my DSL, I've made use of symbols to signify an anchor, which can be used to put a fork (or a tee, if you prefer) in the pipeline. Here's a small sample program that runs correctly: object Test extends PipelineBuilder { connector("TCP") / Map("tcpProtocol" -> new DirectProtocol()) "tcp://localhost:4858" --> "ByteToStringProcessor" --> Symbol("hello") "stdio://in

What does the numerical literal 0.e0f mean?

白昼怎懂夜的黑 提交于 2019-12-07 23:17:32
问题 I am currently trying to debug an uninitialized memory error. I have now come across the numerical literal 0.e0f in the OpenBlas source code (which is what the debugger is currently at) what does that mean? The context is this: if ((alpha_r == 0.e0f) && (alpha_i == 0.e0f)) return; The 0.e0f evaluates to 0 apparently. 回答1: A floating-point literals have two syntaxes. The first one consists of the following parts: nonempty sequence of decimal digits containing a decimal point character (defines

Why does instanceof return false for some literals?

元气小坏坏 提交于 2019-12-07 19:18:32
问题 "foo" instanceof String //=> false "foo" instanceof Object //=> false true instanceof Boolean //=> false true instanceof Object //=> false false instanceof Boolean //=> false false instanceof Object //=> false // the tests against Object really don't make sense Array literals and Object literals match... [0,1] instanceof Array //=> true {0:1} instanceof Object //=> true Why don't all of them? Or, why don't they all not ? And, what are they an instance of, then? It's the same in FF3, IE7,

Invalid literal for float(): 0.000001, how to fix error?

偶尔善良 提交于 2019-12-07 17:33:45
问题 I have a .csv file containing 3 columns of data. I need to create a new output file that includes a specific set of data from the first and third column from the original file. The third column contains decimal values, and I believe in such a case I have use the float() feature of python. I have tried the following code: in_file = open("filename.csv", "r") out_file = open("output.csv", "w") while True: line = in_file.readline() if (line == ''): break line = line.strip() items = line.split(','

Pandas read_csv converter – How to handle exceptions (literal_eval SyntaxError)

二次信任 提交于 2019-12-07 15:50:33
问题 Into a Pandas DataFrame, I'm reading a csv file that looks like: A B +--------------+---------------+ 0 | | ("t1", "t2") | +--------------+---------------+ 1 | ("t3", "t4") | | +--------------+---------------+ Two of the cells have literal tuples in them, and two of the cells are empty. df = pd.read_csv(my_file.csv, dtype=str, delimiter=',', converters={'A': ast.literal_eval, 'B': ast.literal_eval}) The converter ast.literal_eval works fine to convert the literal tuples into Python tuple

Type provider and static argument in F#

六眼飞鱼酱① 提交于 2019-12-07 14:48:01
问题 I have a library, Library_1, which compiles correctly and defines a provided type : type modelforexcel = FSharpx.ExcelFile<@"template.xls", "Brokernet", true> When I include this library in another project, Library_2, the compiler complains that it can't find any "Brokernet.template.xls", at the root of the new Library_2 project. Error 4 'C:\Library_2\template.xls' could not be found. Check the spelling of the file name, and verify that the file location is correct. I would like the type to

IntelliJ says \b (backspace) is an illegal escape sequence inside a string literal. Why?

放肆的年华 提交于 2019-12-07 08:13:53
问题 I have this piece of code private static final Pattern controlChars = Pattern.compile( "[\u0001-\u0008\u000B\u000C\u000E-\u001F\u007F]"); and IntelliJ idea (2016.3) puts a red squiggle under \u0008 saying it's an illegal/unsupported escape sequence. Changing it to any of \b , \010 or \x08 has no effect. What I don't get is that the code builds and runs without a problem. Any idea what's the issue? 回答1: This is a bug in the RegExp support. It is fixed in IntelliJ IDEA 2017.1 Public Preview.

ValueError: invalid literal for float() in Python

折月煮酒 提交于 2019-12-07 07:39:05
问题 To all: I have curious if someone can help me understand the error: ValueError: invalid literal for float(). I am getting this when I am passing a text file to a list then trying to convert this list to float values. a = open("input.txt","r") lines = a.readlines() b = map(float, lines) What is odd, at least to me is that when I process: print repr(lines[0]) I get: '0.000\t0.000...\t0.000\t0.000\n' and print type(lines[0]) I get: <type 'str'> I don't understand therefore why the map(float,

Too many characters in character literal?

ぃ、小莉子 提交于 2019-12-07 05:43:55
问题 Can you tell me please what is wrong with this code??? About to getting crazy!!! <asp:LinkButton ID="LinkButton1" OnClick="DivAc('griddiv')" Font-Size="Smaller" runat="server" CommandName='<%# Eval("harf").ToString().ToUpper()%>'><%# Eval("harf").ToString().ToUpper() %></asp:LinkButton> Error: Too many characters in character literal... :( 回答1: Is DivAc('griddiv') a javascript function? Then you have to use OnClientClick instead of OnClick . OnClick is reserved for .NET functions. With

Insert a <br /> tag programmatically (VB.NET)

Deadly 提交于 2019-12-07 03:57:12
问题 I'm trying to dynamically add results to this display and I simply want to put a break tag after a label to start putting information on the next line. For some reason, Using a literal isn't working for me. Is there a better way to do this or should I just use tables? Dim break As LiteralControl break = New LiteralControl("<br />") divListenerInfo.Controls.Add(break) That's part of the code that I'm attempting to use. Let me clarify what I said: It's not working as in the line break isn't