Posts

Showing posts from June, 2015

Create equidistant points along (Poly)line in R -

Image
if have spatial lines object this: require(sp) x <- c(18.25721, 18.25763,18.25808,18.25846,18.25864,18.25886,18.25892,18.25913,18.25940,18.25962, 18.25976,18.25997,18.26021,18.26048,18.26061,18.26086,18.26107,18.26128,18.26154,18.26219, 18.26276,18.26350,18.26445,18.26510,18.26584,18.26668,18.26704,18.26807,18.26850,18.26944, 18.27020,18.27080,18.27111,18.27134,18.27168,18.27191,18.27217,18.27254,18.27309,18.27345, 18.27368,18.27389,18.27398,18.27400,18.27392,18.27383,18.27370) y <- c(44.69540,44.69539,44.69544,44.69552,44.69563,44.69586,44.69608,44.69644,44.69672,44.69687 ,44.69701,44.69718,44.69737,44.69763,44.69771,44.69778,44.69781,44.69781,44.69782,44.69776 ,44.69772,44.69778,44.69794,44.69805,44.69814,44.69822,44.69824,44.69826,44.69821,44.69805 ,44.69775,44.69737,44.69728,44.69717,44.69701,44.69687,44.69671,44.69649,44.69616,44.69598 ,44.69578,44.69560,44.69539,44.69513,44.69490,44.69476,44.69453) river<-

How do I update Google Analytics session data using Measurement Protocol without creating a new session -

question: how can assure visitor's original session updated/attributed new goal triggered using measurement protocol, if trigger happens after original session window has expired? problem in detail: i capturing cid _ga cookie when visitor reaches site , makes contact via form i use measurement protocol captured cid send data google analytics trigger goal "client registered" if visitor later registers services. if happens within 4 hour session window of visitor's first visit site, session created first visit attributed goal. however, if send data google analytics after 4 hour session window, google analytics sees measurement protocol hit new session , creates new session goal attributed. want original session show new goal value. i believe following stackoverflow question related, has no answers posted: " google analytics measurement protocol session timeout , query time limits " nope, not possible, can make hit non-interactive. can

python - Creating a new instance of a Custom User Model in Django -

i have model extension of user model in django 1.8. connecting mysql database this. class libraryuser(models.model): user_id = models.onetoonefield(user) is_catalogue_subscriber = models.booleanfield(default=true) is_research_subscriber = models.booleanfield(default=true) library_membership_number = models.charfield(max_length=64) the reason why extended user model, of course use authentication framework. so now, want create new libraryuser using library_membership_number login username. how should so? create user first reference libraryuser ? ie given some_ variables either received post or migration of users new table u = user.objects.create_user(email=some_email, password=some_password) lu = libraryuser(library_membership_number, user_id = u.id) lu.save() or there correct way this? tried finding online can't find particularly address problem. you should assign value specify fields following: lu = libraryuser(library_membership_number= '

xcode - How do I detect if the charger is plugged in or unplugged using Swift? -

this question has answer here: detect if device charging 5 answers i want detect when charger plugged , when becomes unplugged. want write using swift. great if share code snippet it, if can tell me use nice. see this doc more info. swift: uidevice.currentdevice().setbatterymonitoringenabled(true) if uidevice.currentdevice().batterystate() == uidevicebatterystatecharging { nslog("device charging.") }

mongodb - Idle Connection Timeout in mongoose -

is there way set idle connection timeout in mongoose ? trying 1 below. mongoose.createconnection(ip:port/{server:{"maxidletimems":1800000}}) but above code doesn't seem work. appreciated this option called connecttimeoutms not maxidletimems , socket option. sample code work : var uri = 'mongodb://localhost/mydb'; var options = { server: { socketoptions: { connecttimeoutms: 1800000}}}; mongoose.createconnection(uri, options, function (err) { if (!err){ console.log("connection successful");} }); good luck

smt - Why does Z3 return unknown for this nonlinear integer arithmetic example? -

i have simple example in nonlinear integer arithmetic, namely search pythagorean triples. based on read in related questions (see below), i'd expect z3 find solution problem, returns 'unknown'. here example in smt-lib v2: (declare-fun x () int) (declare-fun y () int) (declare-fun z () int) (declare-fun xsquared () int) (declare-fun ysquared () int) (declare-fun zsquared () int) (declare-fun xsquaredplusysquared () int) (assert (= xsquared (* x x))) (assert (= ysquared (* y y))) (assert (= zsquared (* z z))) (assert (= xsquaredplusysquared (+ xsquared ysquared))) (assert (and (> x 0) (> y 0) (> z 0) (= xsquaredplusysquared zsquared))) (check-sat) (exit) there few related questions, notably: how z3 handle non-linear integer arithmetic? need understanding equation combining nonlinear real linear int z3 support nonlinear arithmetic z3 limitations in handling nonlinear real arithmetics it seems z3 won't attempt finding solution bit-b

