I remember reading about the double pipe operators -- || and <|| -- somewhere and now I can't remember where. I can't find them on MSDN or in the language spec. Are they documented anywhere?
Example
let print a b = sprintf "%O %O" a b
(1, 2) ||> print
// val it : string = "1 2"
This is my code for downloading html to parse:
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
var obj = response.GetResponseStream();
StreamReader reader = new StreamReader(obj);
tmp = reader.ReadToEnd();
(tmp is a string) and when writing it to a text file to look through, I'm noticing that responseStream is stripping out the very text that I'm actually looking to parse. Is there any other way to download raw HTML for future parsing or am I simply out of luck?
I am trying to compute (360 / 24) / 60 I keep getting the answer 0.0 when I should get 0.25
In words: I want to divide 360 by 24 and then divide the result by 60
public class Divide {
public static void main(String[] args){
float div = ((360 / 24) / 60);
System.out.println(div);
}
}
This prints out:
0.0
Why is that? Am I doing something really stupid, or is there a good reason for this
Maybe this cannot be done, but please help or suggest how this can be achieved without writing something to disk.
Lets suppose there are two string values that I want to share between two independent applications.
You are welcome to provide code sample in any programming language.
I have seen some form of this some time ago, but I cannot recall what it was called, and therefore have no clue on how to implement something like this:
SomeMoneyFormat f = "€ 5,00";
Which calls some overload function that can parse the string into a SomeMoneyFormat object.
Greeting,
I'm creating a video play with silverlight 4 and C#. the player is working fine when I set the path for the target folder using this line of code.
string FolderPath = this.Context.ApplicationInstance.Server.MapPath(@"~\Video\");
Now I want to place in C:\inetpub\wwwroot and I want to use the IP address of my IIS instead of the folder place.
please advice how to modify this line of code to target my IIS.
Thank you,
i am trying to get checkbox value ,using c#
In grid view the datasource is from oracle
i have added the checkbox but the value is not coming
please help me in checking the value of check box
this is for selecting the candidate if the checkbox is selected the particular candidate name is selected and the candidate names are appended
in a string
Lets say I have a SP that has a SELECT statements as follows,
SELECT product_id, product_price FROM product
WHERE product_type IN ('AA','BB','CC');
But data goes to that IN clause must be through a single variable that contains the string of values. Something link below
SELECT product_id, product_price FROM product
WHERE product_type IN (input_variables);
But its not working that way. Any idea how to do this?
Hi,
I want to annotate a class dynamically to make it the more generic as possible:
public class Test<T> {
@XmlAttribute(name = dynamicvalue)
T[] data;
public Test(String dynamicvalue) {
}
}
Is there any way to achieve something like this.
TA
Is it possible to create a generic method with a definition similar to:
public static string GenerateWidget<TypeOfHtmlGen, WidgetType>(this HtmlHelper htmlHelper
, object modelData)
// TypeOfHtmlGenerator is a type that creates custom Html tags.
// GenerateWidget creates custom Html tags which contains Html representing the Widget.
I can use this method to create any kind of widget contained within any kind of Html tag.
Thanks
Hello,
I'm having a hard time trying to replace this weird right single quote character. I'm using str_replace like this:
str_replace("’", '\u1234', $string);
It looks like I cannot figure out what character the quote really is. Even when I copy paste it directly from PHPMyAdmin it still doesn't work. Do I have to escape it somehow?
What's the recommended way to print an integer with thousands separator? Best I've come up with so far is
let thousands(x:int64) = String.Format("{0:0,0}", x)
Which works in most cases, but prints zero as 00.
Why is it that
class swi22
{
public static void main(String[] args)
{
int a=98;
switch(a)
{
default:{ System.out.println("default");continue;}
case 'b':{ System.out.println(a); continue;}
case 'a':{ System.out.println(a);}
}
System.out.println("Switch Completed");
}
}
gives error as: continue outside of loop
Why doesn't the following program return 0, since I am accessing p from a new A(), which has not had main called on it?
public class A {
public int p = 0;
public static void main(String[] args) {
p = Integer.parseInt(args[0]);
new B().go();
}
}
class B {
public void go() {
System.out.println(new A().p);
}
}
I'm quite puzzled by CouchDB: if I send a PUT request with some JSON string fields encoded as UTF-8, the non 7 bit ASCII characters get converted to the "\uXXXX" escape sequence. Is there any way to tell it not to escape UNICODE?
using (DirectorySearcher srch = new DirectorySearcher(String.Format("(memberOf= {0})",p_Target.DistinguishedName)))
{
srch.PageSize = 2;
SearchResultCollection results = results = srch.FindAll();
int count = results.Count;
}
count = 3 (THREE) and not 2. Why is that? I don't want to have all results in just one page. I know that PageSize = 2 is silly small but I set that value in this case just for testing purpose (in reality it will be more).
I have trying this :
$string ="Group: ALL:ALL:Good";
@str2 = split (/:/,':',2);
print "@str2";
I am looking in $str[0] = Group and $str[1]= ALL:ALL:Good
It not working . What would be issue ?
Hi,
I am trying extract number, from line has 'copies : 5' string.
this look behind expression not working.
echo "copies : 5" |perl -ne 'print $1 if /(\d+)(?
Thanks
That is the question. What I want to accomplish is something similar to the following Java code:
class A { }
class B extends A { }
public class Tests {
public static void main(String [] args) {
ArrayList<? extends A> lists = new ArrayList<B>();
}
}
(in which B extends A means B inherits from A)
Is it possible at all?
Thanks
hi,
what does this construct mean in PHP ? It is storing a variable called "function" with his String value in an array ?
array('function' => 'theme_select_as_checkboxes')
thanks
my company is sponsoring me to take some online c# classes.
i have a pretty good background in vb.net but im not so string in OOP
can someone please recommend some c# classes online that i can take?
I have a table mytable( id, key, value). I realize that key is generating a lot of data redundancy since my key is a string. (my keys are really long, but repetititve) How do I build a separate table out that has (key, keyID) and then alternate my table to be mytable( id, keyID, value) and keyTable(keyID, key) ?