Posts

Showing posts from July, 2012

mysql - Left Join most recent record, if one exists -

i have table of people, , want pull recent record of event, there may not one. so problem though i'm left joining make sure i'm getting record each person, i'm bringing people have events because i'm pulling max of date criteria. select * tbl_people left join tbl_events on tbl_people.people_uid = tbl_events.people_uid tbl_people.active = 1 , ( select max(event_date) tbl_events ) table people have following people_uid table events have following event_uid, people_uid, event_name, event_date like said, i'd output this: jen, had baby, 7/10/2015 shirley susan megan, had baby, 8/5/2014 etc. i hope makes sense. one way use correlated subquery in join checks there doesn't exists event same person later date: select * tbl_people p left join tbl_events e on p.people_uid = e.people_uid , not exists ( select 1 tbl_events e.people_uid = people_uid , event_date > e.event_date ) p.active

c# - Dynamics CRM code popping up dialog in service -

Image
given following connection code: var serviceuri = "http://machine.co.za/crm/xrmservices/2011/organization.svc"; var clientcredentials = new clientcredentials { windows = { clientcredential = new system.net.networkcredential("someuser", "somepass", "domain") } }; var organizationserviceproxy = new organizationserviceproxy(new uri(serviceuri), null, clientcredentials, null); // line of code pops dialog? var user = (whoamiresponse)organizationserviceproxy.execute(new whoamirequest()); if (user.userid == guid.empty) throw new invalidoperationexception(string.format(@"connection {0} cannot established.", crmconnection.serviceuri)); user.dump(); if supplied password incorrect, code pops credentials dialog. since service not have rights interact desktop, service halts cannot show dialog. how suppress dialog, , have exception thrown instead. using dynami

javascript - Using d3 to append colored circles based on data -

i have svg structure following: <g class="labels"></g> and d3 code: // svg d3 context var labels = svg.select('.labels'); ca = labels.append('g'); function resize() { ca .call(coloraxis) // instance of d3.svg.axis() using same data below .selectall('text') .remove(); ca .selectall('.tick').select('circle') .data(data) .enter().append('circle') .style('fill', function (datum) { return '#' + datum.hex; }) .attr('r', '7.5'); } and structure ends looking this: <g class="labels"> <!-- ca.call(coloraxis) --> <g> <g class="tick" transform="translate(0,14.285714285714285)" style="opacity: 1;"> <line x2="-6" y2="0"></line> </g>

php - How to search titles that contain string in sql and push results into an array -

okay, i'm quite new mysql , can't find simple solution question. want search database , return instances of string. ex: user types "hello world" , database returns queries of "hello name world" etc. i'll take these results , push them php array. here's attempt of according this : include '../config.php'; $con = new pdo('mysql:host='. db_host .';dbname='. db_name .'', db_user,db_password); $firstsearcharray = array(); // push array $searchqueryarray = explode(" ",$searchquery);//$searchquery data sent ajax $query = $con->prepare("select * srating match(title) against (':searchqueryarray')"); $query->bindparam(':$searchqueryarray',$searchqueryarray); $query->execute(); $data = $query->fetch(pdo::fetch_assoc);//i have somehow push each result array (possibly using array_push , loop) i believe way i'm searching isn't optimal. prefer use contains on i've

java - Unable to copy folders using Google Cloud Storage JSON API -

i have gae application created using java. have bucket folders , files i'm trying copy on bucket within same project. folder structure of bucket follows: bucket_test |-------folder1/ |-----testtxt1.txt |-------folder2/ |-----testtxt2.txt i trying copy objects on using following code string old_bucket = "bucket_test"; string new_bucket = "bucket_test_new"; bucket isbkt = new googlestoragehelper() .trycreatebucket(new_bucket, storage); storage.objects.list listobjects = storage.objects().list(old_bucket); objects objects; objects = listobjects.execute(); (storageobject object : objects.getitems()) { storage.objects.copy copyobject = storage.objects() .copy(old_bucket, object.getname(), new_bucket, object.getname(), object); try { system.out.println("trying copy on " + object.getname() + " " + old_bucket + " >>>> " + new_bucket); //copy file on new bucket object copyr

jmeter - i want to fetch all the values using regex in a single regcular expression extractor in jemter -

