Posts

Showing posts from September, 2012

javascript - How to format float 0.5 to float 0.50 -

Image
update: seem bug. github issue link: https://github.com/freecodecamp/freecodecamp/issues/10491 ================= i studying freecodecamp course-"exact change". need convert float-type-data 0.5 float-type-data 0.50, have try solutions not work! float.tofixed(2) return string-type "0.50", , if use parsefloat("0.50") return float-type-data 0.5! how can solve issue? follow requirement screenshot, had try float 0.5, failed pass! you have slight misconception numbers in javascript. javascript numbers not have trailing zeroes after decimal point. if requirement 0.50 displayed on screen, must string "0.50" , , not number, 0.5 .

c - Running OpenCL using Visual Studio 2015 -

i'm newbie in opencl, far referred dr. dobbs tutorials opencl , few others , ran on ubuntu worked same codes won't/refuse work on windows using visual studio required environment variables set correctly. i'm using 980m cuda sdk 8 on vs 2015. have 2 files, 1 in c , kernel(cl) file. whenever add both .c & .cl files, program refuses run throwing errors can't find program files , things that. however, if write kernel file within c file, works 1 out of 3. same program works fine on pc running ubuntu 16 , pc amd card running on ubuntu 16. program i'm trying run vector addition written in c. i've attached link code. opencl vector addition add_numbers.c #define program_file "add_numbers.cl" #define kernel_func "vecadd" #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #ifdef __linux #include <unistd.h> #include <fcntl.h> #endif // __linu

sql server - Can both a table and indexed view be columnstore? -

i have data warehouse fact table millions of records , clustered columnstore table. want have indexed view of table casts numeric values of text column numbers , text values of same column blanks, faster performance. if create view clustered index view, view's data stored in columnstore format? before reading answer should read this excellent post niko neugebauer the dude go columnstore indexes in sql server. to answer: yes can create clustered columnstore index in view in sql server. recommendation test view first , decide if need new index or columnstore index underlying table satisfying conditions.

Calling a Excel report from C# with data in cells from SQL Server -

Image
i developing excel report getting data sql server. idea data powerpivot model, view can manipulated through slicers selecting year, week , location. report organized weekday monday saturday columns. within each column set of values placed. @ example here . want report called c# application can set slicer values , open excel report. question how create report. maybe can use cube formulas, or pivot tables. hope people out there can me this. regards geir f

java - Validation of a date with Hibernate -

Image
we have existing hotel management system. asked add date validation in "create accommodation" function in system. dialog looks this: the "end date" validated shown in code below. @future annotation in hibernate ensures date in future. @notnull @future @datetimeformat(pattern = "dd/mm/yyyy") @temporal(temporaltype.date) private date enddate; edit i asked add validation "start date". present or future date allowed. tried use @present annotation, guess there no such thing. unfortunately, @future not accept today's date. new kind of thing. hope can me. thank you. hibernate you can use @creationtimestamp @temporal(temporaltype.date) @column(name = "create_date") private date startdate; or on update @updatetimestamp @temporal(temporaltype.timestamp) @column(name = "modify_date") private date startdate; java (jpa) you can define field date startdate; , use @prepersist protected void oncrea

Bulk changes of list context in sharepoint using R -

i have sharepoint list managed transform in data frame using rcurl , xml murl=geturl("http://mysharepointserver/_vti_bin/listdata.svc/project", userpwd ="login:pwd") mxml=xmlparse(murl)#create tree use c pointers nodes=getnodeset(xmlroot(mxml), "//m:properties") # access xpath queries sdf=xmltodataframe(nodes) what after comparing other data able bulk edit entries in list> eg if nodevalue==x change x y more 1 x and change actual values in sharepoint , not r object there way in r?

javascript - How to read from the console log and if the error includes the string " up-to-data" to pass the 'if' cycle with no error -

p4.run("sync", filename, function (syncerror, updateddate) { var logdata = console.log(syncerror); if() { } }); i'm not sure how implement this.. if there error include string "up-to-date" "if" cycle needs pass no errors. p4.run("sync", filename, function (syncerror, updateddate) { var logdata = syncerror.tostring(); if(logdata.indexof('up-to-date')!==-1){ return true; } else { console.log('not found'); throw new error(syncerror.message); } }); i figure out way. works me. hint void!

