for example. I write a mothed
Private Sub Command1_Click()
Dim dom As New DOMDocument
Dim http As New XMLHTTP
Dim strRet As String
If Not dom.Load("c:\voucher.xml") Then MsgBox "?????"
http.Open "Post", "http://172.31.132.173/u8eai/import.asp", True '?????ASP
http.send dom.xml '?xml????????
strRet = http.responseText '
End Sub
I should import "DOMDocument","XMLHTTP" and so on, what should I do ?
This may seem like a stupid question, so here goes:
Other than parsing the string of FileInfo.FullPath for the drive letter to then use DriveInfo("c") etc to see if there is enough space to write this file. Is there a way to get the drive letter from FileInfo?
I want to create a vb.net project that I will use to only hold image and string resources that I will need in multiple projects.
What I can't figure out is how do I reference these resources from other projects.
I know this is a simple question but it's aggravating me. If I have a key/value pair in a collection but I can't seem to get the value out using the key. I can get the key using the value but not vice versa. Is there some magical way to accomplish this?
For example:
Dim CycleList As Collection
Dim Value as String
Set CycleList = New Collection
CycleList.Add 1, "Some Value"
Value = CycleList(1)
I've also tried CycleList.Item(1) and it's the same result, Value = 1.
Hi,
let's consider a small method:
int MyFunction(string foo, int bar)
{
...
}
and some calls:
MyFunction("",0)
int x = MyFunction(foo1,bar1)
How would you explain this to a non-technical persons? Has anybody a nice metaphor?
I tried to explain method calling (or function application) several times, but I failed. Seems I can't find the right words here.
Regards,
forki
I have a ToString() method that looks like this:
public override string ToString()
{
return "something" + "\n" + "something";
}
Because there are several "something"'s and each is long, I'd like to see
something
something
Sadly, I'm seeing
"something\nsomething"
Is there a way to get what I want?
Greetings,
In my Reporting Services report I've added reference to my custom library. It works fine. I can display the string which is returned from my custom library method as follows:
=ClassLibrary1.MyClass.Parse("harry potter")
Above code works fine - it should return SQL query based on passed parameters. My question is, how can I use this code in my DataSource. I'm trying to do something like this:
SELECT * FROM =ClassLibrary1.MyClass.Parse(@searchedPhrase)
But the above code does not work and the error is returned :"Incorrect syntax near ="
public static void main(String[] args) throws Exception {
RSAKeyPairGenerator rsaKeyPairGen = new RSAKeyPairGenerator();
AsymmetricCipherKeyPair keyPair = rsaKeyPairGen.generateKeyPair();
}
the rsaKeyPairGen is not null, but the generateKeyPair() method is throwing NullPointerException. What may be wrong?
Error message:
java.lang.NullPointerException
at org.bouncycastle.crypto.generators.RSAKeyPairGenerator.generateKeyPair(Unknown Source)
at pkg.main(Main.java:154)
My program is suppose to maintain a collection of Photos in a PhotoAlbum. It begins by reading a folder of photos and adds them to my PhotoAlbum. It then prints a menu that allows the user to list all the photos, add a photo, find a photo, save, and quit the program. Right now if I run my program it will add the 100 photos to the PhotoAlbum, but if I quit the program without saving, it clears the file I am reading from even if I haven't added a photo or done anything to the PhotoAlbum and I'm not sure why.
Here is my method for printing to a file:
private static void saveFile(PrintWriter writer) {
String result;
ArrayList<Photo> temp = album.getPhotoAlbum();
for (int i = 0; i < temp.size(); i++){
result = temp.get(i).toString() + "\n";
writer.println(result);
}
writer.close();
}
And where the PrintWriter is instantiated:
File file = new File(args[0] + File.separator + "album.dat");
try {
PrintWriter fout =
new PrintWriter(new FileWriter(file));
fileWriter = fout;
} catch (IOException e){
System.out.println("ReadFromFile: Folder " + args[0]
+ " is not found.");
System.exit(0);
}
And where it is called in my runMenu Method:
private static void runMainMenu(Scanner scan) {
String input;
do {
showMainMenu();
input = scan.nextLine().toLowerCase();
switch (input.charAt(0)) {
case 'p':
System.out.println(album.toString());
break;
case 'a':
album.addPhoto(readPhoto(scan, t));
break;
case 'f':
findMenu(scan);
break;
case 's':
saveFile(fileWriter);
System.exit(0);
break;
case 'q':
break;
default:
System.out.println("Invalid entry: " +
input.charAt(0));
break;
}
} while (!input.equalsIgnoreCase("q"));
}
I have a project using Entity Framework 4.0 with POCOs (data is stored in SQL DB, lazyloading is enabled) as follows:
public class ParentObject {
public int ID {get; set;}
public virtual List<ChildObject> children {get; set;}
}
public class ChildObject {
public int ID {get; set;}
public int ChildRoleID {get; set;}
public int ParentID {get; set;}
public virtual ParentObject Parent {get; set;}
public virtual ChildRoleObject ChildRole {get; set;}
}
public class ChildRoleObject {
public int ID {get; set;}
public string Name {get; set;}
public virtual List<ChildObject> children {get; set;}
}
I want to create a new ChildObject, assign it a role, then add it to an existing ParentObject. Afterwards, I want to send the new ChildObject to the caller.
The code below works fine until it tries to get the object back from the database. The newChildObjectInstance only has the ChildRoleID set and does not contain a reference to the actual ChildRole object. I try and pull the new instance back out of the database in order to populate the ChildRole property. Unfortunately, in this case, instead of creating a new instance of ChildObject and assigning it to retreivedChildObject, EF finds the existing ChildObject in the context and returns the in-memory instance, with a null ChildRole property.
public ChildObject CreateNewChild(int id, int roleID) {
SomeObjectContext myRepository = new SomeObjectContext();
ParentObject parentObjectInstance = myRepository.GetParentObject(id);
ChildObject newChildObjectInstance = new ChildObject() {
ParentObject = parentObjectInstance,
ParentID = parentObjectInstance.ID,
ChildRoleID = roleID
};
parentObjectInstance.children.Add(newChildObjectInstance);
myRepository.Save();
ChildObject retreivedChildObject = myRepository.GetChildObject(newChildObjectInstance.ID);
string assignedRoleName = retreivedChildObject.ChildRole.Name; //Throws exception, ChildRole is null
return retreivedChildObject;
}
I have tried setting MergeOptions to Overwrite, calling ObjectContext.Refresh() and ObjectContext.DetectChanges() to no avail... I suspect this is related to the proxy objects that EF injects when working with POCOs.
Has anyone run into this issue before? If so, what was the solution?
Hi
I am able to authenticate the user using ADFS and succeded in getting the user alias using the below statement. Since some time, i am looking for a way in getting the other claims of the authenticated user, like email, name, roles, username etc.
Any help on this would be appreciated.
string alias = ((MicrosoftAdfsProxyRP.MicrosoftPrincipal)HttpContext.Current.User).Alias;
Response.Write (alias);
Hi guys,
I'm trying to instanciate a constant NSString by concatanating other NSString instances.
Here is what I'm doing in my implementation file :
static NSString *const MY_CONST = @"TEST";
static NSString *const MY_CONCATENATE_CONST = [NSString stringWithFormat:@"STRING %@", MY_CONST];
It leads to the following compilation error : Initializer element is not constant
I suppose this is because stringWithFormat doesn't return a constant NSString, but since there is no other way to concatenate strings in Obj-C, what am I supposed to do ?
Thanks for your help,
Eric.
I am modifying the source code here: http://thinkandroid.wordpress.com/2009/12/30/getting-response-body-of-httpresponse/
I get this error: non-static method getContentCharSet(org.apache.http.HttpEntity) cannot be referenced from a static context
String charset = getContentCharSet(entity);
This error is line 13 on the second box.
Any ideas? I have been really struggling with this code :-(
I cannot get getResourceAsStream to find a file. I have put the file in the top level dir, target dir, etc, etc and have tried it with a "/" in front as well. Everytime it returns null.
Any suggestions ? Thanks.
public class T {
public static final void main(String[] args) {
InputStream propertiesIS = T.class.getClassLoader().getResourceAsStream("test.txt");
System.out.println("Break");
}
}
I'm wondering is there a difference in terms of computing cost for the Model.get(keys) and Model.get_by_id(ids, parent=None) methods?
Is there a server side computing advantage of using numeric id's over encoded string keys, or other way around? How big is the difference?
PS. Sorry, if it's a dupe. I'm sure I read an article about it, but I cannot find it now.
Hello,
I need to find all image files from directory (gif, png, jpg, jpeg).
find /path/to/ -name "*.jpg" > log
How to modify this string to find not only .jpg files?
Thank you.
After reading the dottrace documentation I realized that:
Dead objects are objects deleted before the end point of the snapshot.
Garbage objects are objects allocated after the starting point and deleted before the end point - in other words, "Garbage objects" is a subset of "Dead objects".
But after doing some profiling sessions, I could see that sometimes the number of "Garbage objects" is by far greater than the number of "Dead objects" of the same class (for example System.String). How should I interpret this phenomenon?
I am wondering whether it is possible to use relative XPath expressions in libxml2.
This is from the javax.xml.xpath API and I would like to do the similar thing using libxml2:
Node widgetNode = (Node) xpath.evaluate(expression, document, XPathConstants.NODE);
With a reference to the
element, a relative XPath expression
can now written to select the
child element:
XPath xpath = XPathFactory.newInstance().newXPath();
String expression = "manufacturer";
Node manufacturerNode = (Node) xpath.evaluate(expression, **widgetNode**, XPathConstants.NODE);
In Qt Website, it is mentioned that we can bind XQuery variables to program variables, but I didn't understand how it decides variable type (QVariant::String,QVariant::Int). As long as I see it doesn't use any XML Schema.
Do you any idea about how it decides variable type?
final Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setType("image/jpeg");
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "[email protected]" });
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "this is the test");
emailIntent.putExtra(Intent.EXTRA_TEXT, "testing time");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(url));
I'm trying to execute a SELECT statement that includes a column of a static string value. I've done this in Access, but never with raw SQL. Is this possible?
Example:
Name Status
John Unpaid
Terry Unpaid
Joe Unpaid
In the above example, the "Status" column doesn't exist in the database.
I would like to override bool's TryParse method to accept "yes" and "no." I know the method I want to use (below) but I don't know how to override bool's method.
... bool TryParse(string value, out bool result)
{
if (value == "yes")
{
result = true;
return true;
}
else if (value == "no")
{
result = false;
return true;
}
else
{
return bool.TryParse(value, result);
}
}
Given one or more instances of a model (AR or DM, whatever). Is it possible to generate the route in the requirement form, by which I mean "/foos/:id"
Given the route:
resource :foo do
resource :bar
end
generate_route_method [@foo,@bar] - "/foos/:id/bars/:id"
I'm not talking about #foos_path or #polymorphic_path, rather, literally generating the string containing the wildcard components (i.e ":id"), the same as it would appear as if you did "rake routes".
Hi,
In entity framework is there a way to have a default value for a column such that Linq to Entity won't require this parameter when constructing a new object?
For example I've marked on column in the EF designer with a default value (I typed in "All" as it was a string). But if I try to construct a new record and not specify this parameter I still get a FOREIGN KEY constraint exception.
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_FunctionalityTypeInterfaceRelationship"