this input box. want fetch value of box in single regular expression extractor. can 1 help? <input name='plaid_response' type='hidden' value='{"_id":"qpo8jo8vddhmepg41pbwckxm4kdk1yudmxowk", "_item":"kddjmojberukx3jkdd9ruxa5eveja4seno4aa", "_user":"ejxpmzpr65fp4ryno6rzua7ozjd9n3hna0rya", "balance": {"available":1203.42,"current":1274.93}, "meta":{"number":"9606","name":"plaid savings"}, "numbers":{"routing":"021000021","account":"9900009606", "wirerouting":"021000021"},"type":"depository", "institution_type":"fake_institution"}'> this regex extracts value input field: <input.*?\s*?value='([^']*) for more information see: https://regex1

nim - Working with distinct tuples -

with type defined type brotuple = distinct tuple[a, b, c: int] , how can i: create new instance ( brotuple() telling me error: object constructor needs object type ) access fields ( proc example(br: brotuple) = echo br.a says: error: undeclared field: 'a' ) it's bit strange use distinct tuple, because intent of distinct hide accessors , procs have. should use object instead if goal prevent ambiguity other tuples/objects. if want it, here go: type brotuple = distinct tuple[a, b, c: int] var bro = brotuple((a: 0, b: 0, c: 0)) echo((tuple[a, b, c: int])(bro).a)

oracle - Unable to write the correct XML data from CLOB column -

/* have written below procedure writes clob column data physical location in xml format. file gets written getting truncated or missing correct xml format.*/ create or replace procedure p_generate_xml c_amount binary_integer := 32767; l_buffer varchar2(32767); l_chr10 pls_integer; l_cloblen pls_integer; l_fhandler utl_file.file_type; l_pos pls_integer := 1; l_clob clob; l_message_num number; l_cnt number; l_err_msg varchar2(3000); v_sysdate date; begin l_message_num := 1; c2 in ( select xml_clob , case_id audit_xml_clob case_id = '2006s1000018') loop select count(1) l_cnt audit_xml_clob nvl(dbms_lob.getlength(xml_clob),0) > 0; if l_cnt > 0 l_pos := 1; select xml_clob l_clob audit_xml_clob case_id = c2.case_id; l_fhandler := utl_file.fopen('my_dir1', 'test.xml','w',c_amount); l_cloblen := dbms_lob.g

junit - Mockito - You cannot use argument matchers outside of verification or stubbing - have tried many things but still no solution -

i have following piece of code: powermockito.mockstatic(dateutils.class); //and line exception - notice it's static function powermockito.when(dateutils.isequalbydatetime (any(date.class),any(date.class)).thenreturn(false); the class begins with: @runwith(powermockrunner.class) @preparefortest({cm9dateutils.class,dateutils.class}) and org.mockito.exceptions.invaliduseofmatchersexception...... cannot use argument matchers outside of verification or stubbing..... (the error appears twice in failure trace - both point same line) in other places in code usage of when done , it's working properly. also, when debugging code found any(date.class) returns null. i have tried following solutions saw other people found useful, me doesn't work: adding @after public void checkmockito() { mockito.validatemockitousage(); } or @runwith(mockitojunitrunner.class) or @runwith(powermockrunner.class) change powermockito.when(new boolean(dateutils.iseq

javascript - AES encrypt in .NET with zero padding and decrypt with Node.js -

i'm trying decrypt data nodejs. this data created c# , aes-cbc-256 algorithm. keysize , blocksize 256 , padding zeropadding . i cant' decrypt node.js, error is: error: error:0606506d:digital envelope routines:evp_decryptfinal_ex:wrong final block length here javascript code: decipher = crypto.createdecipheriv('aes-256-cbc', key, iv.slice(0, 16)); decrypted = decipher.update(encryptedpayloadbuffer, 'base64', 'ascii'); decrypted += decipher.final('ascii'); decipher = null; return decrypted; i use library "crypto". read somewhere node.js decryption works pksc7 padding. true ? can't change in c# project, must find solution on node side. can me please ? edit: tried disable autopadding this: decipher.setautopadding(false); //next line of code: //decrypted = decipher.update(encryptedpayloadbuffer, 'base64', 'ascii'); but received error: error: error:0606508a:digital envelope routines:evp_decryptfi

