Posts

Showing posts from February, 2010

r - access column reference to summarise column using dplyr -

i have been trying find way iterate through columns in dataframe using dplyr can perform operations on each column. dont quite understand how reference each column without hardcoding column name. for example, column means using apply: apply(exampledf,2,function(x){mean(x)}) note reference column x can passed function. there similar missing in dplyr ? the specific task trying (along non-working dplyr code) create new column contains column_mean(column_sd) : library(dplyr) set.seed(42) exampledf<- as.data.frame(matrix(ceiling(runif(16,0,50)), ncol=4)) colnames(exampledf)<-c("c1","c2","c3","c4") row.names(exampledf)<-c("r1","r2","r3","r4") exampledf%>%group_by(exampledf$c1)%>%mutate(meansd=paste(mean()+"("+sd()+")")) goal c1 c2 c3 c4 meansd r1 46 33 33 47 37.50(15.15) r2 47 26 36 13 25.75(13.30) r3 15 37 23 24 32.00(6.16) r4 42 7 36 48 33.00(17.33) ...

sql server - Stored procedure for merging tables -

i doing work @ client on sales datamart, adding new connection erp. client have kept old database ('888') manufacturing , created new '999' database sales. history remains in 888 until 31 december , new sales in 999 1 jan 2016 onwards. i have sql server tables , views set interrogate erp both 888 , 999 using new tables , views replicas of had 888. want union of 888 , 999 data sets have single data set. i pretty comfortable creating unions fact tables there should no duplicate records, guidance on dim tables. the customers , products replicated out of 888 999 in erp absolutely will have duplicates, want have single version 999. however, customer gets deleted 999, still have history 888 need include it. what thinking can't union (because of duplicates), rather thinking need create sort of procedure inserts records 999 table , processes 888 against that, adding records not exist in target. my problem don't know how write such stored procedure. if ...

node.js - Add Prerender.io to Existing angularJS webapp -

ive been trying setup angular webapp work prerender.io app not have of built in middleware desire; have decided want work express.js tutorials set project using this. example setup i able create project works prerender if make new using express.js generator plugin. thats , dandy doesn't me out; not creating project, rather want add prerender existing project. there way create new express.js project , import entire angular app (with folder structure; etc, moving app's root directory on new express app)into , have routing etc unaffected? how 1 go adding prerender created angularjs webapp? (like basic 1 seen below) i've tried bunch of times throughout day , ended installing ton of ugly dependancies project , having delete them all; appreciated. :: app.js: // app.js var app = angular.module('mypremadeapp', ['ngroute']) $locationprovider.hashprefix('!'); .config(function($routeprovider, $locationprovider){ $routeprovider.when(...

java - Align panels with backgrounds correctly? -

i started java guis few weeks ago , have difficulty alignment. basically, i'm trying have 2 panels different background image (top bar , content) , want align them 1 after another. problem is, can't use borderlayout.north , borderlayout.south , because background image loses original size , gets tiny. how can align them correctly, without losing original size? here's code: package main; import java.awt.borderlayout; import java.awt.graphics; import java.awt.image; import javax.swing.imageicon; import javax.swing.jframe; import javax.swing.jpanel; public class imagetest { public static void main(string[] args) { imageframe frame = new imageframe("topbar.png", "contentimage.png"); frame.setsize(640,480); frame.setvisible(true); } } class imagepanel extends jpanel { private image img; public imagepanel(string img) { this(new imageicon(img).getimage()); } public imagepanel(image img) { this.img = img; } public ...

node.js - Error Refreshing Session "JSON text did not start with array or object and option to allow fragments not set." -

