Search Results

Search found 4591 results on 184 pages for 'tostring'.

Page 111/184 | < Previous Page | 107 108 109 110 111 112 113 114 115 116 117 118  | Next Page >

  • Problem In Event Receivers in sharePoint?

    - by JanardhanReddy
    Hi all, iam creating folders in document library from third party app.once the folder is created iam changing the metadata fileds in the documetn libary by using event receivers. so i wrote code in itemadded event to set the metadata vlaues of created folder public override void ItemAdded(SPItemEventProperties properties) { DataSet strDs = new DataSet(); try { DisableEventFiring(); SPListItem item = properties.ListItem; strName = item["Name"].ToString(); EnableEventFiring(); } } but iam getting null value in properties.ListItem. so please tell me how we can get the current item values in properties.ListItem. thanks in advance.

    Read the article

  • Create a string with n characters.

    - by C. Ross
    Is there a way in java to create a string with a specified number of a specified character? In my case I would need to create a string with 10 spaces. My current code is: StringBuffer outputBuffer = new StringBuffer(length); for (int i = 0; i < length; i++){ outputBuffer.append(" "); } return outputBuffer.toString(); Is there a better way to accomplish the same thing. In particular I'd like something that is fast (in terms of execution).

    Read the article

  • web service client in java

    - by user622222
    I want to generate a client program using the service I am unable to display the results, how can I do so? import java.rmi.RemoteException; public class searchtry { public static void main(String[] args) throws RemoteException { SearchRequest request=new SearchRequest(); SearchRequestType1 type1=new SearchRequestType1(); query.setAppId("*********************************"); //Windows Live gave this id for using that service query.setSources(new SourceType[]{SourceType.Web}); query.setQuery("Java"); aratip.setParameters(request); SearchResponseType0 answer= client.search(type1); System.out.println(answer.toString()); }

    Read the article

  • MVC 2 ViewContenxt. Writer doesn't exist in MVC 1?

    - by DaveDev
    I had the following code in an ASP.NET MVC 2 application. internal TextWriter _writer; // some stuff _writer = _viewContext.Writer; _writer.Write(_tag.ToString(TagRenderMode.EndTag)); I tried to move it to MVC 1 & now it doesn't build any more. I'm getting this error: 'System.Web.Mvc.ViewContext' does not contain a definition for 'Writer' Can someone point out how I can resolve this? Thanks.

    Read the article

  • GridView CheckBox Disable

    - by zxc
    I have a gridview populated by checkbox using the code below Data Source Result: Branch,101,102,103,104,105,106,107,108,109,110 00001,null,null,null,null,null,null,null,null,null,null 00016,1,1,1,1,1,0,0,0,0,0 00244,1,1,1,1,1,1,1,1,1,1 <asp:TemplateField HeaderText="101"> <ItemTemplate> <asp:CheckBox runat="server" id="cb101" Checked='<%# Eval("101").ToString().Equals("1") %>' /> </ItemTemplate> </asp:TemplateField>... and so on It is properly working for checkbox if if the column is 0 and 1. Now what I need to do is if the column is null the checkbox should be disabled/readonly

    Read the article

  • Insert values into dataset

    - by sudha.s
    Am using vb.net.Having dataset contain column name as phone .it contain set of phone number. i want to add 0 to each phone number and store it in another dataset. my code -------- cmd = New OracleCommand("select substr(PHONE,-10)as PHONE from reports.renewal_contact_t where run_date=to_date('" + TextBox1.Text + "','mm/dd/yyyy') and EXP_DATE =to_date('" + TextBox2.Text + "','mm/dd/yyyy') and region not in('TNP')", cn) ada = New OracleDataAdapter(cmd) ada.Fill(ds, "reports.renewal_contact_t ") Dim ds1 As New DataSet ds1 = ds.Clone() For Each q In ds.Tables(0).Rows phone = z + q("PHONE").ToString For Each q1 In ds1.Tables(0).Rows q1("PHONE") = phone Next Next my problem is am not getting values in ds1.Please help me to correct it.

    Read the article

  • How to detect if a form input element of type file is empty

    - by Ankur
    I have some code which reads a file through a form field of type file <input type="file" ... /> I want to give the user another option of providing a url to a file rather than having to upload it as many are already online. How can I detect when this field is empty on the server side. I am using Apache Commons FileUpload FileItemStream item = iter.next(); name = item.getFieldName(); stream = item.openStream(); if(!item.isFormField()){ if(item.toString()!=""){ .... I need to detect when item is empty. The above code doesn't work, nor does using: if(item.equals(null)){ ....

    Read the article

  • Spring MVC 3.1 How to access HttpSession in Custom Authentication Provider (which implements AuthenticationProvider)

    - by user1506231
    My application calls a web service during the Authentication process (as shown in code below). How can I save some information in HttpSession during this process? This information like customer-account-number will be used in various other places in the application after the user is logged in. Is it possible to pass HttpSession parameter to the MyServiceManager's static login method? public class MyAuthenticationManager implements AuthenticationProvider { @Override public boolean supports(Class<? extends Object> authentication) { return authentication.equals(UsernamePasswordAuthenticationToken.class); } @Override public Authentication authenticate(Authentication authentication) { //MyServiceManager.login - makes a call to web service if(MyServiceManager.login(authentication.getName(), authentication.getCredentials().toString(), XXX_HTTP_SESSION_XXX)) { List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority> (); authorities.add(new GrantedAuthorityImpl("ROLE_USER")); authorities.add(new GrantedAuthorityImpl("ROLE_SUPERVISOR")); return new UsernamePasswordAuthenticationToken(authentication.getName(), authentication.getCredentials(),authorities); } else { return null; } } }

    Read the article

  • How can find out the system default currency symbol on BlackBerry?

    - by ageektrapped
    I have a need to display a currency value in my application. There doesn't seem to be an easy way to do this with the RIM API, so I'm reduced to creating my own solution (a common refrain for BlackBerry development, unfortunately) Currently I'm using the Formatter class, from javax.microedition.locale like so protected String formatResult(double result) { try { Locale l = Locale.getDefaultForSystem(); Formatter formatter = new Formatter(l.toString()); return formatter.formatCurrency(result); } catch (UnsupportedLocaleException e) { return "This fails for the default locale because BlackBerry sucks"; } } I always hit the catch block in the simulator. Since this doesn't work by default on the simulator, I'm hesitant to put it in the application. So I have two questions: Can anyone tell me if the above solution is the way to go? And how to fix it, of course. Is there a way I can retrieve the currency symbol for the current locale programmatically so I can format myself?

    Read the article

  • Java: How to make this Serializable?

    - by Hasslarn
    I dont know that much about Serializable, but i need this class to be. How to achieve it? package helpers; public class XY implements Comparable<XY> { public int x; public int y; public XY (int x, int y) { this.x = x; this.y = y; } public int compareTo( XY other ) { String compare1 = this.x + "-" + this.y; String compare2 = other.x + "-" + other.y; return compare1.compareTo( compare2 ); } public String toString() { return this.x + "-" + this.y; } } As of now i cant send it as an object with outputstream..I´ve tried just to implement Serializable but it doesnt do the trick!

    Read the article

  • ASP.NET MVC4: How to convert an IEnumerable to a string for ViewBag

    - by sehummel
    This is what I'm trying to do, but it doesn't work: HardwareType hwt = new HardwareType { HType = "PC" }; IEnumerable<Hardware> Pcs = db.Hardware.Where(h => h.HardwareType.Contains(hwt)); ViewBag.Pcs = Pcs.ToString(); So how do I convert my IEnumerable to a string (or other primitive data type) so the compiler won't give me an error when I try to use it in my Razor? @foreach (var item in ViewBag.Pcs) { <li><a href="#" class="btn"><i class="icon-hdd"></i> @item.HType</a></li> }

    Read the article

  • how to convert the html tags and get a message in string

    - by Ranjana
    how to convert the html tags to the msg bodg in mail function. i.e i have   Company Name: BPL   Industry Type:   i have got the string as datatable dt=new datatable(); string msg= dt.rows[i]["Message"].tostring(); i need to convert this html tags to the exact message; if (boolcheck) { msg.Body = ????????? wat to use over here.... how to remove the html tags and get the exact message } pls help??????????/

    Read the article

  • afterTransactionCompletion not working

    - by Attilah
    I created an hibernate interceptor : public class MyInterceptor extends EmptyInterceptor { private boolean isCanal=false; public boolean onSave(Object entity, Serializable arg1, Object[] arg2, String[] arg3, Type[] arg4) throws CallbackException { for(int i=0;i<100;i++){ System.out.println("Inside MyInterceptor(onSave) : "+entity.toString()); } if(entity instanceof Canal){ isCanal=true; } return false; } public void afterTransactionCompletion(Transaction tx){ if(tx.wasCommitted()&&(isCanal)){ for(int i=0;i<100;i++){ System.out.println("Inside MyInterceptor(afterTransactionCompletion) : Canal was saved to DB."); } } } but the method afterTransactionCompletion doesn't get executed after a transaction is commited. I've tried all the ways I know of but I can't make it work. What's more surprising is that the onSave method works fine. Help ! Could this be due to this bug ? : http://opensource.atlassian.com/projects/hibernate/browse/HHH-1956 How can I circumvent this bug if it's the cause ?

    Read the article

  • Jquery returns internal server error

    - by Chocol8
    I am sure i am doing something bad here, but i cannot figure out what. <script type="text/javascript"> $(function () { $("li").bind("click", function () { var sel = $(this).attr('id').toString(); $.ajax({ type: "POST", contentType: "application/json", data: sel, url: "Default.aspx/SaveValue", dataType: "text", success: function (data) { alert(data.d); }, error: function (XMLHttpRequest, textStatus, errorThrown) { debugger; } }); }); }); </script> Any advises please? And here is the debug info gathered

    Read the article

  • How can I generate an RFC1123 Date string, from C code (Win32)

    - by Cheeso
    RFC1123 defines a number of things, among them, the format of Dates to be used in internet protocols. HTTP (RFC2616) specifies that date formats must be generated in conformance with RFC1123. It looks like this: Date: Wed, 28 Apr 2010 02:31:05 GMT How can I generate an RFC1123 time string from C code, running on Windows? I don't have the use of C# and DateTime.ToString(). I know I could write the code myself, to emit timezones and day abbreviations, but I'm hoping this already exists in the Windows API. Thanks.

    Read the article

  • Simple Thread Programming

    - by mike
    I have started to play with threads in c#, but need now help, here is my code: public partial class Form1 : Form { public Form1() { InitializeComponent(); DoCount(); } public void DoCount() { for (int i = 0; i < 100; i++) { objTextBox.Text = i.ToString(); Thread.Sleep(100); } } } its a simple win forms with a textbox, i want to see the "counting", but as you see in my code, the textbox shows me 99, it count till 99 and then shows up.. i`ll think, i have to manage this in a new thread but dont know how!

    Read the article

  • how to print number with commas as thousands separators in Javascript

    - by mikez302
    I am trying to print an integer in Javascript with commas as thousands separators. For example, I want to show the number 1234567 as "1,234,567". How would I go about doing this? Here is how I am doing it: function numberWithCommas(x) { x = x.toString(); var pattern = /(-?\d+)(\d{3})/; while (pattern.test(x)) x = x.replace(pattern, "$1,$2"); return x; } I am wondering if anyone has a simpler or more elegant idea. It would be nice if it works with floats also, but that is not necessary. It does not need to be locale-specific to decide between periods and commas.

    Read the article

  • Scala, represent pattern of boolean tuple into something else.

    - by Berlin Brown
    This is a cellular automata rule (input Boolean == Left, Center, Right Cell) and output Boolean . What is a better way to represent this in Scala. trait Rule { def ruleId() : Int def rule(inputState:(Boolean, Boolean, Boolean)) : Boolean override def toString : String = "Rule:" + ruleId } class Rule90 extends Rule { def ruleId() = 90 def rule(inputState:(Boolean, Boolean, Boolean)) : Boolean = { // Verbose version, show all 8 states inputState match { case (true, true, true) => false case (true, false, true) => false case (false, true, false) => false case (false, false, false) => false case _ => true } } }

    Read the article

  • DataGridView avoiding adding new columns

    - by phenevo
    Why, this code create 2 the same columns in grid (Color and Color). How to inputs data color from collection in column which existing before set datasource ?? public Form1() { InitializeComponent(); DataGridViewTextBoxColumn ds = new DataGridViewTextBoxColumn(); ds.Name = "Color"; dataGridView1.Columns.Add(ds); List<Car> cars=new List<Car>(); for (int i = 0; i < 5; i++) { Car car=new Car {Type = "type" + i.ToString(),Color=Color.Silver}; cars.Add(car); } dataGridView1.DataSource = cars; }

    Read the article

  • Debug.writeline locks

    - by Carra
    My program frequently stops with a deadlock. When I do a break-all and look at the threads I see that three threads are stuck in our logging function: public class Logging { public static void WriteClientLog(LogLevel logLevel, string message) { #if DEBUG System.Diagnostics.Debug.WriteLine(String.Format("{0} {1}", DateTime.Now.ToString("HH:mm:ss"), message)); //LOCK #endif //...Log4net logging } } If I let the program continue the threads are still stuck on that line. I can't see where this can lock. The debug class, string class & datetime class seem to be thread safe. The error goes away when I remove the "#if DEBUG System... #endif" code but I'm curious why this behavior happens. Thread one: public void CleanCache() { Logging.WriteClientLog(LogLevel.Debug, "Start clean cache.");//Stuck } Thread two: private void AliveThread() { Logging.WriteClientLog(LogLevel.Debug, "Check connection");//Stuck }

    Read the article

  • How to add on to an existing onclick event?

    - by Corey Sarnia
    I'm currently writing a Greasemonkey script for a page, so I can't modify the script myself. There is a form submit button on the page. When you click this button, it executes some fancy AJAX calls and such to update the page and do serverside things. What I'm trying to is basically set a "lastClick" value when the button is clicked. I want to add the code GM_setValue("lastClicked", (new Date()).getTime().toString()) to store the last time the button was clicked (for future uses of the script, it will actually do something with this date). How exactly can I accomplish this?

    Read the article

  • SQL Stored Procedure fired from C# Code-Behind not working on UPDATE

    - by CSSHell
    I have a stored procedure called from a C# code-behind. The code fires but the update command does not get performed. The stored procedure, if run directly, works. I think I am having a brain fart. Please help. :) CODEBEHIND protected void btnAbout_Click(object sender, EventArgs e) { SqlConnection myConnection = new SqlConnection(strConnection); SqlCommand myCommand = new SqlCommand("spUpdateCMSAbout", myConnection); myConnection.Open(); myCommand.CommandType = CommandType.StoredProcedure; myCommand.Parameters.Add("@AboutText", SqlDbType.NVarChar, -1).Value = txtAbout.Text.ToString(); myCommand.ExecuteNonQuery(); myConnection.Close(); } STORED PROCEDURE ALTER PROCEDURE fstage.spUpdateCMSAbout ( @AboutText nvarchar(max) ) AS BEGIN SET NOCOUNT ON; UPDATE fstage.staticCMS SET About = @AboutText; END HTML <asp:Button ID="btnAbout" runat="server" Text="Save" CausesValidation="False" onclick="btnAbout_Click" UseSubmitBehavior="False" /> C# .NET 4.0

    Read the article

  • What is/are the Scala way(s) to implement this Java "byte[] to Hex" class

    - by nicerobot
    I'm specifically interested in Scala (2.8) techniques for building strings with formats as well as interesting ways to make such a capability easily accessible where it's useful (lists of bytes, String, ...?).. public class Hex { public static String valueOf (final byte buf[]) { if (null == buf) { return null; } final StringBuilder sb = new StringBuilder(buf.length * 2); for (final byte b : buf) { sb.append(String.format("%02X", b & 0xff)); } return sb.toString(); } public static String valueOf (final Byteable o) { return valueOf(o.toByteArray()); } } This is only a learning exercise (so the utility and implementation of the Java isn't a concern.) Thanks

    Read the article

  • FileNotFoundException when using FileInputStream

    - by user1672817
    I am trying to access a file I have contained in the jar. The beginning of my code is as follows: import java.io.*; import java.net.*; public class intro { public static void main(String[] args) throws IOException{ URL jarUrl = intro.class.getResource("myFile.jar"); File myJar = new File(jarUrl.toString()); FileInputStream fis = new FileInputStream(myjar); } I'm getting the following error: Exception in thread "main" java.io.FileNotFoundException: file:\...myFile.jar (The filename, directory name, or volume label syntax is incorrect) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(Unknown Source) at intro.main(intro.java:10) It seems to have no problem finding the URL or initializing the file, but I can't get the FileInputStream to work. Does anybody know what I'm doing wrong? Help would be appreciated.

    Read the article

  • Create link to Sitecore Item

    - by Zooking
    I know I have done this before but I can't seem to remember where or how. I want to create a link to an Item in Sitecore. This code: Sitecore.Data.Items.Item itm = Sitecore.Context.Database.GetItem(someID); return itm.Paths.Path.ToString(); Produces the following string: http://localhost/sitecore/content/Home/Item1/Item11/thisItem I would like to have this string instead: http://localhost/Item1/Item11/thisItem.aspx What is the correct way to get the path to the item? In this case I can't use a normal Sitecore link: Sitecore.Web.UI.WebControls.Link

    Read the article

< Previous Page | 107 108 109 110 111 112 113 114 115 116 117 118  | Next Page >