Posts

Showing posts from June, 2011

ios - AVAudioPlayer Swift simultaneously play two audio -

my question is: use 1 viewcontroller , choice of songs , there lose. how make if clicked on enable next previous audio has stopped. , turns out simultaneously play 2 audio recordings , new , previous. me code: var audio = avaudioplayer() func playdownload(previewurl: string) { if let url = localfilepathforurl(previewurl) { let playeritem = avplayeritem(url: url) { audio = try avaudioplayer(contentsofurl: url) try avaudiosession.sharedinstance().setcategory(avaudiosessioncategoryplayback) try avaudiosession.sharedinstance().setactive(true) audio.delegate = self audio.preparetoplay() audio.play() } catch { print(error) } } }

java - Select query with outer join -

Image
i have 2 tables files , employees. files : file_id| filename | modifiedby 1 a.java 10 2 b.java 11 employees: id| name 10 rahul 11 priya 12 rohith what trying is, print filenames , person modified file. have modifiedby persons'name table employee using employee id. if employeeid doesnot exist in employees table, must not throw error. asked using outer join. kindly in doing new topic use query: select f.filename, e.name files f left outer join employees e on f.modifiedby = e.id the files table: (with extra, non existant modifiedby id) the employees table: output: edit: since you're using oracle dbms, need drop as keyword: select f.filename, e.name files f left outer join employees e on f.modifiedby = e.id

c# - Invoke command OnSelectionChanged in GridViewComboBoxColumn WPF -

Image
is there way can invoke command , pass selecteditem parameter viewmodel when selection change occurs? xaml: <telerik:gridviewcomboboxcolumn itemssource="{binding statuslist, mode=twoway, updatesourcetrigger=propertychanged}" selectedvaluememberpath="statusname" displaymemberpath="statusname" datamemberbinding="{binding shipped, mode=twoway, updatesourcetrigger=propertychanged}" isvisible="{binding isexist, mode=twoway}"> </telerik:gridviewcomboboxcolumn> i tried adding interation triggers couldn't able find exact event pass selecteditem parameter, <i:interaction.triggers> <i:eventtrigger eventname="contextmenuclosing"> <i:invokecommandaction command="{binding statusdropdowncommand, mode=oneway}"/> </i:eventtrigger> </i:interaction.triggers> viewmodel: public icommand statusdropdowncommand { { return new relaycommand(statusdropdown); } ...

Suggest a Normalization technique in MySql -

Image
following table structure table 1: create table page_visits ( domain varchar(50) not null, campaign_id bigint default null, subscriber_id bigint default null ); sample rows of above table. +-----------+------------------+------------------+ | domain | subscriber_id | campaign_id | +-----------+------------------+------------------+ | abcdef | 5834234569635200 | 5814789314123456 | | abcdef | 5834979786543520 | 5814789314123456 | | abcdef | 1238003995770880 | 5814789314123456 | | abcdef | 4567900658540544 | 5814789314123456 | | abcdef | 8765906092156928 | 5814789314123456 | +--------+------------------+---------------------+ we have 100 million rows (approx) , size 100 gb (approx). want normalize table. instead of having "varchar" datatype domain , want use domain_id medium int in above table. because domain name repeating lot of times in table. i keep domains in separate table following , domain name unique in following table. ...

how to add the html file as an attachment in python? -

matches = [] root, dirnames, filenames in os.walk('c:\users\desktop\adi\new folder'): filename in fnmatch.filter(filenames, '*.html'): matches.append(os.path.join(root, filename)) page = filename #print filename server.quit() in above code : firstly, finding *.html files in directory. finding it, working fine me. later want send html file attached email person. failing in that. can suggest me how attach file email , send concerned person ? above program working fine in sending email person, prints name of file in email not able attach email , send it. error : traceback (most recent call last): file ".\task.py", line 39, in <module> server.sendmail(fromaddress,toaddress,msg.as_string()) file "c:\python27_3\lib\email\message.py", line 137, in as_string g.flatten(self, unixfrom=unixfrom) file "c:\python27_3\lib\email\generator.py", line 83, in flatten self._write(msg) fil...

php - WP Ajax not working in else condition -