trying refresh access tokens after 60 min limit. running local node server. give context, have returned following data spotify authentication endpoint. storing session in nsuserdefaults, not sure if have store refresh token in location.. swap: tokendata { access_token: 'bqazwk7kjbmtklzuvtpstw0xwmrww6zs2j6txoobmrh4p-cxw6shqqnzwebd9be38xz6zunlfdg-evetthwgorwa9gaqaooaqp5k4gfkevcbhlcdgvc_izjo1jh91fmb2o-l-yhejqc9dzuif7wwwcgfaxk2sj2qfnkp4mp13pxc9ilsnhnu-b9nfzawydohdf4', token_type: 'bearer', expires_in: 3600, refresh_token: 'aqdmpirx9wgwshk9aivybzlg1qjyv0avmgzeduwfvz0hggo5dhemksptevrciitzt_l4giflhpnfzlrxlmznksseru7ng8_3ssjphdsibdskjbdkjbdkudroc4zbegpwncjlmzgl4a' } when session expired in xcode, trigger function in xcode if !session.isvalid() { sptauth.defaultinstance().renewsession(session, withserviceendpointaturl: nsurl(string: tokenrefreshserviceurl), callback: { (error:nserror!, renewedsession:sptsession!) which points this.. app.post("/re...

ios - GoogleMaps not found -

i trying use google maps in ios app xcode ver 7.2 , swift ver 2.1.1. add googlemaps in pod file fine added frameworks , libs required support googlemaps fine, following tut , according have add bridging header file include #import <googlemaps/googlemaps.h> . app have 1 bridging header file because using facebook login put import statement in same file , in 'others linker flag -objc' there after few required settings in storyboard compiled proj getting error "googlemaps/googlemaps.h" not found. have searched , tried suggested ways on stackoverflow hard luck nothing worked yet.i grateful if suggest me doing wrong here. make sure pod install went smoothly. according tutorial, you should see output similar following: downloading dependencies installing googlemaps (1.10.4) using swiftyjson (2.3.0) generating pods project integrating client project

log4net - Exiting the logging from an appender -

is possible configure log4net stops going through rest of appenders if appender got match? something like: <appender name="tlsreadingappender" type="log4net.appender.rollingfileappender"> <file value="c:\logs\tposin_tlsreading.log" /> <filter type="log4net.filter.loggermatchfilter"> <loggertomatch value="tposin.serviceapp.tls.tlshandler"/> </filter> <filter type="log4net.filter.denyallfilter" /> <dontcheckanymoreappenders /> </appender> you can specify long list of appenders "active" if referenced in root tag of log4net.config file: <root> <level value="error" /> <appender-ref ref="filelogappender" /> </root> you create list of appenders, using "namespace.class" name of appender filter events on each file. can share bit more requirements , want achieve?

javascript - Form Validation laravel -

alright , made form validation , okay , when want connect validation in laravel use way this pages controller public function getcontact(){ self::$data['title'] = 'contact us'; return view('content.contact',self::$data); } public function postcontact(test $request){ } } this routes : route::get('contact','pagescontroller@getcontact'); route::post('contact', 'pagescontroller@postcontact'); and form <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script> <script type="text/javascript" href="{{asset('js/class.formvalidation.js')}}"></script> <script type="text/javascript" href="{{asset('js/landin_validation.js')}}"></script> <link rel="stylesheet" type="text/css" href="{{asset ('js/sty...

pickle memory leak in python -

i have large list of lists of list of integers, lists @ different levels of different length, otherwise have stored using numpy. store last level of list of integers using array('i', listofinteger) save memory. total size 5g (it 20g if directly use lists instead of array('i') ). when load file using pickle, takes 30g memory , memory not release after load done. if delete data, still takes more 25g memory. memory released after python existed any solution how solve this? why pickle still hold memory? any suggestions on how store data?

java - LibGdx Polygon.getTransformedVerticies() not returning the array -

i have quite simple problem makes no sense me. i have method drawstar() in helper class: public void drawstar(star star) { shaperenderer.begin(shapetype.line); shaperenderer.setcolor(color.red); poly[star.id].setvertices(star.verticesstar); if(star.rotation > 0){ poly[star.id].rotate(star.rotation); poly[star.id].setorigin(star.originx, star.originy); shaperenderer.polygon(poly[star.id].gettransformedvertices()); }else if(star.rotation == 0){ shaperenderer.polygon(star.verticiesstar); } shaperenderer.end(); system.out.println(poly[1].gettransformedvertices()[5]); //works fine } the above takes dimensions , vertices of star object pass , draws accurately array of polygons. there no problems @ stage. the problem when try access polygon array in class, example: polygon[] poly = new polygon[50]; poly = helper.poly; system.out.println(poly[1].gettransformedvertices()[5]); //says array indexoutofbo...

javascript - Change alert to input field -

i have code file name when i'm browsing image file. document.getelementbyid('image').addeventlistener('change',prepareupload,false); function prepareupload(event) { var files = event.target.files; var filename = files[0].name; alert(filename); filenames=document.watermark_url.filenames.value; } but example code prompt file name instead of displaying in input field. how change code when upload image, file name display in input field? change alert document.getelementbyid('inputtext.id').value = filename;

r - dplyr Update a cell in a data.frame -

df <-data.frame(x=c(1:5),y=c(letters[1:5])) let's want modify last row, update.row<-filter(df,x==5) %>% mutate(y="r") how update row data.frame ? way, found albeit strange way anti-join , append results. df <-anti_join(df,update.row,by="x") %>% bind_rows(update.row) however, seems inelegant way achieve simple task. ideas appreciated... with data.table , can assign ( := ) value rows i true. efficient assignment done in place. library(data.table) setdt(df)[x==5, y:="r"] df # x y #1: 1 #2: 2 b #3: 3 c #4: 4 d #5: 5 r as op mentioned last row, more general way is setdt(df)[.n, y:= "r"] or @thelatemail mentioned, if want replace row mention row index in i i.e. in case 5 . setdt(df)[5, y:="r"]

ios - Can't dismiss keyboard for iPhone 5 and iPhone5s -

i'm trying dismiss on screen keyboard programmatically , have code below override func viewdidload() { nsnotificationcenter.defaultcenter().addobserver(self, selector: selector("keyboardwillshow:"), name:uikeyboardwillshownotification, object: nil); nsnotificationcenter.defaultcenter().addobserver(self, selector: selector("keyboardwillhide:"), name:uikeyboardwillhidenotification, object: nil); } func keyboardwillshow(notification: nsnotification) { var info = notification.userinfo! let keyboardframe: cgrect = (info[uikeyboardframeenduserinfokey] as! nsvalue).cgrectvalue() uiview.animatewithduration(0.1, animations: { () -> void in self.bottomspace.constant = keyboardframe.size.height }) } func keyboardwillhide(notification: nsnotification){ self.bottomspace.constant = 0 } it work fine iphone 6 , ipad, not iphone 5 , iphone 5s, suggestion? try this: // dismiss keyboard when user touch screen overrid...

How to send Chinese characters from SAP to PHP through RFC? -

i communicating php through rfc using function module.i tried send chinese characters function module php , in php side getting chinese charcters in form of ###### , i don't understand side problem ,either php side or sap side? give me suggestion side need focus rectify problem ? or other way send chinese character php? sap fm code:fn name: zmm_php_to_sap t_log-msgty = 'e'. concatenate p_uname '用户无检料权限' t_log-msgtx separated space. append t_log. php code: $login = array ("ashost"=>$row_login1["sap_server"], "sysnr"=>$row_login1["sap_system_number"], "client"=>$row_login1["sap_client"], "user"=>$row_login1["sap_username"], "passwd"=>$row_login1["sap_password"], "codepage"=>"8300"); $rfc = saprfc_open ($login); if(!$rfc){ $error=saprfc_error()...

mysql - Latest Variable out of versioned pool -

for project, need keep track of huge amount of variables. needs logged, user changes variable etc. table looks (simplified 1 variable-type) (id surogate key tell versioned entries apart): id | variable_id | change_time | change_user | change_task | revision | value 1 1 date 1 123 1 hello world 2 2 date 1 123 1 22.5 3 1 date 2 456 2 foo bar to retrieve latest set of revisions (here entries 2 , 3) use solution described on here: retrieving last record in each group the resulting query looks this: select v1.id, v1.value variable_history v1 left join variable_hisotry v2 on ( v1.variable_id = v2.variable_id , v1.revision < v2.revision ) v2.id null now need modify query, following rules apply: querying latest variables should return row 2 , 3 querying latest variables for task 456 should re...

c++ - OpenCV Alphabets detection and extraction on shape of alphabet after skeletonization -

Image
i want detect , extract alphabets image , create new image contains alphabets.i have applied skeletonization on image after want suggestions.how can detect letters using contours or stroke bases.the images using dvd player pack panel e.g, the code using skeletonization is cvtcolor(input, input, cv_bgr2gray); cv::threshold(input, input, 127, 255, cv::thresh_binary); cv::mat skel(input.size(), cv_8uc1, cv::scalar(0)); cv::mat temp; cv::mat eroded; cv::mat element = cv::getstructuringelement(cv::morph_cross, cv::size(3, 3)); bool done; { cv::erode(input, eroded, element); cv::dilate(eroded, temp, element); // temp = open(input) cv::subtract(input, temp, temp); cv::bitwise_or(skel, temp, skel); eroded.copyto(input); done = (cv::countnonzero(input) == 0); } while (!done); the output image after skeletonization, source : http://felix.abecassis.me/2011/09/opencv-morphological-skeleton/ in opencv 3.0 there module text detection , recognitio...

python - Python3 change key type of nested dict from string to integer -

i have dict structure players = {xxx: {'name' : "admin"}, yyy: {'name' : "user"} } xxx , yyy meaning keys string. want them integer. how can convert keys integer please? assuming strings xxx , yyy contain valid integer representations, can use following construct dict key values converted integers: players2 = {int(k) : v k, v in players.items()}

php - Translate my website content -

guys know question asked before not same. i have website want translate content. what came with: 1-gettext //its not me 2-google api //google translate bad , google add name in wbesite 3-make files different language. i prefer last 1 because want website english , arabic. any more solutions? , disadvantages of making third solution ? thanks salam essam, companies nowadays use called i18n (internationalization) believe should check out website: https://lingohub.com/blog/2013/06/php-internationalization-i18n-mechanisms-tutorial/ tells why third method you're mentioning bad. hope helps.

r factor - Replace value in a column based on a Frequency Count using R -

i have dataset multiple columns. many of these columns contain on 32 factors, run random forest (for example), want replace values in column based on frequency count. one of column reads this: $ country : factor w/ 92 levels "china","india","usa",..: 30 39 39 20 89 30 16 21 30 30 ... what retain top n (where n value between 5 , 20) countries, , replace remaining values "other". know how calculate frequency of values using table function, can't seem find solution replacing values on basis of such rule. how can done? some example data: set.seed(1) x <- factor(sample(1:5,100,prob=c(1,3,4,2,5),replace=true)) table(x) # 1 2 3 4 5 # 4 26 30 13 27 replace levels other top 3 (levels 2/3/5) "other": levels(x)[rank(table(x)) < 3] <- "other" table(x) #other 2 3 5 # 17 26 30 27

python - pyobjc application load-time improvement -

i have built pyobjc app , found seems take long time load. i've added logging measure time takes load each step. before getting apphelper.runeventloop() app took 10 seconds, sometime 20 seconds load. the strip-down code looks this: import objc objc.setverbose(debug) # debug flag true/false applicationview import applicationview applicationdelegate import applicationdelegate .... pyobjctools import apphelper apphelper.runeventloop() the applicationview , applicationdelegate custom modules implement cocoa application user interface , have many imports. think takes long time. my questions are: if imports in imported modules affect load time, can add code there check if particular import yet or not, , load time? if want add splash screen, how can if worst case cannot make changes applicationview , applicationdelegate modules, , need wait them load. get rid of imports in custom modules seem used when particular window (nswindowcontroller) loaded. because st...

r - Prevent Jekyll from creating a page link from a static file -

Image
i have class site hosted through github project pages , built jekyll. issue want have r markdown file ( .rmd , markdown r code) static file students download, jekyll keeps linking page if in root directory of site , .md like this: here's repo of site (in gh-pages branch), there's link in readme live. it doing because file has front matter (and title in front matter more specific), , header file (_includes/header.html) building main navigation automatically this: {% my_page in site.pages %} {% if my_page.title %} <a class="page-link" href="{{ my_page.url | prepend: site.baseurl }}">{{ my_page.title }}</a> {% endif %} {% endfor %} if remove front matter won't end there. if need front matter can change way nav built, maybe adding mainnav: true front matter of files want end in main nav. change if statement if my_page.mainnav . i don't way main nav built, think example, can b...

go - Do I copy resp.Body? -

i learning go , have following code works fine: resp, err := http.get(url) // html ... doc, err := html.parse(resp.body) // parse html page now want print out html first parsing: resp, err := http.get(url) ... b, err := ioutil.readall(resp.body) // line added, not working now... doc, err := html.parse(resp.body) i guess reason resp.body reader, can not call read twice? idea how can correctly? copy resp.body? because client streams response body network, it's not possible read body twice. read response []byte doing. create io.reader on bytes html parser using bytes.newreader . resp, err := http.get(url) ... b, err := ioutil.readall(resp.body) doc, err := html.parse(bytes.newreader(b))

java - Using @Entity Class When Table Doesn't Exist -

i have several database tables spring mvc/jpa application refers using @entity , @table annotations. i've run issue if application switches between database connections, tables exist on database 1 may not exist in database 2 (as following sdlc cycle , promoting table additions/changes after "ok"), resulting in sql exception when application server starts. does spring offer way mark specific @entity classes "optional" or "transactional" there no database exceptions returned because of nonexistant tables? in opinion, there no option that. you can add automatic update of schema in hibernate, mentioned doing manually. hibernate validating schema, when establishes connection. use @entity , looks table , throws error if there no name specified.

java - How to retrieve the heap size set in the eclipse.ini file? -

Image
i have set heap size required in eclipse.ini file in following way: -xms256m -xmx1024m is there way access value 1024mb (max heap size) java code? here not require jvm heap size, instead need heap size set during eclipse start-up. one pointer find when check show heap status preference in eclipse preferences, view shows current heap usage , max heap size (value set in eclipse.ini file). hence think there api view uses read value ini file. any pointers on name of class used render heap status monitor view helpful. please find below link heap status monitor screen shot in eclipse picks heap size set in ini file , displays same. the heap status display org.eclipse.ui.internal.heapstatus uses java runtime class: runtime runtime = runtime.getruntime(); long totalmem = runtime.totalmemory(); long freemem = runtime.freememory(); long maxmem = runtime.maxmemory();

How to receive a BYTE[] from C# -

there 2 questions: i try make program need use com component(ocx) created mfc. assume component name myocx. myocx has function "readuserdata (byte* buf)".(i can see function spec has become readuserdata(ref byte buf) in c#.) buf byte[30]. content string: 100. here partial of code: byte buf = new byte(); if (myocx.readuserdata(ref buf)) { (int = 0; < 30; i++) { myocx.readuserdata(ref buf); textbox3.text += (char)buf; } } there no error during running, textbox3.text content "111111111111111111111111111111", think because "100" first letter '1' 30 times. i ask how write code make can "100" original byte[30]; another question not has readuserdata(byte* buf), has writeuserdata(byte* buf). write "200" buf. please tell me how this. thank you. not knowing how myoxc.readuserdata works, try this: byte[] b...

composer php - Laravel packages in Production -

i want make sure if understanding correct. when developing locally, cli, use composer bring in packages use app. these packages put in "vendor" directory. now, vendor directory included in gitignore file won't pushed version control. however, when deploy app production, since vendor packages not version controlled, in cli (while ssh'd server) need run composer update. grab dependencies composer.lock file , install them on server. consequently, when developing locally, if pull in new package, i'd have run composer update on server new package production. please let me know if understanding of correct. thanks! you don't want running composer update on production. want run composer install . with composer update have possibility of upgrading packages using versions haven't tested them on. if need update dependencies can local , composer.lock file updated. lock file committed, on server running composer install install packages match v...

android - Animated ExpandableListView in Scrollview -

i trying implement animated expandablelistview in scrollview layout. when expand category scroll not working. if method please me. in advance! this xml code: <scrollview android:id="@+id/scroll_view" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/nav_header_container" android:overscrollmode="never" android:scrollbars="none"> <linearlayout android:id="@+id/ll_scroll" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <linearlayout android:id="@+id/ll_home_category" android:layout_width="match_parent" android:layout_height="wrap_content" android:backgrou...

javascript - FormData in IE8/9 -

i have implemented script uploading files ajax, works perfect in other browsers except explorer, noticed formdata not supported ie9 , less, there alternatives formdata in ie, , want use clean javascript function doobjuploadexplorer(url, lnk_id, file, progress, success, content, frm, div_dlg, start_func){ var file_input = null, frm_data = new formdata(), req; try { //firefox, chrome, safari etc req = new xmlhttprequest(); } catch (e) { // internet explorer browsers req = new activexobject("microsoft.xmlhttp"); } if (document.getelementbyid(file)) { file_input = document.getelementbyid(file); (var = 0; < file_input.files.length; ++i) { frm_data.append(file, file_input.files[i]); } } req.upload.addeventlistener('progress', function(e) { //event called while upload in progress if (progress !== undefined && e.lengthcomputable) { $('#...

linux - There alawys has complile error when compile the latest kernel in ubuntu,as follow -

ld arch/x86/realmode/rm/realmode.elf arch/x86/realmode/rm/header.o: in function real_mode_header': (.header+0x8): undefined reference to pa_trampoline_start' arch/x86/realmode/rm/header.o: in function real_mode_header': (.header+0xc): undefined reference to pa_trampoline_status' arch/x86/realmode/rm/header.o: in function real_mode_header': (.header+0x10): undefined reference to pa_trampoline_header' arch/x86/realmode/rm/header.o: in function real_mode_header': (.header+0x14): undefined reference to pa_trampoline_pgd' arch/x86/realmode/rm/header.o: in function real_mode_header': (.header+0x18): undefined reference to pa_wakeup_start' arch/x86/realmode/rm/header.o: in function real_mode_header': (.header+0x1c): undefined reference to pa_wakeup_header' arch/x86/realmode/rm/header.o: in function real_mode_header': (.header+0x20): undefined reference to pa_machine_real_restart_asm' arch/x86/realmode/rm/trampoline_64.o: in func...

java - How to use org.jf.dexlib2 write or rewrite dex file? -

i searching long time on net. no use. please or try give ideas how achieve this. , there demo here can't understand.i want know whether dexlib2 can used write or rewrite dex file dexrewriter rewriter = new dexrewriter(new rewritermodule() { public rewriter<string> gettyperewriter(rewriters rewriters) { return new rewriter<string>() { public string rewrite(string value) { if (value.equals("lorg/blah/myblah;")) { return "lorg/blah/yourblah;"; } return value; } }; } }); dexfile rewrittendexfile = rewriter.rewritedexfile(dexfile);

LLVM: Optimization loading failing on OSX -

i trying run llvm instrumentation project , able load instrumentation optimization under linux. i have compiled , installed llvm 3.2 , clang 3.2 on osx, , have same version in linux. when try run in linux: command opt -load ./obj/llvminstrument/libllvminstrument.so -help |grep instrum -insert-edge-profiling - insert instrumentation edge profiling -insert-gcov-profiling - insert instrumentation gcov profiling -insert-optimal-edge-profiling - insert optimal instrumentation edge profiling -insert-path-profiling - insert instrumentation ball-larus path profiling -instrument_block - injects block instrumentation instructions -instrument_function - injects function instrumentation instructions -instrument_prepare - prepares instrumentation instructions same command, in osx: command opt -load ./obj/llvminstrumen...

javascript - how to get(call) dynamically generated variable value to save in (mysql) database using php -

i trying save value of dynamically generated checkbox, label , select tag in mysql database using php in tags retrieving value different database , trying save data of checked field label value , selected option value, not able it, please suggest me doing wrong. <script language="javascript"> function getmatchplayer1(mid) { window.location="?mid="+mid; } </script> </head> <?php $host="localhost"; // host name $username="root"; // mysql username $password=""; // mysql password $db_name="test"; // database name // connect server , select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); // select data...

java - lucene setting negative scores to certain query terms -

q1="apple^0.1 juice^0.85" q2="apple^-0.1 juice^0.85" q1 works perfectly. if set negative weight "apple" in q2 , throws lexical error. know how fix in way without using .setboost() method? caused by: org.apache.lucene.queryparser.classic.tokenmgrerror: lexical error @ line 1, column 7. encountered: "-" (45), after : "" @ org.apache.lucene.queryparser.classic.queryparsertokenmanager.getnexttoken(queryparsertokenmanager.java:1129) @ org.apache.lucene.queryparser.classic.queryparser.jj_consume_token(queryparser.java:562) @ org.apache.lucene.queryparser.classic.queryparser.term(queryparser.java:333) @ org.apache.lucene.queryparser.classic.queryparser.clause(queryparser.java:247) @ org.apache.lucene.queryparser.classic.queryparser.query(queryparser.java:171) @ org.apache.lucene.queryparser.classic.queryparser.toplevelquery(queryparser.java:160) @ org.apache.lucene.queryparser.classic.queryparserbase.par...

Node.js Server and Cognito Sync -

i trying create node.js server pickup data local db , put cognito. cannot use cognitosyncmanager because not browser app. can tell me how can upload data? also, unable find out how create dataset , how upload data dataset using cognitosync. sorry, newbee cognito why asking such basic question. if want use cognito sync aws node js sdk, need use class cognitosync instead of cognitosyncmanager. here's api reference http://docs.aws.amazon.com/awsjavascriptsdk/latest/aws/cognitosync.html following blog has guide on getting started cognito sync node js https://mobile.awsblog.com/post/tx1kd3g8q9nfwvf/amazon-cognito-in-your-node-js-web-app

c# - CSS href Path from Hidden Filed Value and Extra String -

<link runat="server" href="css/template.css" rel="stylesheet" /> this external css link. , have hidden filed in page: <asp:hiddenfield id="hdfextra" runat="server" /> i'm setting value hdfextra on page load . need combine css href hidden filed, need this: href="<% hdfextra.value %>css/template.css" so have extra/css/template.css href. not know how works. one way direct modify href on page_load first give id link <link runat="server" id="csslink" href="css/template.css" rel="stylesheet" /> then on page load modify href as csslink.attributes["href"] = rootofcss + "css/template.css"; and rendered on page: <link id="csslink" href="extracss/template.css" rel="stylesheet" /> you can use single string rootofcss or use hidden field value ask as csslink.attributes["...

jmeter - How can I get name of HTTP Request from field Name with BeanShell? -

i need variable field http request called name. if give examples how can other fields such : path, server name or ip using beanshell? thank in advance add beanshell preprocessor child of request use following code lines required values: string name = sampler.getname(); // parent sampler name string path = sampler.geturl().getpath(); // path string url = sampler.geturl().gethost(); // ip or hostname you can store values jmeter variables if required like vars.put("name", name); see how use beanshell: jmeter's favorite built-in component guide comprehensive information on using beanshell scripting in jmeter test.

mysql - Database design & normalization -

Image
i'm creating messaging system e-learning platform , there design concerns i'd feedback on. first of all, important me , system highly modifiable in future. such, maintaining high normalization across tables important. on how system work: all members (students or teachers) part of virtual classroom. teachers can create tasks , exercises in these classrooms , assign them 1 or multiple students ( member_task table not illustrated). a student can request specific task or exercise sending message teachers of classroom. messages sent students sent teachers. cannot address message specific teacher. messages sent teachers can addressed 1 or more students. students cannot send messages other students. messages behave chat, meaning private conversation starts between student , teachers when send message. here's er diagram made: so question is, table normalized purpose? there can done reduce redundancy of data across tables? , out of curiosity, in bcnf? an...

c - Meaning of "%lf" place holder -

here small program intently put place holder %lf in second printf . why second printf has same result first printf ( both printf 1.3). int main() { double f = 1.3; long l = 1024l; printf("f = %lf", f); printf("l = %lf", l); return 0; } it's undefined behaviour if printf() has format specifier mismatch. %lf expects double passing long int . c11, 7.21.6.1 fprintf function 9 if conversion specification invalid, behavior undefined.282) if argument not correct type corresponding conversion specification, behavior undefined. that said, happens when call printf() first time, value of f passed in floating point register or @ location in stack double. next time call p rintf() , reads same location due format specifier %lf . opposed reading value of l stored. if swap order of printf() calls, observe different output. platform specific. once program invokes undefined behaviour , can happen. basically, can't e...

javascript - cordova - check internet connectivity first then load body page -

i using cordova-plugin-network-information plugin below code. <script type="text/javascript" charset="utf-8"> // wait device api libraries load // document.addeventlistener("deviceready", ondeviceready, false); // device apis available // function ondeviceready() { checkconnection(); } function checkconnection() { var networkstate = navigator.connection.type; var states = {}; states[connection.unknown] = 'unknown connection'; states[connection.ethernet] = 'ethernet connection'; states[connection.wifi] = 'wifi connection'; states[connection.cell_2g] = 'cell 2g connection'; states[connection.cell_3g] = 'cell 3g connection'; states[connection.cell_4g] = 'cell 4g connection'; states[connection.cell] = 'cell generic connection'; states[connection.none] = ...

android - How to make VideoView full screen -

Image
i want play video in activity using videoview ,and make fullscreen , landscape mode (with hiding virtual button , status bar)when click button . but can not hide virtual button , has white line in bottom. this activity code: public class videoactivity extends activity { private videoview mvideoview; private string murl; private button mfullscreen; private static string tag = videoactivity.class.getname(); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); log.d(tag,"oncreate"); setcontentview(r.layout.video); mvideoview = (videoview) findviewbyid(r.id.video); mfullscreen = (button) findviewbyid(r.id.fullscreen); file file = new file(environment.getexternalstoragedirectory(),"video.mp4"); mvideoview.setvideopath(file.getpath()); mvideoview.start(); mfullscreen.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { ...

mysql - how to write dyanamic select query statement with where clause in lovs management of SPAGOBI server -

i need write simple select statement clause dynamically in list of values(lovs management) of spagobi server. and want know how set profile attribute in spagobi server. can 1 me..? create datasource in spagobi first create query in dataset.in dataset can set dynamic feature parameter see in dataset can preview dataset preview option in it. can use dataset in cockpit or document build in server.

algorithm - Generating Gaussian Random Numbers without a Uniform Random Number Generator -

i know many uniform random number generators(rngs) based on algorithms, physical systems , on. eventually, these lead uniformly distributed random numbers. it's interesting , important know whether there gaussian rngs, i.e. algorithm or else creates gaussian random numbers. precisely want don't want use transformations such box–muller or marsaglia polar method gaussian uniform rngs. interested if there paper, algorithm or idea create gaussian random numbers without of use uniform rngs. it's pretend don't know there exist uniform random number generators. as noted in answers/comments, virtue of clt sum of iid random number made reasonable looking gaussian. if incoming stream uniform, bates distribution . ami tavory answer pretty amounts using bates in disguise. @ closely related irwin-hall distribution , , @ n=12 or higher lot gaussian. there 1 method used in practice , not rely on transformation of u(0,1) - wallace method (wallace, c. s. 1996. "fast...

wordpress - rich reviews plugin not working properly -

i using rich review plugin create rating system.what want rate different categories of single product looks,hair , teeth of person example,what did created form in rich review , want use code snippet [rich_reviews_form category="person"] in single page,it enables me use code snippet , displays 3 different forms,the problem can supply input through 1 form,even if change category of forms different name,i can supply input 1 of form? this requires patch plugin author, both js handles form elements, , $_post submission of form data. essentially patch allows have independent forms on same page using shortcode parameter unique key. instance 2 forms on same page might this. [rich_reviews_form category="something" unique_key="one"] [rich_reviews_form category="something_else" unique_key="two"] see this thread

java - Custom Class Used in A List/HashSet -

i have custom class looks below: public class customclass(){ private int keycode; private boolean up; private string totrigger; public string gettrigger(); public boolean up(); public int keycode(); } whats best way performance have list of unique values? i thinking of hashset how make sure unique instances of customclass? what need override? equals , hashcode? make sure hash set of customclass have unique instances? thanks if a.equals(b) true there hashcode() must same. override both .equals() , .hashcode() in custom class. use same fields of custom class calculate hashcode used check equality in .equals(). yes it'll make sure there unique instances of customclass in hash-set. go it.

r - Exclude unused factor levels in each facet in ggplot -

Image
consider data frame: df <- data.frame(vars=c(rnorm(3),rnorm(3,2,1), rnorm(3,1,1)), names=c("a","b","c","a","d","b","c","a","f"), groups=c(rep("x",3),rep("y",3),rep("z",3))) i'm plotting ggplot: ggplot(df, aes(reorder(names, vars), names)) + geom_bar(stat="identity") + theme_bw() + facet_grid(groups~., scales="free_x") + coord_flip() + ylab(null) + xlab(null) it looks i want following: each grid item should drop unused items, e.g. in "x" grid there should no "d" , "f" the x axis should the value of "vars" column. proportions in each grid should same, overall x scale should dropped. want proportions of bars in each grid intact the bars should in decreasing order in each grid (longer bars on top) update : edit using advice here error: ggplot(df...

android - how to open menu profile to relayted activity -

this code textview product1 = new textview(this); product1.setclickable(true); product1.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { if(v.gettag().tostring().equals("test")){ //toast.maketext(mainactivity.this, "hi", toast.length_long).show(); startactivity(new intent(mainactivity.this, testactivity.class)); } }); i have tag example profile how open tag want open no of tag using if(v.gettag().tostring().equals("test")){ ----------- } if did'nt wrong. can use switch statement achieve that. switch (v.gettag().tostring()) { case "test": startactivity(new intent(mainactivity.this, testactivity.class)); break; case "profile": startactivity(new intent(mainactivity.this, registeractivity.class)); break; }

html - getting values of auto generated input fields angularjs -

i stuck problem while now, trying values auto generated input fields 1 click can values of generated inputs @ once. this part of html inputs created : <div ng-controller="ingredientcontroller ctrl" class="col-md-12"> <div class="col-md-4" ng-repeat="ingredientgroup in ctrl.ingredientcontainer"> <div ng-repeat="group in ingredientgroup"> <div ng-if="!group.groupid"><h3>{{group.name}}</h3></div> <div ng-if="group.groupid"> <div class="form-group"> <label> {{group.name}}<input type="text" class="form-control"> </label> </div> </div> </div> </div> </div> <div class="modal-footer"> <button type="button...

ruby on rails - Carrierwave thumb method doesn't work for remote image url -

i have model 2 fields img_file (to load computer) , img_url (to load remotely internet). have standart thumb method in ulpoader. version :thumb process :resize_to_fit => [50, 50] end the problem that, when call method img_file works, doesn't img_url. here code: f.inputs f.input :project_id, as: :select, collection: project.all {|p| [p.title]} f.input :img_file, as: :file, hint: image_tag(f.object.img_file.thumb) f.input :img_url end this how call thumb method both: column :img_file |photo| image_tag photo.img_file.thumb end column :img_url |photo| image_tag photo.img_url.thumb end it seems silly question, i'm stuck with. hope, see problem. thanks!

c# - Add XML file to ZIP -

issue i have been given old piece of code (5+ years) , have been adding functioanlity application. have come across issue , xml file not correctly getting added zip. when check zip after xml file appear 0 data. code so create xml , add correct data file: using (isolatedstoragefilestream doc = localstorage.openfile(xmlfile, filemode.open)) { //add code populate xml file. works fine. } then open xml , create zip , trying add xml zip: note: there line under ' zippackage ' says " the class has been deprecated " using (isolatedstoragefilestream filestream = localstorage.openfile(xmlfile, filemode.open)) { using (isolatedstoragefilestream zipstream = localstorage.createfile(zipfile)) { using (zippackage zippackage = zippackage.create(zipstream)) { zippackage.addstream(filestream, xmlfile, zipcompression.deflate64, datetime.now); zippackage.close(true); } } } then copy bytes file: usi...