how to import .xml file to database [closed] - import

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
hi i want to import my .xml file to sql server database in asp.net 3.5 c# for windows application.so give m rply as fast as posible.

this might help you http://support.microsoft.com/kb/316005
this code snippet might be helpful
DataSet reportData = new DataSet();
reportData.ReadXml(Server.MapPath(”report.xml”));
SqlConnection connection = new SqlConnection(”CONNECTION STRING”);
SqlBulkCopy sbc = new SqlBulkCopy(connection);
sbc.DestinationTableName = “report_table”;
//if your DB col names don’t match your XML element names 100%
//then relate the source XML elements (1st param) with the destination DB cols
sbc.ColumnMappings.Add(”campaign”, “campaign_id”);
sbc.ColumnMappings.Add(”cost”, “cost_USD”);
connection.Open();
refer http://www.akamarketing.com/blog/135-importing-xml-into-sql-server-table-aspnet.html

It's not brilliant, but you could read an XML file into a dataset and then use a data adapter to then populate the database...that would require very few lines of code, but not something you'd really want to hold onto...more of a once off dataload.

first u ve 2 manipulate d xml file using an xml parser, so that the elements in the xml document converts into objects that can be accessed by other applications

If this is something you are doing that is considered to be preprocessing, I would consider using SSIS: Import XML to SQL Server

Related

