Posts

Showing posts from August, 2011

c++ - Sort std::vector<int> but ignore a certain number -

i have std::vector<int> of size 10 , each entry -1. vector represents leaderboard game (high scores), , -1 means there no score entry. std::vector<int> myvector; myvector.resize(10, -1); when game started, want load high score file. load each line (up 10 lines), convert value found int std::stoi , , if number >0 replace -1 in vector @ current position. all works. problem: since values in file aren't sorted, want sort myvector after load entries. with std::sort(myvector.begin(), myvector.end()); this sorts in ascending order (lower score better in game). the problem that, since vector filled -1 , there aren't 10 entries saved in high scores file, vector might contain few -1 in addition player's scores. that means when sorting vector above code, -1 appear before player's scores. my question is: how sort vector (in ascending order), entries -1 put @ end (since don't represent real score)? combine partitioning , sorting:

Merging 2 folders in java keeping the common files by changing its name -

there 15 folders have. every folder has similar sub-structure. merge contents of folders: 1. taking 2 folders @ time 2. taking 3 folders @ time such both files same name saved. example: folder 1 ---pqr ------abc.txt ------xyz.txt folder 2 ---pqr ------abc.txt after merging: folder 3 ---pqr -------abc.txt -------abc.txt(2) -------xyz.txt please me java code. in advance. this have done far in netbeans. package merger; import org.apache.commons.io.fileutils; import java.io.file; import java.io.ioexception; import java.util.hashmap; import java.util.map; public class merger { public static void main(string[] args) { } public void copydifferentfolderfilesintoone(string mergedfolderstr, string... foldersstr) throws ioexception { final file mergedfolder = new file(mergedfolderstr); final map<string, file> filesmap = new hashmap<> (); (string folder : foldersstr) { updatefilesmap(new fil

r - Calculating the median of a time series, by 8 every 8 hours -

i new r , have calculate mean of time series, containing 5 years, hourly taken data of ozon etc.. my df looks like: structure(list(date = structure(c(1l, 1l, 1l, 1l), .label = "01.01.2010", class = "factor"), day.of = c(1l, 1l, 1l, 1l), time = structure(1:4, .label = c("00:00", "01:00", "02:00", "03:00"), class = "factor"), svf_ray = c(1l, 1l, 1l, 1l), gmax = c(0, 0, 0, 0), ta = c(-1.3, -1.2, -1.2, -1.2), tmrt = c(-19.3, -12.1, -12, -12.1), pet = c(-10.4, -8.7, -8.7, -8.7), pt = c(-11.3, -9.3, -9.3, -9.3), ozon = c(61.35, 62.65, 63.4, 63.85), rdatum = structure(c(14610, 14610, 14610, 14610), class = "date"), year = c(2010, 2010, 2010, 2010), month = c(1, 1, 1, 1), day = c(1, 1, 1, 1), hour = c(0, 1, 2, 3)), .names = c("date", "day.of", "time", "svf_ray", "gmax", "ta", "tmrt", "pet", "pt", "ozon&

c# - MVC5 WebSecurity, use secondary database temporarily -

i have solution 2 mvc projects. first management system, second portal contractors. want manage contractor login of portal via main application. the membership database both projects identical in schema (the default). thought hijack main system's register action, swap out connection string, register contractor user in its' own database, swap connection string main one. i'm guessing won't work, namely based on fact websecurity.initializedatabaseconnection() can called once. thus question: if want call websecurity.createuserandaccount() method point different database initialized for, how so? i looked @ built-in initializesimplemembership filter clues, not seeing path i'm looking for. is feasible approach? alternatively, if can password hashed per same way it's done default, looks can enter required data db manually. it appears can manually work out. according msdn docs websecurity.createuserandaccount() : this method creates n

r - plotting points within a date range specified with shiny slider bar -

from larger dataset, want plot points within min , max date specified shiny slider bar containing date range. post builds related post linked here . data contained @ bottom using dput . the code/app below sequentially plots points date increased slider bar. when move 2nd slider bar want points no longer in date range removed, currenlty not happen. how subset data points (and paths) >= min date , <= max date shown? not clear me how reference 2 dates on slider bar. thanks in advance. library(ggplot2) library(shiny) ui <- fluidpage( titlepanel("gps data summary"), sliderinput(inputid = "order", label = "sequance of observations", min = as.date(min(dat$posigmt)), max = as.date(max(dat$posigmt)), value = c(as.date(min(dat$posigmt)), as.date(min(dat$posigmt)))), plotoutput("pointplot") ) server <- function(input, output) { output$pointplot <- renderplot({ p <- ggp

windows - Continuous deployment with Microsoft Azure -

if worker role or matter web roles continuously serving both long/short running requests. how continuous delivery work in case? pushing new release in cloud abort current active sessions on servers. should strategy handle situation? cloud services have production , staging slots, can change whenever want. continuous d or can implemented using visual studio team services, , recommend - use that. say, demands decide when should switch production , staging slots (for example, did when user load low, in our case night, can different in case). slots swapping fast process , (as far know) process of changing settings behind load balancers not physical deployment. https://azure.microsoft.com/en-us/documentation/articles/cloud-services-continuous-delivery-use-vso/#step6 upd - remember testing that, , experience incoming connections stable (for example, rdp) , outgoing not. so, can not guarantee existing connections ended gracefully, experience there no issues.

vsto - Outlook AddIn - change the GlobalAppointmentId -

is there way change globalappointmentid of appointment. i found property schema: var globalidpropertyschema = @"http://schemas.microsoft.com/mapi/id/{6ed8da90-450b-101b-98da-00aa003f1305}/00030102"; and set new value it: item.propertyaccessor.setproperty(globalidpropertyschema, my_new_id); then when using item.propertyaccessor.getproperty i'm getting new id, item.globalappointmentid still original one. i'm needing addin can sync appointments using ics files, our system sends ics files suffix in icalendar uid field. it's possible create appointments our system through outlook addin, ics file send uses globalappointmentid uid field in ics file. store it, needs have our suffix. tips? you need release appointment make sure outlook reloads next time. do see change after restart outlook?

java - Calling a method with it's previous values on a single line -

so have quite simple method, has 1 job, has give me min , max values of chaning variable. public int[] axislimits(int axisinfo, int axismin, int axismax){ if(axisinfo >= axismax){ axismax = axisinfo; }else if(axisinfo < axismin){ axismin = axisinfo; } int axislimits[] = {axismin, axismax}; /* axislimits[0] = axismin; axislimits[1] = axismax; */ return axislimits; } previously had int axislimits[] = new int[2], that's why have 2 lines commented. so it's works fine, have predefine 2 variable every axis, , save min , max values before next call: int limitz[] = new limits().axislimits((int)accelz, minaccelz, maxaccelz); minaccelz = limitz[0]; maxaccelz = limitz[1]; and can use minaccelz , max accelz or limitz[0] , limitz[1]. is there way go around , make single line call? (so can work limitz[0] , limitz[1] needed? how class like: public class minmax { private int min; p

Combine / merge / mix multiple audio files with MP4Parser on Android -

i have 2 mp4 audio files , 1 mp4 video file. need combine them reproduce video , 2 sounds @ same time (parallel, not concatenate), in order mp4 file. for example, have mp4 audio file voice, music, , video. need play videoclip. i have been trying add several audio tracks movie mp4parser with: video.addtrack(audiotrack1); video.addtrack(audiotrack2); but when play it, can hear 1 of them. maybe mp4parser working correctly , didn't understand functionality, cause need answer it. is possible mp4parser or wrong , impossible? if possible, please give me working example code? thank in advance.

javascript - How to use multiline sprite sheet in Craftyjs without specifying frames manually -

i've started out using craftyjs , running problem. i have sprite sheet has 2 rows same animation. top row has 4, bottom has 3. i can't figure out how play through 7 images. can play through 1 row or other not through them all. this main function have. note commented out section. can work fine if explicitly set each frame. it's not bad 1 since have 7 of them.... have have 100+! function talk(){ var talker = crafty.e('2d, canvas, talk_start, spriteanimation'); /* .reel('talk', 1000 ,[ [0,0],[1,0],[2,0],[3,0], [0,1],[1,1],[2,1] ]) */ talker.reel('talk', 1000, 0, 0, 6); talker.animate('talk', -1); } is there way make go through rows on sprite sheet without having manually create frames? thanks in advance! as far aware there no built-in way in crafty (v0.7.1) this. however, can make helper function generate these wrap-around reels you. function generatereel(fromx, fromy, framec

c++ - Static locals in methods and ELF OS ABI -

given program $ cat main.cpp #ifndef with_local_static static int y = 0; #endif class x { public: void foo() { #ifdef with_local_static static int y = 0; #endif ++y; } }; int main() { x().foo(); return 0; } compiled in 2 different ways: $ g++ main.cpp -o global $ g++ main.cpp -dwith_local_static -o local i 2 different binary formats: $ file local local: elf 64-bit lsb executable, x86-64, version 1 (gnu/linux), dynamically linked (uses shared libs), gnu/linux 2.6.24, buildid[sha1]=0x8d8e998601e44115b5fa6c0e71f3ed97cb13a0bd, not stripped $ file global global: elf 64-bit lsb executable, x86-64, version 1 (sysv), dynamically linked (uses shared libs), gnu/linux 2.6.24, buildid[sha1]=0x3481ba7c6969ed9d1bd1c8ce0f052d574023d488, not stripped can explain why elfosabi_linux in 1 case, elfosabi_none in other? compiler gcc 4.7.2 the background in environment, loader rejects executables not elfosabi_none . the gnu/linux format super

wamp connection failing due to protocol violation with standard recent versions of ratchet/wamp and autobahn -

i trying put wamp connection local website. used ratchet/wamp on server side , autobahn|js on client side. service running fine , able connect, onopen/onclose callbacks being triggered on server. but when connect browser, connection's onopen callback never called. instead, console log shows following: "autobahnjs debug enabled" autobahn.js:123:6 "ok, autobahn loaded" "0.9.9" wamp.php:28:1 "trying create wamp transport of type: websocket" autobahn.js:732:6 "using wamp transport type: websocket" autobahn.js:732:6 array [ 1, "blablarealm", object ] autobahn.js:732:6 "websocket transport send" "[1,"blablarealm",{"roles":{"caller":{"features":{"caller_identification":true,"progressive_call_results":true}},"callee":{"features":{"caller_identification":true,"pattern_based_registration":true,"shared_regis

php - users getting created in joomla -

Image
attached image has user list created without knowledge in website build on joomla framework. can me understand how these users getting created , how stop them created? i changed "allow user registration" under user: options no , fixed.. i able create users registration page , see new users in list. able create users thinking error. infact working way destined to.. link followed https://docs.joomla.org/help35:components_users_configuration thanks ceejayoz comment.

javascript - How can I prevent UTF8 strings from being allowed in my HTTP queries using JS (Node.js)? -

i have mysql table username field latin1 charset. if search table utf8 string, error: error: er_cant_aggregate_2collations: illegal mix of collations (latin1_swedish_ci,implicit) , (utf8mb4_unicode_ci,coercible) operation 'like' side question: because i'm using statement, specifically? i feel solution problem check if username parameter http query latin1 compatible string or not. if not, omit sql query. how check if particular string compatible specific character set latin1 in javascript/node.js? i realized solution problem convert encodings within sql using convert function.

Method Not Allowed http exception using AJAX in Laravel -

what causing exception? meaning of methodnotallowedexception ? using laravel 5.2. html , input fields: <div class="form-group"> <label class="control-label">name</label> <input type="text" class="form-control" name="name" id="name" data-validate="required" placeholder="enter name" /> </div> <div class="form-group"> <label class="control-label">detail</label> <textarea class="form-control" name="detail" id="detail" placeholder="enter detail"></textarea> </div> <input type="hidden" id="_token" name="_token" value="{{ csrf_token() }}"> <div class="form-group col-sm-offset-3"> <button type="submit" onclick="postdata()

cloud - gsutil: Can't touch a file with brackets in the name -

$ gsutil du -sh gs://test123/ commandexception: cloud folder gs://test123/testfile[1994]/ contains wildcard; gsutil not support objects wildcards in name. $ gsutil mv gs://test123/testfile[1994]/ gs://test123/testfile_1994/ commandexception: cloud folder gs://test123/testfile[1994]/ contains wildcard; gsutil not support objects wildcards in name. $ gsutil mv "gs://test123/testfile\[1994\]/" gs://test123/testfile_1994/ commandexception: no urls matched: i'm unable list directory, or rename folder. should do? since there isn't answers here whatsoever, i'll post i've done. haven't put effort making easy use. ymmv. check out gsutil github go commit d153cb33bfa8e96a32b2ebdee86e03251cfb71fd , working at. revert commit 46c09952d137e8704c1209bb8bdfbb2e73a2cd5d after reading commit message , making sure you're aware of why blocked. apply patch @ bottom of message. disables [ , ] wildcard characters.

Quoted identifier error Codefluent -

we have quotedidentifier problem azure producer. have entity defined geography property. created geospatial index on table. however, if perform insert or update on table followind error: insert failed because following set options have incorrect settings: ‘quoted_identifier’. verify set options correct use indexed views and/or indexes on computed columns and/or filtered indexes and/or query notifications and/or xml data type methods and/or spatial index operations. we solved error dropping , restoring stored procedures of table set quoted identifier on now. the problem is, every time run producer stored procedures dropped , created quoted identifier off. how can solve situation? you can configure sql server producer generate set quoted_identifier on @ top of files: <cf:producer name="sql server" typename="codefluent.producers.sqlserver.sqlserverproducer, codefluent.producers.sqlserver"> <cf:configuration quotedidentifier=

javascript - How can you avoid prevent a beforeEach from running before one particular it block? -

describe('1', function () { beforeeach(function () { // before each except 1.5 }); it('1.1', function () { }); it('1.2', function () { }); it('1.3', function () { }); it('1.4', function () { }); it('1.5', function () { // beforeeach shouldn't run before }); }); i'd prevent beforeeach running before it block 1.5 . how can that? option 1 i suggest using nesting describes, e.g.: describe('1', function () { describe('1 4', function () { beforeeach(function () { // before each except 1.5 }); it('1.1', function () { }); it('1.2', function () { }); it('1.3', function () { }); it('1.4', function () { }); }); describe('only 5', function () { it('1.5', function () { // beforeeach shouldn't run before }); }); behind scenes describe register befor

php - How do I access an Array Value using it's Key in a view -

i've been working on method email users data , i'm having trouble printing data in view. can access data in bulk format displays within html table user. model: function getemaildata($usersid){ $this->db->select('*'); $this->db->from('symptom'); $this->db->where('userid', $usersid); $symptomstate = $this->db->get(); $result = $symptomstate->result_array(); return $result; } function getemailbmdata($usersid){ $this->db->select('*'); $this->db->from('bowelmovement'); $this->db->where('userid', $usersid); $bmstate = $this->db->get(); $result = $bmstate->result_array(); return $result; } controller: function senddataasemail(){ $uid = $this->session->userdata('id'); $uname = $this->session->userdata('username'); $uemail = $this->input->post('email_data');

wpf - Copy list to Flowdocument messes up 1st listitem -

i'm writing extension allows user merge multiple notes single note , provides features adding periods onto end of original notes. i'm writing code copies parts of 1 flowdocument , inserts periods goes. i having problems copying lists new document. reason first listitem ends in paragraph preceeding list instead of in list. my code: foreach (block b in tempdoc.blocks) { thisblock++; if (b list) { pkhcommon.wpf.helpers.addblock(b, mergeddocument); } else { paragraph p = b paragraph; foreach (inline inl in p.inlines) { if (!(inl linebreak)) pkhcommon.wpf.helpers.addinline(inl, mergeddocument); } if (thiselement != lastelement || thisblock

Deploying Rails 3 app on bluehost -

i keep receiving 500 internal server error i followed guide bluehost found here , still nothing works ~/railstest/public/.htaccess options -multiviews passengerresolvesymlinksindocumentroot on #set whatever environment you'll running in railsenv production rackbaseuri / setenv gem_home /home1/railstestc/ruby/gems ~/.bashrc export hpath=$home export gem_home=$hpath/ruby/gems export gem_path=$gem_home:/usr/lib64/ruby/gems/1.8 export gem_cache=$gem_home/cache export path=$path:$hpath/ruby/gems/bin export path=$path:$hpath/ruby/gems if click bluehost's hosting tab, , click rubygems icon you'll see nice notice down page bit: using ruby gem(s) !!!!at time rails 3.0 not supported , can cause broken ruby/rails environment!!!! need add /home4/localvor/ruby/gems include path. can adding following code script: $:.push("/home4/localvor/ruby/gems") in other words, blu

statistics - Different results in R console versus Jupyter -

i'm analyzing agreement between 2 judges scoring same item using cohen's kappa. i'm using r , kappa.test() function fmsb package. when run in r console don't error, in jupyter do. in r console rd <- c(1,0,0,0,1,1,0,0,1,0) ba <- c(1,0,0,1,0,1,0,0,1,0) kappa.test(rd, ba, conf.level=0.95) $result estimate cohen's kappa statistics , test null hypothesis extent of agreement same random (kappa=0) data: rd , ba z = 1.7723, p-value = 0.03817 95 percent confidence interval: 0.06683747 1.09982919 sample estimates: [1] 0.5833333 $judgement [1] "moderate agreement" but in jupyter get error in vapply(seq_along(mapped), function(i) {: values must length 1, fun(x[[1]]) result length 0

c - Pop function linked list, glibc detected double free or corruption -

i recieving error when attempt run program: * glibc detected * ./a.out: double free or corruption (fasttop): 0x0000000001926070 *** i attempted create own pop function in c , giving me error above. i'm not sure went wrong. struct node *pop(struct node *top, int *i) { struct node *new_node = top; int count = 0; if ( new_node == null) { return top; } while ( new_node != null && (count < 1)) { *i = new_node->value; free(new_node); new_node = new_node->next; count++; } return new_node; } free(new_node); new_node = new_node->next; you access objct after freed it. invokes undefined behaviour. once released, must not acce object. instead use temporary pointer: struct node *next = new_node->next; free(new_node); new_node = next; that actual cause fault. however, code far complicated: the if ( new_node == null) superfluous,as while loop tests null pointer , new_node same value top anyway

version control - How to copy several Monticello commits from local repository to Smalltalkhub.com automatically? -

i commit several versions of monticello packages local repository on disk during day. at later time want sync local repository smalltalkhub.com repository. at moment copy local commits manually 1 one smalltalkhub repository using monticello browser. how can automate task? you can use gofer automate monticello tasks. gofer new package: 'myproject-core'; package: 'myproject-tests'; url: 'http://smalltalkhub.com/mc/user/myproject/main/' username: 'user' password: '***'; push.

2D array pointer access segmentation fault in C -

i'm trying write code conway's game of life in c. have problems 2d array contain universe. show parts of code cause me problems. there 2 problems can't handle. #include <stdio.h> #include <stdlib.h> #include "file2ppm.h" typedef enum { false, true } bool; void *allocatememoryfor2darray(int x, int y); //allocate memory 2d array void initializeuniversefromfile(char* path, int x, int y, int array[x][y]); //set values of cells file void initializeuniverserandomly(int x, int y, int array[x][y]); //set random values int getnumberofcolumns (file *file); //get number of columns in file (ydim of universe) int getnumberoflines (file *file); //get number of lines in file (xdim of universe) void print2darray (int x, int y, int array[x][y]); //print 2d array void setdimensionsfromf

rest - PHP and basic RESTful services; GET requesting all records vs one record -

my php class has project involving restful services have basic service set this: $request = $_server["request_method"]; switch($request) { case 'get': $user = $acctreader->read($_get["username"], $_get["password"]); if (isset($_get["id"]) && $user == true) { // echo method return single record db after validating $user account in separate table } elseif (!isset($_get["id"] && $user == true) { // echo method return records db } case 'post': case 'put': case 'delete': default } i'm in midst of having respond user validation in such if enter in valid username/password do not explicitly request single id, should see records here's part of html looks like: <form action="taskservice.php" method="get"> <label for="username">username</label>

I unpublish my chrome extension by mistake, how could I republish it in the same location? -

Image
the extension used reside here: https://chrome.google.com/webstore/detail/beanote-note-taking-on-pa/nikccehomlnjkmgmhnieecolhgdafajb there no republish button.... i appreciate if me it... >< thanks

how to design model classes in java project -

i new jsp. want test project familiar it. the project have selected design website people can register on , make resume themselves. each person registered can define projects has worked on before. for example, if register user name sht , define projecta , projectb , means these projects should displayed in resume. by way, want use mvc design. my problem when want design model classes, don't know approach best following scenarios: 1- first thing came mind that, can have class users contains userid , username , ... need class projects contains projectname , projectid , , again class userproject has userid , projectid able find project belongs specific user. in example have user object user class userid 1 , username 'sht'. i have 2 objects project class : object1{projectid = 1, projectname = "projecta"} object2{projectid = 2, projectname = "projectb"} and again have these objects userproject : object1

javascript - Bulk uploading markers from Excel with custom info boxes -

i'm trying upload excel spreadsheet containing student names geolocations, , "top skills" online class google javascript api. eventually, want each location have popup box associated it, displaying student name , top skills. from can tell according api, have use data arrays plot markers: var locations = [ ['bondi beach', -33.890542, 151.274856, 4], ['coogee beach', -33.923036, 151.259052, 5], ['cronulla beach', -34.028249, 151.157507, 3], ['manly beach', -33.80010128657071, 151.28747820854187, 2], ['maroubra beach', -33.950198, 151.259302, 1] ]; then add these locations this: for (i = 0; < locations.length; i++) { marker = new google.maps.marker({ position: new google.maps.latlng(locations[i][1], locations[i][2]), map: map }); } a couple of questions: is there speedier way of uploading excel spreadsheet data javascript format without manually writing each location?

c++ - Why is operator""s hidden in a namespace? -

in order use operator""s std::string have using namespace std::string_literals . user-defined literals don't begin _ reserved, possible conflict can't excuse. other operator""s std::chrono that's int literals, there's no conflict there either. what's reason this? there 2 reasons why literals put namespaces: it considered undesirable users use using namespace std; hold of corresponding literals. having literals declared in namespaces specific these doesn't cause problem. depending on domain may desirable use s suffix else. there suffix s mean seconds don't conflict. in video of stl's cppcon 2014 talk (posted remyable in comment) stephan t. lavavej explains overall design of literals in c++14 , pretty clear not supposed in global namespace! instead, literal suffixes in standard library live in hierarchy of inline namespaces giving users fine-grained control on literals being made available. example, lite

Python: setting max for bank withdraw -

i'm new python , still trying hang of it. i'm attempting change processing function in following code user can not withdraw more money "bank" has on record, 500. hoping help. enter if statement >500? #simple bank atm def main(): pin=7777;balance=500;pin=0;success=false pin=getinput(pin) pin,pin,balance,success=processing(pin,pin,balance,success) display(success,balance) #input function def getinput(pin): pin=int(input(“please enter pin:”)) return pin #processing function def processing(pin,pin,balance,success): if pin==pin: success=true amt=float(input(“how withdraw?”)) balance=balance-amt return pin,pin,balance,success else: success=false return pin,pin,balance,success you can use if condition this. if amt <= balance: #can't withdraw on current balance balance -= amt else: print("error. amount exceeds funds on record.") also, other things

android - Realm 0.89 causes UnsatisfiedLinkError -

since upgrading realm 0.83.1 0.85 or 0.89, i'm unable run app. i'm stuck in 0.83.1 version. i'm getting weird link error when run on device. i'm trying encrypt database, it's supported in 0.85 or higher. appreciated! here logcat output: caused by: java.lang.unsatisfiedlinkerror: no implementation found java.lang.string io.realm.internal.util.nativegettableprefix() (tried java_io_realm_internal_util_nativegettableprefix , java_io_realm_internal_util_nativegettableprefix__) @ io.realm.internal.util.nativegettableprefix(native method) @ io.realm.internal.util.gettableprefix(util.java:47) @ io.realm.internal.table.(table.java:38) @ io.realm.realmschema.(realmschema.java:40) @ io.realm.baserealm.(baserealm.java:78) @ io.realm.realm.(realm.java:138) @ io.realm.realm.createandvalidate(realm.java:269) @ io.realm.realm.createinstance(realm.java:249) @ io.realm.realmcache.createrealmorgetfromcache(realmcache

In powershell using imagemagick, how to convert image to a new path -

i want convert tif jpg placed in c:\data\ get-childitem -path $source -filter *.tif | %{ convert $_.fullname "c:\data\$($_.fullname -replace ".tif+$", ".jpg")" } but not work. however works - places converted file in same location original file get-childitem -path $source -filter *.tif | %{ convert $_.fullname "$($_.fullname -replace ".tif+$", ".jpg")" } you're messing destination path concatting c:\data $_.fullname try $_.name property: get-childitem -path $source -filter *.tif | %{ convert $_.fullname "c:\data\$($_.name -replace ".tif+$", ".jpg")" }

cordova - Working with non ionic-native plugins in Ionic 2 -

i'm using custom cordova plugin ( https://github.com/vjai/simple-crypto ), not available in ionic native. i'm using ionic 2 , have installed plugin using command: cordova plugin add https://github.com/vjai/simple-crypto the interface this: var rncryptor = cordova.require("com.disusered.simplecrypto.simplecrypto"); rncryptor.encrypt(key, data, successcallback, failurecallback) rncryptor.decrypt(key, data, successcallback, failurecallback)` method 1: have tried invoke plugin using window.plugins.simplecrypto.encrypt(...) but when run ionic serve , error: typeerror: cannot read property 'simplecrypto' of undefined method 2: way tried cordova.plugins.simplecrypto.encrypt(...) the error got referenceerror: cordova not defined is there way go around doing this? have tried use cordova.plugins.simplecrypto.encrypt function on device? it working case. reason being, emulator unable run cordova.js

html - ng-click() in a div behind another div -

Image
i'm trying trigger ng-click in div behind div, , not working. have situation below: in situation, want trigger ng-click on yellow circle when clicked, have div above yellow circle, div folded corner image. how can trigger ng-click() in div container of yellow circle? you create empty span element attach event <div class="green-box"> <span class="yellow-number" ng-click="action()"></span> </div> adding css green-box position relative , span.yellow-number positions absolute.

HTTP 406 Response Code Check is breaking my Google App Engine/Python API -

i have google app engine api using python , ndb working except http response code/error checking. put in code handle 406 (to accept json requests) , 400 errors (to prevent user leaving required field blank) post function 1 of entities seems have broken code. code error checking included: class task_action(webapp2.requesthandler): def post(self): #only allows json, if not, error if 'application/json' not in self.request.accept: self.response.status = 406 self.response.status_message = "not acceptable, api supports application/json mime type" return new_task = task(parent=parent_key, name = self.request.get("task_name"), hours = int(self.request.get("task_hours")), id = self.request.get("task_name")) #has error code, since name , hours required if name: new_task.name =

windows - Sound Blaster emulation in NTVDM: direct mode and MPU don’t work as expected -

i’ve been trying write small program producing sound example students learn x86 assembly programming in real mode. succeeds playing sound when run dosbox fails when run in ntvdm (i use windows xp’s one). the same trouble attempts access sound blaster in so-called direct mode (with dsp reset performed). dsp command seems work reliably me in ntvdm 0xe1 — retrieving dsp version info. most of ms-dos programs have used produce non-internal-speaker sounds don’t work in ntvdm either. except few of them happily do. i had similar problem internal speaker output few years ago, , turned out order of performing several initialization tasks seemed exchangeable matters in fact. time can’t find solution. here’s test piece of code have (fasm syntax): include 'macro\proc16.inc' midiport_data = $0330 midiport_command = $0331 org 100h start: stdcall midi.initialize stdcall midi._writedata, $c0 stdcall midi._writedata, $00

git - composer.lock is killing my push to heroku? -

Image
i added .gitignore b.c. don't need in repo , of sudden heroku not accept push. heroku runs checks, based on selected repo language / technology, when push code git pre-receive hooks. trying run php app. 1 of checks php repos enforces repo must include composer.json . if don't need must commit empty json: the heroku php support applied applications when application has file named composer.json in root directory. if application has no composer dependencies, must include @ least empty ( {} ) composer.json in order recognized php application. and have dependencies in it, composer.lock required: if composer.json specifies dependencies of kind in require section, corresponding composer.lock gets generated running composer update must committed repository and can push code github because doesn't have such hook.

c - read error device driver -

not able receive buffer using fread() userland function. driver using copy_to_user() pass info. there blatant errors in way implementing this? the error can seen in printf("%s\n",buffer); statement userland code. userland code: #include <stdio.h> #include <stdlib.h> #include <unistd.h> /* ## slave register descriptions ## reset = 0x4 ## en = 0x8 ## input = 0xc ## outlo = 0x10 ## outhi = 0x14 */ void readaccelerator(unsigned int * outlo, unsigned int * outhi); int writeaccelerator(unsigned int *data, char *address); int main (int argc, char *argv[]) { unsigned int *data; unsigned int *result; char * reset_addr = "1"; char * en_addr = "2"; char * input_addr = "3"; unsigned int * outlo = 0; unsigned int * outhi = 0; data = 0xffef; writeaccelerator(1, reset_addr); writeaccelerator(0, reset_addr); writeaccelerator(data, input_addr); writeaccelerator(1, en_addr);

python - how to filter a spark dataframe by a boolean column -

i created dataframe has following schema: in [43]: yelp_df.printschema() root |-- business_id: string (nullable = true) |-- cool: integer (nullable = true) |-- date: string (nullable = true) |-- funny: integer (nullable = true) |-- id: string (nullable = true) |-- stars: integer (nullable = true) |-- text: string (nullable = true) |-- type: string (nullable = true) |-- useful: integer (nullable = true) |-- user_id: string (nullable = true) |-- name: string (nullable = true) |-- full_address: string (nullable = true) |-- latitude: double (nullable = true) |-- longitude: double (nullable = true) |-- neighborhoods: string (nullable = true) |-- open: boolean (nullable = true) |-- review_count: integer (nullable = true) |-- state: string (nullable = true) now want select records "open" column "true". shown below, lots of them "open". business_id cool date funny id stars text type u