Unconventional to bundle web socket server with REST API? -

for enterprise rest api (php in case), bad practice include web socket server along rest api? pairing of 2 makes nice mix event dispatching services, i'm not sure if these 2 services different enough warrant separation? guess con can see @ moment, if rest api go down, web socket servers down, removes possibility of having fail-over connected clients, or degree. if you're looking robust way manage web sockets, check out http://faye.jcoglan.com/ - has libraries javascript, ruby, etc, , runs independently of other servers. if don't need kind of resilience, wouldn't worry mixing rest , web socket apis on same server.

ruby - How to access the table,tr,td which has no attributes using Watir -

Image
i trying access table rows , table data(td),generally table,tr , td has no attributes use tried index still no use,even tried parent element of table still unable access it. <div class = "links"></div> <div class = "board"> <table> <tbody> <tr><td>name</td><td>value</td></tr> <tr><td>shaik</td><td>500</td></tr> <tr><td>shahrukh</td>900<td><span style="" has css properties ></span></td></tr> </tbody> </table> </div> i tried in following way @ie.table(index,0) , @ie.div(:class,'links').table(:index,0) returned error unable locate element @ie.table should work. @ie.div(:class, 'links') not parent of table element since </div> comes before <table> in dom.

ios - Can I disable map panning when select annotations -

i started using skmap library on ios recently. one behavior of function didselectannotation (from skmapviewdelegate protocol), whenever annotation got selected, center of map's visible region move location of annotation. is there way can disable this? it's not feature of didselectannotation function, rather of showcalloutforannotation function. set parameter animated in function no.

How do I correctly persist a Powershell object to JSON when the object was added using Add-Member to a child item? -

i'm running bit of challenge powershell code, simplified , sanitized version of shown here: $outer = ("{""child"": {""grandchild"": {}}}" | convertfrom-json ) $inner = $outer.child.grandchild $newid = [guid]::newguid(); $nested = ("{ ""id"": ""$newid"", ""name"": ""the name goes here"" }" | convertfrom-json) $membernametoadd = "nested" $inner | add-member -membertype noteproperty -name $membernametoadd $nested $inner | convertto-json | out-file "inner.json" $outer | convertto-json | out-file "outer.json" my specific challenge way dynamically added inner item getting persisted. output $inner (as sent inner.json) matches expect: { "nested": { "id": "741b6810-000e-4461-8ab8-6573e0d0b4a7", "name": "the name goes here" }

php - echoing a checkbox inside an echoed form -

i have echo of form , echo of radio button use this: //works fine. value='0' ";if ($row["werkverwijder"] == '0') { echo "checked"; } for textarea use this: //works fine. ".$row["overmij"]."</textarea></td> but when comes checkbox i'm @ complete loss. tried: value='1' "; if($row["fav"] == 'checked') { echo "checked"; } but doesn't work. tried whole lot of other combinations still not getting anywhere. anyone can me this? you haven't provided code it's difficult anything, should work. note spaces: <input type="checkbox" name="sth" <?php if($row["sth"] == "checked"{echo "checked";})?> > check developer console errors.

c# - Image jumps to its center point when dragged with a mouse -

hoping has quick answer 1 haven't been able figure out. rather have image jumping center on mouse cursor, i'd able drag image place on image without jump. know has referencing mouse position against image or reseting origin point of image mouse location, don't know how code it. has done already? using c#. vector3 partspanelscale; public vector3 buildpanelscale; public transform placeholderparent = null; public transform parenttoreturnto = null; gameobject placeholder = null; public gameobject animalpart; public gameobject trashcan; public gameobject partspanel; public gameobject partswindow; gameobject buildboard; gameobject draglayer; private float _mx; // holds current eventdata.position.x private float _my; // holds current eventdata.position.y private float _pmx;// holds previous eventdata.position.x private float _pmy;// holds previous eventdata.position.y void start () { draglayer = gameobject.findgameobjectwithtag("draglayer"); buildboa

html - Center images in a div with equal horizontal and vertical spacing -

