Posts

Showing posts from July, 2012

concurrency - Idea on building a live, serverless multi-user local-network-shared database with SQLite -

i need input on idea had. if you're interested/experienced in sqlite , lowest-budget-high-end-solutions (win ;)) you. while fleshing out question have gotten pretty excited idea, bear me. there's tl;dr below i have developed vb.net (3.5) desktop application sqlite. data structured in eav-model, because need flexibility (the semantic structure of data stored separately in xml file). application performs above expectations, - scenario @ hand - large database (about 120mb main file). as expected performance abysmal when sqlite file(s) on network folder. it's bearable have higher goals. expected scenarios (for now) max. 10 users need access database concurrently within local windows network. 98% of concurrence required heavy read-access, inserts , updates sparse , small. the software used exclusively within environments low budget , technical infrastructure (support , hardware) lower, goal avoid using database server. not want implement own sqlite "server" ...

java - Android: Random number decides players' turn -

i want create random integer between 1 , 2 (for player1 , player2). if it's 1, player 1 should win first move, , if it's 2, player 2 should win first move. tried this, it's not working: random generator = new random(); int rand = generator.nextint(2) + 1; if(rand == 1){ player1 = true; player2 = false; toast.maketext(getapplicationcontext(), playeronename + " won first move!", toast.length_short); } else { player1 = false; player2 = true; toast.maketext(getapplicationcontext(), playertwoname + " won first move!", toast.length_short); } it doesn't give errors, nothing happens. it's player 1 takes first move, , toast doesn't appear! first notice toast command not complete, , should be: toast.maketext(getapplicationcontext(), playeronename + " won first move!", toast.length_short).show(); then you'll have better on what's

Any API to get notification before any file gets deleted in Android -

i want recover file has been deleted recently. there api in android notify before file gets deleted or recover deleted files? thanks in advance no, there no such api, can use file observer notified file deletion

c# - WPF window content as content of another window -

i need show window inside tab of window , using following var childwindoweditor = new mainwindow(); //window embed object content = childwindoweditor.content; //take out content of window embed childwindoweditor.content = null; editortab.content = content; //just tab in tabbed group its working fine, problem if wanted access functions of window class? i know tha should create user control, there solution without having create content of window user control? would casting content window got content work? you should use mvvm pattern. viewmodel datacontext of childwindoweditor . editortab.datacontext = childwindoweditor.datacontext; and that's it. recommend use mvvm . makes life easier.

classcastexpetion when using android:layout_toStartOf -

i have listview until today have positioned 2 views: 1 imageview left of parent, , use textview positioned right of imageview. in xml use following code that: android:layout_torightof="@+id/single" , single imageview. ... no problem whatsoever :-) but today came new idea - want imageview in listview. positioned new view right side of parent (listview). android:layout_alignparentright="true" now small problem arised when did this: in cases have long sentence in textview overlappes new imageview. according android documentation found code: android:layout_tostartof="@+id/volume" , volume id new imageview. i thought work. end of means positions end edge of view start of given anchor view id. [reference] so thought everthing work when compiled , started test app app crashes when listview clicked. crash due classcastexception. imageview cannot cast textview so question why classcastexception? thing postion end edge of textview start o...

javascript - Use CouchDB with Node.js library -

