lundi 3 mars 2014

SCRIPT5007: Unable to get property 'replace' of undefined or null reference


Vote count:

0




Cant figure out why IE is showing this error message on this line:


this.innerHTML.replace('#','').trim()


I used getElementsByClassName and looped through all tags and attempting to remove the hashtag from the innerHTML of the link.


Works great in all browsers other than IE.


Any help appreciated.



asked 1 min ago






Ruby is_a? vs ===


Vote count:

0




What is de difference between is_a? and ===?


Running this Code:



puts myObj.class
puts myObj.is_a?(Hash)
puts myObj === Hash #Curious
puts Hash === myObj


The Outputis:



Hash
true
false #Why?
true


asked 1 min ago


1 Answer



Vote count:

0




=== is a wrapper and can be overridden in subclasses.



answered 7 secs ago

Agis

9,464




scala Play! object persistence is not a member of package javax


Vote count:

1




I'm trying to make Scala application using play framework for interaction with database. But I am not good in this. I used tutorials: http://ift.tt/1fChcpm , http://ift.tt/1eW21kE But then I tried to make entity:


package models


import java.util._ import javax.persistence._



@Entity
@Table( name="persons" )
case class person(name: String, lastName: String, age: Int) {
@Id
@GeneratedValue( strategy = GenerationType.IDENTITY )
var id : Int = _

}


I got next errors: -object persistence is not a member of package javax -not found: type Entity -not found: type Table -not found: type Id -not found: type GeneratedValue


Can someone help me?



asked 1 min ago

Rei

6





Change key pressed


Vote count:

0




Please I want to handle the key pressed and perform another key operation. Example if enter key is pressed then down event occurs. below is my code.



void khook_KeyDown(object sender, KeyboardEventArgs e)
{
if (!((e.KeyValue > 95 && e.KeyValue < 112) || (e.KeyValue == 144) || (e.KeyValue == 13)))
{




e.Handled = true;

}
else if (((e.Handled == false) & (e.KeyValue == 13)))
{


// change key pressed




}
}

void khook_KeyUp(object sender, KeyboardEventArgs e)
{
if (!((e.KeyValue > 95 && e.KeyValue < 112) || (e.KeyValue == 144) || (e.KeyValue == 13)))
e.Handled = true;


asked 16 secs ago






what is the proper way to free up memory from crystal report


Vote count:

0




i just want know what is the proper way to release memory that was occupied by crystal report.


this is my code :



ReportDocument reportdocument = new ReportDocument();
try
{
reportdocument.Load(Server.MapPath(@"~/EndUser/PostHistoryReport.rpt"));
reportdocument.SetDataSource(myDataSet);
reportdocument.SetDatabaseLogon("user", "user123");
CrystalReportViewer1.ReportSource = reportdocument;
}
finally
{
if (reportdocument != null)
{
reportdocument.Close();
((IDisposable)reportdocument).Dispose();
GC.Collect();
}
}


asked 34 secs ago

shal

46





Splash screen with background task


Vote count:

0




I have a splash screen that loads URLs from the Internal Storage and downloads their content from the Web (with an AsynkTask). It puts the downloaded data into an ArrayList, calls the main Activity and finishes. The main activity adapter manages the ArrayList and sets a ListView containing its data.

While I'm in the main Activity, if I press the back button the application exits (I set the android:nohistory="true" for the splash screen activity), but when I return to the app, the splash screen gets loaded and downloads the data again, "doubling" the list view.

How can I prevent the splash screen to be loaded when I return to the app?


Splash screen code:



Context mContext;
ProgressBar progress = null;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mContext = this;
setContentView(R.layout.activity_launcher);

progress = (ProgressBar)findViewById(R.id.progress);
progress.setIndeterminate(true);


if(canWriteOnExternalStorage()) {

try {
setupStorage();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else
//dialog appears


}


The setupStorage() method loads the file from the Storage and executes the AsynkTask.

Maybe could the overriding of the onRestart() method be a solution?

Or should I prevent the AsyncTask from loading the data already downloaded?

Thanks!



asked 1 min ago






How to combine local and Facebook users in iOS app


Vote count:

0




I want to give the opportunity for a user of an app to register/login with Facebook or by creating an account. I know that I can get the user's Facebook account email address, and their first and last names. That's basically the only information for creating a 'local' app account, apart from a password. How can I make sure that if that person logs in to Facebook on another device, that their two devices are linked to the same 'local' account? (i.e if they choose to sign in with Facebook with 2 devices, I only want one local account to be created on my server for that user).


Ideally, I want the login schemes for both to be identical. So if that user logs in with Facebook, I can check (securely) that the FB account is linked to a 'local' account, and automatically log that device in without making the user type in a password. Is this possible?


Edit: The 'local' users will be stored in a database on my server, and the front end will be done in Python running alongside the API for the app. Note that 'local' is just referring to the fact that it uses my app web service rather than an external social network.



asked 1 min ago