Posts

Showing posts from August, 2015

javascript - How to use HTML tags/Attributes in JSON file with Angular -

i have json file has html tags place in objects. possible use html attributes? js var app = angular.module('app', []); app.controller('mainctrl', function ($scope) { $scope.colors = [ { "color": "red", "value": "#f00", "message": "simple message" }, { "color": "green", "value": "#0f0", "message": "message <strong>html</strong> tags" }, { "color": "blue", "value": "#00f", "message": "am going work? should not!" }, { "color": "magenta", "value": "#f0f", "message": "<img src='https://c2.staticflickr.com/4/3684/1180

php - Links with single/double quote or space are redirecting -

am testing on localhost, htaccess shown below: rewriteengine on rewriterule ^user/(.*)$ pages/user.php?u=$1 [nc,l] rewriterule ^bookmarks pages/bookmarks.php [qsa] if type 'localhost/project/bookmarks' or 'localhost/project/user/username' taken bookmark's page or user's page. if added characters '({[-,._' php dissect variable, if doesn't comply page's url accepted characters echo error. but when ' or " or space added, page redirect instead of processing '$_get' request. book'marks or bookma'rks redirecting https://www.google.com/search?q=localhost%2fproject%2fboo%27kmarks&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-us:official&client=firefox-a&channel=fflb how stop happening? this not .htaccess or php. firefox offering google's search services. there number of ways fix (in ff's about:config page) might best off typing http before localhost local urls. inste

javascript - Moving content of canvas with a specific framerate -

so have sprite animation goes fine when it's not in movement (i need go on 20 fps max because if not animation fast), when try move across screen, movement looks choppy. ideas on how make movement smoothly? increase framerate works, i'd see if there option aside of that. var canvasa = document.createelement("canvas"); var canvasb = document.createelement("canvas"); var contexta = canvasa.getcontext("2d"); var contextb = canvasb.getcontext("2d"); canvasa.style.position = "absolute"; canvasb.style.position = "absolute"; var xpos = 0; var ypos = 0; var index = 0; var framesizex = 140; var framesizey = 395; var numframes = 20; var drawing_character = false; var xposition = 0; var now, then, elapsed, starttime, fps, fpsinterval; var fpscounter = setinterval(updatefps, 1000); var forw = true; var cfps = 0; // pictures var background = new image(); background.src = "http://i.imgur.com/3fdb45h.png"; var ch

How end-user know whether the page is developed using semantic elements in HTML5? -

how end-user know whether page developed using semantic elements in html5? differences end-user can if use html5 semantic tags? ok valid question , don't haters downvoted it. here quick reminder: non-semantic elements : example div , span - tell nothing content. semantic elements : example form, table, , img - defines content. http://www.w3schools.com/html/html5_semantic_elements.asp for common user doesn't change see how displayed (the graphical result).but: for , people work on code better if have well-organized code semantic elements used correctly. accessibility : blind people , other people handicaps or diseases can't see , understand page display. have special navigators read them page quick summary based on h[1-6] elements ( basic example far more elaborated ). read http://www.clarissapeterson.com/2012/11/html5-accessibility/ more in-depth explanations on matter.

delphi - How to avoid TDateTime Data Rounding -

i writing column , cell classes fmx tgrid contain tcalendaredit , ttimeedit instances in every cell. works fine except proper processing of changes done in these child controls. type tfmtvalue<t> = record fieldvalue: t; modified: boolean; appended: boolean; deleted: boolean; end; tdatetimecell = class(tstyledcontrol) private fdate_time: tfmtvalue<tdatetime>; procedure setdatetime(const value: tfmtvalue<tdatetime>); function getdatetime: tfmtvalue<tdatetime>; protected procedure setdata(const value: tvalue); override; public property date_time: tfmtvalue<tdatetime> read getdatetime write setdatetime; ... end; ... function tdatetimecell.getdatetime: tfmtvalue<tdatetime>; begin fdate_time.modified := (fdate_time.modified) or (fdate_time.fieldvalue <> fcalendaredit.date + + ftimeedit.time); fdate_time.fieldvalue := fcalendared

javascript - Initialize AMCharts on Button Click Event -

i using amcharts stock chart displaying details. have below code draw amchart. amcharts.ready(function () { generatechartdata(); createstockchart(); }); var chartdata1 = []; var chartdata2 = []; var chartdata3 = []; var chartdata4 = []; function generatechartdata() { var firstdate = new date("2013-01-01"); alert('1 :' + firstdate); firstdate.setdate(firstdate.getdate() - 1500); alert(firstdate); firstdate.sethours(0, 0, 0, 0); (var = 0; < 5; i++) { var newdate = new date(firstdate); newdate.setdate(newdate.getdate() + i); var a1 = math.round(math.random() * (40 + i)) + 100 + i; var b1 = math.round(math.random() * (1000 + i)) + 500 + * 2; var a2 = math.round(ma

Basics of XML view in SAPUI5 -

i've been studying sapui5 framework time , used javascript views in applications. the question - there reasons why should prefer xml views on javascript, if should @ all? if there some, they? if want start trying write xml views, best place learn basic syntax , can find api reference controls created using xml? sapui5 api written use javascript. thanks. the reason use xml views because standard approach of fiori apps sap. creates situation developers have 1 approach. me easier readable. generally speaking see in mobile library xml views used while in desktop usage js still leading. on scn can find many similar questions. the library of examples can found in same api page under tab explored. perhaps using webide (which offers local) install can provide base start development using xml based views.

sql server - T-SQL syntax to show both negative values and NULL values as 0 -

i using sql server 2014 , have query line of code: isnull(b.[leisure],0) 'leisure' the value of leisure can negative, in case want value show 0. how wrap both conditions in code? instead of given block of code, use: iif(b.[leisure] null or b.[leisure]<0, 0, b.[leisure]) or iif(b.[leisure]>=0, b.[leisure], 0)

Set headers on get request angular 2 -

i try set authorization header request authenticate users rest api. i'm using angular 2 rc1. (i'am total beginner). gettest(){ let authtoken = localstorage.getitem('auth_token'); let headers = new headers({ 'content-type': 'application/json' }); headers.append('authorization', `bearer ${authtoken}`); let options = new requestoptions({ headers: headers }); return this._http .get(this._url,options) .map(res => console.log(res)); } i allow cors in backend. header("access-control-allow-origin: *"); header("access-control-request-headers: content-type, authorization"); my console : options api/userprofile/ xmlhttprequest cannot load /userprofile/. response preflight has invalid http status code 406 my request headers any idea ? i think need accept header rather because of 406 status code... let authtoken = localstorage.getitem('auth_token'); let

unmarshalling nested json without knowing keys jaxb java -

i fairley new java , jaxb , stuck on unmarshaling json structor this, cant find way create randomeaccount , randomsubacc objects values nested in them can unmarshalled. { "visit_id": "56602e810ef9d7487eef9f282e9e2f53", "skills": { "accounts": { "randomaccount": { "randomsubacc": { "default": true, "enabled": false } } } } } here's have far skills class (it not xmlrootelement ) , not know how define @xmlaccessortype(xmlaccesstype.field) @xmltype(name="skills") public class skills { private accounts accounts; public accounts getaccounts() { return accounts; } public void setaccounts(accounts accounts) { this.accounts = accounts; } @override public string tostring() { return "skills: accounts=" + accounts; } }

php - Zend Framework 2 mailing not working on CentOS 7 -

basically there custom class mail extends zend\mail\message , uses zend\mail\transport\smtp send mails html template, works nice, it's not written me. working on ubuntu server , works on localhost, it's not working on centos 7 server. i've tried there on web, "service sendmail restart/start/status" returns no such file or directory though sendmail shows /usr/sbin/sendmail. i'm not familiar linux.

ios - Enable save button using shouldChangeTextInRange -

i trying create save button becomes enabled when user enters text both textview , textfield . i have iboutlet called 'savebutton' created button. with following code, save button never becomes enabled. - (void) enablesavebuttonforquote: (nsstring *) quotetext author: (nsstring *) authortext { self.savebutton.enabled = (quotetext.length > 0 && authortext > 0); } - (bool)textview:(uitextview *)textview shouldchangetextinrange: (nsrange)range replacementtext:(nsstring *)text { nsstring *changedstring = [textview.testringbyreplacingcharactersinrange: range withstring: text]; [self enablesavebuttonforquote: changedstring author: self.authortextfield.text]; return yes; } - (bool)textfield:(uitextfield *)textfield shouldchangecharactersinrange: (nsrange)range replacementstring:(nsstring *)string { nsstring *changedstring = [textfield.text stringbyreplacingcharactersinrange: range withstring: string]; [self enablesavebuttonforquote:self.quotetextv

c - How do i put a string and user input into a new string using strcpy? -

sorry if title little bit confusing im trying make command change default shell of user. the user needs call command (btb) , input username e.g. btb username btb being args[0] , username being args[1]. need make 1 string can use make system call system("chsh -s /bin/bash username") . so far have this int registerbtb(char **args) { char command[50]; strcpy(command, args[1]); system(command); return 1; } which taking args[1] , putting command. need strcpy(command, ("chsh -s /bin/bash %s", args[1])); isnt possible. what other way can command have string "chsh -s /bin/bash username" in it strcpy not function you're looking for. should instead use snprintf buffer hold string, if know size: char buf[50]; snprintf(buf, sizeof(buf), "chsh -s /bin/bash %s", args[1]); keep in mind above example suffers potential bug string truncated. if don't know size of username in beforehand can call snprintf twice dyna

datetime - Rails: datetime_field does not display control buttons -

i have form, use date_field helper , works well, control buttons shown, when change datetime_field field displayed control buttons no displayed. my date_field works fine: =f.date_field :publishing_date, placeholder: "yyyy-mm-dd", class: "form-control" the datetime_field not shown controls: =f.datetime_field :publishing_date, class: "form-control" finally, realized there 2 form helpers select datetime: datetime_field (which using) , datetime_local_field (html5). the first 1 datetime_field rendered input type datetime . second 1 datetime_local_field rendered input datetime-local type looking for, works fine , introduced in html5, if want use browser not support html5, displayed input type datatime .

excel - Additional methods in a class module implementing an interface in VBA -

i write vba macro microsoft excel 2010. some of modules in project cry out subclasses, understood inheritance not supported. knowing that, went hard way , implemented methods again in each module using interface. however, experience method occures in 1 of modules (but not in interface) throws exception: method or data member not found! i not entirely sure have feeling somehow related interface. therefore i'd know following: when implementing interface in module in vba, still possible write additional public subs module? if it's not possible, correct pattern append functionality module implements interface? if declare variable interface class, can call methods/properties of interface, regardless of other methods/properties exposed actual object type itself.

php - How do each entity be generated in their respective database? -

there 2 entities: profiles , cars . the entity profiles related table in database x , entity cars related table in database y . the doctrine configuration: doctrine: dbal: default_connection: cars connections: profiles: driver: pdo_mysql host: "%database_host_profiles%" port: "%database_port_profile%" dbname: "%database_name_profiles%" user: "%database_user_profiles%" password: "%database_password_profile%" charset: utf8 cars: driver: pdo_mysql host: "%database_host_cars%" port: "%database_port_cars%" dbname: "%database_name_cars%" user: "%database_user_cars%" password: "%database_password_cars%"

python - Attribute user.grade cannot be referenced in Django template -

i have code website i'm building. in views.py , have following code: django.shortcuts import render django.http import httpresponse, httpresponseredirect django.conf.urls import url .models import userinfo, events django import forms .forms import registerform, loginform, orderform django.contrib.auth.models import user django.shortcuts import redirect django.views.decorators.csrf import csrf_exempt django.contrib.auth import authenticate, login, logout # create views here. def home(request): return render(request, 'student/index.html') @csrf_exempt def signin(request): print "login" if request.method == '

python - Oracle 11g - query appears to cache even with NOCACHE hint -

i'm doing database benchmarking in python using cx_oracle module. benchmark results, i'm running 150 unique queries , timing execution of each one. i'm running this: c = connection.cursor() starttime = time.time() c.execute('select /*+ nocache */ count (*) rowcount (' + sql + ')') endtime = time.time() runtime = endtime - starttime each query passed in through variable sql , , vary in length, runtime, , tables access. being said, queries exhibit following behavior: 1st run: slow (relatively) 2nd run: faster (takes anywhere 1/2 - 1/5 time) 3rd run: marginally faster 2nd run all subsequent runs >= 4: approximately equal 3rd run i need cache disabled accurate results, first few runs throwing off data; it's if nocache isn't working @ all... what's going on here? edit: allan answered question, might interested, did little more research , came across these 2 pages helpful: how clear cached items in oracle http://www.dba-

haskell - Rewrite rule / specialisation type error with universally quantified constraints -

i trying implement type-specific specialisations of functions work prisms, , having difficulty ghc 8. (i encounter different problem ghc < 8, that's question). a (contrived) minimal example of problem: foo :: prism' s -> prism' s foo = id {-# rules "foo/foo'" foo = foo' #-} foo' :: prism' char bool -> prism' char bool foo' = id this causes compiler error: error: • couldn't match type ‘p0 bool (f0 bool) -> p0 char (f0 char)’ ‘forall (p :: * -> * -> *) (f :: * -> *). (choice p, applicative f) => p bool (f bool) -> p char (f char)’ expected type: prism' char bool actual type: p0 bool (f0 bool) -> p0 char (f0 char) • in expression: foo' when checking transformation rule "foo/foo'" it looks me 1 side of rewrite rule type checking "forgets" context. going on here, , how can make ghc happy?

Cassandra: Providing atomicity and preventing "dirty reads" at the same time -

i need atomically insert multiple rows in cassandra table have different partition keys. @ same time, need make sure each query state of data user updating/inserting correct (so in case of race condition data doesn't messed up). example, db structure is: create table test( id uuid, userid uuid, address text, primary key ((id), userid) ); when inserting rows, need make sure each of them pk doesn't exist in database, don't want accidentally overwrite data (cassandra that). purpose, lightweight transactions exist, can add if not exists clause , done. problem have several such inserts should either succeed or none of them. following solution doesn't work: begin batch insert test(id, userid, address) values(50fcdfd9-7f61-11e5-9c9d-a0999b0af139, daf38231-eab1-4cd3-ae31-8d28d15c762b, 'addr1') if not exists; insert test(id, userid, address) values(9c26fcc0-0f82-472c-8e83-01b90bed60cc, 0d1a91c4-780a-4bc6-9c12-f2976cb7b3ef, 'addr2

ios - How to make NSURL with special characters -

my application based in portuguese - brazil. have special characters use in words "açaí". i have search method sends request url this: nsurlsession *session = [nsurlsession sharedsession]; nsstring *urlstring = [nsstring stringwithformat:@"http://www.mydomain.com.br/webservice/search/%@",_query]; nsurl *url = [nsurl urlwithstring:urlstring]; [[session datataskwithurl:url completionhandler:^(nsdata *data, nsurlresponse *response, nserror *error) { //all logic here }); }] resume]; now, if _query set "açaí" (which has ç , í special characters) when try nsurl *url = [nsurl urlwithstring:urlstring]; url variable not initialized , breaks rest. how can send request web service using special characters? i think need escape url string before creating nsurl . nsstring *urlstring = [nsstring stringwithformat:@"http://ww

java - ArrayIndexOutOfBoundException when input is zero -

here code calculating fibonacci of n. don't when n = 0 , arrayindexoutofboundexception raised. fib function when n = 0 , should return 0 . cause this? import java.util.scanner; public class fibonacci { public static int fib(int n) { int[] t = new int[n + 1]; t[0] = 0; t[1] = 1; (int = 2; < t.length; i++) { t[i] = t[i - 1] + t[i - 2]; } return t[n]; } public static void main(string[] args) { scanner in = new scanner(system.in); (;;) { if (!in.hasnextint()) { in.next(); continue; } int n = in.nextint(); if (n >= 0) { system.out.println(fib(n)); } else { system.out.println("invalid input!"); } break; } } } when n = 0, array int[] t = new int[n + 1]; holds 1 element. however, try allocate 2 elements: t[0]

How to display an image that I uploaded to a folder in a server? I am using php and mysql, in the data base is saved just the name of the picture -

0) { while ($row = mysqli_fetch_row($result3)) { echo "">" } } ?> hi said have uploaded image , want show same. in case should use tag src being path/to/imagefolder/name of image stored in db like have fetched data perticular user <table border="1"> $sql="select * tbl_name"; $result = mysql_query($sql); while($row=mysql_fetch_array($result)) { ?> <tr> <td><?php echo $row['name'] ?></td> <td><?php echo $row['password'] ?></td> <td><?php echo $row['username'] ?></td> <td><img src="logo/<?php echo $row['file_name']?>"></td> </tr> <?php } ?> </table>

angular - angular2: Unable to call function while create dynamic component using *ngFor -

i have created dynamic component manually using button click. if click on add button create component next add button. if click on remove button remove component. plunker here, problem while creating component using ngfor, unable remove component while clicking on remove button. noticed remove function call not happening while creating component using ngfor. below code: parent component: import{ component, input, output, eventemitter, viewcontainerref, elementref, componentref, componentresolver, viewchild, componentfactory } '@angular/core'; import {childcmpt } './child-cmpt'; import {shareddata } './shareddata'; @component({ selector: 'my-app', templateurl: 'src/parent-cmpt.html', directives: [childcmpt] }) export class parentcmpt { myallnames: any; @input() thing:string; //allitems: itemsaddremove; constructor(private resolver: componentresolver, priva

c# - Composite Key to navigation property -

i'm trying create table holding notes specific entity. have entity called notes i'd store pk of entity referencing. i'd have composite key of key , table name containing primary key. see example below: public class lot { public int lotid { get; set; } public virtual icollection<note> notes { get; set; } } public class task { public int taskid { get; set; } public virtual icollection<note> notes { get; set; } } public class note { public int id { get; set; } public int entityreferenceid { get; set; } public string entitytype { get; set; } public string comment {get; set; } } so in notes table there be: id: 1 entityreferenceid: 1 entitytype:lot comment: "comment one, lot one" id: 2 entityreferenceid: 1 entitytype:lot comment: "comment two, lot one" id: 3 entityreferenceid: 1 entitytype:task comment: "comment one, task one" it seems should possible in database, i'm not having

android - Textview width doens't adjust after change content -

Image
i'm trying update content of textview data introduced edittext. after change text, if original text (hint) bigger new text, width doens't change. i have next string in hint attribute of textview, "please, introduce amount". if put 25'5, example, textview doesn't resize width. first screen second screen the euro symbol invisible behind textview, , it's shown after insert value. the piece of code amount: <relativelayout android:id="@+id/rlimporte" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/rel_layout_colors" android:clickable="true" android:paddingtop="8dp" android:paddingbottom="8dp"> <imageview android:id="@+id/lst_img3" and

Angular 2 RC 4 compiler-cli errors -

i'm giving try angular 2 rc4 compiler-cli project components compiled offline , i'm running problems in here. just notice, using directions can found in here: http://blog.mgechev.com/2016/06/26/tree-shaking-angular2-production-build-rollup-javascript/ so, layout we're having here several private npm packages have been exported es5 target es2015 version of package nested in esm folder , jsnext:main tag in place points esm/core.js. as done i'm building project loading external modules , creates application, runs no problems. in order make better i'd apply techniques described in web post mentioned above. in order of i've created tsconfig file sets target , module es2015 , run: node_modules/.bin/ngc -p . and i'm doing on linux build server. problem setup reason of components described in external packages cannot parsed ngc , getting: error: no directive annotation found on *external component* error per each use of components located in co

java - How to force TextMergeViewer to flush content even if content is unchanged? -

i implementing editor works on distant document. document first downloaded, copied in local cached file, displayed user edits , saves it. on 'save' action, document uploaded server. classic. but sometimes, if distant document has been modified user during download/edit/upload cycle, conflict detected , compare editor presented user : local version displayed on left pane (and editable) , distant on right pane (and read-only). user "merge" operation manually (i don't consider automatic merge yet) , when save action launched, comparison result overwrites localy cached file afterwards uploaded onto server. still classic issue. the problem is: if user wants discard distant modifications, , wants save document without modifying left pane, compare editor refuses flush content of pane in local file , can not detect user launched save action init upload operation. why compare editor refuses overwrite local version quite simple: since no modification has been made,

Suggestion regarding MySql ID column - Rails -

in rails app, instead of creating default mysql/postgres id columns integers, easy guess next number while hitting routes, best way generate id column ( alphanumeric may be?) going hard guess. i did research on creating uuid's, option? or, there other options? how generating epoch timestamps , storing them id's on before_save callback each time ? usings uuid's cover database ids example of security obscurity. "system security should not depend on secrecy of implementation or components." - national institute of standards , technology consider cases attacker use knowledge of primary key attack system - sql injection (you're screwed anyways), , brute force attacks. should have better guards in place. that being said there valid use cases using uuid's - main 1 being distributed databases using sequential auto increment columns prone race conditions. if have several "write" replications extensive steps hav

android - java.net.SocketException: socket failed: EACCES (Permission denied) -

i have searched solutions , applied project. not working. have permission denied.i have put possible permission manifest file. please tell me what's wrong project. public static void getgetresponse() { inputstream inputstream = null; try { url url = new url("http://120.26.89.113:8080/common/qiniutoken"); httpurlconnection connection = (httpurlconnection)url.openconnection(); connection.setrequestmethod("get"); string userpassword = "wehelper:***********"; byte[] encodedbytes = base64.encode(userpassword.getbytes(), 0); connection.setrequestproperty("authorization", "basic " + encodedbytes); connection.connect(); int rescode = connection.getresponsecode(); if (rescode == 200) { inputstream = connection.getinputstream(); } bufferedreader reader = new buffer

c# - Integrate ASP.NET Identity with QR scan based login -

i trying implement qr code based login mechanism. currently, have username/password based authentication setup(using asp.net identity). creating qr-scanner mobile app interact backend. currently trying steps here , here qr code scan based authentication system. are there solutions available extend asp.net identity better implementing custom solution suggested in links? considered practice this? appreciate time suggestions.

sorting - Sort dictionary of key:value pairs in javascript -

this question has answer here: sorting javascript object property value 23 answers i have dictionary key:value pairs following. rank = { "team 1" : 34, "team 2" : 55, "team 3" : 29, "team 4" : 61, ... } keys team names , values points @ end of season, want sort couples based on values in order print final ranking. can me? in advance object keys , values in javascript have no intrinsic order. before can sort them desired order, need store them in ordered structure. let's items array , have intrinsic order: var object = { a: 1, b: 5, c: 2 } var keyvalues = [] (var key in object) { keyvalues.push([ key, object[key] ]) } the keyvalues array holds ['a', 1], ['b', 5], ['c', 2] . let's sort array, using s

ios - Hide UITableviewcell which contains UITextview (Autolayout) -

i have cell in tableview contains uitextview. uitextview has constraints of top, leading, trailing , bottom uitableviewcell content view. want hide uitableviewcell if textview contains empty text. that, reduce cell height 0. since textview has constraint set respect uitableviewcell. uitableviewcell --------------------------- | -t- | | -l- uitextview -r- | |_________-b-_____________| l,t,b,r - left, top, bottom, right constraints i getting constraints issue. unable simultaneously satisfy constraints. @ least 1 of constraints in following list 1 don't want. try this: (1) @ each constraint , try figure out don't expect; (2) find code added unwanted constraint or constraints , fix it. ( "<nslayoutconstraint:0x7fe5d58753a0 uitableviewcellcontentview:0x7fe5d5874fe0.bottommargin == uitextview:0x7fe5d399c000.bottom>", "<nslayoutconstraint:0x7fe5d58753f0 uitableviewcellcontentview:0x7fe5d

editor - vim - changing the color of selected text -

i editing document in vim, not code. new vim , come windows background. trying select block of text , change it's color. know how select text using visual mode. can please tell me how change color selection? i define presets, eg. red, green, blue, yellow etc, , selected text - :set color = red is possible? can please show me how?

php - TYPO3 with YAG Extension no theme to choose FE error -

i have simple web server @ strato.de on typo3 (v7.6.9) installed. next tried use yag (v4.1.2) (yet gallery) extension. i've done: install yag ter (includes pt_extbase, pt_extlist) create yag sysfolder create extension template includes '[yag] yet gallery (yag)' create albums / galleries , upload images add new content plugin: plugin mode: gallery list choose sources theme: nothing choose (empty select boy) install new theme package, noting changes if try without theme got fe error: the theme identifier not set. please check typoscript configuration. i don't can do. perhaps can me. as far can see did right. again if template correct , active on page want be. clear caches. had similar problem before , problem.

Ajax method in jquery using PHP as backend -

i have script file ajax method has been implemented, adds record form ...and have php file serves backend. trying dint declare record variable in php, declared in jquery part. how did accessed using $record = json_decode($_post['record']); what json_decode , json_stringify in script file. main.js $add_form.submit(function(e) { e.preventdefault(); var fields = ['id', 'name', 'subject', 'theory', 'practical']; var record = {}; (var index in fields) { var field = fields[index]; if (field == 'id' || field == 'theory' || field == 'practical') record[field] = parseint( $('input#add_'+field).val() ); else record[field] = $('input#add_'+field).val(); } record.total = record.theory + record.practical; $.ajax({ url: '/ab_batch/practice/db/action.ph

javascript - Record audio input directly to local storage -

forgive me in advance if isn't possible i'm back-end developer. i'm looking create simple transcription tool. way substantially reduce server cost i'm hoping have transcription take place on client machine. way i'm looking recording audio input , saving indexeddb , not sending server. possible javascript , or html5 , if there plugin or tutorial so? know there lot recording , streaming server can download client system ton of unnecessary overhead. wanted put on indexeddb hide user capacity provide defined location script audio file. help!

vagrantfile - How to group multiple vagrant machines into one environment and another group of machines as another environment? -

hi lets have 4 machines defined in vagrantfile (this example), vagrant.configure(2) |config| config.vm.define "elasticsearch" |a| a.vm.provider "docker" |docker| docker.name = 'elasticsearch' docker.build_dir = ".docker/elasticsearch" end end config.vm.define "elasticsearch-test" |a| a.vm.provider "docker" |docker| docker.name = 'elasticsearch-test' docker.build_dir = ".docker/elasticsearch" end end config.vm.define "mongodb" |a| a.vm.provider "docker" |docker| docker.name = 'mongodb' docker.image = "mongo:3.0" end end config.vm.define "mongodb-test" |a| a.vm.provider "docker" |docker| docker.name = 'mongodb-test' docker.image = "mongo:3.0" end end end and want group elasticsearch , mongodb "dev env" and want grou

python - MD5 Cracker not working python3 -

md = input("md5 hash: ") if len(md) != 32: print("don't md5 hash.") else: liste = input("wordlist: ") ac = open(liste).readlines() new in ac: hs = hashlib.md5(new.encode()).hexdigest() if hs == md: print("md5 hash cracked : ", new) print("sorry :( don't cracked.") executing not working. wordlist: sadasda asdasda sdasd da sdasd asd ahmet asdasf knknkjnbhb klasda output: md5 hash: cdb5efc9c72196c1bd8b7a594b46b44f wordlist: md.txt sorry :( don't cracked. where did mistake? can't see. wordlist if only: ahmet output: md5 hash: cdb5efc9c72196c1bd8b7a594b46b44f wordlist: md.txt md5 hash cracked : ahmet sorry :( don't cracked. the lines file include newline. newline significant: >>> hashlib import md5 >>> md5(b'ahmet').hexdigest() 'cdb5efc9c72196c1bd8b7a594b46b44f' >>> md5(b'ahmet\n').hexdigest(

winforms - Add a TextBox within a text editor control -

i want add controls within richtextbox control. i want give control user insert text in textbox placed in richtextbox. user may edit text in richtextbox or may insert text in textbox you should use "telerik" , create control within third party control.

How to get html to display without being parsed -

i want able this: <code> //my html pasted in , not parsed, people read/copy, goes here <h1>hello world</h1> <code> i know can use code tag , inside it, script tag type="text/plain" , display: block; in css, not responsive , doesnt good. i looked online couldnt find solve issue. i want place can paste html, css or js display purposes , unparsed , styleable , responsive. anyone got idea of best way go this? you can use <xmp> tag around code. frowned upon , deprecated in future, browsers still support , interpret raw html , display accordingly. see mozilla's documentation fuller explanations on so: show source code without xmp tag . without xmp , you'll need escape < , > in pre or code tag.

javascript - How to make the select option tag fill the action attribute with an url so it can open that website -

i need option value fill in action attribute in form can open website. code doesn't work. missing complete process? <form action=" " name="test"> <select name="url"> <option value="google">google</option> <option value="yahoo">yahoo</option> </select> <input type="submit"/> </form> <script> $("form").submit(function () { var selectval = $('select').value(); var url = ''; if(selectval == "google") url = 'http://www.google.com'; else if(selectval == "yahoo") url = 'http://www.yahoo.com'; if(url != ''){ window.open(url, '_blank'); } }); </script> i need option value fill in action attribute in form can open website. code doesn't work. missing complete process? <form action=""> <select name="url"> &