Posts

Showing posts from August, 2014

javascript - Groovy Script Decimal vs. Whole Numbers -

this more of elementry soapui groovy scdript question. in response returns 100.000 i'm assert return value < response if do: max = 100 resonse = ('${responsetc#xyz..."') assert resposne < max "error (java.lang.integer cannot cast java.lang.string" i have found ways around want ask experts - "expert" way of handling this. thank you, rob the natural , "expert" way is: int max = 100 def response = responsestring.tofloat() assert max > response

html - css min-width does not work properly -

i'm trying position div centered in div code: <div style="width:100%; height: 300px; background:red;"> <div style="margin:auto; min-width:50%; height:100%; background:green;">text</div> </div> it results in big green div that's width 100%. expect 50% though. can tell me why css wont give 50% width , center it? updated answer <div style="width:100%; height: 300px; background:red; text-align: center"> <div style="min-width:50%; display: inline-block; height:100%; background:green;">text</div> </div>

asp.net - C# Prompt for open/save zip in ASP receiving error -

let me start off saying i'm sure that's quite simple, unfortunately can't seem figure out. here's problem, query database, return need, zip up, , prompt user save. when prompt appears, appears system.io.compression.ziparchive.zip file name. when attempt open this, says file invalid. appreciated!! if (e.commandname == "downloadattachment") { e.canceled = true; // create zip , send client. //response.write(@"<script language='javascript'>alert('details saved successfully')</script>"); var item = e.item grideditableitem; fileid = (int)item.getdatakeyvalue("unique"); filedata[] allrecords = null; using ( sqlconnection conn = new sqlconnection(configurationmanager.connectionstrings["ptcdbmodelentities"].connectionstring)) { using ( sqlcommand comm = new sqlcommand("select uni...

sql server - two row to one row in sql -

i have table below. customer_number note loayltystatus tier_code 123 yes 123 yes 1 123 1 how combine 1 row 2 row above in select statement? eg: customer_number note loayltystatus tier_code 123 yes 1 1 select customer_number, max(note),max(loyaltystatus),max(tier_code) yourtable group customer_number

javascript - moment.js 2 digit year converting wrong 4 digit year -

has come across issue moment.js: in firefox using moment("6/12/15").format("m/d/yyyy h:mm:ss a") 6/12/1915 instead of 6/12/2015? when throw random string moment without telling format it's in, falls on javascript date object parsing, , format you're passing in not defined standard. leaves wide open implementation-specific behavior. in case, describe happens on firefox not on chrome. this has been sufficient issue moment deprecating entirely . to reliable results string, tell moment format it's in: moment("6/12/15", "m/d/yy").format("m/d/yyyy h:mm:ss a")

Link a button to a python function from my model (Odoo 8) -

i trouble linking button function (python) model. searched on net got few informations odoo 8. code right now: my function model (mymodule.service): def main_val(self, context=none): if context none: context = {} [...] the view associated: <record model="ir.ui.view" id="view_myodule_clients_tree"> <field name="name">mymodule.clients.tree</field> <field name="model">mymodule.service</field> <field name="inherit_id" ref="base.view_partner_tree"/> <field name="arch" type="xml"> <field name="display_name" position="after"> <button name="main_val" type="object" string="bill" class="oe_highlight" /> </field> </field> </record> i keep having error: ...

php - input field: store decimal values with comma instead of a point in mysql database -

i have input field price. entered value stored database, example 13,99 . in mysql database field has type decimal(10,2) . happens price stored correctly database if user types 13.99 point instead of comma. if user types 13,99 stored 13.00 . what should change in code, user can type 13,99 , stored correctly database? <?php ... if ($valid) { $pdo = database::connect(); $pdo->setattribute(pdo::attr_errmode, pdo::errmode_exception); $sql = "update products set price =? id = ?"; $q = $pdo->prepare($sql); $q->execute(array($price,$id)); database::disconnect(); header("location: index.php"); } } else { $pdo = database::connect(); $pdo->setattribute(pdo::attr_errmode, pdo::errmode_exception); $sql = "select * products id = ?"; $q = $pdo->prepare($sql); $q->execute(array($id)); $data = $q->fetch(pdo::fetch_assoc); $price = $data['pri...

Using read.csv in R drops rows that have a NA in them? -

i executing line of code import file flowers <- read.csv("http://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data") 149 rows come in. problem there 151 rows in original dataset. when @ unique values last column (#5), 2 rows "na" getting dropped: unique(flowers[,5]) what have include 2 rows? you can use blank.lines.skip=false in read.csv blank lines well flowers <- read.csv("http://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.dat‌​a", blank.lines.skip=false)

java - What's the current URL for JAXB Bindings XML Schema? -

i'm trying automate generation of java classes xml dtd using xjc. generated java classes must serializable. articles add pointer bindings file uses schema @ http://java.sun.com/xml/ns/jaxb jaxb namespace, url doesn't work anymore. the url http://java.sun.com/xml/ns/jaxb redirects http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/jaxb/index.html in turn says http://java.sun.com/xml/ns/jaxb latest url links http://www.oracle.com/xml/ns/jaxb/ redirects http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/jaxb/index.html . a bit confusing. i've found tutorials @ oracle updated in 2014 still use url, , didn't find other. have more date info? this works me: <?xml version="1.0" encoding="utf-8"?> <jaxb:bindings xmlns:xsd='http://www.w3.org/2001/xmlschema' xmlns:jaxb='http://java.sun.com/xml/ns/jaxb' version='2.1' xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocat...

mysql - Error during the creation of table due to foreign key -

i have table1 in db. table1: create table `product` ( `id` int(11) not null auto_increment, `typename` varchar(255) default null, `typecode` varchar(55) default null, `parent1` int(11) default null, `parent2` int(11) default null, primary key (`id`), key `parent1` (`parent1`), key `parent2` (`parent2`) ) engine=innodb auto_increment=396 default charset=latin1; i tried create second table foreign key has reference product.typename this creation query have used. create table measurements ( id int(11) not null auto_increment primary key, age_group varchar(20) not null, article_type varchar(255) default null, dimension text , createdon int(11) not null, updatedon int(11) not null, createdby text not null, foreign key(article_type) references product(typename) )engine=innodb auto_increment=396 default charset=latin1; but table creation failure following error. error 1215 (hy000): cannot add foreign key constraint i hav...

How to set System properties (awt.toolkit) in Java 1.7 Or how to set java runtime parameters in Java 1.7? -

my application needs set customtoolkit(myapp.mytoolkit) replacing default java toolkit (sun.awt.windows.wtoolkit). java 1.6 till java 1.6 had modified deployment.properties file , worked. see changes in java control panel , custom toolkit used picked up. classpath set used work. \locallow\sun\java\deployment\deployment.properties\deployment.properties shows... awt.toolkit = myapp.mytoolkit javaplugin.vm.options = -djava.class.path=c:\progra~2\java\jre6\classes;c:\users\administrator\tre\mytool\hletkdevglobalorgcom\loadjar.jar;; -xbootclasspath/a:c:\progra~2\java\jre6\lib\deploy.jar;c:\progra~2\java\jre6\lib\plugin.jar -xmx96m -djavaplugin.maxheapsize=96m -xverify:remote -djavaplugin.version=1.6.0_33 -djavaplugin.nodotversion=160_33 -dbrowser=sun.plugin -dtrustproxy=true -dapplication.home=c:\progra~2\java\jre6 -classpath=c:\users\administrator\tre\mytool\hletkdevglobalorgcom\loadjar.jar;; -dawt.toolkit=myapp.mytoolkit control panel - runtime parameters show... -classpa...

php - Populate a multidimensional array of rooms with another multidimensional array of names -

i'm trying assign people $prides 1 multidimensional array rooms $campus in multidimensional array. the people in first array first grouped coded arrays indicating building preference, room preference, , gender. i need first match appropriate arrays, i.e. arrays of people large rooms in building bldgalargef , bldgalargem . fill each room until run out of females, leave remaining bunks empty, , populate next room males. if run out of rooms before run out of people, remaining people need placed homeless array. the number of rooms fixed, number of people, or number of groups in people array can vary. how write without creating loopy mess or building hundreds of nested if , case statements? <?php /* - multidimensional array of people - group requirements: building, room size, smoking, roommate smoking preference - multidimensional array of rooms - group building, size, bunks - break arrays sets - count number of people in each ...

php - Incrementing an array's value is causing warnings in the log -

i trying create array holds count of each course offer based on location , instructor. here sample code $coursecnt = array(); foreach($courselist $course){ $coursecnt[$course['location']][$course['instructor']] += 1 } this code creates array , displays bunch of warnings like: unidentified index "orlando" locations, unidentified index "john smith" instructor i have found if make = 1 instead of += 1 warnings go away of course makes every course location/instructor 1 not good. my next though checking if exists, if doesn't, make 1 , if += 1. here example if(isset($coursecnt[$course['location']][$course['instructor']]){ $coursecnt[$course['location']][$course['instructor']] += 1 }else{ $coursecnt[$course['location']][$course['instructor']] = 1 } this results in fatal error: cannot use string offset array $course array structure 2 dimensional array pulled sq...

php - How to use Eclipse with Php5.6 -

Image
as can see in photo have problems eclipse while programming laravel framework. problem eclipse looking php5.3 code laravel , local server uses php5.6. how can upgrade eclipse php5.6? this juno version released 2012. suggest upgrading more recent version support latest php versions. try latest official release luna eclipse ver. 4.4. follow instructions here: https://wiki.eclipse.org/faq_how_do_i_upgrade_eclipse%3f or here: https://wiki.eclipse.org/faq_how_do_i_upgrade_eclipse%3f

javascript - How to disable html table row -

if click 3 times html table same row means.. want disable/hide row.. click count reset when page reload.. using pure javascript my code: window.onload=function found(row) { var table=document.getelementbyid("main"); var rows = table.rows; (var = 0; < rows.length; i++) { rows[i].onclick = (function() { // closure var cnt = i; // save counter use in function return function() { var result = this.cells[i]; alert("you want choose "+result.innerhtml); } })(i); } } <html> <head> <title>untitled</title> <body> <table id="main"><tr> <td>1</td> <td>2</td> <td>...

gcc - Compilation errors with inline assembly code in c file, probably with branching -

i have below code. when try compile giving errors mentioned after code snippet. void func() __asm__ ( "mfspr 12, 1017;" "rotrwi 12,12,%0;" "andi. 11, 12, %1;" "beq done;" "3:;" "mfspr 12, 1017;" "andi. 11, 12, %2;" "bne 3b;" "ori 12, 12, %2;" "mtspr 1017, 12;" "isync;" "3:;" "mfspr 12, 1017;" "andi. 11, 12, %2;" "bne 3b;" "done:;" ::"r"(31), "r"(1), "r"(2048)); } errors: {standard input}: assembler messages: {standard input}:3607: error: bad expression {standard input}:3607: error: missing ')' {standard input}:3607: error: missing ')' {standard input}:3607: error: syntax error; found `r', expected `,' {standard input}:3607: error: junk @ end of line:...

html - Content is pushed down by DIV -

this question based on question: twitter bootstrap 3 2 columns full height i have same layout. but, when try put div in content part, pushes content of sidebar down. here's fiddle <header>header</header> <div class="container"> <div class="row"> <div class="col-md-3 no-float">navigation</div> <div class="col-md-9 no-float"><div><div style="width=100%;height:55px;background:red"></div>content</div></div> </div> css: html,body,.container { height:100%; } .container { display:table; width: 100%; margin-top: -50px; padding: 50px 0 0 0; /*set left/right padding according needs*/ -moz-box-sizing: border-box; box-sizing: border-box; } header { background: green; height: 50px; } .row { height: 100%; display: table-row; } .col-md-3.no-float, .col-md-9.no-float { float: none; /* baxabbit ...

git - Add private file (that are not pushed) with a commit, possible? -

i've question because helpful in such cases : i'm working on open-source program, , i'd keep git repo clean, containing source , build related files. however, beside that, wrote scripts relevant me quite linked commit or branch i'm working on. is there possibility having these files saved commit not pushed on remote repo ? anyway you're working in separate repo , branch. may commit utility files along corresponding chahges. when prepare commit pull request, make separate release branch, checkout , remove these files in next commit. development branch still have these files in older commits. when feature ready: create branch , checkout it git checkout -b pull_request git rm <all utility files> git commit -am'removed utility files' you can make single commit, keep history tidy. after previous commands: git reset --soft <sha1 forked branch> git commit -am'implemented feature x' now branch pull_request contains change...

smartface.io - I cannot see my app when I debug my project on smartface free -

i have installed free version of smartface , created training project. when build app install on virtual android device cannot see it. see smartface adverts. what can solve problem? should lisenced? the screen mentioned shown @ beginning of app seconds. can see application page , use it. should reinstall on real android device.

c# - wcf service showing error when deployed on server -

i have wcf service running fine on localhost, issue when try deploy on server gives me following error: could not find base address matches scheme http endpoint binding metadataexchangehttpbinding. registered base address schemes []. [invalidoperationexception: not find base address matches scheme http endpoint binding metadataexchangehttpbinding. registered base address schemes [].] system.servicemodel.servicehostbase.makeabsoluteuri(uri relativeorabsoluteuri, binding binding, urischemekeyedcollection baseaddresses) +16604769 system.servicemodel.description.configloader.loadservicedescription(servicehostbase host, servicedescription description, serviceelement serviceelement, action`1 addbaseaddress) +1082 system.servicemodel.servicehostbase.applyconfiguration() +156 system.servicemodel.servicehostbase.initializedescription(urischemekeyedcollection baseaddresses) +215 system.servicemodel.servicehost..ctor(type servicetype, uri[] baseaddresses) +475 sy...

sql server - Sql ForXml; concatenating fields returning either a comma seperated list or empty string -

i have looked through several questions on using xml have either missed, or not found specific query. fortunately, or perhaps not, service need submit data wants fields table(s) submitted attributes rather elements means can use xml auto. require things i'm not sure how write correct sql achieve, , welcome advice. some fields (let's have 3 named log1, log2 , log3) need returned 1 attribute called arguments sake logs. if 3 log fields null needs empty string, or if contain data need concatenated comma separator. suspect simple coalesce not answer here, i'm not entirely sure else do. as said welcome suggestions. thanks. edit apologies, should have added sql assist. select landingid, vesselid, ticketnumber, convert(varchar(10),landingdate1,112) landingdate1, log1, log2, log3, coalesce(vesselname,'') vesselname, vesselowner landings.landingheaders sale xml auto log1, log2 , log3 should become logs , either empty stri...

How to Avoid Duplicate Entries in MongoDb Meteor App -

how avoid duplicate entries in mongodb in meteor application. on command: db.products.find({},{"template_name": 1},{unique : true}) { "_id" : objectid("5555d0a16ce3b01bb759a771"), "template_name" : "b" } { "_id" : objectid("5555d0b46ce3b01bb759a772"), "template_name" : "a" } { "_id" : objectid("5555d0c86ce3b01bb759a773"), "template_name" : "c" } { "_id" : objectid("5555d0f86ce3b01bb759a774"), "template_name" : "c" } { "_id" : objectid("5555d1026ce3b01bb759a775"), "template_name" : "a" } { "_id" : objectid("5555d1086ce3b01bb759a776"), "template_name" : "b" } i want retrieve unique template names , show them on html page. use aggregation framework pipeline stages consist of $group , $project operators respectively. $grou...

java - How to initialize the log4j system properly -

i'm getting 2 warnings. log4j:warn no appenders found logger (com.org.resolver). log4j:warn please initialize log4j system properly. how resolve it? my java class name resolver.java in java class i'm calling private static log log = logfactory.getlog(resolver.class); you need put log4j.properties or log4j.xml in classpath. so, create file name log4j.properties , replace content below: # root logger option log4j.rootlogger=info, debug, stdout, file # redirect log messages console log4j.appender.stdout=org.apache.log4j.consoleappender log4j.appender.stdout.target=system.out log4j.appender.stdout.layout=org.apache.log4j.patternlayout log4j.appender.stdout.layout.conversionpattern=%d{yyyy-mm-dd hh:mm:ss} %-5p %c{1}:%l - %m%n # redirect log messages log file, support file rolling. log4j.appender.file=org.apache.log4j.rollingfileappender #. represents current folder (usually project root folder) log4j.appender.file.file=./logging.log log4j.appender....

Hide map borders and labels in android MapFragment -

i have mapfragment object modify, labels: county,street , such wont visible. borders of counties wont visible... i'll topography. how that? you can use google maps api styled map wizard , can style maps whatever want like, , apply style static maps , or apply style map . [ { "featuretype": "poi", "stylers": [ { "visibility": "off" } ] },{ "featuretype": "transit", "stylers": [ { "visibility": "off" } ] },{ "featuretype": "road", "stylers": [ { "visibility": "off" } ] },{ "featuretype": "administrative", "stylers": [ { "visibility": "off" } ] },{ "featuretype": "water", "elementtype": "labels", "stylers": [ { "visibil...

jsf 2 - how to pass result 'repeat'-'h:selectOneRadio' to List on Backing bean,using Ajax -

this question has answer here: input component inside ui:repeat, how save submitted values 1 answer how pass result of <ui:repeat> <h:selectoneradio> in list on backing bean, using ajax ? <h:form rendered="#{lessonbean.test!=null}"> <ui:repeat value="#{lessonbean.test.questions}" var="quest"> <h:selectoneradio value=""> <f:selectitem itemvalue="1" itemlabel="${quest.a1}"/> <f:selectitem itemvalue="2" itemlabel="${quest.a2}"/> <f:selectitem itemvalue="3" itemlabel="${quest.a3}"/> <f:selectitem itemvalue="4" itemlabel="${quest.a4}"/> <f:selectitem itemvalue="5...

javascript - Mongoose aggregation not sorting dates -

can me understand why aggregation query not sorting results created_at date? user.aggregate([ // records created in last 30 days { $match: { "created_at":{ $gt: new date(today.gettime() - 1000*60*60*24*30) } }}, //sort results signup date { $sort : { "created_at" : -1 } }, // year, month , day createdtimestamp { $project: { "year":{ $year:"$created_at" }, "month":{ $month:"$created_at" }, "day": { $dayofmonth:"$created_at" } }}, // group year, month , day , count { $group: { _id:{ year:"$year", month:"$month", day:"$day" }, "count":{ $sum:1 } }} ]) why aggregation query not sorting results created_at date? there no guarantee $group being stable (i.e.: maintain order if possible). so, if need result in particular order, should use $sort step last step of pipeline. (untested): user.aggregate([ // rec...

jquery - lavalamp with rails not working -

i trying lavalamp work under rails envrioment i thik there conflict gemfile:gem 'jquery-rails','3.1.2'. is there away way in prove apart attempting create project without jquery_rails , simplified gemfile? the page works when not under rails environment. i have tried http://learn.jquery.com/using-jquery-core/avoid-conflicts-other-libraries/ doesn't solve issue.

date - How to get the minutes from two times in java -

i trying difference between 2 hours following string time1 = "05:00 am"; string time2 = "06:20 am"; string format = "hh:mm aa"; simpledateformat sdf = new simpledateformat ( format ); date dateobj1 = null; date dateobj2 = null; try { dateobj1 = sdf.parse ( time1 ); dateobj2 = sdf.parse ( time2 ); } catch ( parseexception e ) { e.printstacktrace ( ); } long diff = dateobj2.gettime ( ) - dateobj1.gettime ( ); double diffinhours = diff / ( ( double ) 1000 * 60 * 60 ); double diffinmins = ( diffinhours + ( int ) diffinhours ) * 60; dump console. system.out.println ( "diff: " + diff ); system.out.println ( "diffinhours: " + diffinhours ); system.out.println ( "diffinmins " + diffinmins ); when run. diffinhours 1.3333333333333333 minutes 139.99999999999997 i calculate time in minutes between 2 times in above case should 80 minutes giving other value. would 1 me minutes between 2 time? with ...

Processing two tasks exactly at the same time as parallel in Java -

i want call 8 methods in method. 2 methods inside of these 8 methods 1 hole task, , remaining 6 methods hole task. i want process these 2 tasks @ same time parallel. as know can threads. honest either couldn't see example similar goal, or couldn't understand example if i've seen. could briefly show me example in order me finish goal? thanks, somethings maybe: import java.util.concurrent.executorservice; import java.util.concurrent.executors; import java.util.concurrent.timeunit; public class main { public static void main(final string[] args) throws interruptedexception { final executorservice pool = executors.newfixedthreadpool(2); pool.execute(() -> { method1(); method2(); }); pool.execute(() -> { method3(); /* ... */ method8(); }); pool.shutdown(); if (!pool.awaittermination(1, timeunit.days)) system.err.p...

angularjs - angular-ui replace'?' with '#' on redirect from facebook oauth -

i'm implementing facebook ouath login in angularjs without sdk. everything works expected except 1 thing. when user click on login button, redirects facebook login page, after successfull login, facebook fires redirect_uri url, , user again in app. problem is, ui-router (probably) replaces '?' '#' in path, so http://localhost/fbauth?access_token=xxx&code=yyy becomes http://localhost/fbauth#access_token=xxx&code=yyy because of that, cannot use $stateparams object query params. suprisingly, when manually enter in browser or click link http://localhost/fbauth?access_token=xxx&code=yyy works properly, , ui-router not replace '?' '#'. i guess, it's related redirection scenario itself. can point me wrong, or how change ui-router behaviour in case? this state, handles fb redirect: .state('fbauth', { url: '/fbauth?access_token&code&expires_in', templateurl: 'static/public/public.ht...

TCl-Tk How to catch floating point numbers from a file -

i'm finding troubles working on file containing floating numbers. these rows file: 174259 1.264944 -.194235 4.1509e-5 174260 1.264287 -.191802 3.9e-2 174261 1.266468 -.190813 3.9899e-2 174262 1.267116 -.193e-3 4.2452e-2 what i'm trying find row desire number (e.g "174260") , extract following 3 numbers. this code: set output [open "output3.txt" w] set fileinput [open "input.txt" r] set filecontent [read $fileinput] set inputlist [split $filecontent "\n"] set desire 174260 set findelem [lsearch -all -inline $inputlist $desire*] set coordinate [ regexp -inline -all {\s+} $findelem ] set x1 [lindex $coordinate 1] set y1 [lindex $coordinate 2] set z1 [lindex $coordinate 3] puts $output "$x1 $y1 $z1" using regexp method string "{\s+}" obtain last character curly brackets: 1.264287 -.191802 3.9e-2} i don't know how extract numbers value , not entire string. i'd tempted in ...

regex - \r\n in scala parser for Windows/Unix -

this question has answer here: new line character in scala 6 answers i've got scala regex test parse string multiple lines. looks following: val s = "this 1 line\r\n" + "the second line\r\n" + "third" scala test "\r\n" working windows, unix should keep "\n" . common solution work on both systems? you test \r?\n instead of \r\n . way carriage return optional.

Git automatic fetch periodically/on branch checkout -

i automated method fetch our remote origin server. perhaps every time switch branches git automatically fetch on branches origin before switch... way when move local "fix branch" master tell me master behind origin master. is possible? more detailed reason requirement below if need know why want this. thanks guys! i work in team of developers. when add change our origin/master branch upload change our ftp server (we have not yet setup git on our server) if create "fix branch" , make changes file... want these files live , master. if merge changes in local file local master without fetch cause problems. if forget bring in changes our origin prior upload file may uploading file missing revisions origin. (naughty know) also aware of updates in master possible can incorporate them "fix branch" git doesn't have built-in scheduling features. you'll have use whatever operating system provides: cron or windows task scheduler or write...

java - Retrieve timestamp from Mysql -

i have java mvc model.which has timestamp 1 of db value inserted db.i have declared data type timestamp in db,now problem if try retrieve showing null values & can not represented java.sql.timestamp statement : pstmt = con.preparestatement("select timestamp, nid id=?"); pstmt.setdouble(1, nidev); rs = pstmt.executequery(); if(rs.next()) { timebean.sethbtimestamp(rs.gettimestamp("timestamp")); } bean class: private timestamp hbtimestamp; public timestamp gethbtimestamp() { return hbtimestamp; } public void sethbtimestamp(timestamp hbtimestamp) { this.hbtimestamp = hbtimestamp; } mydb value inserted :2015-05-15 13:54:53 output: value '0000-00-00 00:00:00' can not represented java.sql.timestamp remove , looks this select `timestamp` nid id=?

How can I change the template that Android Studio uses to create a blank activity -

i change template new activity uses appcompatactivity instead of depreciated actionbaractivity i found sdk\tools\templates\activities\blankactivity\root\src\app_package\simpleactivity.java.ftl , after making backup copy changed import <#if appcompat>android.support.v7.app.actionbaractivity<#else>android.app.activity</#if>; to import <#if appcompat>import android.support.v7.app.appcompatactivity<#else>android.app.activity</#if>; and public class ${activityclass} extends ${(appcompat)?string('actionbar','')}activity { to public class ${activityclass} extends ${(appcompat)?string('appcompat','')}activity { but when create new activity still uses actionbaractivity. i change 2 position: 1.import <#if appcompat>android.support.v7.app. appcompatactivity <#else>android.app.activity; 2.public class ${activityclass} extends ${(appcompat)?string(' appcompat ','')}ac...

css - Create a CSS3 flip-down animation for menus -

i know there plenty of examples out there i'm having trouble making work specific html. the html cannot changed, it's wordpress generated. i have menu sub-menu containing 2 items. i want create css3 animation flips down children items consecutively in example: http://cssdeck.com/labs/navigation-dropdown-with-flip-effect i've been playing around code found in pen http://codepen.io/ganesh_r/pen/tmhsj not seeing similar attempting do. my code pretty simple: .sub-menu{-webkit-transform-style: preserve-3d;} .has-children:hover .sub-menu li{transition: 0.5s;transform-origin: 0px 0px;transform: rotatex(-90deg);} i figured somewhere close after i'm seeing nothing. , i've hit bit of brick wall can't work out why i'm seeing nothing using code. any ideas how can achieve consecutive drop down? html sample: <li class="has-children main-link"><a>top level menu item</a> <ul class="sub-menu"> ...

internet explorer - Jquery DataTables 1.10 not working in IE 9 -

Image
i have page, uses datatables plugin render json data asp.net application. everything working fine in other browsers apart ie9, following error when page loads. drilling code within visual studio can see cells undefined, , causing length piece of code blow up. my question is, how can fix works in ie9? try running same keeping browser compatibility mode on. in browser go , tools > compatibility view settings. you can select option view page in compatible view. see if solves issue.

ios - UIActivityViewController not passing new line characters to some activities -

i using following code set uiactivityviewcontroller: nsarray *activityitems = [nsarray arraywithobjects:[self textmessagetoshare], nil]; uiactivityviewcontroller *activityviewcontroller = [[uiactivityviewcontroller alloc] initwithactivityitems:activityitems applicationactivities:nil]; [activityviewcontroller setcompletionhandler:^(nsstring *activitytype, bool completed) { if (completed) { [self sendfeedbackwithindexpath:indexpath andliketype:100 andcell:nil]; } }]; [self.navigationcontroller presentviewcontroller:activityviewcontroller animated:yes completion:^{ // ... }]; issue when copy message or post facebook or twitter or email or gmail app or default messages app, new line characters in [self textmessagetoshare] maintained. howe...

c# - How to send a mail in Xamarin using System.Net.Mail.SmtpClient -

i trying send , email inside app using system.net.mail.smtpclient. when run code on phone java.lang.runtimeexception error , can't figure out why? i have following code run send email when click button. using system; using android.app; using android.widget; using android.os; using system.net; using system.net.mail; using system.net.mime; using system.threading; using system.componentmodel; namespace sendemail { [activity (label = "sendemail", mainlauncher = true)] public class activity1 : activity { protected override void oncreate (bundle bundle) { base.oncreate (bundle); // set our view "main" layout resource setcontentview (resource.layout.main); // our button layout resource, // , attach event button button = findviewbyid<button> (resource.id.mybutton); edittext text = findviewbyid<edittext> (resource.id.mailtext); button.click += delegate { string ...

java - Acceptable use of instanceof -

this question has answer here: is acceptable use of instanceof? 2 answers i'm new java , struggling design problem. know use of instanceof may indicate design flaw , understand given animal/dog/cat classes example, replacing bark() , meow() makenoise() etc. my question is, sensible design if need call methods not have corresponding method depending on type of subclass? example, if want call new method biteleash() if class dog nothing @ if it's cat ? i did consider having biteleash() in animal nothing, , overriding in dog , there methods many seems clunky solution. in similar vein, if caller needs different depending on subclass has hold of, eg. terminate if subclass cat ? instanceof acceptable here, or there better way? public class animal { string name; public animal(string name) { this.name = name; } public string ...

objective c - NSPopUpButton in a toolbar with fixed image similar to Pages.app UI -

Image
the toolbar in pages (numbers, keynote) has nspopupbutton fixed image (irrespective of menu selected). using view debugging turns out standard nspopupbutton fixed image. according nspopupbutton docs regarding setimage: , this method has no effect. image displayed in pop button cell taken selected menu item (in case of pop menu) or first menu item (in case of pull-down menu). this means standard nspopupbutton has non-standard behaviour. how implemented? because setimage: has no effect, subclass nspopupbuttoncell , overriding -drawimage:withframe:inview: has no effect (because never called). the problem here confusion: pull down menus display menu's first menu item image/title . don't use -setimage: display static image in -pull down menu. instead set first element of menu image/title want display , add selection options additional menu items. @volker absolutely correct. built-in behaviour set image setting first element in menu not using...

javascript - Disable toggle button click function, if button in active class -

Image
i created mvc 4 application. here view of table of project. i want disable clickable function active button for example: disable click function of first row active button , enable click function inactive button and disable click function of 2nd row inactive button , enable click function active button likewise rest of it. here current cshtml code table view button function <div class="btn-group btn-toggle" id="btn-toggle"> @if (item.status == true) { <button class="btn btn-xs active btn-primary" data-hei_id = "@item.hei_id" data-status = "true" >active</button> <button class="btn btn-xs inactivecolor btn-default" data-hei_id = "@item.hei_id" data-status = "false" >inactive</button> } else { <button class="btn btn-xs btn-default" data-hei_id = "@item.hei_id" data-status = "true...

unity3d - Retrieve object value using pointer in Parse for Unity -

i have database schema includes 2 tables in parse: projects & layouts. one project can have multiple layouts 1,2,3, etc. i have created pointer in layouts schema maps projects data. i using unity3d , given query projectobjectid (column present in projects) want find out rows correspondingly present in layouts. public void fetchlayoutsinproject(){ var projectobjectid = "ulaueklpmo"; debug.log ("starting"); var query = parseobject.getquery ("layouts"); query = query. whereequalto("projectobjectid", projectobjectid) ; query.findasync ().continuewith (t => { availablelayouts = t.result; }); } this doesn't work. can explain right way query parse.com pointer in unity?

java - Junit test; Is it possible to configure a Bean's default property, before application context starts up? -

i have bean property "dbserver"; has default of "location1"; during application startup, depending on value of "dbserver", different classes instantiated. i have 200 tests default setting fine. however, of now,i test alternative. question: is there way within junit test case reset default before application context starts ? junit won't start application context unless write setup method under @before annotation. in case can initialize bean values.

ios - ViewModel is null during ViewDidLoad -

i getting started mvvmcross in ios. public class mainview : mvxtabbarviewcontroller { public override void viewdidload() { base.viewdidload(); var vm = (mainviewmodel)this.viewmodel; if (vm == null) return; } } setting breakpoint line access viewmodel , shows me, viewmodel null. i can workaround calling viewdidload() in constructor. then, viewmodel null during constructor call, valid in default viewdidload call. looks workaround. can help? i'm guessing here problem here specific way tabbarviewcontroller constructed. viewdidload virtual method , called first time view accessed. in case of tabbarviewcontroller happens during ios base view constructor - i.e. occurs before class has had constructor called. the way around i've found add check against situation in viewdidload , , make second call viewdidload during class constructor. you can see in action n-25 - https://github.com/mvvmcross/nplus1da...

javascript - Change map to another using tileset -

i'm creating game using phaser.js . it's 2d-retro-rpg-you've-seen-it-100000000-times , i'm using tiled create maps. how supposed change map tileset? i'm quite confused this. couldn't find definite answer in net. suppose player reaches end of level 1, want load level 2. you can use variable called "currentlevel". , call create method when want change levels: gamestate.prototype.create = function() { // (...) // level creation this.level = new level(this.game, this.currentlevel); // (...) }; and in level.js can have this: var level = function(game, levelnumber) { // load tilemap phaser.tilemap.call(this, game, levelnumber); // (...) more logic load data json }; have been clear enough? hope helps!

c++ - Get File size from CFileDialog -

i newbie visual studio c++. using cfiledialog file name , file path user input. , want use progress control loading process , user have wait depend on input file size. got file name , file path using cfiledialog don't know how user input file size. i using below method , return zero. int filesize(const char * szfilename) { struct stat filestat; int err = stat(szfilename, &filestat); if (0 != err) return 0; return filestat.st_size; } please suggest me if have better solution file size. thanks much. the standard portable way be: long long sz; // int small many files ! ifstream ifs(test); if(!ifs) return 0; // when file couldn't opened ifs.seekg(0, ios::end); sz = ifs.tellg(); return sz; the native windows approach use getfilesize() . but if @ mfc alternative doesn't open file first, may @ this question .

php - When fetching questions using API, the output is garbled

i want questions stack overflow api. have done following things: all 3 steps executed successfully. requested user approve app : https://stackexchange.com/oauth/dialog?client_id=4783&scope=private_info&redirect_uri=https://stackexchange.com/oauth/login_success get access token user using link : https://stackexchange.com/oauth/login_success#access_token=..&expires=86399 go content page have data : https://api.stackexchange.com/2.2/questions?order=desc&sort=activity&site=stackoverflow&key=z19xwkofreckwgqme7oizg((&access_token= .. i using file_get_content("https://api.stackexchange.com/2.2/questions?order=desc&sort=activity&site=stackoverflow&key=z19xwkofreckwgqme7oizg((&access_token=..") to data , print it. data printed in browser this: ‹½\ýoÛ6·þwˆØ/oqõÕ‹bè׶nëÚ5Ûºíâ" $Êfbk®$Çñ†ýïï9¤äȱåhywƒv$>Ç"ùø|3éf-볧ÿû×y#gøælÖ«ób5tgªht³={rp‰r{qoØÿ=9+7…ªÎžþuv©Õº‘.‹³§‚‹'gëzu—:;{êa¸q{¥Ù®ÔÙs>Óu£*•¡Ü4u«æ²’ ÜŠÂ...

c++ - Linking error: undefined reference within the same class -

i getting following error g++ 4.9: basis.cpp:16: undefined reference `basis::foo(int, int)' this header file: #ifndef basis_h #define basis_h #include "common.h" #include <math.h> #include "xdouble.h" using namespace std; class basis { private: int rank; int dim; public: basis(); //empty constructor basis(int r, int d); //default constructor void foo(int a, int b); void bar(int a, int b); }; #endif the basis.cpp file following: #include "basis.h" basis::basis() { rank = 0; dim = 0; } basis::basis(int r, int d) // default constructor { rank = r; dim = d; } void basis::bar(int a, int b) { void foo(int a, int b); } void basis::foo(int a, int b) { } even though i'm including basis.h file undefined reference error , can't understand why happening. doing wrong? thanks it looks copy , paste error. try this: void basis::bar(int a, int b) { foo(a, b); } ...