How to read and write data from json file from windows phone7 app
Hi
I am developing wp7 app for the use of students my questions are
How can i write a code to read and write the json/text file for the wp7.
I am using windows 7 OS, VS 2010 Edition.
This is my code below:
xaml:
<Grid>
<TextBlock Height="45" HorizontalAlignment="Left" Margin="7,18,0,550" Name="textBlock1" Text="Full
Name: " />
<TextBox Width="350" Height="70" HorizontalAlignment="Left" Margin="108,1,0,0" Name="txtName"
Text="Enter your full name" VerticalAlignment="Top" />
<TextBlock Height="45" HorizontalAlignment="Left" Margin="6,75,0,0" Name="textBlock2" Text="Contact
No: " VerticalAlignment="Top" />
<TextBox Width="350" Height="70" HorizontalAlignment="Left" Margin="108,61,0,480" Name="txtContact"
Text="Enter your contact number" MaxLength="10" />
<Button Content="Register" Height="72" HorizontalAlignment="Left" Margin="10,330,0,0" Name="btnRegister"
VerticalAlignment="Top" Width="190" Click="btnRegister_Click" />
</Grid>
xaml.cs:
private void btnRegister_Click(object sender, RoutedEventArgs e)
string name, contact;
name = txtName.Text;
contact = txtContact.Text;
try
if (name != "" && contact != "")
string msg = name + " " + contact;
MessageBox.Show(msg);
Student stud = new Student
Name= name,
Contact = contact,
string jsonString = JsonConvert.SerializeObject(stud);
MessageBox.Show(jsonString);
else
MessageBox.Show("Input Proper Information", MessageBoxButton.OK);
catch (Exception ex)
MessageBox.Show(ex.Message);
I have download NewtonSoft.json version 5.0.8.
So, I am able to convert input data into json format, but how can I able to write and read this data from a json/text file.
How can I do?
Thank you in adv and please, reply soon.
We don't have many samples left for Windows Phone 7 + Azure, the closest one to what you want to do is probably:
Using Local Storage with OData on Windows Phone To Reduce Network Bandwidth
this sample uses the local database feature: 'LINQ to SQL', available to Windows Phone 7.1 and 8.0 Silverlight applications, instead of simple file storage but even if you choose to stick with simple file storage I believe you should be able to adapt the
networking related portions of the sample to your particular application.
Eric Fleck, Windows Store and Windows Phone Developer Support. If you would like to provide feedback or suggestions for future improvements to the Windows Phone SDK please go to http://wpdev.uservoice.com/ where you can post your suggestions and/or cast
your votes for existing suggestions.
Similar Messages
-
How to read and write data in to a specified range of cells(it include multiple row & columns) in excel
CVI Comes with a sample project that explains how to read/write to a Excel file: choose "Explore examples..." in CVI welcome page and navigate to <cviSampleDir>\activex\excel folder where you can load excel2000dem.prj.
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos? -
How to read and write data from Excel to TestStand without using LabVIEW VIs
Hi,
How can I read in columns of data from Excel into a TestStand array and write columns of data to Excel from TestStand without using LabVIEW VIs?
I don't think the Property Loader custom step type in TestStand will work because the data I would like to read in from Excel is in a column that is thousands of rows long and the data has to be in the proper format to use the Property Loader to load in an array from Excel.
Thanks for your help.That example does not use LabVIEW and it does about 40% of what you need to do by calling Excel through ActiveX. If you don't know how to use Excel through ActiveX then you'll need to brush up on that.
http://www.microsoft.com/en-us/download/details.aspx?id=16250
http://support.microsoft.com/kb/141759
http://support.microsoft.com/kb/302084
CTA, CLA, MTFBWY -
How to read and write data to a user defined table?
I have created a srf with 2 edit box and a ok buttin, I want to insert data to the user defined table i created using sql query while i press OK button..
Please provide the complete code to insert and select da from the user defined table.Hi,
You can use the code below.
Dim ret As Long
d
Private Sub Add_Table_Click()
Dim oUserTablesMD As SAPbobsCOM.UserTablesMD
Set oUserTablesMD = oCompany.GetBusinessObject(oUserTables)
' When adding user tables or fields, use a prefix
' identifying your partner name space. This will
' prevent collisions from different partner add-ons
' SAP's name space prefix is "BE_"
'Set the two mandatory fields
oUserTablesMD.TableName = "T1"
oUserTablesMD.TableDescription = "Table1"
'Add the table (which contains 2 default, mandatory fields, 'Code' and 'Name')
ret = oUserTablesMD.Add
If ret <> 0 Then
oCompany.GetLastError ret, Str
MsgBox Str
Else
MsgBox "Table: " & oUserTablesMD.TableName & " was added successfully"
End If
End Sub
Private Sub Add_UDF_Click()
Dim oUserFieldsMD As SAPbobsCOM.UserFieldsMD
Set oUserFieldsMD = oCompany.GetBusinessObject(oUserFields)
oUserFieldsMD.TableName = "T1"
oUserFieldsMD.Name = "AlbUDF"
oUserFieldsMD.Description = "Albert UDF"
'Add the field to the table
lRetCode = oUserFieldsMD.Add
If lRetCode <> 0 Then
oCompany.GetLastError ret, Str
MsgBox Str
Else
MsgBox "Field: '" & oUserFieldsMD.Name & "' was added successfuly to " & oUserFieldsMD.TableName & " Table"
End If
End Sub
Private Sub Add_Data_Click()
Dim oUserTable As SAPbobsCOM.UserTable
Set oUserTable = oCompany.UserTables.Item(1)
oUserTable.GetByKey ("T1")
'Set default, mandatory fields
oUserTable.Code = "A"
oUserTable.Name = "Albert"
'Set user field
oUserTable.UserFields.Fields.Item("U_AlbUDF").Value = "1"
oUserTable.Add
If ret <> 0 Then
oCompany.GetLastError ret, Str
MsgBox Str
Else
MsgBox "Value to field: '" & oUserTable.UserFields.Fields.Item("U_AlbUDF").Name & "' was updated successfuly to " & oUserTable.TableName & " Table"
End If
End Sub
Regards,
Noor -
How to read and write in a binary file?
Hi all,
how can i search in a binary file for string and replace this string with another
bin file ...test.bin
search String "DE AD FA 01"
regards
gebiYou need to install Google on your computer. That way, you can search for all the information on that algorithm available on the Internet.
-
Reading and writing to a text file from an Applet
I'm a novice java programming with very little formal programming training. I've pieced together enough knowledge to do what I've wanted to do so far...
However, I've been unable to figure out how to read and write to a text file from an Applet (I can do it from a normal java program just fine). Here is a simple example of what I'd like to do (you can also look at it on my website: www.stat.colostate.edu/~leach/test02/test02.html). I know that there is some problem with permission/security but I'm not smart enough to understand what the error messages are telling or understand the few books I have. If anyone can tell me how to get this applet to work, or direct me to some referrences that would help me out I'd really appreciate it.
Thanks,
Andy
import java.applet.Applet;
import java.net.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.io.*;
public class test02 extends Applet {
public Button B_go;
public GridBagConstraints c;
public void init() {
this.setLayout(new GridBagLayout());
c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
B_go = new Button("GO");
c.gridx=1; c.gridy=0; c.gridwidth=1; c.gridheight=1;
c.weightx = c.weighty = 0.0;
B_go.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
print_stuff();
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
this.add(B_go,c);
public static void print_stuff() {
try{
File f = new File("test02.txt");
PrintWriter out = new PrintWriter(new FileWriter(f));
out.print("This is test02.txt");
out.close();
}catch(IOException e){**/}
}I have almost the exact same problem, and I am in the same situation as you are with respects to the language.
I am simply trying to create a file and output some garbage to it but my applet always spits back a security violation. I've tried eliminating the restrictions on the applet runner I use but I still get the error.
My method:
debug = new Label() ;
debug.setLocation( 20, 20 ) ;
debug.setSize( 500, 15 ) ;
add( debug ) ;
// output
try
OutputStream file = new FileOutputStream( new File( "" + getCodeBase() + "output.txt" ) ) ;
byte[] buffer = { 1, 2, 3, 4, 5 } ;
file.write( buffer ) ;
file.close() ;
} catch( Exception e )
debug.setText( e.toString() ) ;
Can anyone tell why this isnt working? -
How to read and write a data from extrenal file
Hi..
How to read and write a data from extrenal file using Pl/sql?
Is it possible from Dyanamic Sql or any other way?
Reagards
Rajuutl_file
Re: How to Create text(dat) file.
Message was edited by:
jeneesh -
Read and write data from content repository .
Hi All,
We are using content repository to store some document and images on web center server .
So we have created/setup a content repository on web center .
Please proivde me some documnet /wiki page to get some idea how can i read and write date in
content repository .
You are most welocme to provide some idea /suggestion .
Thanks,
Arun.Have you already configured webcenter spaces so it can use content server?
Have you installed the content server seperatly from webcenter or as a part of the webcenter installation?
Check if you have the webcenter spaces component installed in content server because without i don't think it will work...
If you already have configured UCM to work with spaces it's quiet easy.
From your groupspace, open the settings page of your groupspace. Go to the services tab. In the left hand side you can enable the documents services. WHen you have done that, you are able to add the document services taskflows to your pages. Just go to a page in your pagegroup and edit it. Open the resource catalog and you will find some extra taskflows you can add.
If you haven't configured UCM and webcenter to work together, here some steps that will help you:
* Integrating UCM with Spaces
* They both need to use the same LDAP store.
* Since there is no LDAP server available, we choose for embedded WLS LDAP.
* Integrating the ucm into apache
* Stop UCM
* In /oracle/product/wls10320/WebCenter/ucm/config/config.cfg, check the SocketHostAddressSecurityFilter to contain 127.0.0.1
* Add the SocketHostAddressSecurityFilter to /oracle/product/wls10320/WebCenter/ucm/admin/bin/intradoc.cfg
* Add to /oracle/product/wls10320/WebTier/instances/instance1/config/OHS/ohs1/httpd.conf
include /oracle/product/wls10320/WebCenter/ucm/data/users/apache22/apache.conf
* Change the mod_wl_ohs.conf file to
<IfModule weblogic_module>
WebLogicHost localhost
WebLogicPort 7001
Debug ON
WLLogFile /tmp/weblogic.log
</IfModule>
<Location /webcenter>
SetHandler weblogic-handler
WebLogicCluster localhost:8888
</Location>
<Location /webcenterhelp>
SetHandler weblogic-handler
WebLogicCluster localhost:8888
</Location>
<Location /owc_discussions>
SetHandler weblogic-handler
WebLogicCluster localhost:8890
</Location>
<Location /em>
SetHandler weblogic-handler
</Location>
<Location /console>
SetHandler weblogic-handler
</Location>
<Location /consolehelp>
SetHandler weblogic-handler
</Location>
* Restart UCM & WebTier
* Test URL: http://yourServer:7777/idc
* Configure the Identity Store for UCM & WebCenter
* Set the password for the embedded ldap in WLS
Console => Domain Name => Security tab => Embedded LDAP tab => reset credentials
* Restart AdminServer
* Stop UCM
* Add the following to /oracle/product/wls10320/WebCenter/ucm/config/jps-config.xml
<serviceInstance name="idstore.oid" provider="idstore.ldap.provider">
<property name="subscriber.name" value="ou=myrealm,dc=webcenter_domain"/>
<property name="idstore.type" value="WLS_OVD"/>
<property name="security.principal.key" value="ldap.credential"/>
<property name="security.principal.alias" value="JPS"/>
<property name="ldap.url" value="ldap://yourServer:7001"/>
<extendedProperty>
<name>user.search.bases</name>
<values><value>ou=people,ou=myrealm,dc=webcenter_domain</value></values>
</extendedProperty>
<extendedProperty>
<name>group.search.bases</name>
<values><value>ou=groups,ou=myrealm,dc=webcenter_domain</value></values>
</extendedProperty>
<property name="username.attr" value="uid"/>
<property name="user.login.attr" value="uid"/>
<property name="groupname.attr" value="cn"/>
</serviceInstance>
* In the same file, change the serviceInstanceRef ref="idstore.ldap" to "idstore.oid"
* Go to /oracle/product/wls10320/WebCenter/ucm/custom/FustionLibraries/tools
* ./run_credtool.sh
Alias: default
Key: default
User Name: cn=Admin
Password: weblogic123
JPS Config: default
* Start UCM
* Check Provider:
* Go to http://yourServer:7777/idc
* Login : sysadmin/idc
* Administration -> Providers
* jpsuser should be good
* When a ldapuser exist, disable it!!
* Configuring UCM for content search
* Change the file /products/WebCenter11gR1/WebCenter/ucm/config/config.cfg
SearchIndexerEngineName=DATABASE.METADATA to SearchIndexerEngineName=DATABASE.FULLTEXT
* Restart UCM server
* Run the /products/WebCenter11gR1/WebCenter/ucm/database/oracle/admin/batchsnippet.sql in the wcbepsc_ocserver schema
* Restart UCM server
* Open the /products/WebCenter11gR1/WebCenter/ucm/bin/RepositoryManager (sysadmin/idc)
* Recreate the indexes
* Registering UCM with WebCenter
* Go to http://yourServer:7777/em
* Login with weblogic/weblogicPassword
* Go to WebCenter - WebCenter Spaces - webcenter (WLS_Spaces)
* From the top menu, select Settings - Service Configuration
* Select Content Repository
* Add
Connection Name: ucm_connection
Repository Type: Oracle Content Server
Active Connection: checked
Administrator User Name: sysadmin
Root Folder: /WebCenterSpaces
Application Name: Spaces
CIS Socket Type: Socket
Server Host: localhost
Server Port: 4444
Authentication Method: Identity Propagation
* Restart WLS_Spaces
* Test the connection by creating a new group space and upload a document to the document page of this group spaceHope this helps. -
How to Read and Write .XML datas (HELP Plz...)
hai everybody
how to read and write xml datas... plz give clean and simple example..
bcoz me want to produce such type of module...
if any one help me .. thats the only way me laid in software ladder
plz....
thank u in advancethank u for giving idiot..
but before posting i search in google also..
but i cant get what me expect..
thus i posted...
then who is ................?
sorry javacoder01
// plz help me
Message was edited by:
drvijayy2k2 -
How to read and write a string into a txt.file
Hi, I am now using BEA Workshop for Weblogic Platform version10. I am using J2EE is my programming language. The problem I encounter is as the above title; how to read and write a string into a txt.file with a specific root directory? Do you have any sample codes to reference?
I hope someone can answer my question as soon as possible
Thank you very much.Accessing the file system directly from a web app is a bad idea for several reasons. See http://weblogs.java.net/blog/simongbrown/archive/2003/10/file_access_in.html for a great discussion of the topic.
On Weblogic there seems to be two ways to access files. First, use a File T3 connector from the console. Second, use java.net.URL with the file: protocol. The T3File object has been deprecated and suggests:
Deprecated in WebLogic Server 6.1. Use java.net.URL.openConnection() instead.
Edited by: m0smith on Mar 12, 2008 5:18 PM -
How to read and write Unicode text with MS Access?
Hi all, I'm new to Java, so please forgive me if my question is too ... ^_^
I'm writing a small program that read and write data with MS Access. However, when I insert Unicode text into the database, it has wrong encoding like this "h?y l? n?m".
Please tell me how to fix this.
Thanks in advance!The following forum thread might be enlightening:
http://forum.java.sun.com/thread.jspa?threadID=573855&messageID=2870785
I myself do not use MS Access, but a PreparedStatement is in general the best option.
You can set parameters in the SQL which then get converted and even protected against SQL injection hacking. -
How to read and write on ntfs partitions??
Hello everyone, thanks for viewing my post. I want to know how to read and write on ntfs partitions under sata hd on my arch64 system. I'm using kde as my de and dolphin does sees it but can't access it anyway. I didn't had problem so far on mounting usb drives it just automounts maybe because it is a fat partition not a ntfs? Please I need your help...Thanks in advance:)
You will most likely need to rework your fstab. The one from my desktop is shown below. If you want regular users to be able to access the partition, then you will need to change the gid option as I have done. Although you could create a group just for people you want to have access.
You will need to know the device that your windows partition is held on of course. In my case it is my first hard disk, first partition, hence /dev/sda1.
# /etc/fstab: static file system information
# <file system> <dir> <type> <options> <dump> <pass>
none /dev/pts devpts defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/cdrom /media/cdrom auto ro,user,noauto,unhide 0 0
/dev/dvd /media/dvd auto ro,user,noauto,unhide 0 0
/dev/mapper/nvidia_fbgfhehd1 /boot ext2 defaults 0 1
/dev/mapper/nvidia_fbgfhehd2 / reiserfs defaults 0 1
/dev/mapper/nvidia_fbgfhehd3 /var reiserfs defaults 0 1
/dev/mapper/nvidia_fbgfhehd5 /opt reiserfs defaults 0 1
/dev/mapper/nvidia_fbgfhehd6 swap swap defaults 0 0
/dev/mapper/nvidia_fbgfhehd7 /home reiserfs defaults 0 1
/dev/sdd1 /mnt/andromeda vfat defaults 0 0
/dev/sda1 /mnt/windows ntfs-3g defaults,user,gid=users 0 0
My XP partition is set to mount automatically, as I regularly interchange documents between the OS's.
Hope that helps. -
JSP read and write data in MS-SQL database
I am new to JSP. I need to write JSP page to read and write data in MS-SQL Database. I wonder if it is different from other database. I couldn't find useful pointers in the web. Please advise. Thanks!!
Sure, SQL Server is different from Oracle is different from MySQL is different from...
But all of them can be accessed using JDBC:
http://java.sun.com/docs/books/tutorial/jdbc/
Maybe you should learn about that for starters.
You can use SQL tags from JSTL in your JSPs. I'd recommend JSTL highly. No scriptlet code that way. - MOD -
How to read and write on sockets?
Hi.
I want to read and write data from sockets, Can anybody help me.
Regards.
Bilal Ghazi.You need 3 classes. Receiver, RemoteThread and Sender. These classes are not tested by me
//these classes are on the clientside
public class Receiver{//listens to connections
ServerSocket serverSocket = new ServerSocket(port);
while (...){
Socket client=serverSocket.accept();//waits for new connection
RemoteThread thread=new RemoteThread(client);
thread.start();
serverSocket.close();
public class RemoteThread{
final static int BUSYWAITTIME=10;//10 ms
Socket socket;
public RemoteThread(Socket _socket) {
this.socket = _socket;
public void run() {
BufferedOutputStream out = new java.io.BufferedOutputStream(socket.getOutputStream(),socket.getSendBufferSize());
int inBuffSize=socket.getReceiveBufferSize();
BufferedInputStream in = new java.io.BufferedInputStream(socket.getInputStream(),inBuffSize);//wait until get enuff
byte[] buff=new byte[inBuffSize];
while (...) {
//read
while(in.available()<=0 && !stopped){//just wait for it to become ready
try{wait(BUSYWAITTIME);}catch(InterruptedException e){}
int readBytes=in.read(buff);
//do something with the bytes in buff
//This class is on the clientside
public class Sender{
Socket socket = new Socket(host, port);//connects to server
OutputStream out = socket.getOutputStream();
PrintWriter outPrinter=new PrintWriter(out,true);
InputStream in = socket.getInputStream();
//use out or outPrinter to write to server
Gil -
Help on how to read the content of an XML file from the payload
I have a receiver channel / mail adapter, that sends e-mails with a XML attachment.
Im trying to write a Bean, that should make it possible to rename the attached XML file dynamically.
In the Bean I want to read the content of the attached XML file, it could be the order number.
The filename should then be Order number.XML.
<u><i>Can anyone help me with how to read the content of the XML file from the payload.</i></u>
<i><b>Frank</b></i>hi,
check this: http://jakarta.apache.org/poi/
Maybe you are looking for
-
My mom sent me an iphone 4s from the usa how can i activated in israel
they told her it will work worlwide how can activate it in israel
-
Apache giving a Directory index forbidden by rule: /Users/me/Music/iTune
I am trying to configure Apache to display my iTunes folders so that I can download them to my Playstation 3. The Playstation 3 either gives me a network error, or a "Directory index forbidden by rule: /Users/me/Music/iTunes/" in Apache. The network
-
I tried to send a picture message but it wouldn't go through. I turned off iMessage and set it to go through SMS, but it still wouldn't go through. I then turned on cellular data and it worked. Why is data connection needed? (I'm new to iphone)
-
Why can't I stop receiving e-mail from Apple Support Communities?
Why can't I stop receiving e-mail from Apple Support Communities? I have every e-mail preference set to no, yet e-mail still comes every time someone posts to the one discussion I took part in a few years ago.
-
Problem to add a composition using "BAPI_BUS1077_CREATE"
Hi experts, Is there someone who can help me to fix up a problem when calling "BAPI_BUS1077_CREATE" in web dynpro. For who haven't any knowledge of web dynpro, it isn't a problem. It works exactely as in simple dynpro. I set flags for "FLG_HEADER" ,