In Silverlight 4, an extension property called StringFormat is added to display formatting display. There are some predefined formats available. In this article we will see some of them.
In C#, I can write something like:
using (new MyDisposableClass().MethodA());
The semicolon causes a compiler warning to be shown which states possible mistaken empty statement. I haven't run the above code but won't the method still be called?
What uses is there of this type of coding convention? I saw another thread on here about this but I ask in case there areny differences now/therefore different replies.
Thanks
I have the following JSON:
{
"meta": {
"limit": 20,
"next": null,
"offset": 0,
"previous": null,
"total_count": 0
},
"objects": []
}
I'm interested in objects: I want to know if objects is empty and show an alert:
something like this:
success: function (data) {
$.each(data.objects, function () {
if data.objects == None alert(0)
else :alert(1)
});
When I try to insert a link using the TinyMCE link plugin all that happens is I get an empty popup box.
It continuously tries to load:
tiny_mce/utils/mctabs.js
tiny_mce/utils/form_utils.js
tiny_mce/utils/validate.js
tiny_mce/themes/advanced/js/link.js
I've seen solutions where you need to edit a config.php file, but I only have the JS version of TinyMCE
I have a method in Java that concatenates 2 Strings. It currently works correctly, but I think it can be written better.
public static String concat(String str1, String str2) {
String rVal = null;
if (str1 != null || str2 != null) {
rVal = "";
if (str1 != null) {
rVal += str1;
}
if (str2 != null) {
rVal += str2;
}
}
return rVal;
}
Here are some of the requirements:
If both str1 and str2 are null, the method returns null
If either str1 or str2 is null, it will just return the not null String
If str1 and str2 are not null, it will concatenate them
It never adds "null" to the result
Can anyone do this with less code?
Say I have multiple EditTexts in an application. When I click a Button, I want to test what EditTexts are empty and what EditTexts have content. How would I do that? Could someone write the code for the Button click handler.
Hello
While trying to understand how a web server worked, I came accross this:
//myfile.js
function donothing(){};
//myfile.html
javascript:donothing(open('http://www.acme.com/whatever.jpg','','left=100, right=0, top=100, scrollbars=no, status=no, titlebar=no, resizable=no, toolbar=no, menubar=no, width=255, height=255'))
I'm no JavaScript expert, so I don't get how an empty function can be made to work. Does someone know?
Thank you.
Hello,
My layout contains a ListView (the parent is a LinearLayout). I have defined a certain drawable to be the ListView's background. The screen looks like this:
When I click/press the white empty space below the last row, I get this:
Any idea how this happens? Couldn't catch any click event in this activity...
Hi,
I have a page with many panels. each panel will have around 5 textboxes.
I need to disable all the textboxes which are empty when the page is loaded. Want to acieve this using JQuery. Can somebody help me on this?
Let's say I have a string in an RTL language such as Arabic with some English chucked in:
string s = "Test:?????;?????;?????;a;b"
Notice there are semicolons in the string. When I use the Split command like string[] spl = s.Split(';');, then some of the strings are saved in reverse order. This is what happens:
??Test:?????
?????
?????
a
b
The above is out of order compared to the original. Instead, I expect to get this:
?Test:
?????
?????
?????
a
b
I'm prepared to write my own split function. However, the chars in the string also parse in reverse order, so I'm back to square one. I just want to go through each character as it's shown on the screen.
Hi,
in my unit test, the ViewResult.ViewName property is always empty when i use the action name for the view:
return View(model);
or
return View();
Is that by design?
Hi there.
I have a ROXML object that looks like:
class Activity
include ROXML
xml_accessor :id
end
If I have an array of these objects and call .to_xml on the array, I receive an empty xml collection:
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<activities type=\"array\">\n</activities>\n"
Any idea why or how to fix this?
I'm running Rails 2.3.5 with the newest version of ROXML.
Thanks
JAXB treets empty int XML attribute as 0, which is fine with me, but I've got requirement to store it as a null. Seems I can't change DataConverterImpl class to custom implementation. What could be done if at all?
I have a user dao
@Entity
@Table(name="EBIGUSERTIM")
public class EbigUser {
private String id;
private Integer source;
private String entryscheme;
private String fullName;
private String email;
private Long flags;
private String status;
private String createdBy;
private Date createdStamp;
private String modifiedBy;
private Date modifiedStamp;
@Id
@Column(name="ID")
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@Id
@Column(name="SOURCE")
public Integer getSource() {
return source;
}
public void setSource(Integer source) {
this.source = source;
}
@Column(name="ENTRYSCHEME")
public String getEntryscheme() {
return entryscheme;
}
public void setEntryscheme(String entryscheme) {
this.entryscheme = entryscheme;
}
@Column(name="FULLNAME")
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
@Column(name="EMAIL")
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Column(name="FLAGS")
public Long getFlags() {
return flags;
}
public void setFlags(Long flags) {
this.flags = flags;
}
@Column(name="STATUS")
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
@Column(name="CREATEDBY")
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
@Column(name="CREATEDSTAMP")
public Date getCreatedStamp() {
return createdStamp;
}
public void setCreatedStamp(Date createdStamp) {
this.createdStamp = createdStamp;
}
@Column(name="MODIFIEDBY")
public String getModifiedBy() {
return modifiedBy;
}
public void setModifiedBy(String modifiedBy) {
this.modifiedBy = modifiedBy;
}
@Column(name="MODIFIEDSTAMP")
public Date getModifiedStamp() {
return modifiedStamp;
}
public void setModifiedStamp(Date modifiedStamp) {
this.modifiedStamp = modifiedStamp;
}
i am selecting 2 rows out of the db. The sql works
select * from ebigusertim where id='blah'.
It returns 2 distinct rows. When i query the data using hibernate, it appears that the object memory is not being allocated for each entry in the list. Thus, i get 2 entries in the list with the same object.
Criteria userCriteria = session.createCriteria(EbigUser.class);
userCriteria.add(Restrictions.eq("id", id));
userlist = userCriteria.list();
why does this script show empty alert box. I am trying to use php value in javascript
<script type="text/javascript">
alert(<?php echo count($myorder) ?>); </script>
thanks
What is the easiest way to take an objects and convert any of its values from null to string.empty ?
I was thinking about a routine that I can pass in any object, but I am not sure how to loop through all the values.
Hi. I have used the tinymce editor in my form. And I have used an validation for checking whether the editor is empty or not. It works for the initial stage. Also, when I press enter and checks for validation the form got submits. When I checked the source code of the editor it contains the information as below:
<p>&nbsb;</p>
Please check it and help me to get me an answer for this.
UITableView crashes in endUpdate, called by the Managed Object Context "save" method, when:
1- The Core-Data Store is empty
2- The Fetched Result Controller is configured to show sections
3- Two managed objects (or more) have been added to the store
When I've searched this situation in google. I've found exactly matched error in this post.
It looks like a bug.Is there a any solution to avoid this bug ?
Hi i encountered this problem whereby when i initialized my String[], there seems to be a null in the String[] before i do anything. How do i initialized the String[] to be completely empty,i.e. without the null at the start?
The output for the following code is:
nullABC
nullABC
nullABC
nullABC
nullABC
public static void main(String[] args){
String[] inputArr = new String[5];
for (int i = 0; i< inputArr.length; i++){
inputArr[i] += "ABC";
}
for (int i = 0; i< inputArr.length; i++){
System.out.println(inputArr[i]);
}
}
}
Hi,
I was experimenting with basic VB.Net file read/write and encountered this problem. I don't know whether it has something to do with the File IO or the String splitting.
I am writing text to a file like so
Dim sWriter As New StreamWriter("Data.txt")
sWriter.WriteLine("FirstItem")
sWriter.WriteLine("SecondItem")
sWriter.WriteLine("ThirdItem")
sWriter.Close()
Then, I am reading the text from the file
Dim sReader As New StreamReader("Data.txt")
Dim fileContents As String = sReader.ReadToEnd()
sReader.Close()
Now, I am splitting the fileContents variable using Environment.NewLine and saving the returned String array.
Dim tempStr() As String = fileContents.Split(Environment.NewLine)
When I print the array, I get some weird results
For Each str As String In tempStr
Console.WriteLine("*" + str + "*")
Next
I added the *'s to the beginning and end to find out what is going on. Since NewLine is used as the delimiter, I expect the strings in the array to NOT have any NewLine's. But the output was this -
*FirstItem*
*
SecondItem*
*
ThirdItem*
*
*
Shouldn't it be this -
*FirstItem*
*SecondItem*
*ThirdItem*
??
Since I am using WriteLine, my guess is a new line is added after the last string and hence the last empty item in the array after splitting.
But why is there a new line in the beginning of the second and third strings?