Posts

Showing posts from July, 2014

arrays - Actionscript Game - Matching answers with Random Questions -

i'm beginner @ actionscript, there may simple explanation this, missing. appreciate on assignment. i creating children's game user counts objects , picks number answer question asked. questions generate randomly. problem answers not match randomly generated questions. this actionscript, "choice" answer buttons. import flash.events.mouseevent; stop(); //------------------variables----------------- var score = 0; var questionnum = 1; scoretxt.text = "0"; var randomnum:number; var questions:array = ["how many orange flags there?", "how many blue flags there? ", "how many balls clown juggling?", "how many clouds in sky?", "how many horses on carousel?", "how many stripes on roof of tent?"]; var answers:array = [choice10, choice6, choice10, choice4, choice2, choice

ios - QuickBlox : Push notification settings -

Image
is possible change quickblox push notification template runtime? is possible send message, having save_to_history enabled (true) , not come push notification (even if push enabled).

Laravel Count from database -

i want count amount of workers company has. shows like: mcdonalds - 200 employees (example) model: public function gettotalworkers() { return $this->hasmany('app\user')->wherecompanyid($this->company_id)->count(); } view: @foreach($companies $company) <tr> <td>{!! link_to_route('company.edit', $company->name, [$company->id] )!!}</td> <td>{{ $gettotalworkers }}</td> <td>{{ ' /' }}</td> <td>{{ $company->parent_id }}</td> <td>{{ ' /' }}</td> <td>{{ $company->active }}</td> </tr> @endforeach controller: public function index() { $gettotalworkers = $this->company->gettotalworkers(); $companies = company::get(); return view('company.index', ['companies' => $companies, 'gettotalworkers' => $gettotalworkers]); but gives me error: call member funct

java - Confirm dialog before exit android studio -

hi guys have exit button on main activity xml need when user clicks it, opens dialogue confirm exit, if yes exit. if no take them back. here's code far, don't have of part don't know start. package com.tradingsoftwarelimited.labelprinter10; import android.app.activity; import android.app.alertdialog; import android.content.dialoginterface; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.view; import android.widget.button; import android.widget.toast; public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //sets edit , data button hidden button hiddenbutton = (button) findviewbyid(r.id.editbutton); hiddenbutton.setvisibility(view.invisible); button hiddenbutton1 = (button) findviewbyid(r.id.databutton); hidde

java - How to Click Random element from a list of elements returned by a search -

i have page list of products displayed, need click particular type of listings list saved particular type "webelement". now, whenever land on page, check condition , click on first product. but, requirement after checking condition, need click random product in list. see code below. kindly suggest. driver.findelement(by.linktext("all equipment")).click(); driver.manage().timeouts().implicitlywait(10, timeunit.seconds); list <webelement> listings = driver.findelements(by.cssselector("a[href*='/listing?listingid']")); (int i=0; < listings.size(); i++) { webelement requiredlisting = listings.get(i); system.out.println(i); requiredlisting.click(); thread.sleep(10000); getvalue = driver.findelement(by.xpath("//div[7]/span")).gettext(); system.out.println(getvalue); driver.findelement(by.xpath("//div[3]/div[2]/input")).click(); thread.sl

javascript - Inserting HTML code without being affected by CSS and Jquery -

i want insert html code inside page, code insert should not affected css , js of page, should load it's own css , js. example code: <div class="body"> <p>example content </p> <p>sample content 2 </p> <div class="special-div"> <p> no css , js applied div 'special-div', should load it's own css , js </p> </div><!-- /.special-div --> </div><!-- /.body --> in above code div class "special-div" should load it's own css , js , should not affected page's css , js i've tried using iframes firstly cross origin, secondly iframe has it's own scroll bar. i trying insert slider wordpress page, i've built slider in html site , tested default wordpress styles , js changing layout. can remove styles i'm not sure how rid of js affecting slider any appreciate. one way of doing shadow dom . shadow dom provides encapsulati

ios - Make a public var equal to private string -

i want public variable equal string inside method generated call made here func use make call tempstring func handlesnapshotresult(snapshot: dictionary<string, string>) -> void { let tempstring : string = snapshot["temperature"]! println("temperature: " + tempstring) } i want use tempstring inside of uicollectionview cell, how make public variable set collectionviewcell.label.text = temp string btw im new swift you can put call create , set text of cell. when response call set text collectionviewcell.label.text = "your_response_text" you can skip function call.

Set ActiveMQ pollingFrequency in Mule -

i have set activemq in mule , set polling interval. cannot see how 1 such set. guess small setting, cant see it. consuming messages not polling files folder or rows database. typically listen queue , message it's there - event driven. if use transacted setup, mule restart listening period/transaction frequency - still event driven, not polling

jsf 2 - Primefaces Chart labels not showing in nested tabview -

i have page nested tabview , : <p:tabview dynamic="true" id="tabview"> <p:tab title="tab1"> <p:tabview dynamic="true" > <p:tab title="subtab1" > // charts : linechart , piechart ... // labels working </p:tab > <p:tab title="subtab2" > // charts : linechart , piechart ... // !! labels not working !! </p:tab> </p:tabview> </p:tab> <p:tab title="tab2"> // charts : linechart , piechart ... // labels working </p:tab> </p:tabview> so problem labels not working in 'subtab2' , if switch 'subtab2' , 'subtab1' labels work in 'subtab2' , not in 'subtab1'. in 'tab1' , 'tab2' no problem ! i'm working primefaces 5.1. the same

sbt - How to write a plugin which depends on a task from another plugin? -

there great sbt plugin sbt-dependency-graph , provides dependencytree task show dependencies. i want write sbt plugin depends on it, fails. build.sbt sbtplugin := true name := "my-sbt-plugin-depends-on-another" version := "0.1.2.1" organization := "test20140913" addsbtplugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.5") src/main/scala/mysbtplugin.scala import sbt._ object mysbtplugin extends autoplugin { object autoimport { lazy val hello = taskkey[unit]("hello task plugin") lazy val hello2 = taskkey[unit]("hello task plugin2") } import autoimport._ override def trigger = allrequirements override def requires = plugins.jvmplugin val hellosetting = hello := println("hello plugin") val hellosetting2 = hello2 := { println("hello2, task result plugins:") println(net.virtualvoid.sbt.graph.plugin.dependencytree.value) println

jquery - Using flexbox to get 2 divs in equal height, but what about the content? -

Image
i using flexbox create 2 equally sized (in height) div's. works perfectly, 1 small issue. the first div contains form , second div contains general text , few images. the small issue experiencing when form expands, depending on options person selects. expanding mean first div increase in height. flexbox 2nd div increase in height, match first one. now, issue, since content in 2nd div limited, create lot of white-space @ bottom of div when first div expands (the 1 form). i have been thinking solutions, haven't found it. think best solution solve amount of whitespace on 2nd div making space between child div's in 2nd div autmatically adjust. when form (in first div) increase in height, should add space between different div's use in 2nd div. another, , better solution, would automatically show more or less (child) div's (in 2nd div) depending on height of first div (with form). i @ explaining things more difficult is, therefor uploaded (photoshopped) s

java - reflection.proxy not valid when override -

it seems reflection.proxy not expected when there overriden methods. in detail, starting simple application: static void debug( string fmt, object... args ) { system.out.println( string.format(fmt,args)); } interface { void m1(); void m2(); } static class implements { public void m1() { system.out.println( "a.m1" ); m2(); } public void m2() { system.out.println( "a.m2" ); } } static class b extends { @override public void m2() { system.out.println( "b.m2" ); } } public static void main( string[] args ) { b b = new b(); b.m1(); } the output is, expected: a.m1 b.m2 now, try proxify calls methods of "b b". following new code added: static public class helloinvocationhandler implements invocationhandler { proxied; helloinvocationhandler( proxied ) { this.proxied = proxied; } @override public object invoke(object proxy, method method, object[] args) throw

javascript - Pre compile a directive for use in Google Maps marker causes '$apply already in progress' error -

i creating angularjs app integrates google maps. have html use info popup. use similar chunk of html elsewhere in app, started using directive create re usable component. once had implemented realised info popup windows need initialised html @ time of creation not @ time of 'popping up'. i investigated how pre compile directive. same angularjs docs on testing directive. var element = angular.element("<my-directive data=data></my-directive>"); var scope = $rootscope.$new(); scope.data = somedata; element = $compile(element)(scope); scope.$apply(); element.html(); // gives me html this causes error '$apply in progress' know means digest cycle in progress $apply necessary need create precompiled template pass info popup. i have looked $interpolate , $parse don't think can use these directive has link functions need evaluated. use if (!$scope.$$phase) $scope.$apply();

Javascript scope weirdness, function and browser -

i thought doing this: var = function () {}; and function () {} was same thing in js, functions supposed "first class object". today learned in firefox code : var test = true; if (test) { function () { alert("foo"); } } else { function () { alert("bar"); } } what(); display foo, , weird reason chrome display bar... why [number one] ? doing : var test = true, what; if (test) { = function() { alert("foo"); } } else { = function () { alert("bar"); } } what(); solved problem.. why [number two]? can try out http://jsfiddle.net/7cbs5gr7/ here [abstract] have 2 questions : why chrome , firefox act differently on ? -additional 1 : wich 1 right ? - why setting function explicitly in var solved problem ? functions can conditionally defined using either //function statements// (an allowed extension ecma-262 edit

c# - Access CustomProperties set using office365 JS APIs from EWS or REST API -

i have office 365 mail app stores value in custom property before item saved. when item saved want access property using server-side application. reading through custom properties documentation tells me can't access custom properties created using js api using other service ews since these not mapi properties. there workarounds ? possible access these using rest apis ? actually, documented stored , in format. [ms-oxcext] specification provides specifics. values stored json dictionary in custom property on item. should able use ews read custom property extendedproperty . update: after discussing folks internally, should disclaim isn't supported method mrpiao indicated. stated, storage design change, break app if depend on current design. concern don't want lead down path becomes unworkable :). if can describe end goal is, perhaps can suggest more durable solution.

c# - Open Outlook with same credentials as running application -

i'm writing program needs open microsoft outlook , create mail item user when click on button. however, when so, following error: retrieving com class factory component clsid {0006f03a-0000-0000-c000- 000000000046} failed due following error: 80080005 server execution failed (exception hresult: 0x80080005 (co_e_server_exec_failure)). after researching error found out program , ms outlook must both run administrator or normal privilege level. so here's question... how open ms outlook through c# code using same privilege level current running program. need current privilege level, open outlook privilege level. i've had no luck in research far. appreciated! here's code (currently) opening ms outlook , how use it: application outlookapp = new application(); mailitem mailitem = outlookapp.createitem(olitemtype.olmailitem); mailitem.subject = "blah"; mailitem.htmlbody= @"various html stuff"; foreach (string documentpath in this.documentpaths)

Javascript resize background color proportionally to its own size -

i want resize background image 30% original size use background element. sure mistake somewhere in last line. here code : var img = new image(); img.src = "wallpaper.jpg"; var = img.height; var newwidth = (img.width*0.3)); var newheight = (img.height*0.3)); t.getbody().style.backgroundimage = "url("+img.src+")"; t.getbody().style.backgroundsize = "(newwidth)px (newheight)px"; values of background-size property should xpx ypx . try change last line this: t.getbody().style.backgroundsize = newwidth+"px "+newheight+"px";

javascript - 3D ball map rotating in HTML5 canvas -

Image
i have created multiplayer pool game in html5 canvas , working fine. enhance real ball rotations. i'm using simple png files balls cannot "rotate" in direction (they can not real). there solution rotating maps each ball emulate real ball rotations? have drawn balls in 3d max, don't know how implement that. should render lot of ball rotations in directions each ball or there more simple way? one of thoughts create flattened maps each ball dimensions 2*pi x pi (relative) actual spherical map each ball, , clip circle region current ball position, still 2d projection, not 3d. to fake render 3d animation of rotation in single direction. this: then calculate direction vector , rotate sprite based on angle.

How to write this matrix in matlab, -

i want write matrix in matlab, s=[0 ..... 0 b 0 .... 0 ab b .... 0 . . . . . . . . . 0 .... a^(n-1)*b ... ab b ] i have tried below code giving error, n = 50; a=[2 3;4 1]; b=[3 ;2]; [nx,ny] = size(a); s(nx,ny,n) = 0; n=1:1:n s(:,:,n)=a.^n; end s_x=cat(3, eye(size(a)) ,s); ii=1:1:n-1 su(:,:,ii)=(a.^ii).*b ; end z= zeros(1,60,1); su1 = [z;su] ; s_u=repmat(su1,n); seems concatenation of matrix not being done. beginner having serious troubles,please help. use cell arrays , answer previous question a = [2 3; 4 1]; b = [3 ;2 ]; n = 60; [cs{1:(n+1),1:n}] = deal( zeros(size(b)) ); %// allocate space, setting top triangle 0 %// work on diagonals x = b; ii=2:(n+1) [cs{ii:(n+2):((n+1)*(n+2-ii))}] = deal(x); %//deal diagonal x = a*x; end s = cell2mat(cs); %// convert cells single matrix for more information can read deal , cell2mat . important note difference between

javascript - JS why is other code ignored and only return executed -

i got code gave same result: var number = 0; function a(){ number++; //outside return function return function(){ return number; }; } var b = a(); //outside loop for(i=0;i<10;i++){ console.log("loop: "+(i+1)+" :"+b()); } i found solution (1): var number = 0; function a(){ number++; //outside return function return function(){ return number; }; } for(i=0;i<10;i++){ var b = a(); //inside loop console.log("loop: "+(i+1)+" :"+b()); } and apparently should've gotten "correct" solution (2): var number = 0; function a(){ return function(){ number++; //inside return function return number; }; } var b = a(); //outside loop for(i=0;i<10;i++){ console.log("loop: "+(i+1)+" :"+b()); } in solution 1: thought putting var b in for-loop, "refresh" var number every loop, , did because every loop 1 added. in soluti

ios - How to send data to server in xcode? -

i beginner ios development. can tell me how send data server in xcode? have requirement need send device information server. you need first work out kind of api server you're talking has exposed most modern web applications expose rest api (although can speculate server mention exposing). if rest, starting point should not wish write own network layer use restkit: https://github.com/restkit/restkit if not rest, need information on backend api is, , go there...

c# - Optional Parameters causing a InternalErrorException -

i'm starting use optional parameters (as came java , haven't ever experimented them before) , i'm running following issue: unhandled exception: mono.csharp.internalerrorexception: internal error @ mono.csharp.methodgroupexpr.isapplicable (mono.csharp.resolvecontext ec, mono.csharp.arguments& arguments, int32 arg_count, system.reflection.methodbase& method, system.boolean& params_expanded_form) [0x00000] in <filename unknown>:0 @ mono.csharp.methodgroupexpr.overloadresolve (mono.csharp.resolvecontext ec, mono.csharp.arguments& arguments, boolean may_fail, location loc) [0x00000] in <filename unknown>:0 @ mono.csharp.new.doresolve (mono.csharp.resolvecontext ec) [0x00000] in <filename unknown>:0 @ mono.csharp.expression.resolve (mono.csharp.resolvecontext ec, resolveflags flags) [0x00000] in <filename unknown>:0 @ mono.csharp.expression.resolve (mono.csharp.resolvecontext ec) [0x00000] in <filename unknown>

Convert vb.net class object to JSON string in vb.net -

i c# developer , have requirement work in vb.net project. facing simple issue need convert class object json string in vb.net.problem when check string after conversion getting output as: [{},{},{}] i trying store value of 3 objects getting 3 empty objects {}. code this: imports system.web.script.serialization partial class test inherits system.web.ui.page protected sub page_load(byval sender object, byval e system.eventargs) handles me.load dim serializer new javascriptserializer dim msgobj msg dim loginlist new list(of msg)() msgobj = new msg("mubashir", true) loginlist.add(msgobj) msgobj = new msg("yasir", false) loginlist.add(msgobj) msgobj = new msg("umar", true) loginlist.add(msgobj) dim s string = serializer.serialize(loginlist) response.write(s) end sub end class public class msg dim message string dim status boolean sub n

PHP: Check if user can access order information -

i have written function in php check whether user can access order on web application i'm making. it checks account owns given order id , if account isn't current session account idea make user go home page. unfortunately not seem working, user can view order though sql query correct (i have verified through manual sql query). is there problem in code have written? <?php function is_accessible($document, $account) { global $dbh; $sth = $dbh->prepare("select account orders order_id = $document"); $sth->execute(); $result = $sth->fetchall(); if ($result[0]['0'] == $account) { return true; } else { return false; } } ?> <?php if (!is_accessible($_get['id'], $_session['account'])) { header("location: /index.php"); } ?> <?php echo $_get['id']; 10001 echo $_session['account']; 1 ?>

In XSLT 1.0 how to create a lookup function on XML data embedded in the XSLT using key and document('')? -

my specific need lookup line-heights given particular font-size, seeking learn general technique of creating lookups/a specific mapping. i think possible embed xml in xslt document (so can work standalone) , build key on using document('') function reference current xslt, this: <xsl:variable name="data.font-metrics.line-height"> <line-height font-size="11">12</line-height> <line-height font-size="12">14</line-height> <line-height font-size="13">15</line-height> <line-height font-size="14">16</line-height> <line-height font-size="15">17</line-height> <line-height font-size="16">18</line-height> <line-height font-size="17">20</line-height> <line-height font-size="18">21</line-height> </xsl:variable> <xsl:key name="lookup.font-metrics.line

Dart async/await encapsulation -

i want return fractional of decimal, if function takes time, function must give up. tried this, doesn't work... did wrong. show me mistake? string decimaltofractional(double d) async { var df = 1.0; var top = 1; var bot = 1; var future = new future<string>(() { while (df != d) { if (df < d) { top += 1; } else { bot += 1; top = (d * bot).toint(); } df = top / bot; } return new future.value('$top/$bot'); }); future.timeout(new duration(seconds: 2), ontimeout: () => new future.value(d.tostring())); return await future; } there several problems code. if want return result of async operation return type has future<...> future<string> decimaltofractional(double d) async { you can consume result main() async { print(await decimaltofractional(123456789.123456789)); } if want timeout take effect need return event loop. long sync execution running timeout doesn&

seo - Sort keyword data to show highest searches with lowest competition -

Image
i've used google adwords tool find suggested keywords. want take data step further: is there formula or way sort data show highest searches lowest competition? i'm looking create additional column output kind of rating, should show me best keywords target. just note - i'm not going using adwords, me write targeted content. update: i've created column , done searches/competition , sorted that... on surface seems give pretty results. is there formula or way sort data show highest searches lowest competition? warning: competition figure returned adwords competition between advertisers, not competition between content providers (which not available). if want make money, should multiply search competition, because want people fight put ads on page. if not going use adwords, formula makes sense (assuming competition figure between content providers).

How can I escape double quotes from a text input in javascript? -

in variable, string data coming text input following. var notestr="<?php echo $_request["notestr"];?>"; if user given double quotes in text input javascript give error expected. not finding way use javascript str.replace() in scenario because before using on string variable javascript engine generate errors. how can solve problem using javascript? advance help. use php function htmlspecialchars() . var notestr="<?php echo htmlspecialchars($_request["notestr"]); ?>"; and here's javascript equivalent: function escapehtml(text) { var map = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#039;' }; return text.replace(/[&<>"']/g, function(m) { return map[m]; }); } source: htmlspecialchars equivalent in javascript?

jquery - Iterate array on current position -

i've got array letters. right , left key want navigate left , right, on enter key, want current position (or letter) activated , , down keys change letter @ current position. when pressing enter again want leave activated state , able move left , right again. left , right navigation works , down arrows changes letters @ same time. guess need use $(this) in way. i'm sorry if code looks messy, can't pieces this. happy if point me in right direction! // $( document ).ready() var letters = ['','a','b','c','d','e']; var letterindex = 0; $('a:first').focus(); $(document).keydown(function(e) { e.preventdefault(); var keycode = e.which; arrow = {up: 38, down: 40, right: 39, left: 37, enter: 13}; switch(e.which) { case arrow.up: letterindex = letterindex

compiler warnings - Java version when using older target/source the api of the new java version is available -

this question has answer here: why javac “-source” flag doesn't work? 3 answers i have java 8 installed , compile code target , source 1.6. works don't want code compile if there java 8 specific function in code. compiles if run on machine running java 6 java.lang.nosuchmethoderror: java.lang.float.isfinite(f) is possible give error @ compile time? you need set bootclasspath jdk 6 installation. otherwise use jdk 8 , find new classes , methods shouldn't using.

How can I get information about the user's browser via javascript? -

i developing website. want as possible details end user viewing website. know basic information browser name, operating system can http request. want know else can get. is possible browser installed path? operating system logged user name? etc... list of informations? you can't logged in user name or browser installed path (huge security risk!), can information browser , operating system , on in javascript via browser's navigator object the useragent property bit cryptic, might use library parse such uaparser.js

playframework - How to generate Ebean table after evaluation plugin being disabled in Play framework -

i using play framework in 1 of project. currently working initial release. use evaluation plugin generate sql queries create tables. however after first release, have disable evaluation plugin because supports generating first sql ( 1.sql ). however not confident in writing sqls used ebean. looking proper way generated sqls , modify manually base on changes future version. possible? unfortunately ebean can create create ddl (and not update ddl ), means, next evolutions need create yourself. read other answer more details.

java - Print Consecutive numbers by comparing two parameters -

input 3,5 output should 3,4,5 input 5,3 output should 5,4,3 and code public static void test(int a, int b) { if(a>b) { (int = a; >= b; i--) { system.out.print(i + "\t"); } }else if(a<b) { (int = a; <= b; i++) { system.out.print(i + "\t"); } } } it works looks little messy. possible without if else thing? 1 loop. one solution handle boundary values correctly be public static void test(int start, int end) { int current = start; int stepwidth = current <= end ? +1 : -1; while (current != (end + stepwidth)) { system.out.print(current + "\t"); current += stepwidth; } system.out.println(""); } edit 1 using loop. public static void test(int start, int end) { int stepwidth = start <= end ? 1 : -1; (int current = start; current != end + stepwidth; current +=

c++ - Count field incorrect syntax error -

for last several days i'm trying connect store procedure using odbc. crecordset code: sp_insertsesmessagestore::sp_insertsesmessagestore(cdatabase* pdb) : crecordset(pdb){ // param init m_return_value = -1; m_provider_idparam = _t(""); m_branch_idparam = _t(""); m_accountparam = _t(""); m_ses_user_unique_idparam = _t(""); m_display_nameparam = _t(""); m_smtp_addressparam = _t(""); m_message_type_idparam = 0; m_priorityparam = 0; m_subjectparam = _t(""); m_summaryparam = _t(""); m_template_idparam = _t(""); m_body_type_idparam = 0; m_tracking_idparam = _t(""); m_expiration_timeparam = _t(""); m_subcategory_idparam = 0; m_folder_idparam = 0; m_num_attachmentsparam = 0; m_access_idparam = _t(""); m_flagsparam = 0; m_favoriteparam = false; m_certified_idparam = _t(""); m_secure_response_otpparam = _t(""); m_message_idparam = _t("")

regex - Generic solution for removing xml declararation using perl -

hi want remove declaration in xml file , problem declaration embed root element. xml looks follows case1: <?xml version="1.0" encoding="utf-8"?> <document> document root <child>----</child> </document>` case 2: <?xml version="1.0" encoding="utf-8"?> <document> document root <child>----</child> </document>` function should work case when root node in next line. my function works case 2.. sub getxmldata { ($xml) = @_; @data = (); open(file,"<$xml"); while(<file>) { chomp; if(/\<\?xml\sversion/) {next;} push(@data, $_); } close(file); return join("\n",@data); } *** please note encoding not constant always. ok, problem here - you're trying parse xml line based, , doesn't work. should avoid doing it, because makes brittle code, 1 day break - you've noted - valid changes source xml. bot

dataframe - Extract and compare column data by date in R -

i using kaggle data set bike sharing. write script compares predicted values training data set. comparisons of mean month each year. the training data set, call df looks this: datetime count 1 2011-01-01 00:00:00 16 2 2011-01-11 01:00:00 40 3 2011-02-01 02:00:00 32 4 2011-02-11 03:00:00 13 5 2011-03-21 04:00:00 1 6 2011-03-11 05:00:00 1 my predicted values, call sub this: datetime count 1 2011-01-01 00:00:00 42 2 2011-01-11 01:00:00 33 3 2011-02-01 02:00:00 33 4 2011-02-11 05:00:00 36 5 2011-03-21 06:00:00 57 6 2011-03-11 07:00:00 129 i have isolated month , year using lubridate package. concatenated month-date new column. used new column , split, use lapply find mean. library(lubridate) df$monyear <- interaction( month(ymd_hms(df$datetime)), year(ymd_hms(df$datetime)), sep="-") s<-split(df,df$monyear) x <-lapply(s,function(x) colmeans(x[,c("count", "count"

Fake: What is the difference between fileset selectors: !!, ++ and !+ -

there different fileset selectors in fake. difference between these: !!, ++, !+? i found these examples: example 1: // filesets let appreferences = !! "src/app/**/*.csproj" ++ "src/app/**/*.fsproj" example 2: // files let appreferences = !+ "./src/**/*.fsproj" |> scan example 3: let filestozip = !+ (builddir + "/**/*.*") -- "*.zip" |> scan !+ "./src/**/*.fsproj" |> scan is obsolete , replaced !! -- "*.zip" excludes files fileset above.

java - How to generate a key with seed? -

i need generate key algorithm seed (byte array). code doesn't work, because it's give 2 different results on different platforms: byte seed [] = {50,30,...}; byte result [] = new byte [20]; securerandom rand = new securerandom(); rand.setseed(seed); rand.nextbytes(result); i need same results on different platforms. use sha1prng algorithm istead of nativeprng. securerandom rand = securerandom.getinstance("sha1prng"); rand.setseed(seed); rand.nextbytes(result);

php - Populating excel using PHPExcel extension from Yii -

this code: $col = array("year", "month"); $result = yii::app()->db->createcommand("select * mytable `column` = '".$cnp."' ")->queryall(); $dataprovider = new carraydataprovider($result, array()); $excelgenerator = new excelview(array('dataprovider' => $dataprovider, 'columns' => array( array( 'header' => 'year', 'value' => '$data->year', ), array( 'header' => 'month', 'value' => '$data->month', ), ), )); $excelgenerator->run(); the result of excel file 2 column name year , month, how can populate data taken select ? select returns multiple results. thx since using carraydataprovider , value should accessed array: 'value' => '$data[&

playframework - Play framework JavaWs exception java.io.IOException: Remotely Closed -

i trying call post() on url using play framework , getting following exception. new play framework. happening here? i using play 2.2.3. i calling post() on pla.libs.ws.wsrequestholder object. here exception: 2015-05-12 00:34:21,042 - [debug] - verify: returning true 2015-05-12 00:34:21,262 - [error] - cannot invoke action, got error: java.io.ioexception: remotely closed [id: 0xdbe93d29, 0.0.0.0/0.0.0.0:55827 :> remotehost/remoteip:443] 2015-05-12 00:34:21,271 - [error] - ! @6m5hfogf0 - internal server error, (post) [/document/envelopes] -> play.api.application$$anon$1: execution exception[[ioexception: remotely closed [id: 0xdbe93d29, 0.0.0.0/0.0.0.0:55827 :> remotehost/remoteip:443]]] @ play.api.application$class.handleerror(application.scala:293) ~[play_2.10-2.2.3.jar:2.2.3] @ play.api.defaultapplication.handleerror(application.scala:399) [play_2.10-2.2.3.jar:2.2.3] @ play.core.server.netty.playdefaultupstreamhandler$$anonfun$3$$anonfun$

mongodb - How could I remove duplicated data without id -

i need import lot of data mongodb. but many data may duplicated, how remove duplicated data in mongodb elegant way. it's ugly , inefficient check collection.find({all_the_fields}).exist? before importing new record. to index inefficient because need indexing hundreds fields. i want import data , remove duplicated records in collection later. how ? thanks the following 1 document sample, i need import millions of sort of documents, , there many duplicated documents. need find out way remove duplicated documents { "_id": objectid("5550649669702d1901070000"), "report_type": "com_disagg", "item": "wheat", "exchange": "chicago board of trade", "product_exchange": "wheat - chicago board of trade", "date": new date("2009-12-08t08:00:00+0800"), "timestamp_utc": numberlong(1260230400000), "updated_at": new date(1431

javascript - Tabs appear in textarea -

when user clicks on <p> element want text in textarea element. problem text appears in textarea beneath 1 blank row , on top of shifted right. why happening? i tried put textarea div , fix positioning didn't work. i want achieve pure *javascript** , if needed css . here's have far: <!doctype html> <html> <head> </head> <body> <p id="p1"> text text text text text text text text text text text, text text text text text text text text text text text, text text text text text text text text text text text, text text text text text text text text text text text. </p> <div id="holder"></div> <script type="text/javascript"> var text_to_copy = document.getelementbyid('p1').innerhtml; var holder = document.getelementbyid("holder"); var input = document.createelement("textarea")

unable to get the complete list of file matching the regular expression in shell script -

i have directory list of files abc_1.txt abc_2.txt . have parse file name , processing on file #shellscript /tmp/log* file_list=`ls $1` file_name in $file_list # need processing on file name echo $file_name done the script not giving proper output i.e script not giving matching wildcard file name ls cmd. usage of above script shellscript /tmp/log* bash expands shellscript /tmp/log/abc* list of files names input script. ls not needed. iterate on input. try this for f in $* echo "processing $f" # on $f done http://www.cyberciti.biz/faq/bash-loop-over-file/ gives more examples.

c - Struggling to form a linked list -

i working on problem involves creating inventory of supermarket stock, , i'm having considerable difficulties. program supposed prompt user input (item name, quantity, weight, , price) , add item sorted (by increasing alphabetical order) database. so idea create linked list. i've started defining following: typedef struct item_t item; struct item_t{ char name; int weight; int price; int quantity; item *next; }; so idea i'm going every item has details stored in structure type, , *next point next structure in linked list. next came this: void add_new_node_at_end(char *user_input){ new_node = (*item_t)malloc(sizeof(item_t)) if (new_node == null){ printf("memory failure"); exit(exit_failure); } } is correct far? now, i'm not sure pointer *next when create new node, nor know how change fields of structure. can use new_node.item = 'string' or need malloc field names well? sorry, might sill

oracle - ORA 12154 - unable to connect from toad/SQLplus -

when try connect database in tnsnames.ora file sqlplus throws ora-12154: tns not resolve service name i've checked stuff: tns_admin environment variable defined "c:\oraclexe\app\oracle\product\10.2.0\server\network\admin" "c:\oraclexe\app\oracle\product\10.2.0\server\network\admin\tnsnames.ora" located following connect descriptor found my_db in tnsnames.ora file my_db= (description= (address= (protocol=tcp) (host=local.db) (port=1521) ) (connect_data= (sid=scmprod) ) ) "c:\oraclexe\app\oracle\product\10.2.0\server\network\admin\sqlnet.ora" located names.directory_path specifies tnsnames in sqlnet.ora file the question is: what missing? update now on sqlplus using the usr/pwd@selftest connection string works in can't error on server because on old pc still accept connection company works on it. the tnsname.ora selftest= (description= (ad

web services - Getting response from SOAP in php -

i trying response web service using soap in php.actually paid api fore booking flights.i have 2 cases problem,in both cases didnt response properly. here code try{ $client = new soapclient($url); print_r($client->__getfunctions()); $values = $client->getavailability($input_xml); print_r($values); }catch(exception $e){ echo 'error<br>'; echo $e->getmessage(); } case 1 $url=http://59.162.33.102/arzoows/services/domflightavailability in case exception soap-error: parsing wsdl: couldn't find in ' http://59.162.33.102/arzoows/services/domflightavailability ' case 2 $url=http://59.162.33.102/arzoows/services/domflightavailability?wsdl in case no exception output of __getfunctions() response invalid xml format i had contacted api service providers , running. here xml <?xml version="1.0" encoding="utf-8"?>