i working on wordpress plugin. in plugin there check box, when user checked checkbox value saved in database via ajax , when unchecked value deleted database via ajax. create checkbox , write ajax code. here code: html code <?php $cart_items = get_cart_contents(); $cart_info = array(); foreach ($cart_items $_data) { $prod_id = $_data['id']; $cart_info[] = array( 'prod_id' => $prod_id, ); } $_cart_sr = serialize($cart_info); ?> <label class="label" for="purchase"> <?php _e('purchase', 'product'); ?> <input type="checkbox" id="purchase" /> </label> <input type="hidden" class="cart_info" value='<?php echo $_cart_sr; ?>'> here ajax , php code: add_action('wp_ajax_values_save', 'save_check_value'); add_action('wp_...

c# - How to get exception information when using async methods in SSH.NET? -

i using asynchronous methods of ssh.net c# api manage sftp operations. if specify invalid remote path in begindownloadfile or beginuploadfile operation fails , asynccallback called 0 transferred bytes count. want hold of exception information doesn't seem passed. installed error handler on sftp connection (erroroccurred) never gets called. idea of how exception can trapped when using async methods of ssh.net? i've found error: not using enddownloadfile in callback handler. once added there, threw exception.

Python 3.4.4 While Loop exiting and breaking right method -

dears, i'am beginner in python,now trying create script, first:filtering ip-addresses in text file(. second, checks ip availability of addresses file. code produces infinite result if example 1 of ip address not available , did not break loop message :"please re-check ip address list or device". see message after every available ip, should if of ip reachable. pls me. in advance import re import subprocess badlist = open("list nodes.txt", "r") each in badlist.readlines(): badlist.seek(0) = re.findall(r"[0-9]+(?:\.[0-9]+){3}", each) check = false while true : ip in a: ping_reply = subprocess.call(['ping', '-c', '3', '-w', '3', '-q', '-n', ip], stdout = subprocess.pipe) if ping_reply == 0: print ("\n %s. reachible " % ip) check = true continue if ping_reply == 2: print ("\nno r...

powershell - Find a random Local Drive and download files there -

as title says, want find random local drive , download files inside drive. well, thats actual line: powershell.exe -command "& {if($psversiontable.psversion.major -ge 3) {invoke-webrequest http://download1475.mediafire.com/dgmccvd5felg/cu6x9bzhx3hmz78/teste.jpg -outfile atf3@~~.exe}}" as can see, have way download files, want these files downloaded inside random drive, , need that. it happen in computer, don't have how know nothing local drives, prepare script situation please, , need script run in 1 single batch file. you can pick random local drive , change working directory root folder this: $root = (get-wmiobject win32_volume -filter 'drivetype=3 , not driveletter null' | get-random).driveletter + '\' set-loction $root

android - WebView not wraping content -

i can't make webview wrap displayed content. problem webview width screen, while height 300px. how can make wrap content , file suppose be? here current layout xml: <webview android:id="@+id/animation_1" android:layout_width="wrap_content" android:layout_height="wrap_content" /> webview built render html pages doesn't have size . there no way determine doesn't exist , re-size according same way imageview resizes when src image has changed. your best choice set size of webview fixed value maybe weight , user have scroll inside when page bigger webview itself.

The error "Invalid job type for this context" in spark SQL job with Spark job server -

i create spark sql job spark job server , use hivecontext following sample below: https://github.com/spark-jobserver/spark-jobserver/blob/master/job-server-extras/src/spark.jobserver/hivetestjob.scala i able start server when run application(my scala class extends sparksqljob), getting following response: { "status": "error", "result": "invalid job type context" } can 1 suggest me going wrong or provide detailed procedure setting jobserver sparksql? the code below: import com.typesafe.config.{config, configfactory} import org.apache.spark._ import org.apache.spark.sql.hive.hivecontext import spark.jobserver.{sparkjobvalid, sparkjobvalidation, sparkhivejob} object newhiverest extends sparkhivejob { def validate(hive: hivecontext, config: config): sparkjobvalidation = sparkjobvalid def runjob(hive: hivecontext, config: config): = { hive.sql(s"use default") val maxrdd = hive.sql(s"select count...

java - Swapped images while extracting from excel using JavaScript -

my problem while extracting images in excel using java script images swapped somewhere.[![enter image description here][1]][1] using java code here a94 row -- saving picture94 a95 row -- saving picture95 a96 row -- saving picture96 i want save bellow formate a94 row -- saving picture94 a95 row -- saving picture96 a96 row -- saving picture95 i want save each images respective cell. please give me idea .do have change java code. code import java.io.fileinputstream; import java.io.fileoutputstream; import java.io.ioexception; import java.io.inputstream; import java.util.iterator; import java.util.list; import org.apache.poi.hssf.usermodel.hssfcell; import org.apache.poi.hssf.usermodel.hssfrow; import org.apache.poi.hssf.usermodel.hssfsheet; import org.apache.poi.hssf.usermodel.hssfworkbook; import org.apache.poi.ss.usermodel.picturedata; public class readwriteexcelfile1 { public static void readxlsfile() throws ioexception { inputstream excel...

android - Problems using Smart Location Library -

i trying use smart location library obtain periodic location updates. when start process fires listener once there no further updates. here code used public void starttracking(view v) { provider = new locationgoogleplayserviceswithfallbackprovider(this); log.i("tag","start tracking"); smartlocation smartlocation = new smartlocation.builder(this) .logging(true) .build(); smartlocation.location(provider) .config(locationparams.best_effort) .start(this); smartlocation.activity().start(this); } public void stoptracking(view v) { log.i("tag","stop tracking"); smartlocation.with(this).location().stop(); smartlocation.with(this).activity().stop(); } @override public void onactivityupdated(detectedactivity detectedactivity) { log.i("tag","activityupdate : "+detectedactivity.tostring()); } @override public void onlocationupdated(locatio...

jquery - Add scrollbar to menu item which has submenu items, without submenu items being hidden -

Image
i need add scrollbar courses menu list (see picture below). there many courses, , therefore goes on page fold. top navbar fixed , therefore scrolling page doesn't help. when add css: .navbar .navbar-inner .usermenu .dropdown ul.dropdown-menu.courses { overflow-y: auto; /* or : scroll */ } the ul course modules not display (ie. orientation module in example picture below). assuming because sub-submenu nested in ul has overflow-y:auto , therefore not displaying. how solve issue of adding scrollbar courses submenu course submenu items not being hidden. solution fine, css, jquery etc. the html , css quite excessive built in moodle, there lot going on. basic html structure follows: <ul class='nav'> <li class='dropdown'> <ul class='dropdown-menu'> <li class='dropdown-submenu courses'> <ul class='dropdown-menu'> <li class='dropdown-submenu course...

python - Sum up non-unique rows in DataFrame -

i have dataframe this: id = [1,1,2,3] x1 = [0,1,1,2] x2 = [2,3,1,1] df = pd.dataframe({'id':id, 'x1':x1, 'x2':x2}) df id x1 x2 1 0 2 1 1 3 2 1 1 3 2 1 some rows have same id . want sum such rows (over x1 , x2 ) obtain new dataframe unique ids : df_new id x1 x2 1 1 5 2 1 1 3 2 1 an important detail real number of columns x1 , x2 ,... large, cannot apply function requires manual input of column names. as discussed can use pandas groupby function sum based on id value: df.groupby(df.id).sum() # or df.groupby('id').sum() if need don't want id become index can: df.groupby('id').sum().reset_index() # or df.groupby('id', as_index=false).sum() # @john_gait

java - Flow control, implementation replace method List -

directly [http://docs.oracle.com/javase/tutorial/collections/interfaces/list.html] public static <e> void replace(list<e> list, e val, e newval) { (listiterator<e> = list.listiterator(); it.hasnext(); ) if (val == null ? it.next() == null : val.equals(it.next())) it.set(newval); } the bit of trickiness in example equality test between val , it.next. need special-case val value of null prevent nullpointerexception. i wondering why need special-case val value of null prevent nullpointerexception. might understand have safe code prevent nullpointerexception line of code if (val == null ? it.next() == null : val.equals(it.next())) is not related collection iteration, instead val parameter specified in parameters method. thanks in advance clarification above mentioned. your reading of going on here absolutely right: "special case" talking related null-checking parameter, not iteration of list. in fact, mo...

How to check If a file isn't exists in folder and subfolders using python 2.7 -

i try find folders missing file name "kavi*" inside them. folders spread in 1 big folder divided lot of sub folders , sub sub folders. started code don't know how proceed: import arcpy,fnmatch,os rootpath = r"d:\projects\road57\gis\layers\taba\taba-mmi" pattern = 'kavi*.shp' root, dirs, files in os.walk(rootpath): filename in fnmatch.filter(files, pattern): print(os.path.join(root, filename)) the out put is: d:\projects\road57\gis\layers\taba\taba-mmi\8233\4022502\kavim kchulim.shp d:\projects\road57\gis\layers\taba\taba-mmi\8233\4022950\kavim kchulim.shp d:\projects\road57\gis\layers\taba\taba-mmi\8233\4050004\kavim_kchulim.shp d:\projects\road57\gis\layers\taba\taba-mmi\9887\4050012\kavim_kchulim.shp d:\projects\road57\gis\layers\taba\taba-mmi\9889\4050025\kavim_kchulim.shp d:\projects\road57\gis\layers\taba\taba-mmi\9900\4050040\kavim_kchulim.shp >>> this print folders "kavi*" file. need output fo...

visual studio 2010 - ClickOnce/Excel-VSTO under Windows 7 -

we have developed .net 4.0 vsto excel addin in vs2010 deploying via clickonce. our deployable seems fine on windows xp extremely problematic when installed on windows 7. problems seem relate when addin needs removed via excel (i.e. has been soft deleted excel [eg. due failure, etc] , 'remove'd user via excel | options | addins | manage | com addins dialog. the above leads situation addin re-installed after above has occurred, not exposed within excel - i.e. excel addins tab (which appear if there 1 or more addins installed) vanishes forever. becomes more of problem when developing/debugging, renaming/removing addin instances on fly - so developing vsto on windows 7 no longer feasible note addin not in hard deleted (disabled) list - has been removed. have tried installing/re-installing/uninstalling, rebooting, removing registry items (cleaning cache/after-uninstall), removing file system files c:\documents , settings\\local settings\apps\2.0, clearing cache (via mag...

shell - Looping through file lines in bash -

how can loop through each line of file , use line in command in bash ${/'#include "'/"a"} ? (i'm trying replace includes else in line) use sed or awk replace want. example bellow #include string found in filea replaced customtext. no need of loop in case. sed -i 's/\#include/customtext/g' filea

html - Gmail mailto with images and links -

i need create mailto links, automatically sets both recipients , body. i'm fine long body plain text, need contain links , images (and image needs linked). is there way it? it's not possible. can't send mime bodies in mailto: body parameter. since body parameter intended plain/text . can't format value html . send mail programmatically using emailer functions support of html body

node.js - Difference between app.use and app.get in express.js -

i'm kind of new express , node.js, , can't figure out difference between app.use , app.get. seems can use both of them send information. example: app.use('/',function(req, res,next) { res.send('hello'); next(); }); seems same this: app.get('/', function (req,res) { res.send('hello'); }); app.use() intended binding middleware application. path " mount " or " prefix " path , limits middleware apply paths requested begin it. can used embed application: // subapp.js var express = require('express'); var app = modules.exports = express(); // ... // server.js var express = require('express'); var app = express(); app.use('/subapp', require('./subapp')); // ... by specifying / " mount " path, app.use() respond path starts / , of them , regardless of http verb used: get / put /foo post /foo/bar etc. app.get() , on other hand, part of express...

ios - Can't play audio from an online link, using Amazing Audio Engine -

i trying code achieve online streaming/buffering of amazing audio engine, throws me following error: aeaudiofileplayer.m:148: audiofileopenurl: 'wht?' (2003334207) here code: - (void)viewdidload { [super viewdidload]; self.audiocontroller = [[aeaudiocontroller alloc] initwithaudiodescription:[aeaudiocontroller noninterleaved16bitstereoaudiodescription] inputenabled:yes]; _audiocontroller.preferredbufferduration = 0.005; [_audiocontroller start:null]; [self initwithaudiocontroller:self.audiocontroller]; aeaudiofileplayer *oneshot = [aeaudiofileplayer audiofileplayerwithurl:[nsurl urlwithstring:self.urlofsong] error:null]; _oneshot.removeuponfinish = yes; [_audiocontroller addchannels:[nsarray arraywithobject:oneshot]]; } - (id)initwithaudiocontroller:(aeaudiocontroller*)audiocontroller { self.audiocontroller = audiocontroller; nserror *error = null; bool result = [self.audiocontroller ...

C# - Get part of XML to be validated by XSD using attribute value -

i need validate column values before inserting them in table. have written common xsd tables , xml looks this. <root> <table name="user"> <column>userid</column> <column>name</column> <column>roleid</column> </table> <table name="role"> <column>roleid</column> <column>rolename</column> </table> </root> and xsd this: <xs:schema attributeformdefault="unqualified" elementformdefault="qualified" xmlns:xs="http://www.w3.org/2001/xmlschema"> <xs:element name="root"> <xs:complextype> <xs:sequence> <xs:element name="table" maxoccurs="unbounded" minoccurs="1"> <xs:complextype> <xs:sequence> <xs:element type="xs:string" name="column" maxoccurs="unbound...

jquery - How to Toggle "a" tag elements to show hidden DIVs just like the Facebook notification center -

in source code, have 2 a elements want toggle display hidden div content 1 @ time. how facebook notification center operates when icons clicked , think, of have at-least interacted facebook notifications center on top left near logo on facebook website. how workout that? here code below <style> div, { display: block; } body { width: 500px; margin: 100px auto; } { border: 1px solid #ccc; background: #ececec; -webkit-border-radius: 3px; padding: 5px 20px; text-align: center; color: red; text-decoration: none; } #one { margin-bottom: 30px; } .dn_js { display: none; } .db_js { display: block; } </style> here html <div class="wrap"> <div id="one"> <a href="#" data-open="frdz" class="atggl active">friends</a> ...

javascript - Data-toggle and onclick doesn't work together and i'm too new to apply @epascarello 's solution to -

i have problem little bit 1 : jquery onclick doesn't work on button data-toggle , data-target but can't apply solution @epascarello problem i'm using bootstrap , want add collapse , onclick action on same < a> <a class="control" data-toggle="collapse" data-target="#demo"onclick="play('audioplayer', this)"> if delete data-toggle part, onclick works, , if delete onclick part, data-toggle works, could me ? thank :) first give id a tag <a id="yourid" class="control" data-toggle="collapse" data-target="#demo"onclick="play('audioplayer', this)"> and js $(document).on("click", "#yourid", function() { alert("test"); }); try first this called delegated event handlers .you can refer to: http://api.jquery.com/on/ explanation with delegated event handlers, attach event handlers parent...

html - Weird img shifting when using jQuery slideDown and slideUp -

i've following html structure: <div class ='profilename'> <hr> <span class='name'>content</span> </div> <div class ='profile'> <div class='floatrightimg padded'> <img src='imgurl' class='shadow'/> </div> <p>description</p> </div> with following css linked: hr { color: #cccccc; } .floatrightimg { float: right; } .profile { height: 450px; width: 700px; margin: auto; } .profilename { width: 700px; margin: auto; } .shadow { box-shadow: 10px 10px 5px #888888; } .padded { padding: 0 30px 0 15px; } .name { background-color: #ffffff; color: #cccccc; left: 70px; padding: 0 8px; position: relative; top: -20px; font-weight: bold; font-size: 20px; } .name:hover { cursor:pointer; } and i'm using following jquery function: $(document).ready(function(){ $(".name").click(function(){ var tobeslided = $(t...

excel - How to use Workbook_BeforeClose from a custom module -

i trying prompt user when tries close workbook this private sub workbook_beforeclose(cancel boolean) msgbox "changes has been detected. want export data ?" end sub i know code need placed in thisworkbook module. there way custom module ? need add functionality multiple workbooks used client part of up-gradation, done replacing old modules new modules. you can use application.vbe object , workbook.vbproject modify file's vba. note requires excel performing upgrade has have setting "trust access vba project" toggled on (it can found in trust center under tab macro settings). when not needed anymore, it's option best left off though security reasons.

c++ - using a method declared pure virtual in derived classes -

this question has answer here: pure virtual function implementation 8 answers i working code , saw odd, method of class "myclass" let's call x() : virtual void x() = 0; so myclass abstract class , in myclass.cpp x() has proper implementation... in derived classes of myclass, method called via myclass::x(); i thought = 0 invalidate implementation... it's not case , is, in fact, usable in derived classes. can please tell compiler when encounters = 0 ? from standard (9.2 class members [class.mem]): = 0 pure-specifier it tells compiler that: the class abstract the method defined outside class definition (usually in derived class) example 1 (build fails) if understand question correctly, have that: class myclass { public: virtual void x() = 0; }; class myderivedclass : myclass { public: virtual void x(); }...

javascript - ThreeJS : CSG (Wrapper?) -

i've been using standalone threecsg.js ( https://github.com/chandlerprall/threecsg ) create different shapes i'm having errors occur shapes i'm trying create: maximum call stack exceeded. it seems repo not being updated tried csg-wrapper ( https://github.com/kraag22/csg-wrapper ) creates shapes without problems heavily outdated three.js. is there other csg library can use? or 1 wrapper csg ( https://github.com/evanw/csg.js ) up-to-date ? my 2 reports on repos: https://github.com/kraag22/csg-wrapper/issues/3 https://github.com/chandlerprall/threecsg/issues/23

sql - Retrieve maximum number from alphanumeric column -

please can me sql query how maximum number alphanumeric field. below code field. can see want retrieve highest number oss 120. in advance. asg1 asg10 asg14 asg2 asg21 asg4 lts1 lts10 lts14 lts2 lts21 lts4 oss1 oss10 oss100 oss11 oss114 oss120 oss2 oss21 oss3 oss4 oss5 oss6 oss7 you can use regular expression this. work every length of string , number. select column_name table_name regexp_replace(column_name,'[a-za-z]','')= (select max(to_number(regexp_replace(column_name,'[a_za-z]',''))) table_name)

html - How put some horizontal offset to an element bottom border with CSS? -

i use bottom-border on a element, , want add horizontal offset border. what have now: link cool name ------------------- what want: link cool name ---------------- how can archive this? using a element. a pseudo-element ideal here can styled in fashion want, color, width & height...even position below link text. a { position: relative; text-decoration: none; } a::after { content: ""; position: absolute; top: 100%; right: 0; width: 75%; height: 2px; background: orange; } <a href="#">long stretch of text</a>

symfony - SonataAdminBundle: set permission depending on field value -

i have working sonataadmin+fosuser (without sonatauserbundle) setup roles , acl enabled. working fine, every user has access different admins depending on roles. now need go bit deeper. restrict access 1 of admin depending on value of association of underlying entity. lets have this: /** * @orm\entity */ class content { /** * @var string * * @orm\manytoone(targetentity="contenttype", inversedby="contents") */ private $type; } /** * @orm\entity */ class contenttype { /** * @var string * * @orm\column(name="name", type="string", length=255) */ private $name; } i following: users role_xxxxx : have access contents content type name 'xxxxx' users role_yyyyy : have access contents content type name 'yyyyy' ... of course means when creating new content or filtering list of contents, users should not able select content type on don't have permission. i h...

checkbox - how to select multiple checkboxes in ionic -

i using ionic framework app development , want select multiple checkboxes on click of header checkbox or button. <ion-list> <ion-checkbox ng-model="filter.color">colors</ion-checkbox> <ion-checkbox ng-model="filter.blue">red</ion-checkbox> <ion-checkbox ng-model="filter.yellow">yellow</ion-checkbox> <ion-checkbox ng-model="filter.pink">pink</ion-checkbox> <ion-checkbox ng-model="filter.number">number</ion-checkbox> <ion-checkbox ng-model="filter.one">1</ion-checkbox> <ion-checkbox ng-model="filter.two">2</ion-checkbox> <ion-checkbox ng-model="filter.three">3</ion-checkbox> </ion-list> when click on "colors", 3 three checkboxes should clicked. , when uncheck 1 of them, "colors" should unchecked , other 2 should remain....

swift2 - Replacement for _stdlib_getDemangledTypeName() in Swift 2.2 -

the latest release of swift 2.2 removes _stdlib_getdemangledtypename() . what options replace this? i'm using in debug messages this: let debugstr = "\(_stdlib_getdemangledtypename(self)) -> \(self.versionstring) (\(self.versioninfo))" you can pretty descriptions of type names through string initialiser. should suffice replacement _stdlib_getdemangledtypename . example: string(self.dynamictype)

asp.net mvc - Calculate total cost based on rate and duration like Hours,Minutes with C# -

i have dropdown list present duration of specific job format "hours,minutes": <select class="form-control"> <option></option> <option>0,10</option> <option>0,20</option> <option>0,30</option> <option>0,40</option> <option>0,50</option> <option>1</option> <option>1,10</option> <option>1,20</option> <option>1,30</option> <option>1,40</option> <option>1,50</option> </select> i have rate hour: var rate = "8"; // 8 € if user selects example "1,3", how can calculate total cost based on rate? (in case total 12€) you can do string[] time = "1,30".split(","); int total = convert.toint32(time[0]) * rate; if (time.length >1) total += convert.toint32(time[1]) * rate / 60;

How to add Google Play license into an android application created with Appcelerator? -

i created android payment application appcelerator , want publish in google play. need add license google play. have read information in http://developer.android.com/intl/es/google/play/licensing/index.html don't know how adapt titanium studio app. try use module https://github.com/eric-sofisoftwarellc/tilicensing haven't luck, shows error: requested module not found: com.sofisoftwarellc.licensing know module this? know how integrate appcelerator app? thank you. you can find how add application google play there to allow licensing use <uses-permission android:name="com.android.vending.check_license" /> and licensing module appcelerator to avoid error: requested module not found: com.sofisoftwarellc.licensing try clean build application , remove application device(emulator) before installing

c++ - Render cycle in cocos2d-x -

i have game engine written my team, it's component based. has logic components , visual components. in visual components there function named updatevisual(delta) , drawn there. for example, let's take physic ball entity in world: class logicballcomponent { // ... }; class visualballcomponent { sfml::texture mballtexture; void updatevisual(float) { mballtexture.translate(...); globaldisplaymanager::instance().draw(mballtexture); } }; globaldisplaymanager returns window representation creates gl-states, etc. (sf::renderwindow in sfml). system easy integrate. now need make android-game using engine. i've chosen cocos2d-x use window creation, rendering, fonts, resources etc. there way job: class ball : public clayer { bool ball::init() { csprite* sprite = csprite::create(...); this->addchild(sprite, 0); // [!] } }; and don't know how use in way. there such possibility? you should check out fun...

c++ - why does it wrap without endl;? -

i'm c++ beginner , wrote simple program: #include <iostream> using namespace std; int readnumber() { cout << "insert number: "; int x; cin >> x; return x; } void writeanswer(int x) { cout << "the sum is: " << x << endl; } int main() { int x = readnumber(); int y = readnumber(); int z = x + y; writeanswer(z); return 0; } i don't understand why output this: insert number: 3 insert number: 4 sum is: 7 and not like: insert number: 3insert number: 4the sum is: 7 since in readnumber function there no endl; . what missing? (of course i'm happy result get, it's unexpected me) that's because push enter after enter numbers (-: first 2 lines of "output" aren't pure output. it's mixed input.

add comment to zip file in r -

i'm trying add comments zip files using function zip in r. instance, need add comment "s:splist". so, assumed proper way may be: data(iris) write.csv(iris, "iris.csv") zip(zipfile="iris.zip", files="iris.csv", extras="-z s:splist") file.remove("iris.csv") i in console following output: adding: iris.csv (deflated 77%) enter new zip file comment (end .): zip warning: name not matched: s:splist apparently function zip makes , attempt add comment, comment giving troubles. can me? many in advance advice migue

scala - A non-blocking connection way in kafka -

first of all, i'm new on may explanation of problem not accurate. i have topic in kafka data. consumer (written in scala) want connect server , consume information. problem think in executions consumer doesn't close , it's blocking reading. i have followed this code. how can create non-blocking connection read topic? if need more details, please let me know.

javascript - Custom edit menu Angular Dashboard Framework -

Image
i'm working angular dashboard framework (sdorra) , change edit menu; at default click on menu can add widget, edit dashboard, save , discard changes show below. i add new icon new function, in particolar case, add duplication function of dashboard. my html follow: <div ng-app="isdashboard" ng-controller="dashboardcontroller" ng-init="init('$name','$id', '$sid')" style="color:#a60076"> <adf-dashboard name="dashboard" adf-model="dashboard.model" /> </div> and controller is 'use strict'; var model = { rows: [{ columns: [{ styleclass: 'col-md-4', widgets: [] },{ styleclass: 'col-md-8', widgets: [] }] }] }; angular.module('isdashboard', ['adf', 'adf.widget.clock']) .config(function(dashboardprovider){ das...

r - Extracting environmental variables at coordinates -

i using r , trying create dataframe containing information on environmental variables @ coordinates (x,y). currently working matrix altitude data. in form long, lat, altitude . and spatial points data frame containing x,y coordinates i have tried use extract function in form: xyalts <- extract(altvals,xypoints) however keep getting error: error in (function (classes, fdef, mtable) : unable find inherited method function ‘extract’ signature ‘"matrix", "spatialpointsdataframe"’ can suggest why not work? can extract function not used spatial point data frames?

When I use jdbc and phoenix to query data from hbase,the "resultset.first()" throw exception -

Image
the code this: the exception this: java.sql.sqlfeaturenotsupportedexception @ com.salesforce.phoenix.jdbc.phoenixresultset.first(phoenixresultset.java:173) if recode code use next() instead of first() you'll fine: while(resultset.next()) { //do resultset } if you're looking why though... you'll have go , ask developers of jdbc driver. positioning inside resultset requires scrollable resultset , possible feature not there.

java - How do I suppress warning "Synchronization on a non-final field" -

is possible suppress kind of warning? note: not looking suppressing warnings(like @suppresswarnings("all") ), mentioned type. for intellij, put annotation on class has warnings @suppresswarnings("synchronizeonnonfinalfield") this lead me tag use suppression , trial , error lead me put on class instead of on field or synchronized statement. :-p

google finance - How to get exchange rate with GoogleFinance on dates market is closed -

i can retrieve exchange rate on given date following command: =googlefinance("audusd","price","09/15/2015") however if market closed day googlefinance returns "n/a": =googlefinance("audusd","price","11/19/2015") how googlefinance me price though market closed? i used following solution based on utc time: import datetime dt nowutc = dt.datetime.utcnow() today14= nowutc.replace(hour=14, minute=25, second=0, microsecond=0) today21= nowutc.replace(hour=21, minute=5, second=0, microsecond=0) if (nowutc >= today21 or today14 >= nowutc): #go yahoo-finance , last value.... this solution based on times @ market closed: http://www.wisestockbuyer.com/2012/05/what-time-do-stock-markets-open-and-close/

c++ - GSL non-linear least squares fit won't converge -

i relatively new c++ , gsl. nonetheless have undertaken endeavour solve problem of fitting non-linear functions data implementations provided gsl. idea have class ( clnm ), holds data , model coefficients etc. clnm class has method cnlm::fitmodel_manu takes initial values , function pointers functions minimized, provided in fit_functions.cpp . i have minimal working example first generate data using formula , coefficients in example gsl reference manual provides ( y = exp(lambda*x)+b , {a,lambda,b}=<5.0,-0.1,1.0>). works out fine , data expected. with data cnlm object constructed. fitmodel_manu method called. the implementation works , code compiles fine (using g++ , iso c++11, g++ -std=c++0x ), cannot seem convergence ever, if provide correct parameters initial guess. iteration: 0 c0 = 1 c1 = 5 c2 = -0.1 |f(x)| = 1954.18 status = success iteration: 1 c0 = -15.513 c1 = 2170.38 c2 = 16.5136 |f(x)| = 902.806 status =...

php - shorthand if explanation ? mark operator -

for template engine use shorthand if condition. need check if value != null print out line if true. tried: echo "test" ($user->affiliate_id !=null) ? i have no idea write behind ?. the line $somevariable = $condition ? $valuea : $valueb equivalent to: if ( $condition ) { $somevariable = $valuea; } else { $somevariable = $valueb; } so, basically, if condition true , $somevariable take first value after ? symbol. if false , take second value (the 1 after : symbol). there's special case can not define first value , this: $somevariable = $somevalue ?: $someothervalue . it's equivalent to: if ( $somevalue ) { $somevariable = $somevalue; } else { $somevariable = $someothervalue; } so, if $somevalue evaluates true (any value different 0 evaluated true ), $somevariable catch value. otherwise, catch $someothervalue . to give example: function printgender( $gender ) { echo "the user's gender is: " ....

ios - How do I iterate through JSON co-ordinates and build annotations as one function? -

i struggling annotations being placed using json data. have tried iterating coordinates json new array when try pass array need coordinates fails because cannot take arrays. how can fix this? can help? alamofire.request(.get, "https://demo1991046.mockable.io/score/locations").responsejson { (responsedata) -> void in let swiftyjsonvar = json(responsedata.result.value!) if let resdata = swiftyjsonvar["users"].arrayobject as? [nsarray] { self.newarray = (resdata as? [nsarray]) } print("\([self.newarray])") var = 0; < self.newarray!.count; ++i { self.longitude.append(self.newarray[i]["lon"] as! string!) print("longitude: \(self.longitude)") self.latitude.append(self.newarray[i]["lat"] as! string!) print("latitude: \(self.latitude)") } let doublelat = self.latitude.map { ...