function - Use ping output to create a CSV -

i have written following code use ping command ping multiple computers, capture following values it: reply / request timed out etc. actual ip address of remote host this function working fine however, if trying returned values csv unable so. # declaration of function name , expected parameters function ping-check{ [cmdletbinding()] param ( [parameter(mandatory=$true, valuefrompipeline=$true, valuefrompipelinebypropertyname=$true, helpmessage='enter name of remote host.')] [string]$objcompname ) begin{ # setup process startup info $pinfo = new-object system.diagnostics.processstartinfo $pinfo.filename = "ping.exe" $pinfo.arguments = " -a " + $objcompname + " -n 2" $pinfo.useshellexecute = $false $pinfo.createnowindow = $true $pinfo.redirectstandardoutput = $true $pinfo.redirectstandarderror = $true } process{ $p = new-object system.diagnostics.process $p.startinfo = $pinfo $p.start() | out-null $p.waitforexit() # redirect o

unix - bash zip omit files -

i'd zip folder, zip skips files. folder structure is: main_folder > sub_folder > file2.sql file11.txt file12.sql main_folder contains sub_folder , 2 files, subfolder contains 1 file. when use zip -r $path * i receive .zip file contains except file11.txt. tried various options have not solved problem. zip makes correct structure , takes every single file except files main_folder. could try this; zip -r your.zip * -x file11.txt man zip; -x files --exclude files explicitly exclude specified files..

Gulp: Include folder tree, except one folder -

