Posts

Showing posts from March, 2012

java - How to read full line while using line split? -

bufferedreader tableread = new bufferedreader(new filereader(tablefile)); while ((tableline = tableread.readline()) != null){ cnamedata = tableline.split(","); (int =0; i< cnamedata.length; i++){ system.out.println(cnamedata[i]); } } this code in mind takes line example, john, 23, male, , splits , puts array cnamedata, when prints out gives 23 , male only, how insert john array? in advance.

vb.net - Type Mismatch Error, declaring Range Variable in Excel VBA -

Image
this should simple fix, i've searched , searched , can't figure out wrong. i'm getting "run-time error 13: type mismatch": dim rng range dim endrw integer, endcol integer endrw = 30 endcol = 10 set rng = sheets("sheet1").range(sheets("sheet1").cells(2,3),sheets("sheet1").cells(endrw,endcol)) ^^^ last line causing error ^^^^ try set rng = sheets("sheet1").range(cells(2, 3), cells(endrw, endcol)) evidence.

php - My script does not recognize my IP -

i use geoiploc library . created simple script variables: $ip = $_server["remote_addr"]; $my_country_code = getcountryfromip($ip, "code"); and uploaded script server. result: variable $ip returns ip, , variable $my_country_code returns code of country, good! that same script uploaded server ( http://subdomain.my-domain.com , belongs job). result: variable $ip does not return ip, ip: 192.168.211.xxx. therefore, variable $my_country_code not return country code. in both cases use home pc. what's going on?

sqlite - distinct values as new columns & count -

i'm trying generate summary table using sqlite below. i need aggregate 1) number of times each model driven, 2) total distance driven & 3) distinct values driver col & count number of times each driver has driven particular model - group model with count(model) & sum(distance) 1 & 2 - `i need last part #3 , right approach find number of occurrences each distinct values of column , add them new columns each model ? my table is: id model datetime driver distance ---|-----|------------|--------|--------- 1 | s | 04/03/2009 | john | 399 2 | x | 04/03/2009 | juliet | 244 3 | 3 | 04/03/2009 | borat | 555 4 | 3 | 03/03/2009 | john | 300 5 | x | 03/03/2009 | juliet | 200 6 | x | 03/03/2009 | borat | 500 7 | s | 24/12/2008 | borat | 600 8 | x | 01/01/2009 | borat | 700 result be id model| drives distance john juliet borat ---|-----|--------|---------|------|------ |------ 1 | s | 2 | 999 | 1 |

generics - Can a Java argument be type-bound by a Class contained in another object? -

note: question theoretical; i've since given on using immediately , i've thought overcomplicates code , smells little antipattern. however, find interesting in theory , love community's it. i'm refurbing code written around turn of century image manipulation; beginning chopping apart single class lot of redundancies number of bifunction filters. each accept bufferedimage , intensity (double), , return new bufferedimage. of course, lot of these image filters have additional concerns, radius-of-effect or intensity, , if i'm going chain them efficiently, able set these "uniforms" (or quasi-constants) before use. my current method extend imagefilter class further, , set uniforms bean-style properties. thought of doing constraining them generic class held in interface, , having along lines of: public void addproperty(uniform<t> property, t type) in there, t specified entirely uniform. the original class kept of these uniforms in hashmap stri

android - Sqlite database update after async post not working -

i using httppost method send message android device via web server. when response comes back, device supposed update on-board database format i've used million times, if(postmessage(themessage).trim().equals("ok")){ databasehelper helper = new databasehelper(sharedialog.this); database = helper.getwritabledatabase(); strsharedwith = strsharedwith + thenameencoded+ "|~|";//my delimiter; string strfilter = "listtitle= '" + listtitle + "'"; contentvalues values = new contentvalues(); values.put("sharedwith", strsharedwith); int numrows = database.update("listdata", values, strfilter, null); database.close(); toast.maketext(getbasecontext(), numrows + "", toast.length_short).show();//toasts "1" everything appears work: message sent other device, response comes web server, , toast message indicates 1 row has been updated...but value remains null. see i'm missing? thanks

go - How to measure both before and after byte size and time to compress -

i want gzip string (it json response) var b bytes.buffer gz := gzip.newwriter(&b) if _, err := gz.write([]byte("yourdatahere")); err != nil { panic(err) } how can output size of bytes before , after compression , more importantly how can time takes compress , decompress string? you can calculate size per nipun talukdar's comment. len([]byte("yourdatahere")) b.len() and use time.now() , time.since() time taken. var b bytes.buffer input := []byte("yourdatahere") fmt.println("input size : ", len(input)) gz := gzip.newwriter(&b) start := time.now() gz.write(input) if _, err := gz.flush(); err != nil { panic(err) } totaltime := time.since(start) fmt.println("compressed size : ", b.len(), "\ntime taken : ", totaltime) gz.close() same method can applied unzipping. can create support function can timing. func timer(starttime time.time) { totaltime := time.since(starttime

Assembly: printf not printing new line -

i have following code prints number of parameters passed ./main . notice fmt in rodata section. i've included new line \n , in c , instead of printing new line, prints: number of parameters: 1 \n my code is: ;main.asm global main extern printf section .rodata: fmt db "number of parameters: %d \n", 0 section .text: main: push ebp mov ebp, esp ;stackframe push dword[ebp+8] ;prepara los parametros para printf push fmt call printf add esp, 2*4 mov eax, 0 ;return value leave ;desarmado del stack frame ret i know including 10 before 0 , after "number..." in fmt print it, want printf it. assemble code nasm , link via gcc create executable. when use quotes or double quotes around string in nasm , doesn't accept c style escape sequences. on linux can encode \n ascii 10 this: fmt db "number of parameters: %d", 10, 0 there alternative. nasm supports back

ios - Calling Ti.App.getArguments() crashes app when launched via new App Shortcuts -

i testing out new support application shortcuts announced on forums here: http://www.appcelerator.com/blog/2015/11/ios-9-3d-touch-sample-app/ i have shortcuts showing when press on app icon - perfect. however app launches crashes. , reason when app launched or resumed perform checks incoming parameters using ti.app.getarguments(). and bug rendering new 3d touch features released in november last year useless live app. i reported issue on jira last month still sitting in inbox , not getting attention. how attention on bug? @ least acknowledged , out of inbox? here ticket in jira: https://jira.appcelerator.org/browse/ac-3428

c - What is the purpose of pthread and the select () function? -

our professor gave code in class: st = select(max+1, &rs, null, null, &timeinterval); if(st){ for(int i=0; i<workers; i++) { if(fd_isset(channels[i]->read_fd(), &rs)) and have hard time trying understand it's doing. i've tried research more pthreads nothing seems show explain doing. says has file descriptors don't how being in code. the purpose of select wait on multiple file descriptors, possibly time out, when returns positive number, means @ least 1 fd in rs set becomes ready reading, in loop, check fd it, , performs read on it. note, should check bigger 0 instead, because -1 returned in case of error, should not check fd_set handle error: if(st > 0) { for(int i=0; i<workers; i++) { if(fd_isset(channels[i]->read_fd(), &rs)) { // perform read on channels[i]->read_fd } } } else if (st == 0) { // handle time out } else { // handle erro

javascript - Adding properties to an object using function and bracket notation -

i have assignment on basic javascript class i'm taking , can't seem work. have unit test given me: describe('addsixthproperty', function() { it('should add food property value of bbq using bracket notation', function() { expect(objects.addsixthproperty()['food']).to.equal('bbq'); }); }); i given empty function: // don't touch line var mysticalanimal = objects.mysticalanimal(); function addsixthelement(){ return } so tried this: var mysticalanimal = objects.mysticalanimal(); objects.addsixthproperty = function(){ mysticalanimal['food'] = "bbq"; return mysticalanimal["food"]; }; it doesn't work. our test page doesn't pass that. appreciated! thanks in advance! you're returning mysticalanimal['food'] , , test tries access ['food'] again, ends accessing 'bbq'['food'] , undefined . need return mysticalanimal , letter case

Enable JMX on Kafka Brokers -

i enabled jmx on kafka brokers adding `kafka_jmx_opts="-dcom.sun.management.jmxremote=true -dcom.sun.management.jmxremote.authenticate=false -dcom.sun.management.jmxremote.ssl=false -djava.rmi.server.hostname=<server_ip> -djava.net.preferipv4stack=true`“. however, when use ‘kafka.tools.jmxtool’ metrics, outputs unix time stamps not expected behavior. sh /usr/local/kafka/bin/kafka-run-class.sh kafka.tools.jmxtool -- object-name 'kafka.server:type=brokertopicmetrics,name=alltopicsmessagesinpersec' --jmx-url service:jmx:rmi:///jndi/rmi://<server_ip>:9111/jmxrmi the above command prints out unix time stamps. how can fix , have print out metrics? you must set 'jmx_port' variable, or add following line bin/kafka-server-start.sh. export jmx_port=${jmx_port:-9999} then able connect kafka jmx metrics. use jconsole tool , 'localhost:9999' address.

linux - Eclipse GCC C Cross Compiling for OpenWrt not working -

i beginner in both linux , openwrt. sorry if stupid question. i following tutorial : https://downloads.openwrt.org/docs/eclipse.pdf chip : mt7620 toolchain prefix : mipsel-openwrt-linux- toolchain path : /ligo/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14 code: #include <stdio.h> void main() { printf("hello world"); } error: **** build of configuration debug project hello **** make building target: hello invoking: cross gcc linker mipsel-openwrt-linux-gcc -l/ligo/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/lib -o"hello" ./main.o mipsel-openwrt-linux-gcc: warning: environment variable 'staging_dir' not defined mipsel-openwrt-linux-gcc: warning: environment variable 'staging_dir' not defined /ligo/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/lib/gcc/mipsel-openwrt-linux-musl/5.3.0/../../../../mipsel-openwrt-linux-musl/lib/crt1.o: in function `_sta

python - Create subset of large CSV file and write to new CSV file -

i create subset of large csv file using rows have 4th column ass "dot" , output new file. this code have: import csv outfile = open('dot.csv','w') open('service_requests_2015_-_present.csv', newline='', encoding='utf-8') f: reader = csv.reader(f) row in reader: if row[3] == "dot": outfile.write(row) outfile.close() the error is: outfile.write(row) typeerror: must str, not list how can manipulate row able straight write(row), if not, easiest way? you can combine 2 open statements, statement accepts multiple arguments, this: import csv infile = 'service_requests_2015_-_present.csv' outfile = 'dot.csv' open(infile, encoding='utf-8') f, open(outfile, 'w') o: reader = csv.reader(f) writer = csv.writer(o, delimiter=',') # adjust necessary row in reader: if row[3] == "dot": writer.writerow(row) # n

datasource - Transaction TimeOut when we are using JPA Paging Item reader in Spring batch -

can stuck here...please find logs below: 2016-04-18 18:13:57,645 warn [[standby] executethread: '3' queue: 'weblogic.kernel.default (self-tuning)'] o.h.e.t.s.i.synchronizationcallbackcoordinatortrackingimpl [jdklogger.java:64] hhh000451: transaction aftercompletion called background thread; delaying aftercompletion processing until original thread can handle it. [status=4] 2016-04-18 18:13:57,646 castxn-735623935340919 warn [simpleasynctaskexecutor-1] o.h.e.j.s.sqlexceptionhelper [jdklogger.java:44] sql error: 0, sqlstate: null 2016-04-18 18:13:57,647 castxn-735623935340919 error [simpleasynctaskexecutor-1] o.h.e.j.s.sqlexceptionhelper [jdklogger.java:44] unexpected exception while enlisting xaconnection java.sql.sqlexception: transaction rolled back: transaction timed out after 30 seconds bea1-018b7b77ba5e55afe704 @ weblogic.jdbc.jta.datasource.enlist(datasource.java:1760) @ weblogic.jdbc.jta.datasource.re

javascript - CreateJS - Type not recognized error thrown during sound registration -

i trying load sounds through soundjs sound registration, , getting following error: createjs.js:15 uncaught error: type not recognized. i figure soundjs library having issues either locating files or having trouble file extensions, using .ogg, inline examples i've seen. here code: createjs.sound.alternateextensions = ["mp3", "ogg"]; createjs.sound.on("fileload", function(event) { console.log(event); }, this); (var = 0; < soundmanifest.length; i++) { soundmanifest[i].loaded = false; console.log("loading " + soundmanifest[i].src); createjs.sound.registersound(soundmanifest[i].src, soundmanifest[i].id) } soundmanifest array of objects source item giving path .ogg files, , id. i've double , triple checked path names, pretty sure that's not it. ideas? developing on chrome. thanks posting github link. helpful. fortunately, have super simple answer you. rename "object" class made in mai

security - Running windows shell commands NASM X86 Assembly language -

i writing simple assembly program execute windows commands. attach current working code below. code works if hard code base address of winexec function kernel32.dll, used program called arwin locate address. reboot breaks because of windows memory protection address space layout randomization (aslr) what looking find way execute windows shell commands without having hard code memory address code change @ next reboot. have found similar code around nothing either understand or fits purpose. know can written in c using assembler keep size small possible. thanks advice/help. ;just runs simple netstat command. ;compile nasm -f bin cmd.asm -o cmd.bin [bits 32] global _start section .text _start: jmp short command function: ;label ;winexec("command execute",null) pop ecx xor eax,eax push eax push ecx mov eax,0x77e6e5fd ;address found arwin winexec in kernel32.dll call eax xor eax,eax push eax mov eax,0x7c81cafa call

MYSQL - how to get previous row value if current value is zero -

i have table called value_record below id | record_id | value | servertime 1 | 20 | 0 | 2016-04-19 04:51:16 2 | 20 | 0 | 2016-04-19 04:40:19 3 | 20 | 0 | 2016-04-19 04:27:34 4 | 20 | 70 | 2016-04-19 04:14:24 5 | 20 | 50 | 2016-04-19 04:02:21 .. select value value_record record_id in(20) order servertime desc limit 1; output : 0 but expected output is: 70 it means if current value 0 query go previous row not 0 , display non 0 value. how achieve in mysql? you need filter values different 0 , don't need in clause: select `value` value_record record_id = 20 , `value` > 0 order servertime desc limit 1;

java - Infinite loop when trying to read and create a file -

this java code compiles. when ran program, lasted long time , didn't results, , said runofoutspace, guess fell infinite loop, cannot figure out why. import java.util.*; import java.io.*; public class exercise3{ public static void main (string[] args){ file infile = new file(args[0]); file outfile = new file("ex3.txt"); try { scanner scan = new scanner(infile); arraylist<string> readfile = new arraylist<string>(); string findword = args[1]; string replaceword = args[2]; while(scan.hasnextline()) { readfile.add(scan.nextline()); } //system.out.println(readfile); (int i=0; i<readfile.size();i++) { string n = readfile.get(i); n = n.replaceall(findword,replaceword); readfile.add(i,n); } printwriter output = new printwriter(outfile); (int i=0; i<readfile.size();i++) { output.println(readfile.get(i)); } output.close(); scan.close(); } catch (filenotfoundexception e){ system.err.println("file n

javascript - Nested views in marionette.js when creating a table -

i have 2 collections: "collection" , "collection2". can't figure out how render both of these collections table, keep them in separate views. example: row1: group 1, row2: first collection object row3.. second collection object .... row 4 group 2, row 5 first collection2 object row 6 second collection2 object .... please js (function() { // here's list of objects displaying var = json.parse('{"type":"report","limit":20,"offset":0,"data":[{"group":"platform","detail":[{"reason":"invalid issuer","errorcode":"123456","total":"1","realtotal":"1","nonrecurring":"1","recurring":"0"},{"reason":"declined","errorcode":"111111","total":"1","realtotal":

javascript - how to update ng-model of textarea after manual insert of some text into it -

i have code takes input input area , inserts text @ caret position inside text area, insert part working accurately ng-model of text area fails update same. here code var app = angular.module('plunker', []); app.controller('myctrl', function($scope, $rootscope) { $scope.items = []; $scope.add = function() { $scope.items.push($scope.someinput); $rootscope.$broadcast('add', $scope.someinput); } }); app.directive('mytext', ['$rootscope', function($rootscope) { return { link: function(scope, element, attrs) { $rootscope.$on('add', function(e, val) { var domelement = element[0]; if (document.selection) { domelement.focus(); var sel = document.selection.createrange(); sel.text = val; domelement.focus(); } else if (domelement.selectionstart || domelement.selectionstart === 0) { var startpos = domelement.selection

mongodb - Middleware does not redirect to page on success of auth attempt.Using laravel 5.2 and Mongo DB -

this in routes route::post('companylogin','auth\authcontroller@companylogin'); route::group(['middleware' => 'auth'], function () { route::get('dashboard',['uses' => 'pagecontroller@dashboard' , 'as' => 'dashboard']); }); this controller: <?php namespace app\http\controllers\auth; use app\user; use validator; use app\http\controllers\controller; use illuminate\foundation\auth\throttleslogins; use illuminate\foundation\auth\authenticatesandregistersusers; use illuminate\support\facades\input; use illuminate\support\facades\redirect; use illuminate\support\facades\request; use illuminate\support\facades\auth; use view; class authcontroller extends controller { public function companylogin() { $userdata = array( 'email' => input::get('email'), 'password' =>input::get('password')); $isauth = au

Automated testing for tmLanguage and sublime-syntax files? -

is possible create automated tests *.tmlanguage or *.sublime-syntax file? best practices doing that? i'd use sublimelinter plugins, since instant feedback while working on file. xmllint works *.tmlanguage , , pyyaml *.sublime-syntax . personally, i'm using gruntfile test packages, that's not integrated using sublimelinter. however, can used travis ci , likes.

ios - XMPP multi device sync with xmpp chat message -

xmpp multi device sync : trying develop messaging application using xmpp. trying implement chat sync on multiple devices per user. able messages on logged devices or first offline device logs in. different devices use different resource full jabber id different. if using xmppframework in ios, can add xmppmessagecarbons extension var xmppmessagecarbon = xmppmessagecarbons() xmppmessagecarbon?.autoenablemessagecarbons = true xmppmessagecarbon?.adddelegate(self, delegatequeue: xmppqueue) xmppmessagecarbon?.activate(xmppstream) and implement delegates func xmppmessagecarbons(_ xmppmessagecarbons: xmppmessagecarbons!, willreceive message: xmppmessage!, outgoing isoutgoing: bool) { } func xmppmessagecarbons(_ xmppmessagecarbons: xmppmessagecarbons!, didreceive message: xmppmessage!, outgoing isoutgoing: bool) { }

amazon web services - Difference between RDS and Redshift -

can list down main differences between amazon redshift , rds? know both relational db's why choose 1 on other ? rds managed service online transaction processing databases (oltp), i.e. managed service usual mysql, postgresql, oracle, mariadb, microsoft sql server or aurora (amazon's own relational database) redshift managed service data warehousing, i.e. columnar oriented storage, typical business analytics type of workloads.

codeigniter - How to Setup Recurring Payments -

how can integrate recurring payment in paypal using codeigniter platform.can share tutorial this. <form id="fpaypal" method="post" name="paypal_form" action="<?= $paypal_url ?>" style="display: none"> <!-- paypal configuration --> <input type="text" name="business" value="<?= $this->preparetodisaplay($settings_list['paypalemail']->value) ?>"> <br /> <?php if($recurring) { ?> <input type="text" name="cmd" value="_xclick-subscriptions"><br/> <input type="text" name="a3" value="<?= $camp_member_info->total ?>"><br/> <input type="text" name="p3" value="1"><br/> <input type="text" name="t3" value="m"><br/> <input type="text" name="

c# - Mapping XML to another XML -

our system acts middleware between several different systems. requires working several differently formatted , laid out xml files contain (roughly) same information. handled via middleware knowing of formats. becoming unmanageable , want replace path allows our system work standard format, , convert our client files , using transformer layer. however, have lot of clients coming on board (hence rework), , reduce amount of developer work minimum per client. on investigation, can see 3 primary ways of doing this: a) use xslt transformer. handle each client , xml file separately. pros: clear understand, little overhead during runtime, simple text conversion, can dropped , uploaded, can largely reused if client formats happen similar. cons: requires lot of work xml files converted per client. can technically done non-developer. b) utilise automapper: create initial classes our format, run client files through xml -> poco generator, , create profiles each of them. pros: simple u

Mysql not logging in a new mysq.log file -

i've enabled logging in dev environment follows: general_log_file = /var/log/mysql/mysql.log general_log = 1 but problem whenever server creates new mysql.log file, new log doesn't record mysql activities have restart mysql service , starts logging activities being on production cannot everyday restart mysql service. have checked newly created mysql.log file mysql:adm.

html - Set buttons at the rightmost part of the page -

sorry if such simple question i'm having hard time when comes css , stuff that. so question how put these 2 buttons @ rightmost part. that. here code: echo "<div class='container table-responsive'> <table style='width:100;'> <tr> <td align='right'> <h5>".$filename2."</h5> </td> <td> <button type='button' class='btn btn-info btn-sm' data-toggle='modal' data-target='#$id'> <span class='glyphicon glyphicon-search'></span> view </button> <div id='$id' class='modal fade' role='dialog&#

Spark streaming scala window length by number of objects -

i using spark , scala , create window operation length set in number of objects i.e. window starts empty, stream initiates objects stored in window until holds 10 objects , when 11th comes first dropped. is possible or have use other structure list or array? documentation ( http://spark.apache.org/docs/latest/streaming-programming-guide.html#window-operations ) , googling refer time based window (length , interval). thank in advance. window in spark streaming characterized windowduration , slideduration (optional). so, time window. can consider using apache flink . supports both count windows , time windows . in comparison spark, flink has streaming ideology. process incoming events arrive (spark processes events in micro-batches). result, flink may have restrictions. give try if suits needs.

javascript - How to make modal window open dynamic content and change url? -

i make modal window open different routing website http://architizer.com/projects/rauchkuchlhaus-auf-der-seewiese-am-schliersee-1/ the flow is: create route state modal window put modal opening logic inside onenter property (will running when route changed current state). finally items(which should open new modals) should have references change route needed parameters ui-sref="home({foo: 'fooval1'})" . you can find answer in common questions ui-router modal $stateprovider.state("items.add", { url: "/add", onenter: ['$stateparams', '$state', '$modal', '$resource', function($stateparams, $state, $modal, $resource) { $modal.open({ templateurl: "items/add", resolve: { item: function() { new item(123).get(); } }, controller: ['$scope', 'item', function($scope, item) { $scope.dismiss = function() { $scope.

javascript - Why JSON Object Serialization is needed or important sending in ajax call to the server? -

i have seen @ several places developers using json.stringify(data) while making ajax call server serialization of post data in json string, why needed ? $.ajax({ url: url, type: "post", data: json.stringify(data), contenttype: "application/json", complete: callback }); several modern frameworks capable directly bind json data structures model businesses, allows incredibly fast , easy relationship between client , server data models. this way can work feely on client side js objects, on moment send data server via ajax, stringify these objects allow server end understand them, , in automatic way server able translate info server data classes, without further interaction needed (of course, need defined classes compatible client model data structures).

angularjs - Custom directive not outputting correct result -

i have following custom directive customerdirective : var app = angular.module('directiveapp', []); var dircontroller = app.controller('directivecontroller', function() { this.customer = { name: 'james', address: 'mellieha' }; }); dircontroller.directive('customerdirective', function() { return { template: 'name: {{customer.name}} address: {{customer.address}}' }; }); and invoked in index.html follows : <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>example - example-example12-production</title> <script src="../../bower_components/angular/angular.min.js"></script> <script src="directive.js"></script> </head> <body ng-app="directiveapp"> <div ng-controller="directivecontroller"> <div custome

how to create hive table with line separator other than \n -

my data field contains newline characters in it. need include these newline character in data. possible create hive table embedded newlines? add lines terminated '\n' create command , replace \n char like. but first result find @ google...

web services - Is Facebook generating new webpage for every user accounts or they just using 1 webpage for every account? -

this question has answer here: create personal page every user, php 4 answers what happen if new user creates account in facebook ? facebook generate new web page it? or have 1 web page user account , of them accessing page when online? new in web development , want know if how facebook handling process when user created account. want know if every user has own web page generated server side scrip. , saved on server , access when online, or there only 1 web page on server , of user accessing page when online? i don't know exact details of how views shown facebook i.e. technologies use, don't have page each user sure. if want verify check url. loading different html document each request or each user? url change not request particular document, specify route mapped request server , new data retrieved , put appropriate place. take single pag

AutoMapper property name conversions -

i'm trying register mapping convention handle mapping classes pascal case names classes underscore names postfix , prefix, , again. i've tried follow examples, cannot head around how it's supposed work. this 1 of many things i've tried, looks should work (in opinion :)), doesn't seem anything: public class pascalcaseentity { public string callingsystem { get; set; } } public class underscorewithprefixandpostfixentity { public string p_calling_system_ { get; set; } } public class partsmappings { public void apply() { mapper.initialize(cfg => { cfg.addprofile<fromunderscoremapping>(); cfg.addprofile<tounderscoremapping>(); cfg.createmap<pascalcaseentity, underscorewithprefixandpostfixentity>() .withprofile("tounderscoremapping"); cfg.createmap<underscorewithprefixandpostfixentity, pascalcaseentity>() .withp

ajax - Should I use REST style URLs with PUT and DELETE in my web app? -

i have spa (single page application) uses ajax extensively getting , saving data , server. in 1 case allow admin view/add/edit/delete users. current urls area looked like: (get) /users?userid=1 // user id of 1 (post) /users?userid=1&firstname=jim // update first name of user id 1 (post) /users?firstname=bob // create new use first name bob (post) /users?userid=1&delete=true // delete user id of 1 having spent time working on restful api in related project, i'm wondering if it's preferred use http types (get, post, put, delete) in web app well. also, better use path parameter user id instead of query parameter? these urls (rewrite of ones above) better option in long run: (get) /users/1 // user id of 1 (put) /users/1?firstname=jim // update first name of user id 1 (post) /users?firstname=bob // create new use first name bob (delete) /users/1 // delete user id of 1 in theory yes should. should restful possible means using http

r - Counts by group and calculation/display of tables -

i have information science papers, there binary data on funding source (government (gvt) - yes/no), , categorical data on lead author nationality (lead). this code counts number of gtv funded papers per lead nation: gvt.funding=aggregate(data.frame(count=sysrev$gvt), list(value=sysrev$gvt),length) gvt.not=format(round(((gvt_funding[1,2]/(gvt_funding[1,2]+ gvt_funding[2,2]))*100),1),nsmall=1) gvt.yes=format(round(((gvt_funding[2,2]/(gvt_funding[1,2]+ gvt_funding[2,2]))*100),1),nsmall=1) this code produces following table: gvt.not gvt.yes gvt.not(%) gvt.yes(%) can 39 143 21.42857 78.571429 deu 7 7 50.00000 50.000000 dnk 9 35 20.45455 79.545455 gbr 10 5 66.66667 33.333333 jpn 2 8 20.00000 80.000000 nor 20 49 28.98551 71.014493 rus 13 1 92.85714 7.142857 usa 84 104 44.68085 55.3191