Posts

javascript - plus signs in the JS code - why aren't they optional here -

i'm curious answer taken dagg nabbit @ so here: convert hh:mm:ss string seconds in javascript var seconds = (+a[0]) * 60 * 60 + (+a[1]) * 60 + (+a[2]); right, var seconds = (a[0]) * 60 * 60 + (a[1]) * 60 + (a[2]); doesnt work expected - doesn't calculate number of seconds. why? they cause implicit conversion of string number. in browser's debug console, try: > typeof +'1' "number" > typeof '1' "string"

Image in Java web service -

i developing server part in java restful web service (using apache tomcat), planning deploy on cloud web service. want web service provide images client (mobile devices or browsers), user can upload or replace images dynamically later. question 1: should store images @ server ? options-- 1].save images in database (as blob) 2].local file system of server. question 2: how process client request options-- 1].i can retrieve locally , give image response. 2].i can give public url of image response, , client can download url. can suggest me option should opt optimize server side processing , storage cost, w.r.t security. answer 1: while subject debate, usual answer is: local file system. can add entry in database location of file , metadata actual binary blob should on file system. answer 2: if pass along public url, supposes have public http server can access , provide images requested. if case consider opting because http servers can optimize out of box (e.g. caching...

validating html field for database value -

i have registration form , in have enter teacher_id , primary key in database. problem cant give same id 2 teachers how can validate according database values. of validate accept numbers using jquery. can me in this.

c# - Rendering a partial view with jquery -

the problem; i have view 2 partial views 1 view handle client side msgs , gridview. the gridview form , can delete update items. when deleting or updating error/success msgs generated in tempdata grid partialview being rendered actionresult functions. i need way render messages partial view without posting or redirecting controller since data exists in tempdata. view: <div id="page-knownrecipient"> @html.partial("clientsidemessages") @html.partial("_tabspartial") @if(model != null) { using (html.beginform()) { @html.partial("_editmodepartial", model);//grid } } </div> all callback routing gridview returns partialview editmodepartial , since view never reloaded messages should displayed in "clientsidemessages" partial never rendered after delete/ update callbacks. accordingly need way render "clientsidemessages" partialview using jquery, ...

struts2 - Server side validation error message are repeated in Struts 2 -

i using struts2 xml validaion (action-validation.xml). problem when clicked save button more 1 time, error message appears repeatedly. how resolve issue? you should prevent submitting form (and saving data) twice, instead of caring double error messages, go away automatically once you'll solve real problem. to prevent double form submission, disable submit button javascript; prevent f5 landing page, use post redirect pattern, or history.pushstate(). prevent multiple submissions when crafted, use token (tokeninterceptor in struts2). read more: 4 ways prevent duplicate form submission how prevent multiple form submit client side? prevent double submission of forms in jquery avoid duplicate submission of struts 2 jsp page

android - Scale buttons in in widget -

Image
i want create widget has number of buttons scaled horizontally when screen size changed. can single layout.xml? i tried illustrate image below : you can achieve setting android:layout_weight="" tag in linearlayout . see below example. <linearlayout android:id="@+id/linearlayout1" android:layout_width="match_parent" android:layout_height="wrap_content" > <button android:id="@+id/crop" android:layout_width="0dp" android:layout_height="50dp" android:layout_weight="1" android:background="@drawable/crop_drawable" > </button> <button android:id="@+id/rotate" android:layout_width="0dp" android:layout_height="50dp" ...

How to make javascript file update take effect immediately on IIS for asp.net web sites? -

Image
i'm writing asp.net project. when trying fix bug, updated 1 of javascript files , deployed new version on server's iis 6.0. can see new javascript file has been updated on physical folder of website. however, when verifying bug local machine found it's not fixed. after investigation, realized it's because javascript file received browser not latest version. deleted ie's caches , problem still exists. tried download javascript directly website using url like: http://myserver.mydomain.com/mywebsite/scripts/myscript.js , found out downloaded javascript file of old version. realized caused cache on server side. tried set server's iis: on site's "output caching" option, unchecked "enable cache" , "enable kernel cache" : also added rules .js , .css file: after taking these actions, updated javascript file on server, restarted iis , tried download local machine again.however, javascript downloaded still not late...