Image
i have div containing 10 images, each own div: <div id="tankdialog" title="choose tank" style="display:none"> <div class="imagebox"><img src="images/tanks/tank1.png" style="width:150px" /></div> <div class="imagebox"><img src="images/tanks/tank2.png" style="width:150px" /></div> <div class="imagebox"><img src="images/tanks/tank3.png" style="width:150px" /></div> <div class="imagebox"><img src="images/tanks/tank4.png" style="width:150px" /></div> <div class="imagebox"><img src="images/tanks/tank5.png" style="width:150px" /></div> <div class="imagebox"><img src="images/tanks/tank6.png" style="width:150px" /></div> <div

PHP Replace Emoticon from MySQL Can't looping -

i have problem syntax coding emoticon. can replaced in first post, in next post can't replaced. not looping well. you can see images in: http://postimg.org/image/srph22j8d/ # populated emoticon $sqlemo = "select * apprtcfg obj_typ = 'emo' order id asc;"; $queryemo = mysql_query($sqlemo); while ($rsltemo=mysql_fetch_array($queryemo)) { $emo_code = $rsltemo['obj_link']; $emo_img = $rsltemo['obj_source']; } echo $content = str_replace($emo_code,'<img src="image/'.$emo_img.'">', $row['content']); you should replace emotions images, inside while , echo after end of while. $sqlemo = "select * apprtcfg obj_typ = 'emo' order id asc;"; $queryemo = mysql_query($sqlemo); $content = $row['content']; while ($rsltemo=mysql_fetch_array($queryemo)) { $emo_code = $rsltemo['obj_link']; $emo_img = $rsltemo['obj_so

c# - Component.GetComponent<Rigidbody>() causing a ton of errors -

i trying follow space shooter tutorial online unity5 , having trouble rigidbody. i realize rigidbody has been replaced component.getcomponent() want make variable instead of typing out. i getting ton of errors using component.getcomponent() , dont understand what's wrong. here code snippet, trying constrain movement clamp: using unityengine; using system.collections; public class playercontroller : monobehaviour { public float speed; public float xmin, zmin, xmax, zmax; void fixedupdate(){ float movehorizontal = input.getaxis("horizontal"); float movevertical = input.getaxis("vertical"); vector3 movement = new vector3(movehorizontal, 0.0f, movevertical); component.getcomponent<rigidbody>().velocity = movement*speed; component.getcomponent<rigidbody>().position = new vector3 ( mathf.clamp(component.getcomponent<rigidbody>().position.x, xmin, xmax),

c# - How to create BeginStoryboard in code behind for WPF? -

i have following xaml , wish convert code behind, have been able create animations control fades in & out expected, i'm having trouble converting ismouseover trigger code behind: <datatemplate.triggers> <eventtrigger routedevent="control.loaded" sourcename="notificationgrid"> <beginstoryboard x:name="beginnotificationstoryboard"> <storyboard x:name="notificationstoryboard"> <doubleanimation storyboard.targetname="notificationgrid" from="0.01" to="1" storyboard.targetproperty="opacity" duration="0:0:0.5" /> <doubleanimation storyboard.targetname="notificationgrid&q

how to get the submitted value of tableselect in drupal 7 -

function test($form, &$form_state){ $form = array(); $header = array(.............); $values = array(.............); $form['table'] = array( '#type' => 'tableselect', '#header' => $header, '#options' => $rows, '#multiple' => $ischeckbox, '#empty' => t('no users found'), ); $form['submit'] = array( '#type' => 'submit', '#value' => t('submit'), ); return $form; } // end of function test() function test_submit($form, &$form_state){ $selected = $form_state['values']['table']; drupal_set_message($selected) // displays array index (0,1,2 etc) return; } how selected table row values in drupal form. need assistance on issue. appreciated. what in $selected index of $rows have selected in table. values in $rows need use index have in $selected. i created ea

android - How to store an ArrayList or a HashMap to a file or in SharedPreferences? -