VSCode dynamic JSON schema validation [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have built project for a web application configuration. It includes generated (from TypeScript) JSONSchemas. To simplify - user can configure things like forms - field order (string[]), hidden fields(string[]) etc. JSON Schmeas are very helpful for users, who aren't too familiar with the configuration, and it validates some errors, that could rise from mistakes in the configuration.
But they cannot help in every situation - in those string arrays - user can put any string, and the schema will be valid.
What I would want to make - is some dynamic validation - when the user opens [ for the field order - he has to choose from the list of fields, that would be fetched from the APIs.
Something, like when you type packageName: "" in the package.json dependencies - it gets a version for the given package.
I would think, that I would have to make some VSCode extension for this - but I don't know - where to start. Can someone point me in the direction - an example, where someone uses real time JSON schema validation would be grateful.
Found an answer by digging through vscode source code. Searched all files, that contains package.json and dependencies (regex search (package.json[\s\S\n]*dependencies)|(dependencies[\s\S\n]*package.json)) and found a class PackageJSONContribution and this was exactly what I was looking for.
Then I made a simple extension using yo code (as from the example of Your first extension).
Some interfaces and classes I was unable to import from vscode, I just made a local copies for my extension. Made my own class FooJSONContribution with the only difference -
it's getDocumentSelector() function changed to
public getDocumentSelector(): vscode.DocumentSelector {
return [{ language: 'json', scheme: '*', pattern: '**/foo.json' }];
}
Adjusted extensions package.json activationEvents and added "onLanguage:json" (this could be optimised).
Adjusted activate event of the extension by adding
const contribution = new FooJSONContribution(xhr, true);
const disposableCompletionItemProvider = vscode.languages.registerCompletionItemProvider(
contribution.getDocumentSelector(),
new JSONCompletionItemProvider(contribution),
'"',
':'
);
context.subscriptions.push(disposableCompletionItemProvider);
And that's it. All of the foo.json files now work like package.json files -
Things I need to do now - adjust the code of FooJSONContribution.ts to work for my own needs, for my own API's, for my own files.
I Uploaded this example here https://github.com/leqwasd/VsCodeAsyncJsonAutocomplete

phow_caltech101 to change categories in matlab (vlfeat) [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I'm studying the Caltech101 computer vision dataset using Matlab..
I wanted to classify and train the images of caltech-101 using phow_caltech.m file
but there was a problem, I don't know how to change the categories...
these are what I did.
setup lv_setup
test version : vl_version verbose OK
vl_demo OK
make m_file phow_caltech101.m (copy)
I downloaded caltech101 images at [here][2] by myself and copied to data/caltech-101
>>phow_caltech101 (in command widnow)
I saw fixed example categories (BACKGROUND_Goole, Faces, Faces_easy, Leopards, Motobikes)
I've tried to change the example categories(BACKGROUND_Goole, Faces, Faces_easy, Leopards, Motobikes)
I want to use categories ( accordion, airplanes, anchor, ant in caltech-101)
I changed some codes of phow_caltech101.m but it didn't work...
plz give me some advice ... help me
I look forward to replying your mail or answer thank you~!
this is phow_caltech101 code
C:\VLFEAT\data\caltech-101 ( there are many image folders )
conf.calDir = 'data/caltech-101' ; ( I changed like this in phow_caltech101.m file)
From the help header to phow_caltech101:
The program can also be used to train a model on custom data by pointing CONF.CALDIR to it. Just create a subdirectory for each class and put the training images there. Make sure to adjust
CONF.NUMTRAIN accordingly.
Create a folder (say 'data/myclasses') containing the new classes (image collections) and have conf.caldir point to it, in phow_caltech101.m. That should be the first thing you change. There should be no need to change conf.prefiX if you are still putting the classes under data/.... but you need to adjust conf.numtrain to be the number of training sets you want to use.
caveat: my answer is based entirely on the documentation, I have not run the software.
Edit
Rather than attempt to run the script directly, start by trying to run the following lines at the matlab prompt, to check that you set up your folders correctly:
% the following line should contain the path to your data...
conf.calDir = 'data/caltech-101'; % <-- change this line if necessary
% make sure matlab finds the folder with your data
exist(conf.calDir, 'dir') % should return a "1"
% check the contents of the calibration data folder
classes = dir(conf.calDir)
If the folder does not exist or the contents being listed as classes are incorrect you need to adjust conf.calDir or the location of your data.

Setting a file name from a form in CodeIngiter

I'm a novice in programming and hence this question might look too dumb. My task is to set a variable called "filename" from a form that has three fileds that need to be submitted by the user. For example the file name should be: Filename=(Field1Data)+(Field2Data)+(Field3Data). I was trying to use something like: 'file_name' => set_value('enter_product_name')_set_value('test_type')_set_value('test_unit')
Any help with this will be greatly appreciated. Thanks in advance.

SendGrid - Efficient Real Estate Email Composition [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm trying to do the following using the latest SendGrid php information found here.
For a real estate portal, let's say a few people (5) are interested in an open house in Florida, represented by a real estate agent. An array includes their emails like this $prospect_email_array[], names like this $prospect_name[], realtor like this $realtor, and location like this $location. What would be the appropriate way to send an email out to them, in one go, as blind copies (so no prospect sees other prospects email addresses), efficiently. I am looking for comprehensive code to accomplish this. So far, on the php side, I have this pseudo code:
To: $prospect_email_array[]
From: mail#realestatesite.com
Title: $realtor's Open House in $location Welcome
Body:
Dear $prospect_name[],
I hope to see you in our upcoming open house in $location.
Looking forward to seeing you there!
Best Wishes,
$realtor
In addition, having a plain text version and html version is what I'm after. Will the equivilant of 2 'br' tags be preserved in plain text? Are 2 'br' tags needed in the html version for spacing as above? There may be emails for open houses, house interest, and potential buyers. Would these be the categories to use in SendGrid? Also, is utf-8 supprorted by default, or do we need to pass something to SendGrid?
Here's some "pseudo code" that should accomplish most of what you're trying to do. I haven't tested this at all and it's quite possible that there are typos and irregularities in it. It should get you moving in the right direction though.
<?php
include 'path/to/sendgrid-php/SendGrid_loader.php';
$sendgrid = new SendGrid('username', 'password');
$mail = new SendGrid\Mail();
$mail->setFrom('mail#realestatesite.com')->
setSubject($realtor . "'s Open House in " . $location)->
setText('[Fill this in yourself as an exercise]')->
setHtml('Dear %name%,<br />I hope to see you in our upcoming open house in ' . $location . '. <br /> Looking forward to seeing you there! <br /> Best Wishes, <br />' . $realtor);
$mail->setRecipientsInHeader(true);
foreach ($prospect_email_array as $prospect) {
$mail->addTo($prospect);
}
$mail->addSubstitution("%name%", $prospect_name);
$sendgrid->smtp->send($mail);

ZooKeeper returning junk characters for HBase server address [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
how's it goin?
Sorry if I sound stupid here.
I'm trying to create a basic play2.0 - HBase app. When I try to connect HBase from play, ZooKeeper is returning me junk characters for HBase server address.
def main(args : Array[String]) : Unit = {
val conf = HBaseConfiguration create
val admin = new HBaseAdmin(conf)
// list the tables
val listtables = admin.listTables()
listtables.foreach(println)
}
I've nailed down to the weak spot and it's at org.apache.hadoop.hbase.zookeeper.ZooKeeperNodeTracker. It's loading data with junk values for local address and port, which is then passed down to HServerAddress class for further action.
I've looked at my hbase-site.xml (contains just localhost) and hbase-default.xml, which are looking just fine as directed by Apache.
<configuration>
<property>
<name>hbase.rootdir</name>
<value>file:///Users/gchandra/Applications/hbase-0.92.1/data-store/hbase</value>
</property>
</configuration>
Pasted below is stack trace.
Exception in thread "main" java.lang.IllegalArgumentException: Not a host:port pair: ?���5610#L-C02FF6MTDF91��192.168.1.4,64256,1332739256936
at org.apache.hadoop.hbase.HServerAddress.<init>(HServerAddress.java:60)
at org.apache.hadoop.hbase.MasterAddressTracker.getMasterAddress(MasterAddressTracker.java:63)
at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getMaster(HConnectionManager.java:354)
at org.apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.java:94)
at services.HBaseConnection$.main(HBaseConnection.scala:20)
at services.HBaseConnection.main(HBaseConnection.scala)
Appreciate it if someone could help me out here! Thanks!
Just searched for your exception message and found this: Re: IllegalArgumentException: Not a host:port
Do you have a version mismatch between your client library and your server?
It worked in another box, Not sure why it was acting weird in my local! Thanks all!