Posts

java - Mocking a void method from the same class that is being tested -

i trying test method using mockito , powermockito, method internally calling method returns void, wanted mock method since dont care result of method. have been trying on unable find solution please me on this. i tries using powermockito searchprocedurecodecontrollerbean mock = mock(searchprocedurecodecontrollerbean.class); powermockito.donothing().when(mock).seterrormessage((string)anyobject(), mockito.anylist().toarray(), (string)anyobject(), (string)anyobject()); seterrormessage void method, signature method follows public void seterrormessage(string errorname, object[] arguments, string messagebundle, string componentid) { } you can stub method of mocked object only. tested object not mocked. power mockito can stub static methods, it's not case. if don't care method behavior leave this. it`s void baisically don't matter. if , suppress it's influence, mean real problem design class under test owns responsibility. extract method class ...

php - Get a table that can change data directly -

i want data create table can edit,that means data in database can shown in input type box , user can change directly in table. here code: in code name , dob(date of born) , tel. want these data show in text boxes in way allows direct edition of these data. <?php $con = mysql_connect("127.0.0.1","root","password"); mysql_select_db("school2"); $sql = "select * student"; $results = mysql_query($sql,$con); echo "<table border=1 cellpadding=10>"; echo "<tr><th>sid</th><th>name</th><th>dob</th><th>tel</th></tr>"; while($row = mysql_fetch_array($results)) { echo "<tr> <td>$row[0]</td> <td>$row[1]</td> <td>$row[2]</td> <td>$row[3]</td> </tr>"; } echo "</table>"; ?> if ta...

javascript - Tooltip not showing up in Safari 5.1.7 -

i have used title attribute show tool tip option in select shown in code below: <select> <option title="hello 1"> hello 1 </option> <option title="hello 2"> hello 2 </option> <select> but tool tip works in chrome , firefox, doesn't work in safari 5.1.7 . can know how fix or work around issue. here demo note: can't use mutiple="multiple" attribute on select try this $(document).ready(function () { $('select option').each(function () { $(this).attr({ 'title': $(this).html() }); }); }); see demo http://jsfiddle.net/vkwbr/1/

double in C preprocessor directives -

what differences between, #define myvariable 1.25 and, #define myvariable (double)1.25 while declaring preprocessor directives in c. the difference preprocessor will, when sees myvariable , substitute in (double)1.25 rather 1.25 . this have no effect on code (possibly bizarre edge cases notwithstanding) since 1.25 already double literal, per c11 6.4.4.2 floating constants /4 : an unsuffixed floating constant has type double . if suffixed letter f or f , has type float . if suffixed letter l or l , has type long double .

Liferay 6.0: Deploy error -

i'm in process of upgrading liferay 5.2 6.0. all went (not really, i've spent 2 months on - upgrade ext, db, etc). currently managed deploy portlets of mine without issue except 1 portlet... after build-service success, proceed ant deploy , failed. return error: c:\barterfli\liferay\plugins\portlets\membershipactivation-portlet\docroot\web- inf\src\com\leadingside\portal\membership\service\service\persistence\users_activationpersistenceimpl.java:129: unreported exception com.leadingside.portal.membership.service.nosuchusers_activationexception; must caught or declared thrown return remove(((long)primarykey).longvalue()); ^ c:\barterfli\liferay\plugins\portlets\membershipactivation-portlet\docroot\web- inf\src\com\leadingside\portal\membership\service\service\persistence\users_activationpersistenceimpl.java:240: unreported exception com.leadingside.portal.membership.service.nosuchusers_activationexception; must caught or declared thrown return findbyprimarykey(((lo...

java - Setting up L on Android Studio -

Image
so i've been learning android on eclipse summer decided try out android studio along new android-l release. right when make new project though, 3 errors. first 2 failed find support:wearables , gms:play-service-wearable , third android-l needing jdk 7 compile. downloaded jdk 7 , double-checked skd manager make sure had updated tools. looks me can't seem these errors go. here screenshot: for first 2 issues ran , fixed https://code.google.com/p/android/issues/detail?id=72454 : for android studios version 0.8.0 tools > manage add-on sites > user defined sites. for android studios verison 0.8.1 android sdk manager > tools > manage add-on sites > user defined sites. add site https://dl-ssl.google.com/android/repository/addon-play-services-5.xml then make sure have latest google play services (18) for jdk issue i'm vaguely remember getting same thing months ago , fixed downloading jdk 7.

c# - How to bind key value pair to dropdown in MVC4 Razor -

i have country table "tblcountry", there 2 columns country name, country id, want display country name store country id in rest of tables. please tell me approach creating models view, using database first approach. public partial class tblrfatcountry { public long countryid { get; set; } public string country { get; set; } } this model tried add dictionary. public partial class tblrfatcountry { public long countryid { get; set; } public string country { get; set; } public dictionary<string, long> countrydic = new dictionary<string, long>(); } i want can display name store value. please suggest you need : @{ dictionary<long, string> dictionarycountry = new dictionary<long, string>() { {1, "item1"}, {2, "item2"}, {3, "item3"}, {4, "item4"}, }; selectlist countrylist= new selectlist( dictionarycountry.select(x ...