Posts

Showing posts from April, 2014

java - Can't retrieve Double from HashMap<Integer, Double> -

somehow can't retrieve double hashmap i've made using gson. map<integer, double> ratingmap = (map<integer, double>) new gsonbuilder() .create().fromjson(json, map.class); integer ifilmid = filmid; double rating = ratingmap.get(ifilmid); in code i've veried ratingmap contains {2=5.0}, when ratingmap.get(ifilmid) (where i've verified ifilmid in fact 2), variable rating null. missing here? i create hashmap in following way: if (json.equals("")) { // noting ever saved ratingmap = new hashmap<integer, integer>(); ratingmap.put(filmid, rating); } else { ratingmap = (map<integer, integer>) new gsonbuilder().create() .fromjson(json, map.class); ratingmap.put(integer.valueof(filmid), rating); } i let gson format integer double, , seems work fine can't retrieve it. the total code, including saving androids sharedpreferences public void saverating(int rati...

android - Using intents inside Service -

can use intent inside service? should put in "??????"? need call pedingintent alarm inside service.- example. public class calcularhorasservice extends service { public int horar; public int minr; private pendingintent pdintautomatico; @override public int onstartcommand( intent intent, int flags, int startid ) { // line key android.os.debug.waitfordebugger(); log.v( "servicio", "entro al servicio" ); getcalcularhorasalida(); setalarma(); // return return super.onstartcommand( intent, flags, startid ); } /** * set alarm */ private void setalarma() { intent intsincroauto = new intent( ????, alarmaactivarbroadauto.class ); pdintautomatico = pendingintent.getbroadcast( ????, 0, intsincroauto, 0); } } the constructor of intent require context first params, can put this because want create intent inside of service...

android - Why adb is under platform tools? -

i going through adb in android. why under platform tools? no matter, platform, should able install app on emulator or real device... should come under tools directory right generally speaking, platform-tools/ directory contains binaries specific development machine's os. example, running ubuntu linux, , have linux versions of adb , etc. else running windows have adb.exe , etc. the tools/ directory shell scripts , batch files. used both shipped development machines. see nowadays, split them development os (e.g., have android , not android.bat ).

javascript - Choosing page depending on users choices -

i'm trying create webpage user asked name(textbox) , gender(radio buttons) on front page. link new page dependent on whether chose if male or female, need display name entered in text box. so far have name part working using javascript on front page form action directed new page: // called on form's `onsubmit` function tosubmit() { // getting value of text input var mytext = document.getelementbyid("mytext").value; // storing value above localstorage localstorage.setitem("mytext", mytext); return true; } and on other page: // called on body's `onload` event function init() { // retrieving text input's value stored localstorage var mytext = localstorage.getitem("mytext"); // writing value in document document.getelementbyid("name").innerhtml = mytext; } the main problem here directs same page. can tell me how solve problem , add in option user choos...

c++ - MySQL server-side timeout -

i have connection code causes timeout when queries take long. connection options setup ( timeout integer): sql::connectoptionsmap com; com["hostname"] = url; // string com["username"] = user; // string com["password"] = pwd; // string com["opt_reconnect"] = true; com["opt_read_timeout"] = timeout; // 1 (second) com["opt_write_timeout"] = timeout; // 1 (second) after testing timeout setup above found throw occur mysql continues trying execute query. in other words, below try goes catch after configured timeout error code 2013 doesn't stop mysql trying execute query (2013 error code related lost connection): // other code try { stmt = con->createstatement(); stmt->execute("drop database if exists mysqlmanagertest_timeoutread"); stmt->execute("create database mysqlmanagertest_timeoutread"); stmt->execute("use mysqlmanagertest_timeoutread"); stmt-...

php - How come I cannot use bp_core_fetch_avatar() in the theme after I add filter in the plugin, wordpress buddypress? -

after add_filter code below in first plugin, cannot use bp_core_fetch_avatar() in second plugin or in theme, echo out same avatar every user, why? how can fix this? get_avatar can echo out different avatar base on user except cannot recognize $gender create in plugin tell if female or male, avatar assign base on gender . trying pass parameter $gender created in plugin, why think should figure out use bp_core_fetch_avatar(), way, get_avatar can pass parameter plugin?, know get_avatar( $id, $size,$default, $alt). anyway, want know why bp_core_fetch_avatar() echo out same avatar every user after add_filter, add 'item_id'=>"$id". thanks <?php add_filter('bp_core_fetch_avatar',array($this,'set_buddypress_avatar'), 10, 1); ?> <?php public function set_buddypress_avatar($html_data = ''){ $html_doc = new domdocument(); $html_doc->loadhtml($html_data); $image = $html_doc-...

r - Is it possible to use a metric (distance) unit in igraph cutoff argument? -

newbie igraph user here. i'm trying calculate betweenness values every segment (edge) in street network. ideally restrict calculations paths of less x metres considered. igraph::edge.betweenness.estimate function has cutoff argument restricts steps ( turns ) know if possible use metric distance instead. so far closest question have been able find http://lists.nongnu.org/archive/html/igraph-help/2012-11/msg00083.html on igraph help, , suggests might not possible. i have been using network aspatially, simple graph, have attribute of street segment length - lnklength . reading other stackoverflow posts possible use spatial networks igraph (with of spatial packages). if lnklength used weight network solve problem? if has ideas i'd grateful hear them. data <- data.frame( node1 = as.factor(c(aa, ab, ac, ad, ae, af, ag, ah, ai, aj)), node2 = as.factor(c(ba, bb, bc, aa, ab, ac, ba, bb, bc, aa)), lnklength =as.numeric(c(23.05, 42.81, 77.08, 39.63, 147.87, 56.46,...

ios - Core Data: Database not reading correctly -

i'm trying load nsdata core data database data isn't remotely close what's displaying if compare 2 files, original database vs 1 saved nsdata loaded, , 1 saved nsdata doesn't have data in @ all, table structure. here's source, , it's extremely basic: nsmanagedobjectcontext *managedobjectcontext = self.managedobjectcontext; if (managedobjectcontext != nil) { nserror *error = nil; if ([managedobjectcontext haschanges] && ![managedobjectcontext save:&error]) { // replace implementation code handle error appropriately. // abort() causes application generate crash log , terminate. should not use function in shipping application, although may useful during development. nslog(@"unresolved error %@, %@", error, [error userinfo]); abort(); } } nsstring *path = [appdelegate instance].databasedirectory.path; nsdata *file = [[nsfilemanager defaultmanager] content...

Android. Use service or application class for locationListener -

i have task determine user location. can create locationlistener in application class. or can use service. locationmanager locationmanager=(locationmanager)this.getsystemservice(context.location_service); locationlistener locationlistener=new locationlistener(){ public void onlocationchanged( location location){ dive.setlongitude(location.getlongitude()); dive.setlatitude(location.getlatitude()); maphelper.setmapposition(dive.getlatitude(),dive.getlongitude()); } public void onstatuschanged( string provider, int status, bundle extras){ } public void onproviderenabled( string provider){ } public void onproviderdisabled( string provider){ }}; locationmanager.requestlocationupdates( locationmanager.network_provider,0,0,locationlistener); locationmanager.requestlocationupdates( locationmanager.gps_provider,0,0,locationlistener); what need use task? service or application class? advantages , disadvantages of service? advantages , disadvantages of applicat...

css - Text appears cut off on top -

im having issue , have no clue how happened. 1 day , in other text, in column appears cut off on top. this website, , problem on right column in titles: http://vipvan.pt/tours/culturevan/tour-sintra-um-dia?lang=en ! not sure causing can couple of things .text-format h2 { margin-top 1px; } or works well h2 { line-height: 1; }

javascript - Can I find out on the client which submit button was pressed when listening to the submit event? -

say have form multiple submit buttons so: <form method="post" action="..."> <input type="submit" value="search" name="a" /> <input type="submit" value="search" name="b" /> <input type="submit" value="search" name="c" /> </form> i know can listen "click" , retrieve respective element, know if possible when listening submit so: var form = document.getelementsbytagname("form")[0]; function foo(evt) { evt.preventdefault(); console.log(evt); } form.addeventlistener("submit", foo, false); question : possible retrieve clicked submit button `name' when listening submit event? thanks! var form = document.getelementsbytagname("form")[0]; function foo(evt) { evt.preventdefault(); var target = evt.explicitoriginaltarget.name || evt.relatedtarget.name; console.log...

dns - 500 Internal Server Error -

i getting error, when tried visit newly setup site. tried dns check tools , see there several errors dns configuration. in dnsstuff.com, getting these error messages: nameservers found, domain entered non-delegating subdomain. no nameservers provided soa record zone. should configure nameservers have master slave relationship. link: http://www.dnsstuff.com/tools#dnsreport|type=hostname&&value=www.simpaticorp.com with pingdom tools getting these error: delegation not found @ parent. no delegation found @ parent, making zone unreachable internet. not enough nameserver information found test zone, ip address lookup succeeded in spite of that. i new dns configuration. read few tutorials. looks need configure ns records (not sure though). can please me resolve issue. assuming trying reach www.simpaticorp.com (taken dnsstuff.com url), website , reachable. it's dns seems configured correctly. the error see while browsing there http 500,...

javascript - Download File From MVC -

i need way pass list of strings when user clicks icon angular/script , send mvc controller in .net. list needs supposed download file in browser. have learned cannot via ajax and/or pretty messy. edit: list of strings refers list of file ids retrieving, zipping 1 file, downloaded. not want store zipped file anywhere permanently. i open ideas! $http.post('document/downloadfiles', data).success(function () {/*success callback*/ }); [httppost] public actionresult downloadfiles(list<string> fileuniqueidentifiers) { var file = _service.archiveanddownloaddocuments(fileuniqueidentifiers); file.position = 0; return new filestreamresult(file, "application/force-download"); } ok, third-time lucky guess? (i think this'll last implementation sorry jim - you'll have work rest out yourself, think i've given more enough free pointers now... if want more can contact me , i...

python - Rect Errors on Pygame -

hi have been creating game player has dodge oil barrels , have been working on getting rect can create when 2 sprites collide. seems collision boxes messed because whenever start game automatically detect collision between player , barrel. this code: import pygame import os import time import sys import pyganim import random global rand threading import thread class updatethread(thread): def __init__(self): self.stopped = false thread.__init__(self) def run(self): while not self.stopped: self.downloadvalue() time.sleep(2) def downloadvalue(self): rand=random.randrange(1, 10) class oil(object): def __init__(self): self.image = pygame.image.load('oil.png') self.image = pygame.transform.scale(self.image,(300,300)) self.rect = self.image.get_rect() self.x = 1600 self.y = 400 def handle_keys(self): key = pygame.key.get_pressed() distance...

ios - Filtering Restaurants in MKMapView -

i wondering if mkmapview supports filtering restaurants based on cuisine? if search "chinese restaurants", example, chinese restaurants appear or there separate code that, if possible? thanks. mkmapview has no filtering functionality have described. mkmapview used display or annotate map. apple documentation, "an mkmapview object provides embeddable map interface, similar 1 provided maps application. use class as-is display map information , manipulate map contents application." to described, need have dataset of chinese restaurants in specific area. use mkannotation protocol annotate chinese restaurants on mkmapview https://developer.apple.com/library/ios/documentation/mapkit/reference/mkmapview_class/

Elasticsearch: Get report of unmatched should elements in a bool query -

i'm looking way report of unmatched should querys , display it. instance have 2 user objects user 1: { "username": "user1" "doctype": "user" "level": "professor" "discipline": "sciences" "sub-discipline": "mathematical" } user 2: { "username": "user1" "doctype": "user" "level": "professor" "discipline": "sciences" "subdiscipline": "physics" } when bool query matching discipline in must query , sub-discipline in should query bool: must: [{ term: { "doc.doctype": "user" } },{ term: { "doc.level": "professor" } },{ term: { "doc.discipline": "sciences" } }], should: [{ term: { "subdiscipline": "physics" } }] how can unmatched elements in result that: result 1: use...

javascript - How to properly address this JSHint "Possible strict violation" -

edit: issue related jshint, rather jslint - changed tag. the following gives me "possible strict violation". understand why violation occurs - because of use of this in function jslint doesn't believe method: function widget(name){ this.name = name; } widget.prototype.dosomething = dosomething; function dosomething(){ console.log(this.name + " did something"); } although, following approaches solve jslint warning, force me code organization rather avoid: 1) declaring function inline: widget.prototype.dosomething = function (){ console.log(this.name + " did something"); } 2) creating wrapper function passes this : widget.prototype.dosomething = function (){ return dosomething(this); }; function dosomething(self){ // ... } is there way organize code solve issue other using approaches above? the way properly address in question. #1: widget.prototype.dosomething = function (){ console.log(this.name + ...

angularjs - ui-router resolve is not working with the index page controller -

i want resolve value before load first page of application, kept telling me unknown provider: programclasssummaryprovider <- programclasssummary <- homectrl i pretty sure did correctly, because did same thing other controller , routing. not working homepage controller. seems load controller first, before resolved in routing. wrong code? in routing.js $stateprovider .state('home', { url: '/home', controller: 'homectrl', controlleras: 'vm', templateurl: 'index_main.html', resolve: { programclasssummary: ['groupdatafactory', function (groupdf) { return groupdf.getprogramclasssummary(); }] }, ncybreadcrumb: { skip: true } }); in controller.js angular .module('issmccapp') .controller('homectrl', homectrl); homectrl.$inject = ['$scope', '$l...

hadoop - Flume folder routing based on HTTP header -

using curl , flume, post csv files on local machine/hdfs @ different locations based on values of http header. example, http header (network-element: ggsn) files stored on local machine in folder named ggsn. i have following flume configuration a http source a memory channel a hdfs sink routes events files different locations depending on http header i post csv files using curl: find /path/files -type f -exec curl -x post http://localhost:9043 -h "content-type: text/xml" -h "network-element: ggsn" --data-binary "@{}" -v \; these logs generated: * connect() localhost port 9043 (#0) * trying ::1... connection refused * trying 127.0.0.1... connected * connected localhost (127.0.0.1) port 9043 (#0) > post / http/1.1 > user-agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 nss/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2 > host: localhost:9043 > accept: */* > content-type: text/xml > network-element: ggsn ...

java - What's causing my stackoverflowerror in my maze solver? -

i have solve maze using recursion , going fine until ran program , ran stackoverflowerror. i've read couple other questions on site , it's because of infinite recursion none of issues seem exact same mine. my netid_maze.java file import java.util.random; public class netid_maze { int exitrow, entrancerow; char[][] map = null; // method name : maze (constructor) // parameters : none // partners : none // description : no parameter constructor maze public netid_maze() { // omitted code generating random maze setentrancerow(rnger.nextint(row - 2) + 1); setexitrow(rnger.nextint(row - 2) + 1); map[getentrancerow()][0] = '.'; map[getexitrow()][column - 1] = '.'; } // end netid_maze (without parameters) // method name : maze (constructor) // parameters : exittemp (int), entrancetemp(int), maptemp (char[][]) // partners : none // description : parameter constructor maze public netid_maze(char[][] maptemp, int exittemp, i...

javascript - integrating Stripe.com and Parse.com with iOS - can't add a subscription to a customer -

thanks in advance! i've been smashing head against desk day trying figure out why can't add stripe subscription customer via parse. here dictionary looks in objective-c: nsdictionary *productinfo = @{ @"tokenid": token.tokenid, @"plan": @"test plan", @"email": currentuser.email }; i'm calling pfcloud function in background: parse.cloud.define("createsubscription", function(request, response) { var stripe = require('stripe'); // test stripe.initialize('abcdefghijklmnopqrstuvwxyz'); stripe.customers.create({ card: request.params.tokenid, email: request.params.email, plan: request.params.plan }, { success: function(httpresponse) { response.success("success - subscription created"); }, error: function(httpresponse) { response.error("error - subscription canceled"); } ...

clojure - Append new data to entity in Datomic -

in trying update database tag data on posts have function looks like (defn add-tag-to-post [eid email tags] (d/transact conn [{:db/id eid, :author/email email, :post/tag tags}])) unfortunately, not preserve tags (unless query time). append tags list instead of write new one. example: {:title "straight edges", :content "fold instead of tearing it. ", :tags "scissor-less edges", ;;check out these awesome tags :author "me@website.hax" :eid 1759} (add-tag-to-post 1759 "me@website.hax" "art") ;;desired behavior: adds tag "art" list of tags (get-post-by-eid 1759) ;;returns {:title "straight edges", :content "fold instead of tearing it. ", :tags "art", ;;not cumulative tag addition ;/ :author "me@website.hax" :eid 1759} how can achieved? does make more sense query on lifetime of entity instead? ...

aspectj - Aspect not working witha spring bean -

i trying create simple aspect . here simple spring bean public class simpleservice { public void sayhello(){ system.out.println("hi"); } } here aspect class @aspect public class simpleaspect { @before("execution(void sayhello())") public void entering(){ system.out.println("entering.."); } } here configuration file <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemalocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <aop:aspectj-autoproxy/> <bean id="service" cl...

android - Displaying Image from path to ListView -

i able store images path. able retrieve , display imageview. however, whenever tried display images listview doesn't work. please see code below: response appreciated. imageview targetimage = (imageview) findviewbyid(r.id.stud_list_image); private void populatefields() { cursor data = studentsdbadapter.queuepic(); if (data.movetofirst()) { cursoradapter = new simplecursoradapter(this, r.layout.stud_row, data, new string[] {studentsdbadapter.key_imagepathid, studentsdbadapter.key_imagepath}, new int[] {r.id.textstud,r.id.stud_list_image}); simplecursoradapter.viewbinder viewbinder = new simplecursoradapter.viewbinder() { public boolean setviewvalue(view view, cursor cursor, int columnindex) { if(view != null && view.getid() != r.id.stud_list_image) { return false; } string username = cursor.getstring(cursor.getcolumnindex(studentsdbadap...

Converting an image from drawable to byte array in Android -

since sending image parse.com, have convert byte array. first approach select image gallery , convert byte array follows: @override protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); if (requestcode == result_load_image && resultcode == result_ok && null != data) { mmediauri = data.getdata(); string[] filepathcolumn = { mediastore.images.media.data }; cursor cursor = getcontentresolver().query(mmediauri, filepathcolumn, null, null, null); cursor.movetofirst(); int columnindex = cursor.getcolumnindex(filepathcolumn[0]); picturepath = cursor.getstring(columnindex); cursor.close(); // imageview imageview = (imageview) findviewbyid(r.id.imgview); propertyimage.setimagebitmap(bitmapfactory.decodefile(picturepath)); bitmap b...

How can I see the time of my last git pull? -

i did git pull want know @ time happened. there way of checking time of pull? note no changes came in when did pull. perhaps ssh connection logged? want check on local machine rather on server. using linux, git version 2.3.3. git writes fetch_head file every time pull or fetch, if there nothing pull. file can found at: .git/fetch_head . check last modification time of file. in linux can use following check last modified time: date +%s -r .git/fetch_head on osx can following last modified time: stat -f "%m" .git/fetch_head

regex - How does pattern matching works using perl -

i have variables a:b:c a:b:d c:d:e , need output displayed a-b a-b c-d i try following code $res="a:b:c a:b:d c:d:e"; $res=~s/\:/\-/g; $res=~s/..$//mgs; print "$res\n"; but did not receive output use strict; use warnings; $res = "a:b:c a:b:d c:d:e"; $res =~ s{([a-z]):([a-z]):[a-z]}{$1-$2}ig;

iphone - How to fetch string in particular key in firebase -

i have firebase data below: chats | | + - - -simplelogin48simplelogin50 | | | + - - simplelogin50simplelogin48 | | | + - - -simplelogin48simplelogin50 now want fetch chat data contains "simplelogin 48". is possible? no, firebase not support contains operator in queries. firebase provides querystartingatvalue , queryendingatvalue operators selecting range of keys, both based on start of key (or property value or priority if you've ordered on those). see section of firebase ios documentation explains querying. so by: [[[[ref queryorderedbykey] querystartingatvalue:@"simplelogin48"] queryendingatvalue:@"simplelogin48"] you get: + - - -simplelogin48simplelogin50 + - - -simplelogin48simplelogin50 but not : + - - simplelogin50simplelogin48 the way work around creating so-called index node , in case lists chat ids each user: chats_by_user | + - - simplelogin48 | | | + - - simplelogin48s...

c++ - Boost Property Tree Json Read for file containing LPWSTR -

i have code supposed write content in file using writefile . type of contents written in file lpwstr ie wchar_t * . file write ip , ssl , compression . consider following code: #include <windows.h> #include <iostream> #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/json_parser.hpp> int main() { lpwstr ip = null; lpwstr ssl = null; lpwstr comp = null; wchar_t buffer[300]; handle hfile; bool berrorflag; dword dwbytestowrite = 0; //(dword)strlen(buffer); dword dwbyteswritten = 0; if(ip == null || wcslen(ip) == 0 ) { ip = l"127.0.0.1"; } if(ssl == null || wcslen(ssl) == 0) { ssl = l"false"; } if(comp == null || wcslen(comp) == 0 ) { comp = l"true"; } wsprintf(buffer, l"{\n\"ip\": \"%ls\",\n\"ssl\": \"%ls\",\n\"compression\":\"%ls\"\n}",i...

java - ASM AdviceAdapter onMethodEnter - Print all arguements -

i'm looking use asm print values of parameters passed method. i've found examples, can't make sense of it. honest, haven't done "homework" in sense haven't studied asm as need in order build this. if anyone's willing me out great. just example, method returns void , takes single integer parameter. (and i've seen example @ https://gist.github.com/vijaykrishna/1ca807c952187a7d8c4d ) okay figured out. here go. here's method injector class. reads in class file (print.class) , adds instruction print int whenever printint method gets called package asm; import java.io.file; import java.io.fileinputstream; import java.io.fileoutputstream; import java.io.ioexception; import org.objectweb.asm.annotationvisitor; import org.objectweb.asm.attribute; import org.objectweb.asm.classreader; import org.objectweb.asm.classvisitor; import org.objectweb.asm.classwriter; import org.objectweb.asm.label; import org.objectweb.asm.methodvisi...

Writing into buffers in PHP -

i come node.js , things like: buf.writeuint16le(data, offset); now need similar in php. have: protected $tmpl = '06007007010001004b4'; $bytes = unpack('c*', $this->tmpl); but pack function doesn't seem have offset argument. alternatives?

javascript - The arrows of drop-down menu are invisible in IE (IE8) -

Image
this page of javascript drop-down menu , there arrows beside menu content when viewing chrome , firefox. http://code.stephenmorley.org/javascript/touch-friendly-drop-down-menus/ however, cannot see arrows when using ie8. is problem of ie version? what mechanism of arrows? (it seems not images or characters in special font.)

jquery - Javascript - Magnific Popup not working when HTML Elements are generated using Javascript -

i have problem regarding magnific popup, whenever type code in html, working whenever try using javascript generate html element have popup menu, popup not appear. here html code show popup using html code , working <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <div class="right-side"> <div class="logo"></div> <div class="right-content"> <div class="right-content-row profile"> <h6>welcome,</h6> <p><b id='customer_email' name ='customer_email'></b></p> <!--you being served <br><br> <b id ='emp_name...

Document term matrix in R -

i have following code: rm(list=ls(all=true)) #clear data setwd("~/ucsb/14 win 15/issy/text.fwt") #set working directory files <- list.files(); head(files) #load & check working directory fw1 <- scan(what="c", sep="\n",file="fw_chp01.fwt") library(tm) corpus2<-corpus(vectorsource(c(fw1))) skipwords<-(function(x) removewords(x, stopwords("english"))) #remove punc, numbers, stopwords, etc funcs<-list(content_transformer(tolower), removepunctuation, removenumbers, stripwhitespace, skipwords) corpus2.proc<-tm_map(corpus2, fun = tm_reduce, tmfuns = funcs) corpus2a.dtm <- documenttermmatrix(corpus2.proc, control = list(wordlengths = c(1,110))) #create document term matrix i'm trying use of operations detailed in tm reference manual ( http://cran.r-project.org/web/packages/tm/tm.pdf ) little success. example, when try use findfreqterms, following error: error: inherits(x, c("documenttermmatrix...

Pass array by reference and modify values C++ -

i want write function takes inarray[3] = {1,2,3,4} , outarray[3] , , modifies outarray[3] within function contain values = {3,4,1,2}. int main{ int inarray[4] = {1,2,3,4}; int outarray[4]; myfunction(&inarray, &outarray); } void myfunction(&inarray, &outarray){ outarray[0] = inarray[2]; outarray[1] = inarray[3]; outarray[2] = inarray[0]; outarray[3] = inarray[1]; } i'm doing wrong here, , don't precisely understand how pass array reference , manipulate values inside function. the fiunction , call can following way const size_t n = 4; void myfunction( int ( &inarray )[n], int ( &outarray )[n] ) { outarray[0] = inarray[2]; outarray[1] = inarray[3]; outarray[2] = inarray[0]; outarray[3] = inarray[1]; } int main() { int inarray[n] = {1,2,3,4}; int outarray[n]; myfunction( inarray, outarray ); } take acccount definition of array int inarray[3] = {1,2,3,4}; contains typo , not compiled. there must @ least l...

r - Formula interface for glmnet -

in last few months i've worked on number of projects i've used glmnet package fit elastic net models. it's great, interface rather bare-bones compared r modelling functions. in particular, rather specifying formula , data frame, have give response vector , predictor matrix. lose out on many quality-of-life things regular interface provides, eg sensible (?) treatment of factors, missing values, putting variables correct order, etc. so i've ended writing own code recreate formula/data frame interface. due client confidentiality issues, i've ended leaving code behind , having write again next project. figured might bite bullet , create actual package this. however, couple of questions before so: are there issues complicate using formula/data frame interface elastic net models? (i'm aware of standardisation , dummy variables , , wide datasets maybe requiring sparse model matrices.) is there existing package this? well, looks there's no pre-b...

php - SA:MP UCP login error -

i developing user control panel sa:mp server. working on login script @ moment have come across following error: catchable fatal error: object of class mysqli_result not converted string in /var/www/html/login.php on line 21 login.php: session_start(); if(!isset($_session["user"])) { echo 'username: '.$_post['username'].'.'; echo '<br>password: '.$_post['password'].'.'; $szuser = sanitize($_post['username']); $szpass = sanitize($_post['password']); echo '<br>username santizied: '.$szuser.'.'; echo '<br>password santizied & hashed: '.strtoupper(hash("whirlpool", $szpass)).'.'; //exit(); echo "<br>" . date('h:i:s'); echo '<br>logging in, please wait...'; echo "<br>select * `accounts` `username` = '".$szuser."' limit 1"; $...