couchdb uses javascript validate, query, map-reduce , on. i'd know there way use node.js library in these javascript functions? such use require('http') or third party modules installed npm . thanks. you can use node.js libraries long don't require node.js-specific libraries http . example, async works in couchdb. rule of thumb: if it's intended server and client, should good. you can use commonjs's module.exports , exports[something] patterns share code between views. check out the documentation more details. for example, consider view: { _id:"_design/test", views: { lib: { test: "exports.guests = 42;" }, fish_per_person: { map: function(doc){ var guests = require('views/lib/test').guests; // 42 emit(doc.number_of_fish, doc.number_of_fish / guests); } } } } the fish_per_person view requires value guests exported in lib/test .

java - Can't move MP3 file to a different folder -

i trying move mp3 files different folders using file.renameto() , keeps not working don't know why. can tell me doing wrong, please? file songsfolder = new file("songs"); file[] songslist = songsfolder.listfiles(); (int = 0; < allsongs.size(); i++) { //allsongs arraylist defined earlier file music = (file) songslist[i]; fileinputstream filemusic = new fileinputstream(music); int size = (int) music.length(); filemusic.skip(size - 128); byte[] last128 = new byte[128]; filemusic.read(last128); string id3 = new string(last128); string tag = id3.substring(0, 3); if (musicslist[i].isfile()) { file afile = songslist[i]; if (afile.renameto(new file("songs/" + id3.substring(33, 62).trim() + "/" + songslist[i].getname()))) { system.out.println("file moved successfully!"); } else { system.out.println("file failed move!"); } } } th...

c# - TcpClient ConnectAsync get status -

is there way can status of tcpclient async connection? using following code, how can status of client using connected property? try establish remote connection asynchronously in same time don't wait more 5 seconds ... tcpclient client = new tcpclient(); task tsk = task.factory.startnew(() => { client.connectasync(host, port); // client.connect (this false) }); tsk.wait(5000); // client.connect (or if use here, false) first off, not create new task of own; bug. connectasync returns task represents connection attempt: var tsk = client.connectasync(host, port); tsk.wait(5000); after wait returns, check iscompleted property of task; true if , if connection established.

Rails 4: upload attachments to Amazon S3 before saving model -

i have feature users can add notes, , every note can have multiple file attachments. when user clicks 'upload attachment', file begins uploading amazon s3 instantly (before users save note). done ajax. what best way (flow) make sure these amazons3 files linked note (when note submitted) or discarded if note isn't saved? i can think of 2 approaches: go ahead , save note, have column on model tells whether or not it's temporary. if user clicks save, change column temporary permanent. run rake task in background clear out temporary notes more day old, etc., if wanted that. put sort of reference in image's file name. can't use id, since won't exist yet, may have other unique identifiers such combination of username , post title. if can 1st option, i'd preferable. gives unique id note, has express purpose of making possible reference note externally.

ios - Convert NSString with format Tue, 27 Aug 2013 22:22:04 EDT to NSDate -

i trying convert nsstring following format: tue, 27 aug 2013 22:22:04 edt nsdate getting nil . here's attempt // pub date in string** nsstring *pubdate = @"tue, 27 aug 2013 22:22:04 edt"; nsarray *temparr =[ pubdate componentsseparatedbystring:@" "]; nsmutablearray *temparrfinal = [nsmutablearray arraywitharray:temparr]; [temparrfinal removelastobject]; [temparrfinal removeobjectatindex:0]; pubdate = [temparrfinal componentsjoinedbystring:@" "]; here before passing date formatter converted nsstring format this: 27 aug 2013 22:22:04 removing first n last component of string. i've done because original format getting same result. this how trying o convert nsdate : nsdateformatter *formatter = [[[nsdateformatter alloc] init] autorelease]; [formatter setdateformat:@"mmm dd yyyy hh:mm:ss"]; [formatter setdatestyle:nsdateformatterlongstyle]; articledate = [formatter datefromstring:pubdate]; you have set nsdatefo...

ios - Using my NavigationController with my ECSlidingViewController -

Image
what i'm trying do if started creating app. i've got navigationcontroller rootviewcontroller . when app started open loginviewcontroller . in there login-procedure , if fine. i'll start ecslidingviewcontroller . has menu ( uitableview ) , mainview ( uitableview ). until here working fine. can swipe , show's menu. problem starting. when press menu-item starts new viewcontroller , show's content. there still show's same navigationbar - in ecslidingviewcontroller . got no possibility tell user looking at, need show him new options in navigationbar . question how can fix problem? i'd show navigationbar of specific viewcontroller i'm using. if guy's have codesnippets or idea how handle problem. please leave comment bellow. if need codesnippets or else, tell me i'll upload it! thank in advance! code this how start ecslidingmenu: [self performseguewithidentifier:@"loginpush" sender:self.view]; this how i'll...

java - Why ArrayList giving unordered output? -

i have written java program, add integer in arraylist , remove integer arraylist . not giving me proper result. here code.. public static void main(string args[]) { arraylist<integer> a=new arraylist<integer>(); a.add(6); a.add(7); a.add(8); a.add(9); for(int i=0;i<=a.size();i++) { system.out.println("removed elements=>"+a.remove(i)); } } it giving me output follows removed elements=>6 removed elements=>8 exception in thread "main" java.lang.indexoutofboundsexception: index: 2, size: 2 @ java.util.arraylist.rangecheck(arraylist.java:547) @ java.util.arraylist.remove(arraylist.java:387) @ collectiontemp.main(collectiontemp.java:19) why getting output this? your array: a[0]=6 a[1]=7 <-- a[2]=8 a[3]=9 then remove @ 1, , increments 2: a[0]=6 a[1]=8 a[2]=9 <-- remember array indexes start @ 0, last element @ a.length - 1 you exception because loop c...

javascript - Why does $httpbackend.flush cause my $scope.$watch to fire indefinitely? -

when running jasmine unit test angular controller, fails message 'error: 10 $digest() iterations reached. aborting!' when $httpbackend.flush() called. this controller: theapp.controller("myctrl", function($scope, $http, globalstate){ $scope.currentthing = globalstate.getcurrentthing(); $scope.success = false; $scope.$watch(globalstate.getcurrentthing, function(newvalue, oldvalue){ $scope.currentthing = newvalue; }); $scope.submitstuff = function(thing){ $http.put('/api/thing/putthing', thing, {params: {id: thing.id}}) .success(function(){ $scope.success = true; }) }; }); this unittest: describe('myctrl', function(){ var mycontroller = null; beforeeach(angular.mock.module('theapp')); beforeeach(inject(function($injector){ $rootscope = $injector.get('$rootscope'); scope = $rootscope.$new(); ...

php - Adding a hyperlink to every comment -

here image of comment format: http://oi40.tinypic.com/8w07jt.jpg the hyperlink each individual comment date , time url in format of, example: /nottingham/#comment-184 after going through comment templates found these 2 functions following, get_comments_link : retrieves link current post comments and comments_link: displays link current post comments the problem have no idea include these functions creates hyperlink every comment within every comment. once link has been created i'd assign div can format in bottom right corner of each comment. my final goal manipulate link rather comment link automatically work in facebook.com/sharer.php feel can myself once figure out previous part. share on facebook button, have found no plugins yet , thought describing hyperlink easier way explain i'm trying do. elsewhere i've been told following: not sure how implement this... in functions.php i'd add 'get_comments_link' filter return desired link, in...

osx - Create mac DMG file on windows -

we've got application produces installer windows , mac (app works under windows). finished, last step create dmg. possible on windows? problem solved. i've used mkisofs create dmg. gradle script produces dmg file: apply plugin: 'base' task build << { if (!project.hasproperty('dmgbuilddir')) { project.ext.set('dmgbuilddir', builddir.absolutepath) } def mkisofs = new file(project.projectdir, 'src/main/resources/mkisofs.exe').getabsolutepath() ant.exec(executable:mkisofs, failonerror: false, resultproperty: 'builddmgrc') { arg(value: '-j') arg(value: '-r') arg(value: '-o') arg(value: dmgname+'.dmg') arg(value: '-mac-name') arg(value: '-v') arg(value: dmglabel) arg(value: '-apple') arg(value: '-v') arg(value: '-dir-mode') arg(value: '...

rdf - How do you create a Fuseki SPARQL server using the Apache Jena Java API? -

i trying create fuseki sparql server on machine. documentation on jena website describes how create such server command-line, here: http://jena.apache.org/documentation/serving_data/ . looking way of creating , initializing such server using jena java api. have looked on jena api have not made progress in working out how proceed. has done before? yes possible not how fuseki designed operate so @ own risk. you need pull in fuseki dependency, via maven following: <dependency> <groupid>org.apache.jena</groupid> <artifactid>jena-fuseki</artifactid> <version>0.2.7</version> </dependency> then can use sparqlserver class create server , call start() run server , stop() when done. (this located in org.apache.jena.fuseki.server package) it important note if server embedded in jvm start it, when jvm shuts down server shuts down. may intention may not. btw question unclear why want this? there may alternative way...

c++ - In C++11, how to print a character given its Unicode code? -

i sure dumb question, there straightforward way print unicode character in c++ given hex code? instance: know code ❤ 0x2764. there way can use code print (either via printf or on stream)? for record, can print character writing: cout << "\u2764" << endl; but requires knowing value @ compile time rather using variable. thanks from comment see you're on os x, uses utf-8 , has sufficiently complete implementation of c++11 library (libc++) following work. #include <codecvt> // wstring_convert, codecvt_utf8 #include <iostream> // cout int main() { std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> convert; std::cout << convert.to_bytes(static_cast<char32_t>(0x2764)) << '\n'; } this depends on console working utf-8, os x's does.

Opengl: low fps when using texture -

after setting texture there 20fps before aplying texture 300fps my code: void loadtex() { gluint texture; hbitmap gltex; bitmap tex; byte texture=tex; glgentextures(sizeof(texture), &texture); gltex= (hbitmap)loadimage(getmodulehandle(null),makeintresource(texture), image_bitmap, 0, 0, lr_createdibsection); getobject(gltex,sizeof(tex), &tex); glpixelstorei(gl_unpack_alignment,4); glbindtexture(gl_texture_2d, texture); gltexenvf( gl_texture_env, gl_texture_env_mode, gl_modulate ); gltexparameterf( gl_texture_2d, gl_texture_min_filter,gl_linear_mipmap_nearest ); gltexparameterf( gl_texture_2d, gl_texture_mag_filter, gl_linear ); glubuild2dmipmaps(gl_texture_2d, 3, tex.bmwidth, tex.bmheight, gl_rgb, gl_unsigned_byte, tex.bmbits); deleteobject(gltex); } as can see load texture resourcs file. call loadtex() in main winapi loop. the second problem texture bit transparent takes color face behind , mixes itsel...

html - Help_File in C# -

i'm using ms visual studio pro 2012 , want create kind of file. i thinking in create html file this question is: need have html file in directory, after have .exe file created or html file added .exe file? if not, how can done? [.net framework 4.5 | windows forms] edit : want load given (local) html file in default web browser. file should 'inside' .exe file. if you're looking build file visual studio, why not at: http://shfb.codeplex.com/ sandcastle build file based on comments have written on classes , methods. hit forward slash 3 times (e.g. / ) above class or method declaration , comment box appear. populate salient details, run sandcastle, , file generated.

javascript - Highcharts combining a column and spline chart from an html data table -

Image
is possible show first series column, , second spline - in html table based highcharts chart? eg. following link: http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/column-parsed/ - shows 2 data series, both columns. how change code below, show first column, , second spline? $(function () { $('#container').highcharts({ data: { table: document.getelementbyid('datatable') }, chart: { type: 'column' }, title: { text: 'data extracted html table in page' }, yaxis: { allowdecimals: false, title: { text: 'units' } }, tooltip: { formatter: function() { return '<b>'+ this.series.name +'</b><br/>'+ this.y +' '+ this.x.tolowercase(); } } }); }); <script src="http://code.highcharts.com/highcharts.js...

windows - Running a php script with a .bat file -

i need run php script @ midnight every night on server. on linux system i'd set cron job, i'm stuck windows system. i know have set task using windows task scheduler, , task need run .bat file in turn run php file, i'm stuck trying write .bat file. what have is: @echo off rem command runs nightly cron job start "c:\program files (x86)\php\v5.3\php.exe" -f c:\inetpub\wwwroot\sitename\crons\reminder-email.php but when try manually run .bat file test it, windows alert saying "windows cannot find '-f'. make sure typed name correctly, , try again. what have missed? the start command optionally accepts title created window first argument; in case, thinks c:\program files (x86)\php\v5.3\php.exe title display , -f (the second argument) executable want run. you can therefore fix providing placeholder title, e.g. start "email reminder task" "c:\program files (x86)\php\v5.3\php.exe" -f c:\inetpub\wwwroot\si...

javascript - Grunt Combine Media Queries - Cannot call method "join" of undefined -

i found grunt combine media queries plugin morning , have been looking @ getting running on build we've got stupid amount of media query declarations in our css (204 - we're using sass) i'd reduce. cmq: { options: { log: true } , your_target: { files: { '<%= meta.csspath %>temp': ['<%= meta.csspath %>hayes.css'] } } } csspath dir css in. when run grunt cmq following error: processed media queries: @media screen , (-webkit-min-device-pixel-ratio: 0) @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) @media screen , (min-device-pixel-ratio: 2) @media screen , (-webkit-min-device-pixel-ratio: 1.5), screen , (-moz-min-device-pixel-ratio: 1.5), screen , (min-resolution: 240dpi) @media (max-width: 767px) , (min-width: 768px) @media (min-width: 768px) , (max-width: 979px) @media (min-width: 768px) @media (min-width: 768px) , (max-width: 767px) @media (min-width: 768px) , (m...

How do Hadoop ChainMapper and ChainReducer reduce disk IO -

i want chain multiple mapreduce jobs i.e. previous mapreduce job's output input of next mapreduce job. because output large , disk io overload heavy, find alternative solution reduce io bottleneck. found chainmapper/chainreducer api. document mentioned following properties "using chainmapper , chainreducer classes possible compose map/reduce jobs [map+ / reduce map*]. , immediate benefit of pattern dramatic reduction in disk io." but don't quite understand why using chainmapper/chainreducer reduce disk io. , reduce io, how should use these 2 apis? as per understanding, though have multiple mappers, chain mapper considers them single task.till task complete,there no intermediate write. see below statement javadoc. the mapper classes invoked in chained (or piped) fashion, output of first becomes input of second, , on until last mapper, output of last mapper written task's output.

c# - How to use Composition instead of Inheritance? -

i have configurator class that, in order work, must receive context object via interface: public class configurator : icontextaware { private icontext _context; //property setter defined icontextaware interface public icontext context { set { _context = value; } } // use _context object in other methods here ... } i plan write many configurator types, need initalize _context fields same way. first thought "why not anger every programmer on internet , use inheritance"? public class contextinitializer: icontextaware { // field hold injected context protected icontext _context; //property setter defined icontextaware interface public icontext context { set { _context = value; } } } public class configurator : contextinitializer { // use _context object here ... } this way, other classes write need context object can inherit contextinitializer, , use context object straight away. pros: guaranteed consistent initializatio...

javascript - carousel selected item highlight when we click on it (using jQuery) -

Image
i using twitter bootstrap carousel, when user select 1 item carousel , want make size bigger, for example : i have html : <ul class="thumbnails" data-bind="foreach: achievementitem"> <li class="span3"> <div class="thumbnail" tabindex="1"> <div data-bind="click: $root.getachievement"> <img data-bind="attr: { src: imagefilename, id: 'thumbnail' + soid }" src="../images/defaultphoto.png" id="thumbnail521dfe57d94eaf0900bf5355"> </div> <img src="../images/trashicon.png" class="trash" data-bind="attr: { id: 'trash' + soid }, click: $root.deleteachievement" id="trash521dfe57d94eaf0900bf5355"> </div> <div class="caption"> <h5 data-bind="attr: { title: title, id: 'caption...

r - ggplot2 help - superimposing GAMs to data + aesthetic changes -

so i'm trying create several plots on 1 time series plot using ggplot2 . here's reproducible code (i hope): # read in data , libraries fishdata <- read.csv("http://dl.dropbox.com/s/nsttbnaj7bzpk1g/fishdata.hilsatotal.csv", header=t) attach(fishdata) require(mgcv) require(ggplot2) # gams total.gam <- gam(totalfishfao ~ s(tonsaquaculturefao) +s(totalmarinefao), quasipoisson, fishdata) inland.gam <- gam(totalinlandfao ~ s(tonsaquaculturefao) + s(totalmarinefao), quasipoisson) hilsainland.gam <- gam(hilsashad.inland ~ s(tonsaquaculturefao) + s(totalmarinefao), quasipoisson) hilsatotal.gam <- gam(hilsasald.total ~ s(tonsaquaculturefao) + s(totalmarinefao), quasipoisson) gtfao.gam <- gam(grandtotal ~ s(totalmarinefao) + s(tonsaquaculturefao), quasipoisson) # plot df3 <- data.frame(cbind(year, totalfishfao, totalinlandfao, ...

ajax - HttpRoutes - how do they work? -

i´m struggling urls ajax-reader/json. each time think understand it, seems haven´t. please, can explain logic behind this??? i got controller: public class servicecontroller : dnnapicontroller { [allowanonymous] [httpget] public httpresponsemessage getallitems(int moduleid) { myprojectcontroller controller = new myprojectcontroller(); ienumerable<iteminfo> items = controller.getallitems(moduleid); return request.createresponse(httpstatuscode.ok, items); } } i got routemapper: public class routemapper : iserviceroutemapper { public void registerroutes(imaproute maproutemanager) { maproutemanager.maphttproute("myproject", "default", "{controller}/{action}", new[] { "mycompany.myproject.services"...

c# - ASP.NET Menu Control: 1st level static, second level dynamic, third level static -

so here's problem: i have menu control on website gets data xml file. need first level static , second dynamic, far good. there 1 more level needs static well! since can set maximum number of static/dynamic levels not property every level specifically, there way accomplish looking for? kettic menu controls windows forms can customize item appearance, text, orientation, image, checkbox, , other controls @ design time.

c# - WCF Services across servers -

ok guys. more of "can done?" question opposed "how do this?" i have wcf project multiple services , lining fine. 2 of them wrapped in windows service installers go on 2 different servers. possible call method in 1 service other service if on 2 separate machines? or have use callback scenario have seen used before? i appreciate advice or ideas. thanks. this depends on binding using , firewall / network route rules on , between 2 machines. if using namedpipebinding, answer no because named pipes bound machine. however, if using of other bindings webhttp, basichttp, etc should ok. beauty of wcf should able spin service endpoint using different binding if necessary -- if using named pipes, should pretty straight forward swap out different binding. a wcf service can client wcf service.

jsf bean validation with dto and validation in entities -

jsf capable automatically validate objects connected form. f.e. have entity person bean validation in there. can populate entity form using {form.entity.field}. jsf managed bean forced have entity entity getter getentity() (to automatic validation using annotations in object). on other side, such solution not preferable , should use dtos in jsf managed beans. unfortunately, want bean validation logic keep in 1 place - entity. is possible validate entity dto's annotations entity (not copying) automatically jsf (no or little code, using embedded jsf bean validator jsr-303)?

php - JSON.parse not working on older mobile browsers -

i have json string a. in format: '[{"key1":"val1",...,"keyn":"valn"},{...},...,{...}]' a created on php server using json_encode(array). var str = json.parse(a); works in desktop browsers, mobile safari, mobile chrome etc.. var str = json.parse(a); throws exception('exception: cannot parse string') in android 2.2 default browser , black berry devices' browers. json.parse works in browser not json string a. there bug in json parser on browser? edit. if put textarea , copy , paste string directly javascript code.. json.parse('[{"key1":"val1",...,"keyn":"valn"},{...},...,{...}]') works. but, doesn't work -> json.parse($('div').html(a).text()); the older json.parse parse object.... try surround below... '{ "data" : [{"key1":"val1",...,"keyn":"valn"},{...},...,{...}] }' if not wo...

asp.net mvc - KendoUI Upload Control not posting correctly -

Image
using vs'12 kendoui - c# asp.net mvc ef code first internet application template i have gotten kendo ddl ( dropdownlist ) work, i working on post actionresult when found that if (modelstate.isvalid) false when click on kendoui upload button ( 1 bound in control) if click on regular submitt button <input type="submit" value="upload" id="do" class="k-button"/> modelstate.isvalid true, none of "upload selected files" in [httppost] actionresult my question simple , how post both of them controller @ once? here little example of code ( 2 buttons ) <div> <p> <input type="submit" value="upload" id="do" class="k-button"/> </p> </div> @(html.kendo().upload() .name("attachments") .async(async => async .save("index", "imageupload") .autouplo...

visual studio 2010 - Dynamics AX 2012 SSRS Report multivalue parameter -

i'm using dynamics ax 2012 & visual studio 2010 create rdp based ssrs report. after changing couple of report parameters multi value, recieve warning: dataset parameter siteid cannot bound report parameter myds_siteid because not have same multivalue property. this rdp attribute looks like: [datacontractattribute] class mydpcontract { inventsiteid siteid; } [datamemberattribute("siteid")] public inventsiteid parmsiteid(inventsiteid _siteid = siteid) { siteid = _siteid; return siteid; } how resolve this? return array of inventsiteid? there property i've not set? this solution got working. had problems loading rdp in visual studio when specified extended data type, used string. [datacontractattribute] class mydpcontract { list siteid; } [datamemberattribute("siteid"), aifcollectiontypeattribute("return",types::string)] public list parmsiteid(list _siteid = siteid) { siteid = _siteid; ...

Android SMS originating address issue -

i have app published handles sms messages. have received feedback users wanting app handle sms messages come sender letters instead of plain old phone number. is, if understand right, receive messages not sender number "123-456-1234" sender "lettered". have never seen before. in emulator tried emulating sms such sender using command sms send testsender messagecontent , emulator says accepts numbers +[0-9]* . 1 else have idea of users talking about? your users talking companies change sender id alphanumeric number. examples of when carrier texts (i.e. carrier texts me 'vodafone'), or when dentist texts me upcoming appointment 'dentist'. take @ answer info how it: how sms messages transmit senders name? if app sorts texts or similar, imagine filter them same way standard telephone number.

How to hide x-axis in lattice R -

how hide x-axis (xlim?) in lattice xyplot? normally plot be: hist(rnorm(10,0,2), axes=f) and global solution great, since have quite few plots. i'm using gridextra package: grid.arrange(plot1,plot2,plot3, ncol=3) this instance allows hide xlab, ylab, main. pl = list(plot1,plot2,plot3) do.call(grid.arrange, lapply(pl, update, xlab="", ylab="", main="")) sample data in case: data <- data.frame(x=rnorm(10,2,2),y=rnorm(10,3,3),z=rexp(10,2)) plot1 <- xyplot(x~y, data, xlab="name", ylab="name", main="title") plot2 <- xyplot(z~y, data, xlab="name", ylab="name", main="title") plot3 <- xyplot(z~x, data, xlab="name", ylab="name", main="title") hiding globally can shown on print() on above or else helps. try this xyplot(1:10~1:10, scales=list(x=list(at=null))) you should read docs in ?xyplot

ios - Google maps api directions JSON output get parameter of compass? -

i'm working on new app in ios dev need using google maps api. read google maps api web services,json , there outputs parameters:"route","legs","step",etc. in app have 1 leg (no waypoints) , x steps & each step calculate compass angle - not in true time (getheading() or something). say, getting angle (clockwise north) in point of view of specific step , use later goal. so how compass parameter in json output? worng exp: { "staus":"ok", "routes": [{ .... "legs":[{ "steps":[{... "start_location": "end_location": /*------------------------*\ ??? "compass_angle": ??? /*------------------------*\ ]} ]} ]} } you use formula here calculate initial bearing between 2 coordinates: http://www.movable-type.co.uk/scripts/latlong.html

c# - Why shouldn't all functions be async by default? -

the async-await pattern of .net 4.5 paradigm changing. it's true. i've been porting io-heavy code async-await because blocking thing of past. quite few people comparing async-await zombie infestation , found rather accurate. async code likes other async code (you need async function in order await on async function). more , more functions become async , keeps growing in codebase. changing functions async repetitive , unimaginative work. throw async keyword in declaration, wrap return value task<> , you're pretty done. it's rather unsettling how easy whole process is, , pretty text-replacing script automate of "porting" me. and question.. if code turning async, why not make async default? the obvious reason assume performance. async-await has overhead , code doesn't need async, preferably shouldn't. if performance sole problem, surely clever optimizations can remove overhead automatically when it's not needed. i've read ...

sonarqube - Sonar Qube uninstall linux -

to install sonar there sonar.sh it. how uninstall sonar on linux shell? there script remove , don't leave trash in system? to start sonar : sonar.sh start stop sonar : sonar.sh stop uninstall sonar : remove sonar installation directory that's !

Google Analytics API v3 unknown error. createEventWithCategory: not compiling -

gaidictionarybuilder set forkey:gaisessioncontrol error reads: key value says it's not code compliant. gaidictionarybuilder *dictionary = [gaidictionarybuilder createeventwithcategory:@"ux" action:@"app started" label:nil value:nil]; [dictionary setvalue:@"start" forkey:kgaisessioncontrol]; [[gai sharedinstance].defaulttracker send:dictionary.build]; i following google's documentation directly site, & still have no idea error coming from? https://developers.google.com/analytics/devguides/collection/ios/v3/migration#setting-data google analytics documentation has error (like usual). got rid of error replacing "setvalue:" "set:" from: [dictionary setvalue:@"start" forkey:kgaisessioncontrol]; to: [dictionary set:@"start" forkey:kgaisessioncontrol]; works now. gaidictionarybuilder *dictionary = [gaidictionarybuilder createeventwithcategory:@"ux" action:@"app sta...

sorting - PHP Array Multisort on Status -

i'm trying multisort db array based on users status. status = 1 go @ top, status = 0 go @ bottom of array. thought had working stopped today addition of new rows db. uasort($ven, function ($a, $b) { return $a['v_status'] == '1' ? false : true; }); it's simple db array mysql: array ( [0] => array( [name] => '', [v_status] => 0 [1] => array( [name] => '', [v_status] => 1 ) as mentioned in comments other answer, splitting array active/inactive arrays better solution sorting. $items = array( array('name' => 'active1', 'active' => '1'), array('name' => 'inactive1', 'active' => '0'), array('name' => 'active2', 'active' => '1'), array('name' => 'inactive2', 'active' => '0'), array('name' => 'inactive3', 'activ...

math - high precision division in C -

i want following calculation without losing precision in c. uint64_t ts_1 = 0x5212cb03ca115ac0; uint64_t ts_2 = 0x5212cb03ca115cc0; uint64_t ts_delta = (ts_2 - ts_1) double scale_factor = ts_delta/(2^32) i getting value of ts_delta 0x200. value of scale_factor 15.000000 .basically losing precision during calculation. how do without losing precision.? here short self contained example on how trying print. #include <stdio.h> #include <stdint.h> #include <inttypes.h> int main() { uint64_t ts_1 = 0x5212cb03ca115ac0; uint64_t ts_2 = 0x5212cb03ca115cc0; uint64_t ts_delta = (ts_2 - ts_1); double scale_factor = ((double)ts_delta) / (((uint64_t)1) << 32); printf("ts_delta %"prix64" scale factor %f \n",ts_delta,scale_factor); return 0; } you're not doing calculation think you're doing. ^ operator in c not perform exponentiation, performs bitwise exclusive or. divi...

javascript - Missing .map resource? -

this question has answer here: jquery's jquery-1.10.2.min.map triggering 404 (not found) 11 answers i've started having problem projects. when index page loads contains reference jquery source file, console logs error: get http://localhost:3000/js/lib/jquery-1.10.2.min.map 500 (internal server error) . this doesn't affect application @ all, it's annoying see whenever open console. know coming from? edit: note i'm not explicitly referencing .map file, pointing <script src="js/lib/jquery-1.10.2.min.js"></script> jquery started using source maps. for example, let's @ minified jquery 2.0.3 file's first few lines. /*! jquery v2.0.3 | (c) 2005, 2013 jquery foundation, inc. | jquery.org/license //@ sourcemappingurl=jquery.min.map */ excerpt introduction javascript source maps : have ever found wishi...

html - Force a link to open a "Save link as" dialog -

similar, not quite one: force browser save file after clicking link i don't want make file download rather render (the end doing "content-disposition: attachment" header. want our internal website users click link , dialog lets them choose directory load file to. this, opposed natural state of things non-right-click downloads directly users' downloads folder. if understood correctly , without plugins, think impossible. way can require verify browser , browser chrome (due spec http://dev.w3.org/2009/dap/file-system/file-dir-sys.html ) can that.

How to update MongoDB by Object ID with C++ driver? -

i think have exhausted available documentation on this. using c++ bson drivers mongo, find record mongo, perform update on record based on found records object id. main area i'm struggling update query. example of i've tried doesn't work: db.update("mydb.mycollection", query("_id" << objectid("521e68e5b9efcf5a9dff7052")), bson("$set" << bson("somefield" << "11111"))); i cannot find shred of documentation on how use c++ driver query or update based on _id field, in example unique field. example code appreciated, 1 runs find query, picks off objectid, , updates field on particular document. i don't have driver compiled, however, thought casting oid ? db.update("mydb.mycollection", query("_id" << oid("521e68e5b9efcf5a9dff7052"))) in case, there number of test cases located here may/not prove useful i've used in ...

java - JSP: forEach - Don't repeat certain values -

i'm having trouble this... i have code this: market market = new market(); list<market > list = marketservice.getmarketitemlist(market); model.addattribute("list", list); i have table this: type | item_name fruit | banana fruit | apple vegetable | onion and have coded for each in jsp this: <c:foreach var="cmenu" items="${list}"> <li><a href="${url_itemmarket}/${cmenu.itemname}">${cmenu.description}/a>/li> </c:foreach> in jsp, want this: type | item name fruit | banana | apple vegetable | onion i don't want repeat value fruit in jsp view . can me example or references this? thanks! 1. you have errors in html: <li><a href="${url_itemmarket}/${cmenu.itemname}">${cmenu.description}/a>/li> ^ ^ ...

php - Conversion of mixed ASCII string with multi-byte sequences to proper UTF-8 -

please consider following ascii string comes in csv file: foo\xe2\x80\x99s bar using php, how can 1 reliably convert utf-8 value is: foo’s bar if string value printed foo\xe2\x80\x99s bar , in php string can defined this $str = "foo\\xe2\\x80\\x99s bar"; you can string printed foo’s bar using eval() method. eval("\$value = \"foo\\xe2\\x80\\x99s bar\";"); echo $value; the result display foo’s bar .

list - Trying to find all combinations of a 2-state vector (in python) -

i trying find combinations of 4 element vector contains 1's , -1's. ex (1,1,1,1),(-1,1,1,1),...(-1,-1,-1,-1) etc idea pretty inefficient im sure can't think of way it, here trying do. found how many total vectors there be, created many empty lists. began vector a , compared each list in vectors . if a matched of lists randomly changed sign of element of a , , again checked new list a against vectors . if a didn't find match replaced on of lists in vectors , , while loop incremented 1. should proceed until possible combinations have been found , printed. code spitting out first change in vectors continually looping without adding new a 's vectors . can spot in code isn't doing intended and/or point me in right direction? thanks import random numvec = 2**4 # number of macrostates 4 component 2-state system vectors = [[0,0,0,0] in range(numvec)] #initializing numvec vectors = [1,1,1,1] = 0 while < 16: if any(x == x in vectors): y = rando...

php - How to solve image upload on Wordpress? -

Image
i have wordpress site , i'm having problems uploading pictures. here print sreen of problem, didn't work on site until now. can't upload image , when select file shows error uncaught rangeerror: maximum call stack size exceeded , v.event.remove . have no idea problem, disabled plugins problem remains. please , thank you! edit discovered problem theme i'm using, still haven't found exactly! i solved problem. functions in 1 of javascript files , validation.js file, updated , commented functions in conflict, page working good!! help!

vb.net - How to determine if a date is the last day of the month? -

can me on how determine if given date last date or day in month? for example have 2 dates, 1 2013-01-27 , other 1 2013-02-28. need determine if date last day. 1 must display 2013-02-28 because last day of month in february while 2013-01-27 not last day of month in january. what condition can use? thanks in advance. use this: function islastday(byval mydate date) boolean return mydate.day = date.daysinmonth(mydate.year, mydate.month) end function

ruby on rails - Heroku issue, ActionView::Template::Error (undefined method `name' for nil:NilClass): -

loading without problem on localhost:3000, once deployed heroku receiving following error. ran heroku logs --tail 2013-08-29t04:38:23.403690+00:00 app[web.1]: connecting database specified database_url 2013-08-29t04:38:26.898295+00:00 app[web.1]: [2013-08-29 04:38:26] info webrick 1.3.1 2013-08-29t04:38:26.898295+00:00 app[web.1]: [2013-08-29 04:38:26] info ruby 2.0.0 (2013-06-27) [x86_64-linux] 2013-08-29t04:38:26.898634+00:00 app[web.1]: [2013-08-29 04:38:26] info webrick::httpserver#start: pid=2 port=11226 2013-08-29t04:38:27.010520+00:00 heroku[web.1]: state changed starting 2013-08-29t04:38:28.496863+00:00 app[web.1]: started "/" 50.148.15.124 @ 2013-08-29 04:38:28 +0000 2013-08-29t04:38:28.642277+00:00 app[web.1]: processing eventscontroller#index html 2013-08-29t04:38:29.529140+00:00 heroku[router]: at=info method=get path=/ host=afternoon-gorge-1648.herokuapp.com fwd="50.148.15.124" dyno=web.1 connect=5ms service=1081ms status=500 bytes=643 2013-08...

linux - Listen Socket and copy to another port -

i know each port can assigned 1 app. however, want this: (1) want monitor port, such 80. port assigned app, such apache (2) can copy every sockets sent port, , redirect ports port i have searched tcpdump, can capture packets(with whole content). not how copy packets , send them port? or, maybe there other tools can capture packet easily? can give me details if want implement myself? because not @ socket programming. as correctly noted, not able use socket packets port 80 easily. because if second socket receive packets port, need reuse port (so_reuseaddr option). if application third-party , cannot set option server socket, not work. probbaly try checking out scapy has option of sniffing packets , see if meets our requirement: http://www.secdev.org/projects/scapy/doc/usage.html .

javascript - Why is it suggested to avoid .innerHTML? -

sorry being javascript noob, can please explain why recommended not use .innerhtml . when have faster , easier in form of .innerhtml , why shouldn't use ? innerhtml sledgehammer. blast away contents of selected dom element , replace them whatever happens assigned @ time. leads number of html escaping , validation issues. more importantly, pages large number of events bound, using innerhtml append element regenerate dom elements, means event bindings can lost. there issues regarding memory leaks in older versions of ie when elements removed dom. with of said, i'm not telling you shouldn't using innerhtml . use time in jquery when use $(selector).html() . sledgehammer right tool job, , when events delegated won't matter how content reloaded.