i want gulp.src include file , folders in src directory, except src/devpackages directory, src/devpackages directory not copied gulp.dest . how can that? tried gulp.src(['src/**/*', '!src/devpackages/**']) , gulp.dest creates src/devpackages , leaves empty. gulp.src([ basedir + '/**', // include '!' + basedir + '/src/devpackages{,/**}', // exclude devpackages ], { dot: true });

python - convert requests.models.Response to Django HttpResponse -

in django project, need get/post data third-party url in view, , redirect web page provides. example, can class testview(templateview): def get(self, request, *args, **kwargs): data = { 'order_id': 88888, 'subject': 'haha', 'rn_check': 'f', 'app_pay': 't', } url = 'http://some-third-party-api-url?order_id=88888&subject=haha&...' return httpresponseredirect(url) however want use third-party api wrapped sdk , class testview(templateview): def get(self, request, *args, **kwargs): sucre.alipay_sdk.base import alipay sucre.alipay_sdk import alipay_config django.http import httpresponse alipay = alipay(alipay_config) data = { 'order_id': 88888, 'subject': 'haha', 'rn_check': 'f', 'app_pay':

windows - How to unlock a directory/file with pure batch instructions? -

i know there several utilities (such unlocker, lockhunter, etc.) offer functionality of finding processes locking file or directory. however, using external software (even freeware) hassle within company , using powershell restricted. so, wondering how can write batch script can detect , terminate processes locking files in given directory? i guess should use kind of taskkill commands, quite new batch commands. attention.

android - gradle --profile option not working properly -

i have multimodule gradle android project. i trying run :app:installdebug task root project directory --profile flag , expecting profile report in app/build/reports see profiling report in root/build/report. also reports generated doesn't include profiling data :app:installdebug task configuration phase data app module. it nice if gradle doc doesn't give ample information on this.

java - Creating a copy of an excel file is not working as expected -

i want copy entire content of 1 excel(.xls) after replacing " , ' . however, code creating new excel copying last column(in case, 7th column). please advice going wrong code... public class rename { static hssfrow row_read = null; static hssfrow row_write = null; static cell cell; static fileoutputstream output = null; static hssfworkbook workbook_read = null; static hssfworkbook workbook_write = null; static hssfsheet sheet_read = null; static hssfsheet sheet_write = null; public static void removechar() { try{ fileinputstream input = new fileinputstream("inputpath//test_input.xls"); workbook_read = new hssfworkbook(input); sheet_read = workbook_read.getsheet("report"); workbook_write = new hssfworkbook(); sheet_write = workbook_write.createsheet("test"); dataformatter formatter = new dataformatter(); int rowcount = sheet_read.getlastrownum(); system.out.println(rowcount); for(int rownum = 0; rownum<=rowcount; rownum++) { for(int cell

Javascript: Using server-sent events with PHP? -

i'm trying first time use server sent events inmy project , i'm quite excited it. because can goodbye ajax. ( love ajax not i'm doing now). any way, tried use server sent events check ping server (php script) , if ping happens, show simple alert('hello world'); in page. however, don't know why never in page.. no errors either indicate went wrong. this javascript server sent code: var pin =localstorage.getitem("pin"); var evtsource = new eventsource("https://example.com/check-for-orders.php?pin="+pin+""); evtsource.addeventlistener("ping", function(e) { var data = json.parse(e.data); alert(data); alert('hello world'); }, false); and php code: <?php header("access-control-allow-origin: *"); header("content-type: text/event-stream"); header("cache-control: no-cache"); //header("connection: keep-alive"); session_start(); //

Filter method return just the first item Android -

i have recyclerview , tried make filter search recycler item , working , when use , type thing result first item of list. this filter method private list<data> filter(list<data> datas, string newtext) { newtext = newtext.tolowercase(); final list<data> filteredmodellist = new arraylist<>(); (data data : datas) { final string text = data.gettodo_title().tolowercase(); if (text.contains(newtext)) { filteredmodellist.add(data); } } return filteredmodellist; } and menu @override public boolean oncreateoptionsmenu(menu menu) { getmenuinflater().inflate(r.menu.menu_search, menu); menuitem searchitem = menu.finditem(r.id.action_search); searchview searchview = (searchview) menuitemcompat.getactionview(searchitem); searchview.setonquerytextfocuschangelistener(new view.onfocuschangelistener() { @override public void onfocuschange(view v, boolean hasfocus) {

razor - Render data from database in layout file -

i want include data (fetching database) in _layout file of asp.net mvc core project. situation: _layout page @if (signinmanager.issignedin(user)) { html.action("modules", "layout") } controllers/layoutcontroller.cs using microsoft.aspnetcore.mvc; namespace project.controllers { public class layoutcontroller : controller { ... public actionresult modules() { ///return modules return partialview("_modules", moduleaccess.tolist()); } } } views/shared/_modules.cshtml @model ienumerable<project.models.module> <div class="two wide column"> <div class="ui menu" id="modules"> @foreach (var item in model) { <a class="item"> @html.displayfor(modelitem => item.name) </a> } </div> when going webpage following error: 'ihtmlhelper<dynamic>' not contain

excel vba - how to read childnodes values based on another child node value in vba xml -

<legalentitydatavorow> <name>siemens financial services</name> <activitycode null="true"/> <attribute1>9474</attribute1> <attribute10 null="true"/> <attribute11 null="true"/> <attribute12 null="true"/> <attribute13 null="true"/> <attribute14 null="true"/> <attribute15 null="true"/> <attribute16 null="true"/> <attribute17 null="true"/> <attribute18 null="true"/> <attribute19 null="true"/> <attribute2 null="true"/> <attribute20 null="true"/> <attribute3>sfs</attribute3> <attribute4>sfs inc</attribute4> <attribute5 null="true"/> <attribute6 null="true"/> <attribute7 null=&qu

entity framework - How to properly create C# class with a list of weekly open hours property -

i feel going obvious many of you, research led me nowhere. i'm trying build class create objects list of properties one: public class myobject { [key] public int id { get; set; } public string title { get; set; } public list<openhours> openhours { get; set; } public filter filters { get; set; } } i want openhours object store list of daily hours accessible doing myobject.openhours[index].property . i'm getting error openhours object not have defined key, don't want in database different entity, want store properties same way if listed each of weekday's properties directly in myobject class. here openhours class: public class openhours { public dayofweek day { get; set; } public string starttime { get; set; } public string endtime { get; set; } } i want each of "myobject" objects have unique openhours values, not want create id it. missing in syntax, or bad logic so? thanks in

c# - How to detect that IsOneWay is set to true -

as follow below question, i'm getting same error. detect i'm in 1 of these situations, , avoid access servervariables collection. right i've got code in try catch - there has better way it. [operationcontract(isoneway = true)] public void somefunction() { } some code called: protected string getwebclientipaddress(httpcontext context) { try { string ipaddress = context.request.servervariables.allkeys.contains("http_x_forwarded_for") ? context.request.servervariables["http_x_forwarded_for"] : null; if (!string.isnullorempty(ipaddress)) { string[] addresses = ipaddress.split(','); if (addresses.length != 0) return addresses[0]; } return context.request.servervariables.allkeys.contains("remote_addr") ? context.request.servervariables["remote_addr"] : null

spring - Java and SAML - where to start? -

we have custom rest web app (java based) uses username/password login. call application 'admin'. users of admin use couple of commercial cloud based applications, call these app1 , app2. i've been asked investigate how can use single sign on between admin, app1 , app2. app1 , app2 can configured use saml , have full access code of admin application. i've done preliminary reading , understand principles involved. i want prototype code i'm not sure start! example how should proceed identity provider? interface should implement, there abstract class should extended? service provider. given app1 , app2 can configured use saml changes/extensions needed on admin app? many m disclaimer: i'm creator of pac4j. if have java apps , want secure them using saml, should take @ pac4j security engine available many java frameworks: j2e , spring mvc / boot , play , many more. for saml support: http://www.pac4j.org/1.9.x/docs/clients/saml.html

I'm new to spark,trying to generate the decision tree model in scala and use that model in java to predict.How to load that model in java? -

i have saved model generated in scala disc. val model = decisiontree.trainclassifier(trainingdata, numclasses, categoricalfeaturesinfo, impurity, maxdepth, maxbins) model.save(sc, "c:\model") using same imports java in order load model: decisiontreemodel model = decisiontreemodel.load(sc, "c:\\model");

python - PyInstaller Tkinter window low resolution in App bundle, but not in app program -

Image
i think i'm missing obvious can't figure out myself. i'm building mac app python 2.7 using pyinstaller (running dev3.3 version). app works fine, no issues. @ beginning there's small window updates built using tkinter. after building app pyinstaller (running oneflie option) 2 files( ls -al outcome): -rwxr-xr-x 1 karoldra staff 62756614 8 lis 11:08 mac drwxr-xr-x 3 karoldra staff 102 8 lis 11:09 mac.app here's structure of folder: mac mac.app contents frameworks info.plist macos mac resources myicon.icns basically - mac.app package contains same mac file main folder. the issues different resolution in tkinter window depending on file run. here's sample of tkiter window: the top 1 run mac file the bottom 1 run mac.app file as can see bottom ones resolution lower reason... can tell me why happening , how solve issue? eventually found answer by...carefully reading docs ;) there's 1 line so

php - when i add 'session' code, the page is not working -

it's simple authentification don't know why session interrupt page, when click on submit 'the page connect.php interrupt' 'unable process request' 'http error 500' $login = $_post['login']; $pwd = $_post['pwd']; $portfolio = new vendor\model\portfolio(); $list_portfolio = $portfolio->select_portfolio_by_mail($mail,$pwd); $result = mysql_fetch_array($list_portfolio[2],mysql_assoc); session_start(); $_session['nom'] = $result['nom']; $_session['prenom'] = $result['prenom']; index.php <?php session_start(); if (isset($_session['nom'])) { echo $contenu_fr; } elseif (!isset ($_session['nom'])) { ?> <form method="post" action="<?php echo $url_front.'/control/connect.php' ?>" id="contactform"> <div class="row"> <div class="col-md-6 col-sm-6 col-xs-12 form-group">

Android google calendar deleting future instances of recurring event -

i'm trying delete future instances of google calendar recurring (repeated) event pro-grammatically using content resolver. and have updated rrule of event , example if want delete future instances of event starting date 11/11/2016 edit rrule string so: freq=daily;until=20161111;wkst=su however , when viewing google calendar application find no changes , find event color has changed black color. some notes keep in mind: 1- i'm using third party library : https://github.com/everythingme/easy-content-providers calendarprovider calendarprovider = new calendarprovider(context); event event = calendarprovider.getevent(eventid); event.rrule = "freq=daily;until=20161111;wkst=su"; calendarprovider.update(event); and functionalities in library seem work fine. 2- while reading pro-grammatically recurring events have specific until date in it's rrule , have realized field in google event called "lastdate" updated 1 hour later after until value

unix - How can I make this find command work recursively in the current directory? -

i have find command , need make work recursively in current directory ( @ moment searches files on disk ) find . -name ‘oldname*’ -print0 | xargs -0 rename -s ‘oldname’ ‘newname’ any idea how make search in current directory navigated in terminal ? would work? find . -name 'oldname' -exec rename -n 'oldname' 'newname' \;

java - Many-stepped procedure with several possibilities for errors- call each step separately from outer class, or have one method? -

newbie here.. i'm wondering best practice in following case: i use mvc-pattern. controller-class needs call model-class perform procedure. procedure has 4 steps. in 3 first steps, if goes wrong, model produce list of strings, controller must ensure displayed user, in addition error message. in last step, model produce map, again controller must ensure showed user. in last step, timeout occur.. what best way handle this? i have made 2 rough drafts of suggestions below. alternative 1: public class model{ public list<string> step1(){ // return empty list if ok, fill list otherwise } public list<string> step2(){ // return empty list if ok, fill list otherwise} public map<string, string> step3(){ // return empty list if ok, fill list otherwise} } public class controller{ model mymodel; public void doprocedure(){ list<string> list = mymodel.step1(); if(list.size() != 0){ str

javascript - HTML5 local storage to save notes -

i created note web app allows user create several notes , navigate between them using various tabs on left. now want these notes save in local storage added following code: $(document).ready(function() { $(window).unload(savesettings); loadsettings(); }); function savesettings() { localstorage.notes = $('#notes').html(); } function loadsettings() { $('#notes').html(localstorage.notes); } } it works in degree. meaning whole div saved in cache reason when reload page can see different tabs not text wrote. whole point save notes it's problem if can't see text wrote. i unfortunately not knowledgeable on javascript & jquery, have no idea do. i believe smarter save each tabs , textarea individually in cache instead of whole div don't know how that. if can me or @ least guide me, appreciated. the "value" of <textarea> field apparently not become part of innerhtml of el

How To convert 1D array to 2D array in C# -

i have: string snacks="chocolate,alwa,samosa,channa"; i need array like: snacks= {"chocolate,alwa" , "samosa,channa"}; in c#. could pls suggest way find snacks string snack2[][]=new string[math.round(snacks.length/2)][2]; int cnt=0; for(int i=0;i<math.round(snacks.length/2);i++) { (int j=0;j<2;j++) { snacks2[i][j]=snack[cnt++]; } }

c# - how to make combobox to take data by selection and custom also both -

Image
i want insert data access database combobox have item in time when want insert thing there not exist in combobox how can write down manually on combobox , insert db oledbcommand cmd = new oledbcommand(); cmd.commandtype = commandtype.text; cmd.commandtext = "insert [data] ( [description] ) values ('" + combobox10text + "' )"; cmd.connection = con; con.open(); cmd.executenonquery(); system.windows.forms.messagebox.show("data inserted successfully"); you there, dot missing. combobox10.text give entered text: cmd.commandtext = "insert [data] ( [description] ) values ('" + combobox10.text + "' )"; i suggest check emptiness , use parameterized sql commands avoid sql injection

angularjs - ng2-cache support for angular2 -

on doing npm install ng2-cache latest version of angular2, throws following error: - +-- unmet peer dependency es6-shim@^0.35.1 +-- ng2-cache@0.1.5 `-- unmet peer dependency rxjs@5.0.0-beta.12 npm warn optional skipping failed optional dependency /chokidar/fsevents: npm warn notsup not compatible operating system or architecture: fseve nts@1.0.15 npm warn ng2-cache@0.1.5 requires peer of es6-shim@^0.35.1 none instal led. npm warn ng2-cache@0.1.5 requires peer of rxjs@5.0.0-beta.6 none insta lled. npm warn angular-quickstart@1.0.0 no description npm warn angular-quickstart@1.0.0 no repository field. npm warn angular-quickstart@1.0.0 no license field. and angular2 modules , has peer dependency on rxjs@5.0.0-beta.12 version. kindly on how can ng2-cache implemented , used in latest angular2 applications

java - Configuring the maven plugin cxf-codegen-plugin to ignore security concerns -

i trying set maven project generates java code based on wsdl files. unfortunately having problems because test environment doesn't have valid ssl certificate (i have confirmed using chrome). because happening in test environment not concerned security. want code generation work. the following shows how use plugin cxf-codegen-plugin <plugin> <groupid>org.apache.cxf</groupid> <artifactid>cxf-codegen-plugin</artifactid> <version>3.1.8</version> <executions> <execution> <id>generate-sources</id> <phase>generate-sources</phase> <configuration> <sourceroot>${project.build.directory}/generated/cxf</sourceroot> <defaultoptions> <bindingfiles>

javascript - How to determine a execution time of a PHP, jQuery, AJAX script -

in 1st condition : i passing values using jquery ajax php file named email.php. want script executed 20 secs after 20 secs should throw error max execution time reached can execute through jquery ajax via getting response. in 2nd condition i want determine execution time of jquery code. ex: if have got value through fields , have sent server, somehow if server not respond want script execution time, if script has executed more 20 secs terminate process , display error message of network error! some links may : php set_time_limit() microtime() you. javascript https://developer.mozilla.org/en-us/docs/web/api/console/time https://developer.mozilla.org/en-us/docs/web/api/performance/now

android - Export data (offline): save and share a file -

i offer convenient way backup data cordova app users. appealing me app backup data json file , offer user save/share same way other file. i've got far saving data real file , invoking share dialog, file fails share/save. it's because external apps don't have permissions access file created app (gmail says: 'permission denied attachement') , don't know how allow external apps access file created app. ideas? my code: ex = json.stringify(ex); window.resolvelocalfilesystemurl('cdvfile://localhost/temporary/', function(dir) { console.log('directory resolved.'); dir.getfile('makeshift.json', {create: true, exclusive: false}, function(file) { console.log('date file created.'); file.createwriter(function (filewriter) { filewriter.onwriteend = function() { console.log('data saved.'); var time = date.now(); cons

asp.net mvc 4 - What is executing the code when using await/async? -

here sample code https://www.asp.net/mvc/overview/performance/using-asynchronous-methods-in-aspnet-mvc-4 public async task<actionresult> gizmosasync() { viewbag.syncorasync = "asynchronous"; var gizmoservice = new gizmoservice(); return view("gizmos", await gizmoservice.getgizmosasync()); } as understood, async/await usefull freeing worker thread can process other request. getgizmosasync not call "httpresponse.content.readasasync" (which guess executed thread io pool) it's calling other non async code " var uri = util.getserviceuri("gizmos");". what executing "var uri = util.getserviceuri("gizmos");" if it's not thread worker pool ? there no io here. your understanding of async little off. allows thread returned pool if it's in wait-state . last bit important. thread still executing code, it's external process going on, doesn't require thread, i.e. network comm

javascript - Return only certain yield in generator(iterator) function -

i this. function* iteraterecord() { const db = yield mongoclient.connect(''); const collection = db.collection(''); const query = {} const cursor = collection.find(query); while (yield cursor.hasnext()) { const bsonobject = yield cursor.next(); } } for(record of iteraterecord()) { //do stuff } now can see not work db yield first iteration of for. return yield @ cursor.next. is possible? have tried few things multiple yield not part of iteration. thanks you're mixing 2 different things here: (1) js generators , (2) usage of js generators emulate async/await. there number of libraries (2) co or bluebird , of them expect you're going yield promises. it not work for loop sure because doesn't wait promises resolve , doesn't return result generator.

outer join in oracle sql -

i did searches oracle sql outer joins see whether there shotcut (like think in mysql can *= b believe, outer join). found 1 thing looked promising didn't work. trying find shortcut because can never remember outer join syntax. have time. take example: select l.*, r.* database.login l left outer join database.relation r on l.user_id = r.user_id , r.user_id null several values of r.user_id null expected. tried read somewhere: select l.*, r.* database.login l, database.relation r l.user_id = +r.user_id but did not select rows database.relation did not have user_id matching database.login. so have type whole syntax? trying entry in login not in relation. i suppose use following: u.user_id not in select user_id database.relation if necessary you can this: select l.*, r.* database.login l, database.relation r l.user_id = r.user_id (+) for left outer join , select l.*, r.* database.login l, database.relation r l.user_id (+) = r.u

google apps script - Use unique values from a column range -

i made script create folders , files in these specific folders. script works fine can't use unique values column range (the folders , files name of range - separated coma) - need a1 value in range name of first folder (and same name of files), a2 value name of second folder (and files), , on... what can solve this? function myfunction() { var aa = spreadsheetapp.getactivesheet(); var data = aa.getdatarange().getvalues(); var pasta = driveapp.createfolder(data); driveapp.getfolderbyid('0b1b9zgsfr8j0rw82ntrqejd5bmm').addfolder( pasta ); driveapp.getrootfolder().removefolder(pasta); var doc = documentapp.create(data); docfile = driveapp.getfilebyid( doc.getid() ); driveapp.getfolderbyid( pasta.getid() ).addfile( docfile ); driveapp.getrootfolder().removefile(docfile); docsheet = driveapp.getfilebyid('1zspgqv5u9kvtu9h9kcwh9yutugtj8x9fjlke7_vdcws'); var dodo = docsheet.makecopy().setname(data); driveapp.get

android - FirebaseAnalytics.getInstance showing warning but compiles successfully -

Image
when write code firebase analytics firebaseanalytics.getinstance() warning message: missing permissions required firebaseanalytics.getinstance: android.permission.access_network_state , android.permission.wake_lock here screenshot: i didn't found googling. i tried cleaning , rebuilding project. restarting android studio. nothing worked. what's issue? edit: permissions there. can see in merged manifest. still gives error. add <uses-permission android:name="android.permission.access_network_state" /> , <uses-permission android:name="android.permission. wake_lock" /> manifest file

scala - When are classes extending AnyVal not unboxed? -

in https://stackoverflow.com/a/40486805/4533188 told classes extending anyval cannot unboxed compiler (so there underlaying primitives in jvm bytecode) in cases. rules when unboxing not work? i understand if class extending anyval put collection, unboxing not work. given example generics, understand whole picture. the documentation pretty clear on these occasions : allocation summary a value class instantiated when: a value class treated type. a value class assigned array. doing runtime type tests, such pattern matching. example of value class treated type: trait distance extends case class meter(val value: double) extends anyval distance def add(a: distance, b: distance): distance = ??? add(meter(3.4), meter(4.3)) example of value class assigned array: val arrayofmeter: array[meter] = ??? example of pattern matching: val p: meter = new meter(1.0) p match { // ... }

java - Can't update item in database [sqlite] -

can't find error in code. i'm sure, there might problems id's. maybe queries wrong. kinda new stuff. mydbhelper public void onclick(dialoginterface dialog, int whichbutton) { string edittextvalue = edittext.gettext().tostring(); task t = new task(edittextvalue); dbhandler.updatetask(t); if (dbhandler.updatetask(t) == true){ toast.maketext(mainactivity.this, "ir", toast.length_long).show(); } else { toast.maketext(mainactivity.this, "naah", toast.length_long).show(); } displaytasklist(); } update function: public boolean updatetask(task t){ boolean result = false; string q = "select * " + table_name + " " + column_id + " = " + t.getid(); sqlitedatabase db = this.getwritabledatabase(); cursor c = db.r

how to list array of object literals using service in angularjs with and example programs -

<!doctype html> <html ng-app="shoppinglistapp"> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"> </script> <body> <div ng-controller='shoppinglistshowcontroller showlist'> <ol> <li ng-repeat="item in showlist.items"> {{item.quantity}}of{{item.name}} </li> </ol> <script> {angular.module('shoppinglistapp',[]) .controller('shoppinglistshowcontroller',shoppinglistshowcontroller) .service('shoppinglistservice',shoppinglistservice); shoppinglistshowcontroller.$inject=['shoppinglistservice']; function shoppinglistshowcontroller(shoppinglistservice,function($scope)) { $scope.showlist.items=shoppinglistservice.getitems(); } function shoppinglistservice() { var service=this; var items=[{ name:"d", quantity:"d" }]; this.getitems=function() {return items;}; }} </script> </body> </html>

jquery - using .one() on multiple classes -

i have multiple divs same class name, once 1 clicked don't want function happen again if same class clicked again. $('.js-item').one( "click", function() { console.log('clicked once'); // once if div same class clicked again }); is there way .one() happen once on classes? because @ moment applies once each time individual div class name clicked. i need these divs have same class name. you can call off() on classes after executing logic: $('.js-item').one("click", function() { console.log('clicked once'); // once if div same class clicked again $('.js-item').off('click'); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="js-item">click me!</div> <div class="js-item">click me!</div> <div class="js-item">click me!</div> <

User input error checking using text file in Java -

i have text file room numbers in school. have code asks room number of student's class. kb user input scanner , roomnos text file scanner. code: string room = null; boolean invalid = true; while(invalid) { system.out.println("what room number of class?"); room = kb.nextline(); while(roomnos.hasnext()) { string roomno = roomnos.nextline(); if(room.equals(roomno)) invalid = false; } if(invalid == true) { system.out.println("the room number you've given invalid."); } } the code works if first room number given user valid. however, if user inputs invalid room number, loop not stop, is, says room number invalid , asks room number again , again, if room number valid. think hasnext() in nested while loop not restart , go beginning of file , hence, cannot search room number during next loops of bigger while loop. whatever problem is, how can fix it? your check invalid input happens

android - How to update a view in every specific time of frame -

currently using recursive invalidate() calls , don't know if code run at fixed rate in every phone . below can see code here. handler approach better , reliable one? how can make view update speed fixed in every phone? @override protected void ondraw(canvas canvas) { super.ondraw(canvas); if(action){ checkcollisiondetection(); rotateangle = rotatereverse ? rotateangle - levelrotatespeeds[level-1] : rotateangle + levelrotatespeeds[level-1]; canvas.rotate(rotateangle,coordinateutils.centerx,coordinateutils.centery); invalidate(); //this recursive approach }else canvas.rotate(rotateangle,coordinateutils.centerx,coordinateutils.centery); canvas.drawroundrect(rect,markerroundsize,markerroundsize,paint); }

mysql - Trigger with two IF blocks -

hello have problem trigger when use alone works no. how can fix syntax error? create trigger `c_edit` after update on `client` each row if old.name != new.name insert `change`(`id_user`, `table`, `column`, `id`, `status`, `before`, `now`) values (old.id_user_edit, 'client', 'name', old.id_client, '4', old.name, new.name); end if; if old.name_sql != new.name_sql insert `change`(`id_user`, `table`, `column`, `id`, `status`, `before`, `now`) values (old.id_user_edit, 'client', 'name_sql', old.id_client, '4', old.name_sql, new.name_sql); end if; error: #1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near '' @ line 4 since using multiple statements within trigger's body, need use mysql's begin ... end compound statement syntax , along delimiter statement change delimiter: delimiter // create trigger `c_edit` after update on `client` each row begin

android - Firebase Appinvites return with resultCode 3 -

i want try out app-invites firebase - unfortunately onactivityresult reports onactivityresult 3. using code documentation: https://firebase.google.com/docs/invites/android i get: requestcode=101, resultcode=3 before select contact , saw title , text passed - unfortunately no hint in log. sha-1 entered , working app ( using firebase analytics in there ) i had release sha-1 added in firebase console - not debug sha-1 key - adding 1 solved issue

swift - How do I create a back button when connecting a tab bar view to a view controller -

Image
i have tab bar view connects view controllers through tabs @ bottom, want 1 of view controllers have buttons lead new new pages within when new view controller opens information on it, there no button when embed navigation controller im new swift , looking bit of issue make sure starting application through navigation controller, way have button wanted, carry every viewcontroller. once that, button on of viewcontrollers have button on navigation bar @ top. where plus button on bar @ top on nav bar, button appear. if have questions please feel free leave comment!

sql - Subtract one column from another in SAS data step -

i have below code subtract column "eligible in store" column "total count" in sas. reason, not working. i'm new sas, seems should extremely straight forward. i've tried pretty can think of though, appreciated. data additional_upcs (drop=_freq_); set additional_upcs; ut_id; retain total_count; if ut_id = 19 total_count = _freq_; else total_count = total_count; new_upcs = (total_count-eligible_in_store); run;

Where do I find "bucket" details for Firebase setup? -

Image
for configuring firebase connection need include bucket details. storagebucket: "<bucket>.appspot.com", where find this? you can find bucket id in storage panel of project's firebase console : it's value starting gs:// .

javascript - Value of other column in the row in dynamic row is not changing -

i have dynamic row here , have created drop down of product , want price changed automatically when drop down selected. <div> @using (html.beginform("saveproduct", "master", formmethod.post, new { @id = "frmproductdetail", @class = "form-horizontal" })) { @html.antiforgerytoken() @html.validationsummary(true) // @html.hidden("productorderid", model.productorderid) // @html.hidden("productid", model.productid) <div class="row-fluid border-light-color"> <div class="padding-5"> <div class="span12"> <div class="clear"></div> <div class="col1"> <span>@html.labelfor("customer name"):</span> </div> <div class="col2">