Posts

html - Authentication required? javascript -

i wondering how can require authentication website. such in picture: https://kb.tanium.com/images/thumb/5/58/authenticationrequired.png/700px-authenticationrequired.png can javascipt? help that's basic http response code 401 sent browser upon request. can on webserver securing folder/page .htaccess file or directive, or can return 401 http response in code (java, php or whatever use) example in java: response.setstatus(httpservletresponse.sc_unauthorized); normally handle of 401 responses job of browser, has nothing javascript. can try change defaut behavior of browser using javascript, try take @ page . i'd recommend not doing instead html form can freely customize , let return form identifiers.

php - where to use mysql_real_escape_string on JSON data in GET request -

i using json data request selecting & inserting mysql. if had used mysql_real_escape_string json, please let me know $json_data = mysql_real_escape_string($_get['json_data']); json_decode($json_data, true); mysql_queries this way ok or else have on every variable like $json_data = mysql_real_escape_string($_get['json_data']); $string = json_decode($json_data, true); $variable1 = mysql_real_escape_string($string['variable1']); $variable2 = mysql_real_escape_string($string['variable2']); $variablen = mysql_real_escape_string($string['variablen']); mysql_queries where use mysql_real_escape_string on json data in request you put 3 different domains in single sentence, each of them having different syntax , different escape rules. don't mix them! // $text text received in query string // might correct json representation of data structure // may else well; source injection // nonetheless, have thoroughly checked ...

c# - .Net WebAPI not responding when returning HttpResponseMessage -

i'm having problem web api action when returning httpresponsemessage . object return stream of audio, file have 60kb , in first time have success when call web api, however, in next time web api not responds , browser stay loading. below following code: why web api not works/responds in next time call? [httpget] [route("api/card/playaudio/{text}")] public async task<httpresponsemessage> playaudio(string text) { var audiostream = await _cardservice.getstream(text); return createaudioresponse(audiostream); } private httpresponsemessage createaudioresponse(system.io.stream audiostream) { var result = this.request.createresponse(httpstatuscode.ok); //httpresponsemessage result = new httpresponsemessage(httpstatuscode.ok); result.content = new streamcontent(audiostream); result.content.headers.contentdisposition = new contentdispositionheadervalue("attachment"); result.content.headers.contentdisposition.filename = string....

how to design routes for nesting resources in rails? -

i want create web application. one user has many articles; one article has many comments; the codes below: class user ..... has_many :articles end class article .... belongs_to :user embeds_many :comments end class comment .... embedded_in :article, inverse_of: :comments end i want use nesting routes: resources :users resources :articles resource :comments end end but rails guide told avoid multiple nesting resource. can give me ideas. in advance! you can avoid deep nesting using shallow nesting . resources :users resources :articles, shallow: true resources :comments end end it give same routes as: resources :users resources :articles, only: [:index, :new, :create] end resources :articles, only: [:show, :edit, :update, :destroy] resource :comments, only: [:index, :new, :create] end resource :comments, only: [:show, :edit, :update, :destroy] and urls this: users/1 users/1/articles articles/1 articles/1/edit articl...

sap - Return a list of all atributes of a persistent class in abap -

i got persistent class on custom table. get_persistent_by_query can list of objects. how can objects of atributes printed user (e.g alv)? can call instance function if click on somehow? here dynamic solution, query_data result returned call get_persistent_by_query( ). in end data stored in structured table <table>, can use display in alv. note there little control on order of field. real use you'd have add error handling well. data: pers_obj_desc type ref cl_abap_classdescr, pers_query_data type ref data, field_cat type lvc_t_fcat. field-symbols: <table> type standard table. loop @ query_data assigning field-symbol(<pers_data>). @ first. pers_obj_desc ?= cl_abap_typedescr=>describe_by_object_ref( p_object_ref = <pers_data> ). loop @ pers_obj_desc->attributes assigning field-symbol(<attr_desc>). append initial line field_cat assigning field-symbol(<field_cat>). <field_cat>-...

gitlab - Git push is stuck and does not throw any errors -

i trying push after merging temporary branch master. 'git push' not doing job. local processing gets stuck @ last step. how can resolve this? i did following: git checkout master git merge --no-ff dev_08_15 git commit -a -m "dev_08_15 merge commit" git push origin master and git stuck @ place. below output get. counting objects: 61, done. delta compression using 4 threads. compressing objects: 100% (19/19), done. writing objects: 100% (28/28), 2.20 kib, done. total 28 (delta 14), reused 0 (delta 0) i can pull changes others pushing. can't push of changes now.

php - How to send mail in zend2.2 using DKIM -

i new dkim concept. have been provided private , public keys of dkim. do need make changes in code or have setup domain keys server ? if need make changes should enabling dkim in mails. i using zend 2.2 , php 5.3.3 got link https://github.com/fastnloud/zf2-dkim requiring minimum zend 2.3. in advance.