Posts

Showing posts from April, 2010

regex - Add line break after every 60 characters in String for Java -

this question has answer here: putting char java string each n characters 6 answers suppose string this: string msg = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" i want add or append line break (a carriage return) after every 60 characters either through looping or regex (regex cooler). you in java : string msg = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz..."; string updatedmsg = msg.replaceall("(.{60})", "$1\r"); this replace every 60 characters same 60 characters , add carriage return @ end. the (.{60}) capture group of 60 characters. $1 in second put content of group. \r appended 60 characters have been matched. have

javascript - How to inject filter in app config -

i have filter want inject module config set value state title etc. .config(["$stateprovider","$filter", function ($stateprovider,$filter) { $stateprovider .state('app.home', { url: '/', data: { title: $filter('myfilter')('trans.abc'), }, views: { "content@app": { templateurl: '---', controller: 'dummycontroller' } }, resolve: { } })` here filter app.filter('myfilter',gettranslate); function gettranslate($rootscope){ return function(text){ return 'test title'; } }

JavaScript Wait Until Event Is Completed -

how can execute function after html element gets value ? i've got number input , getjson using value parameter, getjson loads initial value of number, resulting in null. how can avoid ? seems if using ajax call desired number getting null. want make sync if yes then, go ahead , check out wait until jquery ajax requests done? or else if using xhttp.open("get", "ajax_info.txt", true); use instead xhttp.open("get", "ajax_info.txt", false); reference : http://www.w3schools.com/ajax/ajax_xmlhttprequest_send.asp

java - ArrayList<Object> JSON -

i've 2 classes on backend: produto public class produto implements serializable { @transient @jsonserialize @jsondeserialize private set<filial> filials = new hashset<>(); //more fields //getters , setters filial public class filial implements serializable { @id private long id; @column(name = "nm_filial") private string nmfilial; //more fields //getters , setters the filiais property isn't database field , receives value way: @requestmapping(value = "/produtos/{id}", method = requestmethod.get, produces = mediatype.application_json_value) @timed public responseentity<produto> getproduto(@pathvariable long id) { produto produto = produtoservice.findone(id); set<filial> filials = produtofilialservice.findfiliaisbyidproduto(produto.getid()); produto.setfilials(filials); return optional.ofnullable(produto) .map(result -> new responseentity<>(

sql server - Sum of one field minus sum of another SSRS Expression -

Image
i have ssrs report i'm working on. value of 1 field own dataset , subtract value of field different dataset. can this; however, values grouped rather giving me individual value gives me: (sum of all completed) - (sum of all completed previous year). here expression using column "compared last year" =sum(fields!completed.value, "mtdsales") - sum(fields!completed.value, "mtdminus1") "mtdsales" , "mtdminus1" 2 seperate datasets. mtdsales dataset current months sales outcomes grouped company mtdminus1 dataset last years figure current month comparing 2 months separately. i had in report pulling current data 1 database , older data data warehouse , combining. need few things: 1. establish match field this can simple single column. if need match on multiple fields need add calculated field each dataset can match on. assuming need match on company , financial year , each dataset returns 1 year of data, might m

c# - Service Only Works While Debugging -

i have created wcf service , having trouble testing once has been deployed. here powershell using test it: $service = new-webserviceproxy -uri http://localhost:16651/service.svc $service.getlist() when debugging service visual studio f5 , can call script without issue. getlist() returns long list of telephone numbers. however, when host site on iis , run above script, empty return value. service factory so following this question , added attribute service.svc : factory="system.servicemodel.activation.webscriptservicehostfactory" however, resulted in script returning error on first line: new-webserviceproxy : object reference not set instance of object. which not make sense me, not referencing empty objects... (this error appears when debugging , when hosting on iis). web.config next, tried updated web.config per linked question: <services> <service name="lyncwebservice.service"> <endpoint binding="we

python - Convert 1D object numpy array of lists to 2D numeric array and back -

say have object array containing lists of same length: >>> = np.empty(2, dtype=object) >>> a[0] = [1, 2, 3, 4] >>> a[1] = [5, 6, 7, 8] >>> array([[1, 2, 3, 4], [5, 6, 7, 8]], dtype=object) how can convert numeric 2d array? >>> a.shape (2,) >>> b = what_goes_here(a) >>> b array([[1, 2, 3, 4], [5, 6, 7, 8]]) >>> b.shape (2, 4) how can reverse? does easier if a array np.array of np.array s, rather np.array of list s? >>> na = np.empty(2, dtype=object) >>> na[0] = np.array([1, 2, 3, 4]) >>> na[1] = np.array([5, 6, 7, 8]) >>> na array([array([1, 2, 3, 4]), ([5, 6, 7, 8])], dtype=object) one approach using np.concatenate - b = np.concatenate(a).reshape(len(a),*np.shape(a[0])) the improvement suggest @eric use *np.shape(a[0]) should make work generic nd shapes. sample run - in [183]: out[183]: array([[1, 2, 3, 4], [5, 6, 7, 8]], dtype=objec

android - if/else type statements within java -

i trying determine upon startup whether in-app has been purchased, current code; if (!(getsharedpreferences("purchased", 0).getboolean("purchased", false))) admob(); log.d("not upgraded", "show ad upgraded already"); if (!(getsharedpreferences("purchased", 0).getboolean("purchased", true))) admobskip(); log.d("upgraded", "do not show ad upgraded already"); but appears run through code, rather checking, ios use if / else , seem unable use , wanted java equivelent piece of code if possible? have swapped purchased ' true ' on second half of statement. use instead if (getsharedpreferences("purchased", 0).getboolean("purchased",false) == false) { admob(); log.d("not upgraded", "show ad upgraded already"); } else if (getsharedpreferences("purchased", 0).getboolean("purchased",true) == true) { admobs

angular - Can't bind to 'userID' since it isn't a known property of 'view-user' -

i have following template expression: which refers viewusercomponent contains: @input() userid; why following error? can't bind 'userid' since isn't known property of 'view-user'. 1) ngif="doselect" can create problem sure it works expected. 2) [userid]="selecteduser?.id" shown, can try ?. operator (i assume selecteduser object comes server).

blocking - reloadExtensionWithIdentifier is not working -

when try add other number call directory extension. it's not adding, taking number text filed , try add number call directory extension using below method. [contextis addblockingentrywithnextsequentialphonenumber:phonenumber]; after calling below methods. [contextis completerequestwithcompletionhandler:nil]; [[cxcalldirectorymanager sharedinstance] reloadextensionwithidentifier:@"com.something.something.callidextension" completionhandler:^(nserror *error){ if(error!=nil) { nslog(@"error %@",[error description]); } }]; but it's not woking. think reloadextensionwithidentifier not updating number dictionary or doing wrong... i got idea question, added reloadextension on viewcontroller, , did work! appreciate you.

xslt - Insert node between chuck of xml based on xpath expression -

variable xml_node contains 2 nodes. <parameter name="fsc-a" type="30"> <is_log>false</is_log> <is_quantitated>false</is_quantitated> <min>0.0</min> <max>262143.0</max> <raw_index>1</raw_index> <linear_index>1</linear_index> <log_index>19</log_index> <final_index>1</final_index> <fl>fsc</fl> <volt

c - Brainf**k interpreter problems -

i'm new c. i'm trying write brainfuck interpreter. have tried far. #include <unistd.h> #include <stdlib.h> char *line; int curr_pos; void interprete(char *coms) { int a; int curr_loop; = -1; curr_loop = 0; while (line[++a]) line[a] = 0; = -1; while (coms[++a]) { if (coms[a] == '+') line[curr_pos]++; else if (coms[a] == '-') line[curr_pos]--; else if (coms[a] == '>') curr_pos++; else if (coms[a] == '<') curr_pos--; else if (coms[a] == '.') write(1, &line[curr_pos], 1); else if (coms[a] == '[') { if (line[curr_pos]) curr_pos++; else { curr_loop = 1; while (curr_loop) { ++a; if (coms[a] == '[')

ios - Coredata in swift -

hello having issue core data in swift, doesn't show error doesn't print when believe should returning 'joe' + 'pass' in console. please? import uikit import coredata class viewcontroller: uiviewcontroller { override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. var appdel:appdelegate = uiapplication.sharedapplication().delegate as! appdelegate var context:nsmanagedobjectcontext = appdel.managedobjectcontext var newuser = nsentitydescription.insertnewobjectforentityforname("users", inmanagedobjectcontext: context) nsmanagedobject newuser.setvalue("joe", forkey: "username") newuser.setvalue("pass", forkey: "password") { try context.save() } catch let error { print("couldn't save user data") print(error) } let request = nsfetchrequest(entityname: "users")

Use of 'prototype' vs. 'this' in JavaScript? -

what's difference between var = function () { this.x = function () { //do }; }; and var = function () { }; a.prototype.x = function () { //do }; the examples have different outcomes. before looking @ differences, following should noted: a constructor's prototype provides way share methods , values among instances via instance's private [[prototype]] property. a function's this set how function called or use of bind (not discussed here). function called on object (e.g. myobj.method() ) this within method references object. this not set call or use of bind , defaults global object (window in browser) or in strict mode, remains undefined. javascript object oriented language, i.e. object, including functions. so here snippets in question: var = function () { this.x = function () { //do }; }; in case, variable a assigned value reference function. when function called using a() , function's this

android - Text background issue on Toolbar -

Image
when adding alpha toolbar background color, notice there background applied title's textview: here layout: <framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:background="#0099cc"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" app:theme="@style/fullscreenactionbarstyle" app:titletextappearance="@style/actionbartitle"/> <imageview android:id="@+id/fullscreen_content" android:layout_width="match_parent" android:layout_height=

haskell - Obtaining `Show a` from the context `Show (a,b)` -

as title says, i'm interested in using show a in context have show (a,b) . problem arises gadts follows: data pairornot pair :: (b,c) -> pairornot (b,c) not :: -> pairornot showfirstifpair :: show => pairornot -> string showfirstifpair (not a) = show showfirstifpair (pair (b,c)) = show b the error is: could not deduce (show b) arising use of ‘show’ context (show a) bound type signature showfirstifpair :: show => pairornot -> string @ app/main.hs:24:20-50 or (a ~ (b, c)) bound pattern constructor pair :: forall b c. (b, c) -> pairornot (b, c), in equation ‘showfirstifpair’ @ app/main.hs:26:18-27 possible fix: add (show b) context of data constructor ‘pair’ in expression: show b in equation ‘showfirstifpair’: showfirstifpair (pair (b, c)) = show b i'd think instance declaration instance (show a, show b) => show (a,b) proves show element , can imagine problem has how typeclass machinery i

java - Return XML document Jax-WS -

i have web service (jax-ws), uses internal service (further i.s. ) connect url via get method. i.s. connects specific url , gets response. returned data(in xml format) might different depending on parameters passed. here 1 important point! difference mean difference of structure of returned xml , i.e 1 set of parametres 1 xml, set of parameters another, different xml (structure different). main goal resend response (another jobs done) client calling web service. here web service works brigde. suppose can't use jaxb, cause different xml structured data(there nothing common between them). question how can solve ? how can resend came me client? without unmarshalling . possible stream? able returned data in inputstream or string @slf4j @webservice(name = ccservicews.ws_name, servicename = ccws.ws_service_name, portname = ccws.ws_port_name, targetnamespace = ccws.ws_namespace) @logged @component public class ccwsimpl implements ccservicews {

java - legend in a plot using flot jquery api -

i'm trying modify plot in order insert custom legend. code following $(document).ready(function(){ graph = $('.graph').plot(formatflotdata(), { colors: [ '#20f', '#00ff4b', '#f00', '#fdff00'], xaxis: { show: false, min : 0, max : res }, yaxis: { min : -50, max : 50, font : { size: 11, lineheight: 13, style: "italic", weight: "bold", family: "sans-serif", variant: "small-caps", color: "#f2f2f2" }, color : "#f2f2f2" }, grid: { bordercolor : "#333", borderwidth : 3 } }).data("plot"); }); the html is: <div class='graph' style="display : inline-block"></div> <div id=&qu

How to pass list of function and all its arguments to be executed in another function in python? -

i have list of functions , arguments this: (func1, *arg1), (func2, *arg2),... i want pass them function execute them this: for func, arg* in (list of funcs, args): func(arg*) how in python? have tried several doesn't unpacking , *arg @ same time. you can use *-operator unpack arguments out of tuple . for example, suppose format of items in invocation list (function,arg1,arg2,...) . in other words, item[0] function, while item[1:] arguments should given function. def f1(x1): print("f1 {0}".format(x1)) def f2(x1,x2): print("f2 {0} {1}".format(x1,x2)) data in ((f1,5),(f2,3,4)): data[0](*data[1:]) # output: # f1 5 # f2 3 4

Why switching between two Tasks does not update file edited in these Tasks? What is Task in PhpStorm about? -

these steps did: open task 1 (create branch master, create changelist) do edit in thefile open task 2 (create branch master, create changelist) do edit in thefile switching task 1 , thefile contain edits made in task 2 so content of thefile same in both tasks. why switching between 2 tasks not update file edited in these tasks? task in phpstorm about?

c# - Access win32_processor propertry "Family" Dictionarie -

i work on small project want read cpu information. using managementobjectsearcher , managementobjectcollection , managementobjects . //cpuinfo managementobjectcollection, method foreach (managementobject obj in cpuinfo) { try { cpufamily = obj["family"].tostring(); console.writeline("family: {0}", obj["family"]); } catch (exception e) { cpufamily = "not available"; } my problem cpu family gets value 198. far research has gone found out key of dictionary, see: https://msdn.microsoft.com/en-us/library/aa394373(v=vs.85).aspx now problem is, don't know how access dictionary. haven't found useful information far.. id access dictionary, no matter key get, want corresponding value. (i thought hard coding keys , values dictionary, if changes on time...) thanks! another question! {0} in console output means? found on net.. link edited the managementobject "caption" contains family..

java - Spring boot 1.4.x and custom CharsetProvider -

i'm trying register custom charsetprovider able use x-gsm7bit encoding. use https://github.com/opensmpp/opensmpp/tree/master/charset/src/main/java/org/smpp/charset provider logica. register new charset provider use meta-inf/services/java.nio.charsets.spi.charsetprovider file content org.smpp.charset.gsm7bitcharsetprovider . i can't make working. sources of test application here https://github.com/asmsoft/provider i java.util.serviceconfigurationerror: java.nio.charset.spi.charsetprovider: provider org.smpp.charset.gsm7bitcharsetprovider not found when start fat jar mvn clean mvn package java -jar target/provider-1.0-snapshot.jar if start mvn spring-boot:run java.io.unsupportedencodingexception: x-gsm7bit and works when start application ide. currently solved problem follows: i've put jar providing custom charset java_home/jre/lib/ext , works expected again, charset being registered on boot. i'm not happy solution , i'd ask help. i th

hibernate - Spring Security Set Role On Registration -

i'm new spring security, i've followed tutorials i'm having trouble understanding how structure of roles works under hood. have 2 tables, 1 user: @entity @table(name = "userprofile", schema = "dbo", catalog = "devtestteam") public class userprofileentity implements userdetails{ @id @generatedvalue(strategy = generationtype.identity) @column(name = "id", nullable = false) private long id; @column(name = "enabled", nullable = false) private boolean enabled; @notempty(message = "enter password.") @size(min = 6, max = 15, message = "password must between 6 , 15 characters.") @column(name = "password", nullable = true, length = 100) private string password; @notempty(message = "enter username.") @size(min = 6, max =

c# - select randomly from string array without repetitions -

good day have problem regarding selecting random string string array developing guessing word game. this string array: string[] movie = {"deadpool", "batmanvssuperman", "findingdory", "titanic", "suicidesquad", "lordoftherings", "harrypotter", "jurassicpark", "hungergames", "despicableme" }; while process in selecting random string array, should next, because want select string not repeated. e.g when program starts select string when select random string again want not select previous word i've selected previously. string word = movie[r.next(0, movie.length)].toupper(); thank response! have nice day. well, convert array list , shuffle in random order : var rand = new random(); string[] movies = { "deadpool", "batmanvssuperman", "findingdory", "titanic", "suicidesquad", "lordoftherings"

3d - threejs slice and dice cube matrix visual -

Image
i'm new threejs. using webgl renderer firefox. looking create visual of database in form of data cube, seen in image below. consist of 3d matrix of individual cubes. able "drag" "slice" of cube out view it. would better achieved buffergeometry or boxgeometry? further, not sure how go grouping of individual cubes. depending on direction of drag action, cube need grouped different cubes. possible dynamically change group object belongs?

Best practices: Layouts on Android (Programmatic vs XML) -

this question has been bugging me time. i've developed couple of apps on android platform , somehow find myself resorting java code in order construct layouts. in professional development environment, acceptable? or should xml files go-to approach? find xml more tedious approach , often, these layouts don't same on devices. don't it. professional viewpoint, has been able develop apps complex views purely using xml files? question killing me because google recommends using xml ui never looks same on devices unless done programmatically. or doing wrong? note i'm referring android 2.2 , 2.3, majority of users use. i use xml layouts on pretty every fragment , activity of every app write. see need create views dynamically, tho configuration of listviews, showing/hiding views, etc needs doing in code. me advantages of xml are: ability use layout editors (eclipse) easier preview layouts possible benefit auto-localisation of layouts easily maintain differen

javascript - Unable to submit form data using ajax() post -

i submit form data using $.ajax() method, data contains image files. while submitting encountered below issues: form not getting submitted in ie10,11 though submitting in chrome , ff, ajax() executing both success , error methods i able submit data in chrome , ff displaying error message data submitted db chrome , ff below code using submit data $.fn.serializeobject = function() { var o = {}; var = this.serializearray(); $.each(a, function() { if (o[this.name] !== undefined) { if (!o[this.name].push) { o[this.name] = [o[this.name]]; } o[this.name].push(this.value || ''); } else { o[this.name] = this.value || ''; } }); return o; }; $(function() { $('form').submit(function() { var senddata = json.stringify($('form').serializeobject()); $('#resul

xcode - Swift 3 Error - Type Any has no subscript members -

Image
i converted code swift 3 , these errors have popped up. have no clue following error means. type 'any' has no subscript members i have tried change [string: anyobject] other types has not worked. appreciated! this other stack overflow question might helpful (from link) let responsemessage = json["response"]! as? string must changed to let responsemessage = (json anyobject)["response"]! as? string the array must cast anyobject.

Error on create view with cast numeric as decimal on postgresql -

good morning everyone! i work postgresql. well, need create views numeric columns stay rounded 15.3 i'm encountering problem not understand. the select work: select cast(15.2547 decimal(15,3)) quantidade_medida_estatistica the view not working: create or replace view teste select cast(15.2547 decimal(15,3)) quantidade_medida_estatistica error: error: can not change data type of column view "quantidade_medida_estatistica" of numeric (15,4) numeric (15,3) thanks! this known "bug" in postgres, can read here . create or replace view not same dropping view , re-creating it. in case existing columns in view need same, described in documentation : create or replace view similar, if view of same name exists, replaced. the new query must generate same columns generated existing view query (that is, same column names in same order , same data types), may add additional columns end of list. calculations giving rise outp

jquery - How to create html tags each with their ID via a button with JavaScript? -

i have button in html click executes javascript function creates new field id in hidden div. i wanted each new field (tag) has created "id" specifies, not id code (below). need different record in database entered in each. can me ? $(document).ready(function () { $('#addpergunta').click(function () { var x = 1; var div = $('#perg-box'); var divtext = $('<div />'); var text = $('<select />'); text.attr('class', 'form-control').attr('id', 'id-pergunta' + x); divtext.append(text); div.append(divtext); $('#div_perg').show(); }); }); here: $(document).ready(function () { var count = 1 $('#addpergunta').click(function () { var div = $('#perg-box'); var divtext = $('<div />'); var text = $('<select />'); text.attr('class&#

android - Delete item from the Firebase database -

Image
i'm trying delete item following list. when try grab key, shows user id key nsshnb2enjcyekfee2fiszbdc6o2 . want grab key of each post. example, if user clicks on first item in list, should grab key ksghfszg.... there lots of answers similar questions structure of database quite different here. here code, used. madapter = new firebaserecycleradapter<note, firebasenoteviewholder>(note.class, r.layout.item_note, firebasenoteviewholder.class, mref) { @override public void populateviewholder(firebasenoteviewholder notemessageviewholder, final note notemessage, final int position) { notemessageviewholder.settitle(notemessage.gettitle()); notemessageviewholder.setupdateddate(dateformat.getinstance().format(notemessage.getdatamodified())); notemessageviewholder.itemview.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { //toast.maketext(getactivity(), notemessage.

javascript - <video> autoplay on chrome android interrupts Spotify -

i work company setting video advertising on mobile , need html5 <video> element. chrome 53 out , supports muted autoplay had great hopes our new video advertisement. unfortunately complains clients muted video autoplay interrupts spotify (and other background media playback). is there way around this? our <video> element looks this: <video width="320" height="180" preload="auto" muted="" autoplay="" webkit-playsinline="" ><source src="....." type="video/mp4"></video> i tried setting volume 0 javascript, doesn't seem when muted. (which makes sense). we want autoplay muted video while keeping background playback enabled. it current bug in chromium (actively being worked on) video audio track, still muted, initiates mediasession. a workaround until fix bug use media no audio tracks , should prevent situation.

php - Yii2 Call to a member function someFunction() on Integer and a non-object -

i wanna show usernames in timeline index. show error call member function getstatuseslabel() on integer if use code : 'status' =>$model->data['status']->getstatuseslabel(), and 'author' => $model->data['author']->getauthor(), and error trying property of non-object if use code : 'author' => arrayhelper::map($model->data['author']->getauthor, 'id','username'), my model namespace common\models; ..... class article extends activerecord { ..... public function getauthor() { return $this->hasone(user::classname(), ['id' => 'author_id']); } public function getupdater() { return $this->hasone(user::classname(), ['id' => 'updater_id']); } public function getcategory() { return $this->hasone(articlecategory::classname(), ['id' => 'category_id'

ios - Multiple UIPickerViews Dependent On Previous Selection With Large Datasource -

i need able select village in thailand, based first off of province, region, district, , selecting village. select province first, , in turn shows regions in province, , on , forth. have spreadsheet @ http://www.316apps.com/fritch/dropdown.xlsx has information, not sure how convert datasource , implement in uipickerviews. advice on this?

database - Mysql query to get count result and group by -

i've got 3 tables different records users, user username | realname | date evn-az-3ju john 11/2012 03:09:40 p.m. jwyvm_rdyt steve 12/2012 03:09:40 p.m. bsmiatwkhi mahesh 01/2013 03:09:40 p.m. zrobzh4um0 santa 01/2013 03:09:40 p.m. wyvm_rdyt grolsch 11/2012 03:09:40 p.m. offline username | messageid | message jwyvm_rdyt 54 <message to="jwyvm_rdyt" id="t4wa4-291" type="chat" from="evn-az-3ju"><body>test1</body><thread>1a327531-5a1c-4d6b-8b66-1209cdabb77d</thread></message> jwyvm_rdyt 78 <message to="jwyvm_rdyt" id="t4wa4-290" type="chat" from="evn-az-3ju"><body>happy birthday</body><thread>1a327531-5a1c-4d6b-8b66-1209cdabb77d</thread></message> evn-az-3ju 89 <message to="evn

javascript - Send two forms with one button and than redirect to third action -

is possible submit simultaneously 2 forms different actions? in actions want set tempdata , redirect third action. i tried method described here submit 2 forms 1 button let's suggest each form have 1 input field. first form "name" input, second "lastname" input submitforms = function(){ document.forms["formforfirstaction"].submit(); document.forms["formforsecondaction"].submit(); window.location("/home/thirdaction") } my actions looks like... [httppost] public void firstaction(string name) { tempdata["name"] = name; } [httppost] public void secondaction(string lastname) { tempdata["lastname"]=lastname; } public actionresult thirdaction () { string fullname; fullname = string.format((string)tempdata["name"] + (string)tempdata["lastname"]); return view(fullname);

utf 8 - Scala convert string between two charsets -

i have misformed utf-8 string consisting should written "michèle huà" outputs "michèle huÃ" according table problem between windows-1252 , utf-8 http://www.i18nqa.com/debug/utf8-debug.html how make conversion? scala> scala.io.source.frombytes("michèle huÃ".getbytes(), "iso-8859-1").mkstring res25: string = michèle huà scala> scala.io.source.frombytes("michèle huÃ".getbytes(), "utf-8").mkstring res26: string = michèle huà scala> scala.io.source.frombytes("michèle huÃ".getbytes(), "windows-1252").mkstring res27: string = michèle huà thank you you don't have complete string there, due unfortunate issue 1 character printing blank. "michèle huà" when encoded utf-8 read windows-1252 "michèle huà", last character 0xa0 (but typically pastes 0x20, space). if can include character, can convert successfully. scala> fixed = new string("mi

Why is the button click event fired despite it being disabled in Aurelia? -

i have following button want active (click enabled) when given condition met despite visually disabling button click event still fired when user clicks. <button class="btn btn-default" click.delegate="dosomething()" type="submit" disabled.bind="true"></button> [update] changed false true mistakenly inserted wrong flag when cleaning example post here. question still valid. you're binding disabled property value false, means attribute disabled not added button. if want button disabled, this: <button class="btn btn-default" click.delegate="dosomething()" type="submit" disabled.bind="true"></button>

Javascript - Playing sound on variable change -

i'll try explain as possible, i'm trying create instant messaging service website used privately group of people. i've got sending , receiving down pat, can't seem find work around notification sounds. what notification sound play when new message received. i've been fiddling 45 minutes, , i've tried looking around solution, can't seem find avail. here javascript: function update() { var xmlhttp=new xmlhttprequest(); var username = "<?php echo $ugt ?>"; var output = ""; var number = 0; var messages = msgarea.childelementcount / 2; xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { var response = xmlhttp.responsetext.split("\n") var rl = response.length var item = ""; (var = 0; < rl; i++) { item = response[i].split("\\") if (item[1