i have searched, haven't been able find proper solution problem. receiving data server , displaying it, want data stored locally, preferably in sharedpreferences or file if there internet access, data should stored , updated. if there no internet access data should displayed. below code package com.timetable; import java.io.fileinputstream; import java.io.fileoutputstream; import java.io.inputstream; import java.io.objectinputstream; import java.util.arraylist; import java.util.hashmap; import java.util.hashset; import java.util.set; import org.apache.http.namevaluepair; import org.json.jsonarray; import org.json.jsonexception; import org.json.jsonobject; import android.app.listactivity; import android.content.context; import android.content.intent; import android.net.parseexception; import android.os.asynctask; import android.os.bundle; import android.view.view; import android.widget.adapterview; import android.widget.adapterview.onitemclicklistener; import android.

php - Unable to get session contents in second function -

i having issues sessions. in first function queue , save session entries can print out function, can see being set correctly. in function remove , try , save entries session variable , error entries undefined index . does have ideas doing wrong here? function queue() { session_start(); $status = 'awaiting moderation'; $channel = '1'; // find entries in 'gallery' channel 'awaiting moderation' status $this->ee->db->select('entry_id') ->from('exp_channel_titles') ->where('status', $status) ->where('channel_id', $channel); $query = $this->ee->db->get(); $entries = $query->result_array(); $entries_count = count($entries); // set count $_session['entries_count'] = $entries_count; // if entries found if ($entries_count > 0) { // flatten entry ids arr

javascript - Top-left pixel outside 100% width of the browser window -

Image
is possible load webpage top-left pixel isn't first 1 rather somewhere else? this current webpage layout , i'd webpage loaded top-left pixel right red arrow lands i think understand request: sounds goal have single-column page , exclusively in section right/left blocks you'd able scroll left/right. if that's correct, restructure page have middle column, , use css positioning on #about section this: #about {position: relative;} #left {position:absolute; left:-100%; width:100%; min-height:100%;} #right {position:absolute; left:100%; width:100%; min-height:100%;} you might need body overflow, too: body {overflow-x:hidden;} then create functionality want, use javascript/jquery animate sections left/right when click on anchors in #about section. or use js plugin, works extremely , designed type of layout: http://alvarotrigo.com/fullpage/

postgresql - Initializing an Empty Table using schema.sql in Spring Boot -

i use table in postgres providing authorization in springboot web app connects postgres database. want initialize table default admin entry if table empty. doing within schema.sql file here code have attempted far: create table if not exists public.jdbcauth ( username varchar(32), password varchar(32) default null, role varchar(32) default null, enabled int default 0, primary key(username) ); if exists (select 1 public.jdbcauth) insert public.jdbcauth (username, password, role, enabled) values ('admin', 'admin', 'admin', '1'); this fails following error: caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'datasourceinitializer': invocation of init method failed; nested exception org.springframework.jdbc.datasource.init.scriptstatementfailedexception: failed execute sql script statement #2 of resource url [file:/home/balajeerc/projects/igvds_webapp/src/main/resources/sch

php - get Date range when there are no date exists in table -

Image
this query it's working fine. but want blank record missing date, when there no record exist date range, while fetching data table. select * tbl_social `dcreateddate` between date_add('2015-07-06', interval 3 day) , date_sub('2015-07-06', interval 3 day); if there no record date '2015-07-08' need date row in listing. thanking you. you can make changes query , bring data not in particular range and has no date . try select * select * tbl_social ( `dcreateddate` not between date_sub('2015-07-06', interval 3 day) , date_add('2015-07-06', interval 3 day) ) or (`dcreateddate` null ) with not between seek records dont fit criteria , null see records dcreateddate blank , fetch data matching both criteria

javascript - jQuery carousel navigation breaking on resize -

i made post carousel, of code got so, , works, have problem resizing window. the whole thing here https://github.com/dingo-d/post-excerpt-carousel it works fine if reload on window width, if resize window, navigation stops working should. right now, when @ first post, cannot go previous (carousel won't move), , when you're @ last, carousel won't move forward. if resize, will. jquery code making work this jquery(document).ready(function ($) { 'use strict'; $(window).on('load', function () { $('.post_excerpt_carousel').each(function(){ var $this = $(this); post_excerpt_positioning($this); }); }); $(window).on('resize', function(){ $('.post_excerpt_carousel').each(function(){ var $this = $(this); if ($(window).width()>760) { $(this).find('li').css('width', '570px'); } p

php - font size depending image size -

i'm sorry english! i've problem imagick php , overlay text on image. size of font small when resize width of image. example 2 image width, first 350px , second 1728px: http://i.stack.imgur.com/8kro0.jpg http://i.stack.imgur.com/teddo.jpg $f->userfontsize size of font logged user choose show on image. if(trim($_get['full']) != 'si'){ $width = 350; $height = 350; } else { $width = getwidth($root . $f->imagepathfull); $height = getheight($root . $f->imagepathfull); } $image = new imagick(); $draw = new imagickdraw(); $pixel = new imagickpixel('white'); $image->newimage($width, $height, $pixel); $image->readimage($root . $f->imagepathnormal); $image->resizeimage ( $width, $height, imagick::filter_lanczos, 1, true); $fontpath = $root . '/assets/fonts/mermaid.ttf'; $draw->setfillcolor('black'); $draw->setfont($fontpath); $draw->setfontsize(12 + $f->userfontsize); $draw->setgravity(1); $dra

VBA Frequency Highlighter Function in Very Large Excel Sheet -

Image
in previous post user: locengineer managed me write finding function find least frequent values in column of particular category. the vba code works part particular issues, , previous question had been answered sufficiently answer already, thought required new post. locengineer: "holy smoking moly, batman! if sheet.... i'd say: forget "usedrange". won't work enough spread... i've edited above code using more hardcoded values. please adapt values according needs , try that. woah mess." here code: sub frequenz() dim col range, cel range dim letter string dim lookfor string dim frequency long, totalrows long dim relfrequency double dim ran range ran = activesheet.range("a6:fs126") totalrows = 120 each col in ran.columns '***get column letter*** letter = split(activesheet.cells(1, col.column).address, "$")(1) '******* each cel in col.cells lookfor = cel.text frequency = application.wor

c - for loop not incrementing counter in gcc -

i'm using gcc 4.9.2 , have program print sum of 4th powers of n numbers. i have written program sum printed out 4th power of number entered , not sum. think problem counter don't know what. if(n>0 && n<=40) { for(c=0;c<=n;c++) { s=0; s=s+c*c*c*c; } printf("%d",s); } because set s=0; inside loop. put outside loop. if(n>0 && n<=40) { s=0; for(c=0;c<=n;c++) { s=s+c*c*c*c; } printf("%d",s); } btw: for-loop can changed to: for(c=1;c<=n;c++) because value c=0 doesn't change anything.

java - Is overriding static field with static block bad practice? -

i want create data structures capture following ideas: in game, want have generic skill class captures general information skill id, cool down time, mana cost, etc. then want have specific skills define actual interaction , behaviours. these extend base class skill . finally, each player have instances of these specific skills, can check each player's skill status, whether player used recently, etc. so have abstract superclass skill defines static variables, skills have in common, , each individual skill extends skill , use static block reassign static variables. have following pattern: class { static int x = 0; } class b extends { static { x = 1; } } ... // in method b = new b(); system.out.println(b.x); the above prints 1, behaviour want. problem system complains i'm accessing static variable in non-static way. of course can't access in way, because want treat skill skill without knowing subclass is. have suppress warning every ti

python - writing only one row after website scraping -

i trying extract list of golf courses in usa through this link . need extract name of golf course, address, , phone number. script suppose extract data website looks prints 1 row in csv file. noticed when print "name" field prints once despite find_all function. need data , not 1 field multiple links on website. how go fixing script prints needed data csv file. here script: import csv import requests bs4 import beautifulsoup courses_list = [] in range(1): url="http://www.thegolfcourses.net/page/1?ls&location=california&orderby=title&radius=6750#038;location=california&orderby=title&radius=6750" #.format(i) r = requests.get(url) soup = beautifulsoup(r.content) g_data2=soup.find_all("div",{"class":"list"}) item in g_data2: try: name= item.contents[7].find_all("a",{"class":"entry-title"})[0].text print name except: name='' try: phone= it

php - What's the best way to include wildcards into your Laravel / LAMP application search function? -

our laravel web app runs several reports users results returned , displayed in datatables. currently, each report has single parameter , can take 1 value. so have report called "users token" , have enter token name users have token assigned. query like: select user usertoken token = '<parameter>' that's great , good, users asking 2 separate requirements. first, have ability provide several values token like: select user usertoken token='ac10.1' or token = 'pr10.1' or token='hr11.1' second want ability have wildcards like" select user usertoken token 'ac10.%' to combine these 2 things have like: select user usertoken token 'ac10.%' or token 'pr10.1' or token 'hr11.1' so when users enter "*" in query, we'll replace '%' in query , on. directive should work exact matches think if don't have '%' in query, right? i can't think there'

Programming language R: meaning of 'weights' parameter in library method 'loess' -

i use library method loess of r programming language non parametric data fitting. dataset two-dimensional. have not found proper documentation of method parameter weights . my data points distributed random variables, , have estimate of respective standard deviations. wondering whether parameter weights allows me supply r details of standard deviations. in other words: wonder whether individual weights in weights (relative) measures of data quality, fit can improved if measure of data uncertainty supplied via parameter weights . edit: suspect entries in weights used weights in weighted least squares regressions of local datasets in loess procedure (maybe additional weight prefactors (position dependent) kernel functions?). suggest case of data points independent distributed random variables, still have different noise levels (i.e. different standard deviations) (as in case), weights should chosen 1/\sigma_{i}^2 , \sigma_{i} standard deviation of respective random variable/

abstract syntax tree - Modifying TypeScript symbol using compiler API -

i trying use typescript compiler api (1.4) rename symbols across source files, example renaming global variable , references it. started instructions here , used identifiers function getnodes(sf: ts.sourcefile): ts.node[] { var nodes: ts.node[] = []; function allnodes(n: ts.node) { ts.foreachchild(n, n => { if (n.kind == ts.syntaxkind.identifier) nodes.push(n); allnodes(n); return false; }) }; allnodes(sf); return nodes; } once create type checker, can resolve nodes (where every reference identifier has separate instance) symbols (where references same variable have same instance): var checker = program.gettypechecker(true); var symbols = getnodes(sourcefile).map((n, i, array) => checker.getsymbolatlocation(n)); great. stuck, since symbol seems immutable. supposed clone , provide kind of lookup table emitter? or custom symbolwriter, or symboldisplaybuilder? can't see many extension points in classes. for example renaming

Laravel Integrate Google Cloud Storage -

im trying integrate google cloud storage file uploads , serving in laravel app stored in google compute engine. what best practice that? right way of using google cloud storage? should use storage facade that? or job copying local file uploads cloud? thanks you can use google apis client library php send requests google cloud storage json api. visit link example .

rx java - Will combinelatest trigger doOnUnsubscribe of its children -

not sure if combined observable delegates doonunsubscribe sources. if not there simple way trigger unsubscribles of children? in code: observable o = observable.combinelatest(o1, o2); if triggers unsubscribe of o trigger unsubscribe of o1 , o2? not sure mean. unsubscription propagated both o1 , o2 if want perform custom actions, have use doonunsubscribe on relevant parties: observable<t> o = observable.combinelatest( o1.doonunsubscribe(() -> { }), o2.doonunsubscribe(() -> { })) .doonunsubscribe(() -> { }); o.take(1).subscribe(); but note these chain-global (instead of per-subscriber) actions , second subscription/unsubscription o may call them again. if need per-subscriber resource management, @ using operator.

perl - Dancer2 eclipse integration? -

i want use dancer2 eclipse? have done dynamic web projects on java directory structures generated eclipse.i searched google couldn't find documentation. if want these if new project should generate file structure dancer2. i can configure , run server eclipse itself. note: have epic plugin installed , working.i on linux. possible? you can run/debug dancer2 application in eclipse ide following steps: 1.create new perl project "file->new->perl project" 2.import source code "import->general->file system" new perl project. now have perl dancer2 project. there's thing need before run/debug project directly inside ecipse: copy or rename app.psgi app.pl, modify ->to_app ->dance. can right click app.pl , run "local perl" application. the psgi file running under plack command. introduced in dancer2. app.pl in dancer needs no modification.

c++ - Predict the required number of preallocated nodes in a kD-Tree -

i'm implementing dynamic kd-tree in array representation (storing nodes in std::vector) in breadth-first fashion. each i -th non-leaf node have left child @ (i<<1)+1 , right child @ (i<<1)+2 . support incremental insertion of points , collection of points. i'm facing problem determining required number of possible nodes incrementally preallocate space. i've found formula on web , seems wrong: n = min(m − 1, 2n − ½m − 1), where m smallest power of 2 greater or equal n, number of points. my implementation of formula following: size_t required(size_t n) { size_t m = nextpowerof2(n); return min(m - 1, (n<<1) - (m>>1) - 1); } function nextpowerof2 returns power of 2 largest or equal n any appreciated. each node of kd-tree divides space 2 spaces. hence, number of nodes in kd-tree depends on how perform division: 1) if divide them in midpoint of space (that is, if space x1 x2, divide space x3=(x1+x2)/2 line),

sql server - How to get a max value of a column in SQL? -

i want find max value of column. have following table structure: orderid | taskid | serialno 1 | 1 | 1 1 | 1 | 2 1 | 2 | 1 1 | 2 | 2 1 | 2 | 3 2 | 1 | 1 2 | 2 | 1 2 | 2 | 2 from above table want following result every orderid , taskid , display max value: serialno 2 3 1 2 by using max getting orderid , taskid well, not intended result. using sql server. how intended result? select orderid, taskid, max(serialno) mytable group orderid, taskid if want max(serialno) , can omit other 2 columns in select.

How do I totally remove the "follow" functionality on Odoo/OpenERP? -

i'm talking follow button under users. can done access control without modifying views? hi alexander suraphel, in form view of our object @ bottom find following syntax : <div class="oe_chatter"> <field name="message_follower_ids" widget="mail_followers"/> <field name="message_ids" widget="mail_thread"/> </div> in : here message_follower_ids add follow feature can remove line, , remove feature object on view. thanks

c - Conditional jump problems -

i'm testing trie valgrind, , having "conditional jump or move depends on uninitialised value(s)" error after first symbol pass function create_trienode. i have struct: typedef struct trienode{ struct trienode **children; bool is_word; } trienode; func create_trienode: struct trienode *create_trienode(char c, struct trienode *parent){ struct trienode *node = malloc(sizeof(struct trienode)); node->children = malloc(alphabet_size*sizeof(struct trienode*)); node->is_word=false; return node; } and func create_tree struct trienode *create_tree(file *file) { struct trienode *root = create_trienode(' ', null); struct trienode *ptr = root; int character; int converted; int buffer; //this handles if file not end newline character = fgetc(file); buffer = fgetc(file); while(character != eof) { character = tolower(character); if (character == 10) // case newline { } else if(isalpha(character)) { con

Overloading R function - is this right? -

consumesinglerequest <- function(api_key, url, columnnames, globalparam="", ...) consumesinglerequest <- function(api_key, url, columnnames, valueslist, globalparam="") i trying overload function this, takes in multiple lists in first function , combines them 1 list of lists. however, don't seem able skip passing in globalparam , pass in oly multiple lists in ... does know how that? i've heard s3 methods used that? know how? r doesn't support concept of overloading functions. supports function calls variable number of arguments. can declare function number of arguments, supply subset of when calling function. take vector function example: > vector function (mode = "logical", length = 0l) .internal(vector(mode, length)) <bytecode: 0x103b89070> <environment: namespace:base> it supports 2 parameters, can called none or subset(in case default values used) : > vector() logical(0) > vector(mode=&

java - JNINativeInterface_ * is null -

i developing jni application. jninativeinterface_ * inside struct struct jnienv_ null, hence causing call jni (example : env->newstringutf(...) ) functions throw segmentation fault error. jnienv_ struct looks : struct jnienv_ { const struct jninativeinterface_ *functions; . . . i dont know how fix this, think java supposed fill when make call system.loadlibrary(...) . appreciate help. two possibilities: 1) c++ code called java native function: for example: jniexport void jnicall java_myjnative_dosomething(jnienv *env, jobject jo) { std::cout << "dosomething() : "; } the jnienv* pointer given java environment. 2) c++ code calls java code via jni: in case have setup javavm* , jnienv* pointer, following jni invocation logic. see example this article . a special case mentionned, if have invoked jnienv* work multiple threads on c++ side. every thread has attach jnienv* using: jnienv *env; // pointer na