angularjs - How to split code coverage by separate files for Angular, Karma and Webpack? -

how can split coverage separate files? right working fine bundle file. using angular , webpack bundling , karma / mocha / chai testing. i have following webpack.config: module.exports = { entry: { public: "./application/src/public.js", office: "./application/src/office.js" }, output: { path: "./client/javascripts/", filename: "[name].js", sourcemapfilename: "[name].js.map" } }; and following karma.conf.js: module.exports = function(config) { config.set({ basepath: "", frameworks: ["mocha", "chai"], reporters: ["mocha", "coverage"], files: [ "./client/libs/angular/angular.js", "./client/libs/angular-route/angular-route.js", "./client/libs/angular-animate/angular-animate.js", "./client/libs/angular-cookies/angular-cookies.js",

sql - How can I make this SELECT in hierarchical data modal using mysql? -

i have used hierarchical data modal store products in database. products have main , subcategory, , result when retrieving full tree of products. select t1.name lev1, t2.name lev2, t3.name lev3, categories t1 left join categories t2 on t2.parent = t1.category_id left join categories t3 on t3.parent = t2.category_id t1.name = 'products' +----------+----------------------+-------------------+ | lev1 | lev2 | lev3 | +----------+----------------------+-------------------+ | products | computers | laptops | | products | computers | desktop computers | | products | computers | tab pcs | | products | computers | crt monitors | | products | computers | lcd monitors | | products | computers | led monitors | | products | mobile phones | lg phone | | products | mobile phones

C++ RPG Error: data member initializer is not allowed -

this has been posted several times, none of times have answered case. please me 'error: data member initializer not allowed' appears under equals signs. here's code problem in it. //player.cpp :contains information player #include <iostream> #include <string> #include "main.cpp" using namespace std; void player() { struct player { int charma = 0; unsigned int hunger = 10; unsigned int energy = 50; unsigned int health = 100; }; enum race { unknown, dead, human, orc, goblin, elf, lizard, cat, vampire, werewolf, snk }; } you getting error because initializing variables when declaring struct . not allowed. instead, move initialization constructor of struct. however not error in code. defining struct inside of player function (which should constructor). need switch those, have player function inside of player struct. way struct have constructor can initialize values. thing, don't #include .cpp files. it's bad practice. your

javascript - How to validate date within a bound using java script -

i have input field follows: <input type="date" id="datepicker"> now want validate field such user can't select date after system's date , can't select date before date specified. for example, if today's date is, 01-oct-2015, user can't select date after 01-oct-2015 , he/she can't select date before, let's say, 02-jan-2013. how using javascript?

ios - Missing 64bit Support, Invalid Bundle. Errors when submitting app -

Image
i'm trying submit new version of client's app itunesconnect using xcode 7 first time. when try uploading itunesconnect, these 2 errors. anyone else experience this? for error 90086:- as said dave chambers in error itms-90086 submitting app link need check things. project --> build settings --> architectures and : targets --> build settings --> architectures you have following 4 things : architectures set standard architectures (armv7, arm64) - $(archs_standard) base sdk set ios8 sdk, example latest ios (ios 8.3) or ios 8.3 build active architecture only --> release set no valid architectures set arm64 armv7 armv7s you no longer error itms-90086 and regarding seond error error itms-90475 you need copy ' bundle id ' in itunes connect ->manage apps -> **viewed app** and then go xcode , paste plist ' bundle identifier' fiel

c# - Foreach Loop Is Not Executing -

there similar type of solution found , tried follow-up still failed solve. i have created student class public property first_name & last_name. using arraylist wanted & print details of each student. after executing code got empty console window. when run code using breakpoint saw flow of code not entering foreach loop. please me.... arraylist studentlist = new arraylist(); public void getstudent() { foreach (student student in studentlist) { console.write("enter first name: "); student.first_name = console.readline(); console.write("enter last name: "); student.last_name = console.readline(); } } public void printstudentinformation() { foreach (student student in studentlist) { console.writeline("-----------------------"); console.writeline("name of student {0} {1}", student.first_name, student.last

html - How to align 3 divs to the top middle and bottom of a page? -

i need align 3 divs top, middle , bottom of webpage below current code. js fiddle <div class="container"> <div class="logo"> logo </div> <div class="nav"> nav </div> <div class="base"> base </div> </div> i have tried using table/table-cell method each section sits side side. the container needs fixed , nav should vertically aligned. any ideas make logo div @ top, nav div in middle , base div @ bottom? you css table, added <div> each block. jsfiddle html, body { height: 100%; margin: 0; } .container { background: gold; width: 100%; height: 100%; display: table; } .container .row { display: table-row; } .container .cell { display: table-cell; } .logo .cell { vertical-align: top; } .nav .cell { vertical-align: middle; } .base .cell { vertical-align: bottom; } <div

Splitting letter in a string to separate row in MYSQL -

i have days(working days school) field in school_calendar table given below select days school_calendars id=1; returns mtwhf result i want output followed +---------+ days +---------+ | m | | t | | w | | h | | f | +---------+ doing string 1000 characters long:- select substr(days, anum, 1) aday school_calendars inner join ( select 1 + units.acnt + tens.acnt * 10 + hundreds.acnt * 100 anum (select 0 acnt union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) units. (select 0 acnt union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) tens, (select 0 acnt union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) hundreds ) sub0 on sub0.anum <= length(days) id=1; for sho

linux - How to use Java to listen to port 17, 'qotd'? -

the problem found little description port 17, known "quote of date" port. useless port, nothing display quote less 512 ascii characters. give me more information how listen port 17 in java? have established server client socket using port:6017. here code: public class dateserver { public static void main(string[] args) { try { serversocket sock = new serversocket(6017); // listen connections while (true) { socket client = sock.accept(); // have connection printwriter pout = new printwriter(client.getoutputstream(), true); // write date socket pout.println(); // know must happens here!!! // close socket , resume listening more connections client.close(); } } catch (ioexception ioe) { system.err.println(ioe); } } } the system runs in linux , code server end of pr

how to assign uninitialized string value from another string in C++ -

i new programming. question may silly helpful if can guide me. please see code below: #include <iostream> #include <string> using namespace std; int main() { cout << "you have choose reverse text" << endl; string inputstring; string outputstring; cout << "enter string want reverse" << endl; getline(cin, inputstring); int n = inputstring.length(); (int = 0; < n; i++) { outputstring[i] = inputstring[n - 1 - i]; // problem in line } } till here works fine inputstring[n - 1 - i] when try assign value outputstring . getting error. outputstring empty, you're accessing out of bounds here: outputstring[i] = inputstring[n - 1 - i]; you have ensure outputstring has length of @ least n time enter loop. there different ways of achieving that. one solution create size n after reading in inputstring . here, creat

node.js - -bash: react-native: command not found -

i have installed brew, node 4.0+, watchman , flow, , received following when npm install -g react-native-cli: /users/home/.node/bin/react-native -> /users/home/.node/lib/node_modules/react-native-cli/index.js react-native-cli@0.1.5 /users/home/.node/lib/node_modules/react-native-cli └── prompt@0.2.14 (revalidator@0.1.8, pkginfo@0.3.1, read@1.0.7, winston@0.8.3, utile@0.2.1) so assume react-native-cli has been installed well. when run react-native, says -bash: react-native: command not found my node version 4.2.1, watchman 3.9, brew 0.9.5 (git 7ed6) , npm 2.14.7 you have make sure /usr/local/share/npm/bin in path use binaries installed npm . add following ~/.bashrc : export path="/usr/local/share/npm/bin:$path" and reload shell session. if find don’t have /usr/local/share/npm/bin directory, npm may install packages in location. in case have use right path in line above. one solution find path run: npm list -g | head -n 1

image processing - How to convert bitmap 16-bit RGBA4444 to 16-bit Grayscale in C++? -

i used method: val = 0.299 * r + 0.587 * g + 0.114 * b; image.setrgba(val, val, val, 0); to convert bitmap (24-bit rgb888 , 32-bit rgba8888) grayscale successfully. example: bmp 24-bit: 0e 0f ef (bgr) --> 51 51 51 (grayscale) // using above method but can't apply bitmap 16-bit rgba4444. example: bmp 16-bit: 'a7 36' (bgra) --> 'ce 39' (grayscale) // ??? anyone know how? are sure need rgba4444 format? maybe need old format green channel gets 6 bits while red , blue 5 bits (total 16 bits) in case of 5-6-5 format - answer simple. r = (r>>3); g = (g>>2); b = (b>>3); reduce 24 bits 16. combine them using | operation. here sample code in c // combine rgb 16bits 565 representation. assuming inputs in range of 0..255 static int16 make565(int red, int green, int blue){ return (int16)( ((red << 8) & 0xf800)| ((green << 2) & 0x03e0)| ((blue >> 3) &a

Can I add if or else condition in jquery json response -

my jquery json response adding data table, have use if conditions on day wise. how can use.please suggest example. here have use condition in data.hours.day field. code is: if (data.hours != null) { var h = $('#hours').datatable(); $('#hours').datatable().fncleartable(); (var = 0; < data.hours.length; i++) { h.row.add([ data.hours[i].day, data.hours[i].open_hr_delivery + " - " + data.hours[i].close_hr_delivery + " , " + data.hours[i].open_hr_delivery1 + " - " + data.hours[i].close_hr_delivery1, "<a href=\"dspedithour?hourid=" + data.hours[i].dspbusinessmasterid + "\" class=\"btn btn-xs font-blue\"><i class=\"fa fa-edit\"></i> update </a>", ]) .draw(); } } often easier create variables can pass array (var = 0; < data.hours.length; i++) { // example variab

how to configure tomcat 5.5 to change localhost to ip address -

i run application on http://localhost:8080 want use machine ip address or alias instead of localhost put application on internet. please tell me how can this. please me.... i don't know tomcat, if you're using windows, can edit hosts file redirect localhost ip address. to this: press windows key + r type notepad.exe go file > open open file c:\windows\system32\drivers\etc\hosts put name , ip address want website go format: ip alias save example of correct hosts file: 12.345.678.90 www.example.com more editing hosts file note: access localhost 127.0.0.1 http://127.0.0.1:8080

java - How to properly throw nullPointerException? -

i need write method delete() takes int argument k , deletes kth element in linked list, if exists. want watch when list empty, or k out of bounds. if either of true, want throw nullpointerexception . code have far below. public void delete(int k){ node current = head; (int = 0; < k; i++){ if(head == null && current.next == null){ throw new nullpointerexception(); } else { current = current.next; // move pointer k position } } remove(current.item); --n; } when go execute value know null, following output: exception in thread "main" java.lang.nullpointerexception @ hw4.linkedlist.delete(linkedlist.java:168) @ hw4.lltest1.main(lltest1.java:23) however, if remove throw new nullpointerexception(); line code, still same error message when executing code value know null. my question is, implementing throw new nullpointerexception()

java - How can i add two class that extends JPanel in One JFrame -

i created 2 class extends jpanel , want add 2 class in 1 frame. unable it. please. my classes --> import java.awt.gridlayout; import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.jpanel; public class calbutton extends jpanel { private jbutton[] buttons; private static final string[] buttonnames = { "7", "8", "9", "/", "4", "5", "6", "*", "1", "2", "3", "-", "0", ".", "=", "+" }; private jpanel buttonpanel; public calbutton() { // todo auto-generated constructor stub buttons = new jbutton[buttonnames.length]; buttonpanel = new jpanel(); buttonpanel.setlayout(new gridlayout(4, 4, 3, 3)); for(int i=0; i<buttonnames.length; i++){ buttons[i] = new jbutton(buttonnames[i]); buttonpanel.add(buttons[i]);

c# - Ms Lightswitch - add dynamic (from code behind) items choice list -

i using microsoft lightswitch framework, need add dynamic items in choice list. far found different posts saying choice list static items , have use separate table if need populate in non-static means. in case, table not option, want add items manually c# code. need populate years combobox, need add last 3 years, current year, , 1 next year. not achieve through static data or table not idea. just create lookup table , add relationship , ls rest you can dynamically populate new table although won't able delete records have children

In Emacs, how can I jump to the top of the file and then return to where I came from? -

in vim, ctrl-i takes cursor previous location (before last jump). ctrl-o complement, moving forward through jumplist. gg jumps top of file, ctrl-i jumps back. the equivalent ctrl-i in emacs c-u c-space . however, obvious way top of file, home , doesn't set mark, there's no way return line came way. is there better set of commands getting top , bottom of file (and perhaps other places) does respect mark ring? or there better way reverse home ? c-spc m-< go top. c-u c-spc (or c-x c-x c-g ) again. ( c-x c-x g not change mark-ring . c-x c-x swaps point , mark, , activates region. c-g deactivates region.)

if statement - Reducing the cyclomatic complexity of a java method -

i have following method: private void setclientadditionalinfo(map map, client client, user user) { map additionalinfo = (map) map.get("additionalinfo"); if (checkmapproperty(additionalinfo, "gender")) { client.setgender(additionalinfo.get("gender").tostring()); } if (checkmapproperty(additionalinfo, "race")) { client.setrace(additionalinfo.get("race").tostring()); } if (checkmapproperty(additionalinfo, "ethnicity")) { client.setethnicity(additionalinfo.get("ethnicity").tostring()); } ..... 12 more if statements used in similar way. difference being different setter method name , different parameter. now, same pattern repeated again , again, there way reduce code complexity? not easily, , not without using reflection. using reflection loop through list of values , call appropriate method in client object. rid of complexity , cleaner/more robus

javascript - saving specific data from localstorage -

i've been workinig on project uses angularjs , have been using localstorage storing data. i'm facing difficulties in separating specific data localstorage before clear it. following sample data stored in localstorage. localstorage.setitem("favclub_"+userid,json.stringify($scope.favclub)); localstorage.setitem("cityofbirth_"+userid,json.stringify($scope.cityofbirth)); all keys stored have userid appended unique. example: userid: john key: favclub_john & cityofbirth_john now need keep data favclub , cityofbirth of users before clear storage on log in. i thinking of having array store required data , iterate through local storage , keep data matches requirements. wondering how can loop through localstorage such dynamically varying keys. sorry if questions been asked. tried searching couldn't find similar question. input great. thanks in advance! as far know, can't iterate on localstorage keys. use different approac

ios - __NSCFNumber unrecognized selector sent to instance - Weird behavior -

i'm having strange problem object of class, inside block have weak reference of view controller, part of code in block __weak typeof(self) weakself = self; [weakself performselector:@selector(reloaditems) withobject:nil afterdelay:0]; [weakself.view setuserinteractionenabled:yes]; if (weakself.shouldpresentnotification) { [[llapi sharedinstance] presentlatestnotification]; weakself.shouldpresentnotification = no; } the problem couple of users have experienced crash [__nscfnumber shouldpresentnotification]: unrecognized selector sent instance 0xbb3c1937855f68da now, understand crash report telling me weakself nsnumber object, doesn't make sense, , if true why crash raised until variable "shouldpresentnotification" accessed? edit: here full stack trace: thread : fatal exception: nsinvalidargumentexception 0 corefoundation 0x0000000182154f5c __exceptionpreproces

ios - UISplitViewController on universal app with Storyboard -

i'm want make app uses uisplitviewcontroler on ipad (as far understand it's available on ipad) want app universal. the setup this: i have uitableview (as master view) , when select row should display detail view of cell. using storyboard , can't figure out how implement split view ipad. what easiest way achieve that? thanks. you don't need 2 storyboards this.you can use them both in single storyboard.for iphone ,we use class swrevealviewcontroller (if new ios coding ..:)) side menu , splitviewcontroller ipad.we can use swrevealviewcontroller ipad well.it depends on requirement. for universal apps,create viewcontrollers using size classes (usually use height width universal apps ). change these size classes , create different viewcontrollers ipad , iphones required. in cases height width job. after creating viewcontrollers,in appdelegate ,using instantiateviewcontrollerwithidentifier method, load required viewcontroller. if (ui_user_int

html - Display PHP in Textarea -

i'm trying display php variable in text area outputs in between text area tags here's code: echo "allergens contained " .'<textarea rows="4" name="allergens_contains"> <?php echo $contains; ?></textarea>'; in text area on webpage i'm getting is: <?php echo $contains; ?> you should concatenate strings , variables via: <?php echo 'this text ' . $php_variable . ' more text'; or <?php echo "this text " . $php_variable . " more text"; or <?php echo "this text $php_variable more text"; or <?php echo "this text {$php_variable} more text";

python - Sqlalchemy if table does not exist -

i wrote module create empty database file def create_database(): engine = create_engine("sqlite:///myexample.db", echo=true) metadata = metadata(engine) metadata.create_all() but in function, want open myexample.db database, , create tables if doesn't have table. eg of first, subsequent table create be: table(variable_tablename, metadata, column('id', integer, primary_key=true, nullable=false), column('date', date), column('volume', float)) (since empty database, have no tables in it, subsequently, can add more tables it. thats i'm trying say.) any suggestions? i've managed figure out intended do. used engine.dialect.has_table(engine, variable_tablename) check if database has table inside. if doesn't, proceed create table in database. sample code: engine = create_engine("sqlite:///myexample.db") # access db engine if not engine.dialect.has_table(engine, variable

angular ui router - Directly opening url with stateparam not working in angularjs -

i have url http://localhost:8000/articles/2345 when clicked within angular, works fine. url's have linked other websites also. error uncaught syntaxerror: unexpected token < i using ui-router below .state('kbca', { parent : 'root', url: "/articles/:articleid", templateurl: "views/abc/abc.html, controller: "abcctrl", data : { authorizedroles : [roles.public] } }) and config like .config(function($locationprovider){ $locationprovider.html5mode(true).hashprefix('!'); }); and have index.html in have made base <div id="wrap"> <div ui-view></div> </div> <!-- end wrap --> <base href="/"> i tried lots of options on web. nothing seems working me. here server conf server { listen 8000; root d:/xampp/htdocs/web/myweb/app; index index.html index.htm; server_name localhost; location /

php - How can I make my switch statement case insensitive? -

in following example, $var can "value", "value" or "value". switch ( $var ) { case "value": // value , value don't seem match here. break; } the comparison seems case sensitive (only all-lowercase "value" matches). there way perform case-insensitive comparison? ref: http://php.net/manual/en/control-structures.switch.php $var = strtolower($var) and in switch cases write lowercase

How can I make my blinking string also change values? (Python 3.5) -

i have following piece of code in python 3.5: def blink(char): while 1: print (char, end = '\r') time.sleep(0.5) print (' ' * 50, end = '\r') time.sleep(0.5) i using function make string blink specific time the problem when use in code below doesn't have desired effect: while true: time.sleep(0.5) seconds += 1 if seconds == 60: minutes += 1 seconds = 0 if minutes == 60: hours += 1 minutes = 0 if hours == 24: days += 1 hours = 0 blink ('days: %s, hours: %s, minutes: %s, seconds: %s' % (days, hours, minutes, seconds)) i'm using piece of code 'simulate' time. problem output looks this: days: 0, hours: 0, minutes: 0, seconds: 1 this keeps on blinking on same line want to, problem output doesn't increase

processing - How to display emoji's in a sketch? -

i have following method in draw() method: pfont f = createfont("arial",size,true); textfont(f,size); text(char(symbol), x, y); where symbol integer unicode range of emojis's 128512-128591. but output displays empty blocks instead of emoji. what correct way this? , how can display rich emoji's liek found in mobile apps etc.?

Add data to XML element within bash script -

i have following xml : <remote host="${jboss.domain.master.address:127.0.0.1}" port="${jboss.domain.master.port:9999}" security-realm="managementrealm" /> i want add username=admin line block. whats best way of going this. have tried every sed combination , have been getting nowehere... recommend against it, but: xml=$( sed 's# /># username="admin"&#' <<< "$xml" )

xcode - tvOS: Invalid Provisioning Profile. This provisioning profile is not compatible with iOS apps -

when trying publish itunes connect via altool tvos app, i'm running errors. /applications/xcode.app/contents/applications/application\ loader.app/contents/frameworks/itunessoftwareservice.framework/support/altool --validate-app --file "/path/to/myapp.ipa" -t ios --username xxx@example.com --password ******** 2015-10-22 09:05:32.175 altool[8567:159593] *** error: unable validate archive '/path/to/myapp.ipa': ( "error domain=itunesconnectionoperationerrordomain code=1176 \"unable process application @ time due following error: invalid provisioning profile. provisioning profile not compatible ios apps..\" userinfo={nslocalizedrecoverysuggestion=unable process application @ time due following error: invalid provisioning profile. provisioning profile not compatible ios apps.., nslocalizeddescription=unable process application @ time due following error: invalid provisioning profile. provisioning profile not compatible ios apps.., nsloc

java - How should I implement removal of rightmost half of my custom Linkedlist -

write method removerightmosthalf member of class linkedlist . not call methods of class , not use auxiliary data structures. if l contains a! b! c! d! e , after calling l.removerightmosthalf() , l becomes a! b! c . int size = 0 ; int halfsize = 0; current = head; while (current.next != null) { ++size; current=current.next; } ++size; if (size % 2 == 0) { halfsize = (size / 2); (int = halfsize + 1; < size; i++) { } } i not know how remove inside loop. help! i suggest use 2 pointers, slow , fast pointer. both pointing start of linked list. the slow pointer move 1 node @ time. the fast move 2 node time. the moment see fast pointer has reached end of list, mark slow pointer node end of list, setting next=null ; important note that, discovery of end of list depend on even/odd size of list. design , test both cases.

reactjs - Karma + Browserify + Jasmine + Istanbul + React coverage -

Image
i'm trying coverage report tests coverage output files on single line showing require path file. example... the tests running fine. react project had include additional paths files , preprocessor tests run. i'm not sure if there wrong karma config? config looks like... /* global module */ module.exports = function (config) { 'use strict'; config.set({ autowatch: true, singlerun: true, frameworks: ['browserify', 'jasmine'], files: [ 'node_modules/karma-babel-preprocessor/node_modules/babel-core/browser-polyfill.js', 'node_modules/react/react.js', 'src/**/*.jsx', 'src/**/!(*spec).js' ], browsers: ['phantomjs'], preprocessors: { 'node_modules/react/react.js': ['browserify', 'sourcemap'], 'src/**/*.jsx': ['browserify', 'sourc

tcpdf not show custom font correctly -

Image
according how implement custom fonts in tcpdf import custom font tcpdf, when use see result . this part of code $pdf = new mypdf(pdf_page_orientation, pdf_unit, pdf_page_format, true, 'utf-8', false); // set language dependent data: $lg = array(); $lg['a_meta_charset'] = 'utf-8'; //$lg['a_meta_dir'] = 'rtl'; $lg['a_meta_language'] = 'fa'; $lg['w_page'] = 'page'; // set language-dependent strings (optional) $pdf->setlanguagearray($lg); // set image scale factor $pdf->setimagescale(pdf_image_scale_ratio); // --------------------------------------------------------- // add page $pdf->addpage(); // convert ttf font tcpdf format , store on fonts folder $fontname = tcpdf_fonts::addttffont(k_path_fonts.'byekan.ttf', 'truetypeunicode', '', 14); //ym($fontname); //die(); //$this->pdf->setfont('byekan'); $pdf->setfont($fontname, '', 8, '', true);

python - Displaying colors of very narrow rectangles in matplotlib's bar plot -

Image
i'm trying plot data in matplotlib has wide x axis range. have 2 sets of data, distinguishable via 2 colors. however, rectangles used in standard bar plot narrowed colors don't display. here's code i'm using: import matplotlib.pyplot plt fig=plt.figure() ax1=fig.add_subplot(111) ax1.bar(plotreal,plotabundance,color='#330000') #first data (x,y,color) ax1.bar(xlist,ylist,color='#9999ff') #second set of data (x,y,color) ax1.set_xlabel() #some axis labeling ax1.set_ylabel() #some axis labeling ax1.set_title() #some title labeling plt.savefig('chart of '+str(counter)+'.png') #some more parameters the data in second set may overlap of first (having same points), , color show whenever case. interested in keeping display format each point displayed line/rectangle, add colors lines/rectangles. even though tried making contrasting colors of 2 data sets it's still impossible distinguish second set in example contained 4 coordinates , f

c# - does not contain a static main method for suitable entry point -

keep getting error message not contain static main method suitable entry point. able explain error me , possibly me fix it? thanks. new c# { class authenticator { private dictionary<string, string> dictionary = new dictionary<string, string>(); public void intialvalues() { dictionary.add("username1", "password1"); dictionary.add("username2", "password2"); dictionary.add("username3", "password3"); dictionary.add("username4", "password4"); dictionary.add("username5", "password5"); } public bool authenticate(boolean authenticated) { console.writeline("please enter username"); string inputusername = console.readline(); console.writeline("please enter password"); string inputpassword =

javascript - JSLint a constructor name should not start with a lowercase letter -

i'm getting following jslint error: constructor name should not start lowercase letter . error when encounters identifier starting lowercase letter preceded new operator. i have model called mymodel contains function this.dosomething = function(); in controller access function: self.mymodel = mymodel; var newmodel = new self.mymodel.dosomething(); although works take jslint error dosomething() should dosomething() although this.dosomething = function() seems incorrect syntax me. question is, best practice syntax remove error?

ruby on rails - CanCan is not allowing custom action/pages in Spree backend -

i have create new role in spree , limited cancan 1 controller. not allow access custom actions/pages. create, delete, index etc the above actions accessible, yet 'clean' view not. controller - def clean @handbags = spree::handbag.is_clean.page(params[:page]).per(50) end abilitydecorator - class abilitydecorator include cancan::ability def initialize(user) if user.respond_to?(:has_spree_role?) && user.has_spree_role?('technical') can :manage, spree::handbag end end end spree::ability.register_ability(abilitydecorator) also tried - can [:clean, :admin, :index etc..], spree::handbag thanks help. i got around overriding collection_actions , adding actions needed work - def collection_actions [:index, :clean, :repair, :colour] end

javascript - WebStorm Node.Js Sequelize Model type hint -

i'd know how type-hint node.js sequelize models in webstorm better code completion. at least able figure out, how code completion model properties. i'm missing model functions sequelize. this how far got: models/examplemodel.js /** * @module examplemodel * @typedef {object} * @property {examplemodel} examplemodel */ /** * * @param sequelize {sequelize} * @param datatypes {datatypes} * @returns {model} */ module.exports = function (sequelize, datatypes) { var examplemodel = sequelize.define('examplemodel', { id: { type: datatypes.bigint.unsigned, primarykey: true }, someproperty: { type: datatypes.boolean, defaultvalue: true } }, { classmethods: { associate: function (models) { examplemodel.belongsto(models.anothermodel, {foreignkey: 'id'}); } } }); return examplemodel; }; models/index.js 'use

java - Check files exist in a directory -

i want read files in folder using java. unfortunately files missing , npe. public static hashmap<string, integer> getcputemp() throws ioexception { file directory = new file("/sys/devices/virtual/thermal"); if (directory.exists()) { hashmap<string, integer> usagedata = new hashmap<>(); file[] flist = directory.listfiles(); (file file : flist) { if (file.isdirectory() && file.getname().startswith("thermal_zone")) { ...................... } } return usagedata; } return null; how can prevent , return null if files not there? can show me solution java 8? i npe here (file file : flist) it should flist null. so, right after flist creation, check null. file[] flist = directory.listfiles(); if (flist == null) { return null; }

validation - Validate an Object in ASP.NET MVC without passing it into an Action -

in asp.net mvc can validate model passed action modelstate.isvalid() . i'd validate arbitrary objects rather 1 model passed in. how can that, using framework's libraries? public actionresult isvalidsofar() { // user's autosaved data var json = await ... homemodel model = jsonconvert.deserialize<homemodel>(json); // validate model <---- how? } public class homemodel { [required, maxlength(100)] public string name { get; set; } } you can use validationcontext class ... below var context = new validationcontext(modelobject); var results = new list<validationresult>(); var isvalid = validator.tryvalidateobject(modelobject, context, results); if (!isvalid) { foreach (var validationresult in results) { //validation errors } }

c++ - Creating and linkin doubly linked list -

hi have been trying debug piece of code long time cant figure out why. appreciated. here, trying copy 2 doubly linked lists(of different lengths) new one. however, when return newly made linked list, nodes not connected. can tell me have done wrong? struct polynode { int coef; int expx; int expy; polynode* prev; polynode* next; } polynode* padd(polynode* a, polynode* b) { polynode* c = new polynode; polynode* c_head =c; polynode* a_head =a; polynode* b_head =b; c->prev = nullptr; c->next = nullptr; polynode* c_next = c->next; polynode* c_prev = c->prev; while (a != nullptr) { c->coef = a->coef; c->expx = a->expx; c->expy = a->expy; cout << "\t\t copied c=" << c->coef << c->expx << c->expy << endl; if(a->next != nullptr) { c_next = new polynode; c_next->prev = c

javascript - Parse serialized date in Grails with proper time zone -

i'm trying bind date in grails app. in application.yml have databindings default javascript date formats: grails: databinding: dateformats: - "yyyy-mm-dd't'hh:mm:ss.s'z'" - "yyyy-mm-dd't'hh:mm:ss'z'" in groovy i'm creating object params def entity = new entity(params) , binds ok, but... the problem have wrong time zone in grails app, i.e.: in angularjs i'm creating new date - thu oct 22 2015 00:00:00 gmt+0200 (cest) (this string representation of date object) next i'm sending via $http service, json payload looks this: { date: "2015-10-21t22:00:00.000z", another: "another:, property: "property" } . date looks fine right now, z @ end means utc thu oct 22 2015 00:00:00 gmt+0200 (cest) - 2 hours => 2015-10-21t22:00:00.000z in grails i'm doing def entity = new entity(params) , here problem, entity.date equals wed oct 21 22:00:00 cest 201

javascript - data attribute from anchor not sending value ti hidden input -

i have anchor tag <a class="productin" onclick="openbox()" data-pid="23">report</a> this opens modal box sends email, have hidden input tag inside email form in want add data-pid <input type="hidden" name="productid" id="productid"> since tagged question jquery, i'll give jquery answer. should work: $(function(){ $('a.productin').click(function(){ $('input:hidden[name="productid"]').val($(this).data('pid')); }); }); fyi - normal procedure in stack overflow post code have tried on own. here fix issues code, not write code you. in future search answer before ask question , give shot on own. then, can ask why code didn't work posting relevant code see. that's why question voted down. it normal procedure downvoter explain why voted down.

JQuery Ajax Post results in 500 Internal Server Error $.ajax (anonymous function) under Linux server -

i getting (anonymous function) in chrome inspector console says because of line in script: $.ajax({ heres code. help. $('#form-new_login').find('span i#ajax_loader').css("display","block");//ok $('#img_log').attr('src','images/onoffline.png');//ok $('#form-new_login').find('input.ise_button.icon-paper-plane').val('en cours...');//ok var verif1=verif_ise_login($('input#ise-form-login'),6);//ok var verif2=verif_ise_password($('input#ise-form-pass'),6);//ok if (verif1 && verif2) {//ok $.ajax({// *********** pb. here ******************* //[cursor before char of ajax({ error : post 500 (internal server error), details : (anonymous function)] type: "post", url: $('#form-new_login').attr('action'),//"modules/membres/profil/mon_profil.php", data: $('#form-new_login').serialize(), cache: false, success:

Set up MATLAB and Simulink support package for Raspberry Pi -

i want install matlab , simulink support package raspberry pi. follow link . directly connect laptop raspberry pi using ethernat cable. didn't output. while installing got error - "could not detect raspberry pi board on "local area connection". check ethernet connection raspberry pi. fdx/lnk/100 leds on raspberry pi board should illuminated. network trouble-shooting instructions see http://www.mathworks.com">the mathworks web site" can solve problem? i have experienced same issue after proceeding in way solved it. before put sd card on raspberry pi need: power off pi connect ethernet cable host computer finally power on pi in addition may take @ troubleshooting guide .

ios - Using URL-Scheme in application -

i want using url-schemes in application when use url-scheme, unlock pro version inside application. but, how can make url-scheme can used once? 1 person can use url scheme, , when url scheme used, cannot used again? usaully, unlock pro version, should using in-app purchases!

ibm midrange - How to get the last day of month in a CL -

i need last day of previous month. cl can run on 3rd day of new month. can select statement in cl (we in 7.1) or if not steps needed code , save date in small table. here simple example of calculating last day of previous month using cl. pgm dcl var(&cymd) type(*char) len(7) dcl var(&jul) type(*char) len(5) dcl var(&jul#) type(*dec) len(5) rtvjoba cymddate(&cymd) chgvar var(%sst(&cymd 6 2)) value('01') cvtdat date(&cymd) tovar(&jul) fromfmt(*cymd) tofmt(*jul) tosep(*none) chgvar var(&jul#) value(&jul) chgvar var(&jul#) value(&jul# - 1)

Why doesn't scala have easier support for Equals? -

reading martin's book, chapter equality object equality chapter 1 may notice implementing equals in scala (as in other language) not straightforward. scala extremely powerful , agile, , cannot believe not simplify things bit. know scala generates proper equals case classes, wonder why couldn't generate simplifications normal classes? to show point, wrote example of how see should like. has flaws, , had use classtag know wrong such basic thing equals due performance (any tip how without classtag ?), thinking scala can generate proper equals case classes, i'd should able generate proper code normal classes, giving developer provides key should used compare objects. trait equality[t] extends equals { val ttag: classtag[t] def key: seq[any] def canequal(other: any): boolean = other match { case that: equality[_] if that.ttag == ttag => true case _ => false } override def equals(other: any): boolean = other match { case that: equa