I have SortedList in descending order.
public class MyComparer : IComparer<int>
{
public int Compare(int x, int y)
{
if (x.CompareTo(y) > 0)
return -1;
return 1;
}
}
class Program
{
static void Main(string[] args)
{
SortedList<int, bool> myList = new SortedList<int, bool>(new MyComparer());
myList.Add(10, true);
bool check = myList[10];//In this place an exception "Can't find key" occurs
}
}
When SortedList created without my own IComparer the code works fine and no exception occurs.
Hi guys
I am sending data to webserver in the Querystrings by creating URL dynamically. When I view that URl in UIAlertView it shows me correct one.
And when i try to get response using NSURL code, it does not respond.
Below is the code.
NSString *uu = @"http://www.zenhomeenergy.com/ZenIphoneServUpdate.aspx?CustomerID=12&FirstName=Andrew&LastName=Turner&State=SA&Street=60 Highfiled Drive Hillbank no phone number&PostCode=5112&Email= &Mobile= &HomePhone= &WorkPhone= &PrimaryResidence=True&HomeOwner=True";
NSString *text = [NSString stringWithContentsOfURL:[NSURL URLWithString:uu]];
if(text)
{
if([text isEqualToString:@"Success."])
{
textView.text = [textView.text stringByAppendingString:@"Success.\n"];
}
else
{
textView.text = [textView.text stringByAppendingString:@"Failed.\n"];
}
}
If you try putting the above URL into browser it says "Success."
But the code above doesnot work.
Please Help.
I'm load testing a web page using visual studio load testing tool, but I have problems displaying results. The problem is cookieless session. Everytime new user comes to a page, page URLL changes and I'm not able to calculate average page response time. What can be done about it?
I am trying to get a list of values within a div that I will format later using the .each() method. They are input values which are hidden my html and jquery call looks like this.
<div id="container_0">
<input type="hidden" id="check_data" value=10>
<input type="hidden" id="check_data" value=20>
</div>
Jquery:
var list = $('#container_0 input#check_data');
$(list).each(
function() {
alert($(this).val());
}
);
This however is not returning any values. Any help would be greatly appreciated.
I had a row in my database:
starttime:4/6/2012 2:00pm, Endtime:31/12/9999, name:"swetha", status:"open".....
When I update this row I changed the starttime to the current time (getdate()) and have no issues. I am running a Windows Service each day at 1am to modify a value in the row.
I would like to know the status of my row at 4/6/2012 11:59 pm when my service runs.
There is no need to do an update at 4/6/2012 11:59 pm and the last update may be at any time of the day however my requirement is to get the status value at 4/6/2012 11:59 pm.
I would like to have the query in SQL Server 2008. Can anyone please help me to find a solution?
Hi,
I have a listbox inside another list box, in inner list box listboxitems height may grow or shrink. My problem is that when the inner items shrink the outer list box doesn't re-render its height. Thus - stays with the previous height before the inner list shrinked.
I have tried so many things here, among Invalidate of all types, selection and de-selection of the list box item that should be updated and more - nothing helps....
Can anyone pls help me with this?
Thanx,
Gili
hi,
i cant get the value of session variable on paypal transaction processing.when transation complete my table is updated, for updation i use a session variable,at that time i can't get the value of the session variable.
is sessions not get in paypal? please help me to find a solution......
I am trying to insert NULL value in Sql Server if I have null value in corresponding C# String object like below :
String Residence = xmlDoc.Descendants("Appointment").Single().Element("StateOfResidence") == null ? null : xmlDoc.Descendants("Appointment").Elements("StateOfResidence").Single().Value;
I am using Entity framework for Database access. So if Residence is null, 'NULL' gets inserted into Database instead of NULL. How can insert NULL for null ?
I asked this question a few days ago but it seems to have gone cold fairly quickly. What I want to do is pretty simple and I can't believe someone hasn't figured it out.
Solution needs to be JScript classic ASP. I am reading a file from a remote server and I want to process that (binary) file on my server and spit the results back to the client as XML.
Here's a simplified version of what I am trying to do. This code runs, or will if the URL is filled in for your site. This test file is readbin.asp. It reads a file called test.bin, and writes the result to a stream. I used a stream because that makes it easier to read the file and parse the contents. Basically I want to:
while not end of stream
read byte from stream
process byte
here is readbin.asp:
<%@ LANGUAGE = JScript %>
<%
var url = "http:// (... your URL to the file test.bin goes here...) " ;
var xmlhttp = Server.CreateObject ("MSXML2.ServerXMLHTTP") ;
xmlhttp.open ("GET", url, false) ;
xmlhttp.send () ;
var BinaryInputStream = Server.CreateObject ("ADODB.Stream") ;
BinaryInputStream.Type = 1 ; // binary
BinaryInputStream.Open ;
BinaryInputStream.Write (xmlhttp.responseBody) ;
BinaryInputStream.Position = 0 ;
Response.Write ("BinaryInputStream.size = " + BinaryInputStream.size + "<br>") ;
Response.Write ("BinaryInputStream = " + BinaryInputStream + "<br>") ;
var ByteValue = BinaryInputStream.read (1) ;
Response.Write ("ByteValue = " + ByteValue + "<br>") ;
Response.Write ("typeof (ByteValue) = " + typeof (ByteValue) + "<br>") ;
%>
My problem is: how do I get ByteValue as a number 0..255? typeof (ByteValue) is "unknown".
Ord?? Byte()?? Asc?? Chr??
I get this error
All the emails are in a queue
Message 1Nzpy9-0005pH-JI is not frozen
delivering 1Nzpy9-0005pH-JI
LOG: MAIN
== [email protected] R=lookuphost defer (-1): host lookup did not complete
I'm currently using this code to get the number of subscribers to my blog:
$whaturl="http://api.feedburner.com/awareness/1.0/GetFeedData?uri=http://feeds.feedburner.com/DesignDeluge";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $whaturl);
$data = curl_exec($ch);
curl_close($ch);
$xml = new SimpleXMLElement($data);
$fb = $xml->feed->entry['circulation'];
but when I echo $fb it doesn't work (the whole file that $fb is being echoed on doesn't appear). Any ideas on why this isn't working?
Here is an example bit from the xml file:
<array>
<dict>
<key>Name</key>
<string>Joe Smith</string>
<key>Type</key>
<string>Profile</string>
<key>Role</key>
<string>User</string>
<key>Some Number</key>
<integer>1</integer>
<key>Some Boolean</key>
<true/>
</dict>
</array>
I have two separate goals. The first is to extract an array from the dictnode that would look like:
[Name] => Joe Smith
[Type] => Profile
[Role] => User
[Some Number] => 1
[Some Boolean] => true
It's not crucial that the boolean be included, so if that adds too much complexity, I'd rather just know how to deal with the others for now.
The second goal is to be able to select the value node (<string>, <integer>,etc) so that I can change the value. I would need to select it based on the text value of the preceding key element.
I think the following XPath should work:
//key[.=$keyname]/following-sibling[1]
But I'm not sure.
Basically, this whole system that Apple uses seems logical, but totally contrary to the XML is supposed to work. If I ran the world, the original XML would look more like:
<dict type="array">
<value key="Name" type="string">Joe Smith</value>
<value key="Type" type="string">Profile</value>
<value key="Role type="string">User</value>
<value key="Some Number" type="integer">1</value>
<value key="Some Boolean" type="boolean">true</value>
</dict>
But since it is fairly logical, I am wondering if I'm missing some obvious way of handling it.
I have developed a simple mechanism for my mvc website to pull in html via jquery which then populates a specified div. All is well and it looks cool.
My problem is that i'm now creating html markup inside of my controller (Which is very easy to do in VB.net btw) I'd rather not mix up the sepparation of concerns.
Is it possible to use a custom 'MVC View User Control' to suit this need? Can I create an instance of a control, pass in the model data and render to html? It would then be a simple matter of rendering and passing back to the calling browser.
warning: passing argument 1 of 'bsearch' makes pointer from integer without a cast
and the corresponding code is
Parent =bsearch((const size_t)ParentNum, ClauseVector, Size,
sizeof(CLAUSE),pcheck_CompareNumberAndClause);
the compilar is gcc.
here CLAUSE is defined as *CLAUSE.
Hello,
With asp.net mvc you can use the annotation
[Required (errormessage="This is required")]
How can I create something like this:
[Required (errormessage="ERRORXX")]
So I can look up in a database what this ERRORXX is and display it on my form. Now my form displays ERRORXX.
How can I create something that solves my problem?
Thx!
Problem:
I want to do this operation
select name from pragma table_info(my_awesome_table)
However, it yields a syntax error. I have the sneaking suspicion this is possible, but it doesn't seem to be documented as usable in the SELECT docs with sqlite.
Hi All
I am working with the new version of boost 1.42 and I want to use regex with named sub groups. Below an example.
std::string line("match this here FIELD=VALUE in the middle");
boost::regex rgx("FIELD=(?\\w+)", boost::regex::perl );
boost::smatch thisMatch;
boost::regex_searh( line, thisMatch, rgx );
Do you know how to get the content of the match ?
The traditional way is
std::string result( mtch["VAL"].first, mtch["VAL"].second );
but i don't want to use this way.
I want to use the name of the subgroups as usual in Perl and in regex in general.
I tried this, but it didn't work.
std::string result( mtch["VAL"].first, mtch["VAL"].second );
Do you know how to get the value using the name of the subgroup?
Thanks
AFG
Hi, I am trying to get the XPath "/deployment/service". Tested on this site:
http://www.xmlme.com/XpathTool.aspx
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org /axis/wsdd/providers/java">
<service name="kontowebservice" provider="java:RPC" style="rpc" use="literal">
<parameter name="wsdlTargetNamespace" value="http://strategies.spine"/>
<parameter name="wsdlServiceElement" value="ExposerService"/>
<parameter name="wsdlServicePort" value="kontowebservice"/>
<parameter name="className" value="dmd4biz.container.webservice.konto.internal.KontoWebServiceImpl_WS"/>
<parameter name="wsdlPortType" value="Exposer"/>
<parameter name="typeMappingVersion" value="1.2"/>
<operation xmlns:operNS="http://strategies.spine" xmlns:rtns="http://www.w3.org/2001/XMLSchema" name="expose" qname="operNS:expose" returnQName="exposeReturn" returnType="rtns:anyType" soapAction="">
<parameter xmlns:tns="http://www.w3.org/2001/XMLSchema" qname="in0" type="tns:anyType"/>
</operation>
<parameter name="allowedMethods" value="expose"/>
<parameter name="scope" value="Request"/>
</service>
</deployment>
I absolutely can't find out why it always tells me that my xpath does not match...
This may be stupid, but am I missing something?
I need to get the living city of each person in a group. Including people that are not my friends.
In the browser seeing facebook profile of some unknown person, they show "lives in ...", if this is set as public information. They include the link to the city object with the city id in the link. That's all that I need.
But, using a facebook app that I created to use the facebook graph api, this information is not public. I can only get the user propriety 'location' from friends of my that I have permission to see it. I gave ALL the possible permissions to my app.
In the api explorer, when I use it as REST, they show few informations about someone not friend of mine.
https://developers.facebook.com/tools/explorer/
Also in the api explorer, when I use the FQL, it didn't works.
This query works, returning the JSON with the data:
SELECT uid, name FROM user WHERE username='...';
But this other query doesn't work:
SELECT uid, name, location FROM user WHERE username='...';
They return a json with a error code:
{
"error": {
"message": "(#602) location is not a member of the user table.",
"type": "OAuthException",
"code": 602
}
}
I asked for ALL the permissions options in the token. And I can get this info in the browser version of the facebook. But how can I get it with the API ?
Here's my Application_OnError event sink in global.asax.vb:
Sub Application_OnError(ByVal sender As Object, ByVal e As EventArgs)
Dim innerMostException As Exception = getInnerMostException(Me.Context.Error)
If TypeOf innerMostException Is AccessDeniedException Then
Security.LogAccessDeniedOccurrence(DirectCast(innerMostException, AccessDeniedException))
Dim fourOhThree As Integer = DirectCast(HttpStatusCode.Forbidden, Integer)
Throw New HttpException(fourOhThree, innerMostException.Message, innerMostException)
End If
End Sub
You'll see that if we've got an innermost Exception of type AccessDeniedException we throw a new HTTPExcpetion with a status code of 403 AKA 'forbidden'
Here's the relevant web.config entry:
<customErrors defaultRedirect="~/Application/ServerError.aspx" mode="On">
<error statusCode="403" redirect="~/Secure/AccessDenied.aspx" />
</customErrors>
So what we're expecting is a redirect to the AccessDenied.aspx page. What we get is a redirect to the ServerError.aspx page.
We've also tried this:
Sub Application_OnError(ByVal sender As Object, ByVal e As EventArgs)
Dim innerMostException As Exception = getInnerMostException(Me.Context.Error)
If TypeOf innerMostException Is AccessDeniedException Then
Security.LogAccessDeniedOccurrence(DirectCast(innerMostException, AccessDeniedException))
Context.Response.StatusCode = DirectCast(HttpStatusCode.Forbidden, Integer)
End If
End Sub
Which unsuprisingly doesn't work either.
Any ideas what we're doing wrong?
I'm trying to implement single-column regionalization for a Rails application and I'm running into some major headaches with a complex SQL need. For this system, a region can be represented by a country code (e.g. us) a continent code that is uppercase (e.g. NA) or it can be NULL indicating the "default" information. I need to group these items by some relevant information such as a foreign key (we'll call it external_id).
Given a country and its continent, I need to be able to select only the most specific region available. So if records exist with the country code, I select them. If, not I want a records with the continent code. If not that, I want records with a NULL code so I can receive the default values.
So far I've figured that I may be able to use a generated CASE statement to get an arbitrary sort order. Something like this:
SELECT *, CASE region
WHEN 'us' THEN 1
WHEN 'NA' THEN 2
ELSE 3
END AS region_sort
FROM my_table
WHERE region IN ('us','NA') OR region IS NULL
GROUP BY external_id
ORDER BY region_sort
The problem is that without an aggregate function the actual data returned by the GROUP BY for a given row seems to be untameable. How can I massage this query to make it return only the first record of the region_sort ordered groups?
I have an asp.net website and i want to get the number of users currently viewing my site. I am aware that there are some third party softwares available, that would give me the list of the users online but i don't want to do that.
Does anyone know how this can be achieved in asp.net? May be if there are any server variables that would keep a track of the website instances that gives the number of users currently visiting the site. Please help me.