Posts

Showing posts from February, 2010

google cloud messaging - Python 3.4 import gcm raise a SystemError: Parent module '' not loaded, cannot perform relative import -

i'm trying import gcm following: from . import gcm and get: systemerror: parent module '' not loaded, cannot perform relative import i tried called: from gcm import gcm by pip install python-gcm follwoing error: module' object has no attribute 'gcm don't use relative import syntax, from . import gcm . instead, put library python interpreter can find (via pip install python-gcm ) , call from gcm import gcm in program. however, if still error while attempting import, should add comment project's open python3 import issue thread on github , let them know, since there still appears ambiguity if bug has been fixed yet or not.

java - insert issue with auto-increment ID with Hibernate for a many to many association -

i use hibernate. db has many many relationship. hibernate generated these 2 classes handle relationship: public class exducours implements java.io.serializable, iembededimproitem { private static final long serialversionuid = 1017414l; private exducoursid exducoursid; private coursimpro coursimpro; private eximpro eximpro; ... @embeddedid @attributeoverrides({ @attributeoverride(name = "coursid", column = @column(name = "cours_id", nullable = false) ), @attributeoverride(name = "exid", column = @column(name = "ex_id", nullable = false) ), @attributeoverride(name = "duree", column = @column(name = "duree") ), @attributeoverride(name = "commentaire", column = @column(name = "commentaire") ), @attributeoverride(name = "id", column = @column(name = "id", unique = true, nullable = false) ) }) and: @embedd...

javascript calling function as array element -

i came across example in toptal youtube video uses syntax won't run in chrome, unless missing something. example comes here ( javascript closure inside loops – simple practical example ) , same syntax used. why not running me/does indicated line below contain valid syntax? var x, y, funcs = []; for(x=0; x<5; x++){ (function(){ var r = x; funcs.push(function(){ console.log(r); }); }); }; (var y=0; y<5; y++){ funcs[y](); //<< valid js syntax/why not working me? }; you need make anonymous function inside first for-loop self-executing adding pair of brackets () after definition. (function(){ var r = x; funcs.push(function(){ console.log(r); }); })(); without this, keep declaring function inside first loop never executed , thus, never pushes array. after first loop, console.log(funcs.length) , 0 since array has no elements. your current code give uncaught type error: funcs[0] not...

Spring web flow form binding append to list -

i'm learning use spring, spring webflow , thymeleaf. created little old school wizard application user have fill out forms click next button , @ end configuration process. every view-state 's model called configuration model class. class contains list<note> notes . on every view-state user has option add notes. issue form binding @ every view-states note list replaced instead of appended new note. how can append list instead of replace @ every view-state? any appreciated. in short: standard java collections arraylist initialized fixed size , cannot appended new entries/pojos. so if want bind/append new entries collection need use the import org.springframework.util.autopopulatinglist; instead of standard java.collections.list see answer wrote on similar question more details: spring webflow submit array new items

java - JavaFX 8 update UI with Platfrom.runLater() still returns null -

i'm writing hexeditor application javafx 8 various reasons. (important is, have can't use hexeditor) my problem when want update ui example with textarea.settext(line); table.setitems(getlistfortable()); i nullpointerexception because textarea (textarea) , table (tableview) null, if have data before intialize stage , set components works. in other questions read platfrom.runlater() should solve somehow doesn`t work me, still nullpointerexception. i'm sure i'm in applications main thread, because application uses 1 thread. here full code method: public void openfile() //this called when user presses "open"-menuitem { filechooser fc = new filechooser(); fc.getextensionfilters().addall( new extensionfilter("text files", "*.txt"), new extensionfilter("all files", "*.*")); file = fc.showopendialog(primarystage); if(file != null) { create(); platform.ru...

django - Modelform: need to get access to related model through the form -

i have models: class item(model): name = ... size = ... class instance(model): item = foreignkey(item) date = datefield() now need make reception, collect formset of items, transform them instances, store instances inside reception (the items don't need stored in reception). don't understand on level should this: in model, in form, in view, or in template (perhaps not). i'm confused it. should make 2 fields in reception model (one items , 1 instances) hide instances field in receptionform? , continue through view create transform, clean unneeded items data reception?

javascript - Options for article scraping from many different websites -

i need add webpage scraping functionality single page application. i need retrieve useful content many different blogs , services. useful content, mean articles, texts , links videos in order embed them on pages. this tool seems offer need: http://www.diffbot.com/ using it, can input article's url , service retrieve data need single page. however, not need handle 250 thousands requests on monthly basis, cost $300 each month; need solution handle 5000 requests each month, possibility of scaling later. i've found lot of scraping solutions through google, offer solutions scrape custom content periodically small number of websites - not need. also, not have experience in area, advise me on should use purpose. dealing javascript. in addition, @ possible allow pages scraped client's browser, rather server-side? i develop spa reactjs , flux architecture. server nodejs+express, database - backendless it sounds custom solution perhaps built on node.js bes...

php - (trim($file) shows unknown error -

i try code little "grab infos page x" - script. code internet, not working: warning: trim() expects parameter 1 string, resource given in $file = @fopen ($url,"r"); if (trim($file) == "") <<<<errormessage belongs here. so tried check if $file isn't string or not. php says: not string not int not numeric not array so then? applepie ? :d how fix script use it? the whole script follows, <?php // url, die durchsucht werden soll $url = "http://xxxxxxxx/community/accounts/xxxxxxxxxxxx/"; // zeichenfolge vor relevanten einträgen $startstring .= "<td class=\"td-minor\">"; $startstring1 .= "<td class=\"td-value\">"; // bis zum nächsten html tag bzw. zeichenfolge nach relevanten einträgen $endstring = "</td>"; $file = @fopen ($url,"r"); if (trim($file) == "") { echo "service out of order"; } els...

javascript - How do I pass a reference to $http in AngularJS? -

i have following controller definition: angular.module('myapp', [ 'ngroute' ]).config(function($routeprovider, $httpprovider) { [...] }) .controller('edit', function($scope, $http, $routeparams) { $scope.projectid = $routeparams.id; $scope.viewer = "undefined"; $scope.mode = 'nothing'; var projectid = $routeparams.id; }) .directive('initcesium', function(){ return { restrict: 'aec', link: function(scope, element, attrs) { if (typeof cesium !== "undefined") { startup(cesium, scope); } else if (typeof require === "function") { require(["cesium", "scope"], startup); } } } }); i need send web service request in function startup . therefore need pass $http startup in 2 places: startup(cesium, scope); require(["cesium", "scope"], startup); how ...

cordova - Ionic framework android project (using intellij) starts on some devices/emulators but not in others -

Image
i'm using intellij idea 14 plugin phonegap/cordova run ionic framework projects. the thing project works okay on android tablet, not in android smartphone, works okay on default android sdk emulator, not genymotion emulators. when try build success message no errors, can see: "d:\intellij idea 14.0\bin\runnerw.exe" c:\users\mateo\appdata\roaming\npm\ionic.cmd run --emulator --target=479009ad544bb0a4 android running command: "c:\program files\nodejs\node.exe" d:\drive\cordova-angular\todoapp\hooks\after_prepare\010_add_platform_class.js d:\drive\cordova-angular\todoapp add body class: platform-android running command: cmd "/s /c "d:\drive\cordova-angular\todoapp\platforms\android\cordova\run.bat --emulator --target=479009ad544bb0a4"" android_home=d:\androidsdk java_home=c:\program files\java\jdk1.7.0_80 running: d:\drive\cordova-angular\todoapp\platforms\android\gradlew cdvbuilddebug -b d:\drive\cordova-angular\todoapp\platforms\androi...

php - Laravel 5 Auth Redirecting - It works, but is it correct? -

let me try explain this. if guest goes / directory, welcome. if guest tries go /start directory, redirected log in page. after guest logs in, redirected /start directory. if logged in user goes / directory, again redirected /start directory. (no need see home page once logged in). i got working how want, i'm not sure if i'm doing how laravel intends done being there non-dry code in pagescontroller.php . plus, i'm redirecting pagescontroller pagescontroller (doesn't sound follows practices me). here routes.php : <?php route::get('', 'pagescontroller@index'); route::get('start', 'pagescontroller@start'); route::controllers([ 'auth' => 'auth\authcontroller', 'password' => 'auth\passwordcontroller' ]); here pagescontroller.php : <?php namespace app\http\controllers; use app\howitworksmodel; use app\whatyougetmodel; use app\startcontentmodel; use illuminate\http\re...

Tesseract + opencv 3.0 + windows, text module small size, linking errors -

i posted text 2 days ago in answers.opencv.org, i'm posting here well. http://answers.opencv.org/question/68634/text-contrib-module-and-tesseract/ good afternoon everyone. first of all, sorry english hehe. i've been trying build opencv contrib module 'text', haven't got sucess. note: other modules xfeatures2d have never given me problem. my platform windows 7 x64 , use vs2013 compiler, i've followed tutorial( http://vorba.ch/2014/tesseract-3.03-vs2013.html ) in order build tesseract 3.04 lib, after compiling succesfully, want generate vproj cmake , problem following: in cmake gui, having selected opencv source, extras directory, etc etc, don't vars under 'tesseract' group set correcly (include , libs). know because when click on configure, log says "tesseract: no". i've inspected findtesseract cmake script , think doesn't work.... please, give me little clue what's happeni...

layout - Android ExpandableListView not showing -

so have expandablelistview in layout, reason showing part of when run app. yes, it's "some" part - enture first groupview . if set fixed height list @ android:layout_height="some dp" , instead of android:layout_height="match_parent" can see whole list. but, if have many group view's , child view's, again, can see part of (as height fixed). i've tried put expandable list inside linearlayout , have tried set android:layout_height="wrap_content" , , on, without success. how can solve this? thank you, <?xml version="1.0" encoding="utf-8"?> <!-- that's main layout.--> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scroll_view_m" android:layout_width="match_parent" android:layout_height="match_parent"> <!-- linearlayout here because scrollview can have 1 child view.--> <linearlayout an...

html5 - Issue with responsive tables (foundation 5) in Rails app -

i implementing tables in rails 4 app. using zurb foundation 5 framework this. the issue encountering on mobile version of table. in browser , tablet views table works expected... on mobile phone displays table shows column 1 twice scrolles through rest of columns (thats fine... issue duplicated first column , not sure how rid of @ all?? table code: <table class="responsive"> <thead> <tr> <th width="150">test test 1</th> <th width="150">test test 2</th> <th width="150">test test 3</th> <th width="150">test test 4</th> <th width="150">test test 5</th> <th width="150">test test 6</th> </tr> </thead> <tbody> <tr> <td>answer 1</td> <td>answer 2</td> <td>answer 3</td> <td>answer 4</td> <td>answer 5</td> <td>answer 6</...

c# - Basic Code (first time coding) errors (visual studio 2015 for desktop express) -

console.writeline("type number, number!"); consolekeyinfo keyinfo = console.readkey(); if (keyinfo.keychar -- 'a') { console.writeline("thats not number, knock off!"); } console.writeline("did press {0}", keyinfo.keychar.tostring()); } } i'm getting below errors above code, how can fix these? cs1026 ) expected cs1002 ; expected cs0200 property or indexer 'consolekeyinfo.keychar' cannot assigned -- read cs1513 } expected consolekeyinfo.keychar gets unicode character represented current consolekeyinfo object . it's read property , means can't modify value of property. by looking code, seems want check character a in if condition. use comparison operator (equality operator) == this if (keyinfo.keychar == 'a')

r - Standard deviation for a subset -

i trying calculate mean , standard deviation variable within subset. coding works fine mean not sd. have included sample data= orf1 came subset. help? mean(stocking.density2012,na.rm=true,data=orf1) [1] 13.72386 > sd(stocking.density2012,na.rm=true,data=orf1) error in sd(stocking.density2012, na.rm = true, data = orf1) : unused argument (data = orf1) region stocking.density2012 1 12 8 7 2 12 8 17 1 34 3 24 1 16 2 5 1 5 4 11 1 5 3 3 7 3 5 13 1 18 4 15 2 18 1 10 6 5 1 10 5 46 1 19 3 12 1 15 6 4 1 4 7 8 1 ...

c# - I have imported the HttpWebRequest but visual studio is not recognizing the ContentLength properties -

using system.net.httpwebrequest; static string sendrequest(string method, string service, string postdata) { string responsestring = null; httpwebrequest request = (httpwebrequest)webrequest.create(service); utf8encoding encoding = new utf8encoding(); byte[] data = encoding.getbytes(postdata); request.method = "post"; request.contenttype = "application/x-www-form-urlencoded"; request.contentlength = data.length; using (stream stream = request.getrequeststream()) { stream.write(data, 0, data.length); } using (httpwebresponse response = (httpwebresponse)request.getresponse()) { responsestring = new streamreader(response.getresponsestream()).readtoend(); } return responsestring; } thew actual namespace system.net , in code should be using system.net; httpwebrequest class name under namespace. if rather using system.net.httpwebrequest; in posted code; vs anyways throw red ...

html - Textarea - JavaScript | Remove line breaks and spaces from content field -

<textarea rows='5' cols='50' id='content'></textarea> <input type='button' value='extract text' onclick='somefunction()'/> assume these 2 html elements. problem following: let's user enters textarea field this, typed. line breaks , spaces. (and yes, python :p) if (...): print "hello everyone!" else: print "dudes me out!" my objective make javascript function removes spaces , line breaks (typed 'enter') , returns space-less string. "thisisasampletext". i've used document.getelementbyid('content').value , mystring.replace(/\s+/g, '') remove spaces. can't make work. ideas? best regards here's live demo of how use regex described remove whitespace in text textarea: function somefunction() { var output = document.getelementbyid("content").value; output = output.replace(/\s/g, "") doc...

How to prevent malicious input in Spring JPA+Spring REST+jHipster -

i'm new spring jpa/jhipster. question inspired jhipster talk julien dubois: https://youtu.be/r3jm2qmqcti?t=43m7s assume have bank account operations on (+100$ restaurant, -50$ atm, ...) each bank account has owner of course. the payload of post rest call creates operation this: {"amount":100,"description":"restaurant","bankaccount":{"id":1136}} the id of bankaccount unique , (for sake of example) have been sent me earlier via rest call. unfortunately, nothing prevents malicious user change value. 1 guess id of bankaccount owned else, , operation added one. i have not (yet) seen examples deal problem. should explicitly check if bankaccount owned user? imagine type of verification may cascade through entities, causing lot of calls. maybe i'm missing something? thanks, andy yes it's reponsibility check in rest controller or underlying services operation authorized. spring security offers d ifferent mec...

web crawler - Python place the spider datas in an excel file -

Image
i lose 1 hour each day classify information websites i'm trying build python spider data website , classify them automatically in excel file. i built part data not know how can append them in excel file code using. here code: import requests bs4 import beautifulsoup import xlsxwriter def spider_list(max_pages): page = 2 while page < max_pages: url = 'http://yellow.local.ch/fr/q/morges/bar.html?page=' + str(page) source_code = requests.get(url) plain_text = source_code.text soup = beautifulsoup(plain_text, 'html.parser') link in soup.findall('a', {'class':'details-entry-title-link'}): href = link.get('href') spider_data(href) page += 1 def spider_data(item_url): source_code = requests.get(item_url) plain_text = source_code.text soup = beautifulsoup(plain_text, 'html.parser') items in soup.findall('h1'): ...

c++ - Difference between const auto and auto for lambdas -

is there (useful?) difference between: auto test = [..](..){..}; and const auto test = [..](..){..}; ? yes, if lambda declared mutable cannot call in second case. int x = 0; const auto test = [x]() mutable { ++x; }; test(); // error

user interface - Java editing window menu bar -

i have problem. see, want add own items window menu bar of application, not add items jmenubar. example, @ menu bar of browser using. type of menu bar. know java run in vm can't access many things outside of jvm, there possible way can done? whenever search "java menu bar" comes jmenubar stuff , nothing creating window menu bar. thanks! you can make jmenubar want. need configure menu bar , menus appropriately.

javascript - How to create or return seperate scope from function in ng-repeat directive -

base code: <tr class="" ng-repeat="row in resultoffiltering"> <td class="{{result[1]}}" ng-repeat="result in createtablebody(row)">{{ result[0] }}</td> </tr> source of resultoffiltering changed when watch notice changes in search input or there choosen new base source, according new table body should created createtablebody executed search after nested fields , create proper order , amount of td in tr. issue: think know issue is, issue result keep reference last execution of createtablebody function, question how create sepereate scope each function execution ? createtablebody function this.createtablebody = function(obj){ var headers = $rs._headers, giveback; if(obj.headers !== headers.length) { var num = obj.headers; if(!angular.isarray(headers[num])){ giveback = obj[headers[num]]; }else{ giveback = that.givebacknestedvalues(...

android - Large Qt external binary resource file -

i want use qt external resource file expansion file android app. total size of resource bundled in resource file 700+ mb. have experienced resource compiler (rcc) can not handle more 500mb before hangs , crash on computer. want make on big file makes lot easier when uploading expansion files android. i run rcc tool commandline following arguments: rcc -binary -no-compression myqrcfile.qrc -o myoutputfile i need use no compression able play video files bundled in resource file directly, not problem here. i have 2 questions, first 1 primary one: is there way bundle files total file size of more 500mb in one file? does size of external qt resource file have impact on performance of application? larger file = slow load or similar? for creating smaller resource data, may try change compression (s, -compress ) for faster loading, there seems 2 possibilities embedd resources in qt. unless specify explicitly create resources-data external library, resource data ...

php - Does ssl block imgur from getting image dimensions? -

Image
i'm using php gd library create png file, i'm saving server. url image is https://server.com/signature/123.png my problem can't upload image imgur, error this issue occurs on other image uploading sites / forums however if decide download image desktop , upload imgur seems work. has idea on why happening?

UNIX shell scripting - if else condition -

i making trivia game in unix voiceover utility on mac os x. shell script below. why won't if-else condition work? ideas? #!/bin/sh clear echo "hey gamers! playing marvel comics" echo "what super hero name?" -v victoria "what super hero name?" read name echo "$name, sounds pretty epic hero." -v victoria "$name, sounds pretty epic hero." echo "see if know names of other epic heroes marvel comics." -v victoria "see if know names of other epic heroes marvel comics." echo "#1. world war 2 veteran, steve rogers, known super hero name?" -v victoria "world war 2 veteran, steve rogers, known super hero name?" read answer1 if [$answer1 = "captain america"] echo "correct. - steve rogers captain america." -v victoria "correct. steve rogers captain america."; else echo "incorrect. - steve rogers captain america" -v victoria "incorrect. steve r...

Regex in Python dilemma -

i having issues previous parts of code, fixed few things, can't figure out how retrieve data , use regex correctly. i'm trying retrieve full address bbb link in url variable. how can pull company name , address efficiently? here code: import urllib2 import re print "enter industry keyword." print "example: florists, construction, tiles" keyword = raw_input('> ') print "how many pages dig through bbb?" total_pages = int(raw_input('> ')) print "working..." page_number = 1 address_list = [] address_pattern = r'<address>(.*?)<\/address>' # here issue page_number in range(1,total_pages): url = 'https://www.bbb.org/search/?type=category&input=' + keyword + '&filter=business&page=' + str(page_number) req = urllib2.request(url) req.add_header('user-agent', 'mozilla/5.0') resp = urllib2.urlopen(req) respdata = resp.read() ...

javascript - HTML DOM reflow and repaint CSS declared properties function -

i writing function can create nicer css function instead of having repaint , reflow every time set slew of css (i know use classes test case) , figured best thing first declared css styles, either inline, embedded, or external. explicit_set_styles function born. yet problem still creating repaint appending child element. how works get computed style of element want declared css properties create same type of element , "defaults" computed style iterate on , check differences if there means change in css declaration. remove type element testing dom so appending new dom element repaint dom, way can test defaults because not appending computed styles blank 100%. have solutions default values comparison values? function explicit_set_styles(){ var elm_defaultview = (this.ownerdocument || document).defaultview; var elm_computedstyles = elm_defaultview.getcomputedstyle(this,null); var element_test = document.createelement(this.tagname.tolowercase()); ...

jquery - Http 304 recieved for application heartbeat -

Image
i trying implement application heartbeat using jquery. the idea of change going reduce application session-timeout 30 minutes 10 minutes implement jquery application heartbeat every 2 minutes (120 seconds). heartbeat avoid user receiving application timeout when browser open if browser closed session should timeout in 10 minutes. i've implemented heartbeat using jquery follows... var heartbeatinterval = 120000; // send heartbeat every 2 mins var heartbeattimer = null; var retrycount = 0; var maxretries = 10; $().ready(function() { // register heart beat server keep session alive. heartbeattimer = setinterval(function() { $.ajax({ url: heartbeatajaxservleturl, type: 'get', error: function(data) { // server may down night or there may // network blip. such try send heart beat 10 times // if still failing kill heartbeat. retrycount = retrycount ...

node.js - How do I troubleshoot freebusy google calendar nodejs api? -

i trying free-busy information google calendar using nodejs api listed here https://developers.google.com/google-apps/calendar/v3/reference/freebusy/query . problem error response 'invalid request'. when run google's try tool, able response though. know getting authorized client. can troubleshoot further? function getavail(auth, datetimerange, calid) { var deferred = q.defer(); // new deferral calendar.freebusy.query({ auth: auth, items: [{id: calid}], timemin: (datetimerange.start).toisostring(), timemax: (datetimerange.end).toisostring(), }, function(err, response) { console.log('response calendar service: ' + response); if (err) { console.log('there error contacting calendar service: ' + err); deferred.reject(); // deferred reject here return; ...

how can we call SQL stored procedure in Entity framework 6.1.3? -

we tried add sp through model, after adding sp model, following code generated , getting build-in errors. aren't able build project. please find below code (context.cs file) reference. please us. public virtual objectresult<usp_getappusers_result> usp_getappusers(string displayname, string username, string userpassword, nullable<int> orgbranchid, string activestatus) { var displaynameparameter = displayname != null ? new objectparameter("displayname", displayname) : new objectparameter("displayname", typeof(string)); var usernameparameter = username != null ? new objectparameter("username", username) : new objectparameter("username", typeof(string)); var userpasswordparameter = userpassword != null ? new objectparameter("userpassword", userpassword) : new objectparameter(...

Recursive group capturing regex with backreference in JAVA -

i trying capture multiple groups recursively in string using backreference group within regex. though using pattern , matcher , "while(matcher.find())" loop, still capturing last instance instead of instances. in case possible tags <sm>,<po>,<pof>,<pos>,<poi>,<pol>,<poif>,<poil>. since these formatting tags, need capture: any text outside of tag (so can format "normal" text, , going capturing text before tag in 1 group while capture tag in group, , iterate through occurrences remove has been captured original string; if have text left on in end format "normal" text) the "name" of tag know how have format text inside tag the text contents of tag formatted accordingly tag name , associated rules here sample code: string currenttext = "the man said:<pof>“this one, @ last, bone of bones</pof><poi>and flesh of flesh;</poi><po>this 1 shall called ‘w...

git - Github and should i use it? -

i expanding tools web development , have come across github , git have been little scared start on. my jobs consist of developing websites modifying existing sites design or functionality. i presuming git , github used full web development form scratch, right? meant use github way client have access project too? anyway sorry noob question have no idea how incorporate git or github existing workflow. git version control system . it's popular these days , you, developer, benefit knowing well. version control practice in general , should using software it. git alternative and, said above, 1 of popular ones. github company provides git hosting service , few value adds (like integrated bug tracking, scheduling, wiki etc.) useful when you're doing larger projects , collaborating other developers.

java - Is it necessary to close an InputStreamReader in a BufferedReader -

this question has answer here: closing inputstreams in java 6 answers we know habit close streamreaders have defined @ end of code. now can see two readers defined below. bufferedreader , inputstreamreader.the bufferedreader closed, unable close inputstreamreader. java code: bufferedreader in = new bufferedreader(new inputstreamreader( connection.getinputstream())); if (in != null) { in.close(); } the problem here, if inputstreamreader in parentheses should closed? kind of code bring problem program? please tell me , thank you~ there no problem doing this, in fact inputstreamreader documentation java api it. in case, inputstreamreader being used bufferedreader , means both close when bufferedreader close() function called it: "closes stream , releases system resources associated it." inputstreamreader "associated...

html - error to do with endwhile in php code while makeing forum -

my new error this: have error in sql syntax; check manual corresponds mysql server version right syntax use near ') , type='o'' @ line 1 can fix , other errors in code: <?php session_start(); require"db_connect.php"; //get page id if(isset($_get['id']) && is_numeric($_get['id'] )) { $id = $_get['id'] ; } else { die("error!"); } //check see if id valid id $idcheck = $db->query("select * forum_tabl forum_id = '$id'"); if($idcheck->num_rows !==1){ die("error"); } $row = $idcheck->fetch_object(); $sql = "select post_id, post_title forum_post forum_id=) , type='o'"; if($query = $db->prepare($sql)){ $query->bind_param('s', $id); $query->bind_result($post_id, $post_title); $query->execute(); $query->store_result(); }else{ echo $db->error; } ?> <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en"...

r - Error: java.lang.RuntimeException: PipeMapRed.waitOutputThreads(): subprocess failed with code 1 -

please me solve issue in rmr2 (rhadoop integration) i using cloudera-quickstart-vm-5.4.0-0-virtualbox version details: hadoop 2.6.0-cdh5.4.0 java version "1.7.0_67" r version 3.2.0 rmr 2.3.0 below r code , error: sys.setenv("hadoop_home"="/usr/lib/hadoop") sys.setenv("hive_home"="/usr/lib/hive") sys.setenv("hadoop_cmd"="/usr/lib/hadoop/bin/hadoop") sys.setenv("hadoop_streaming"="/usr/lib/hadoop-0.20-mapreduce/contrib/streaming/hadoop-streaming-2.6.0-mr1-cdh5.4.0.jar") sys.getenv("hadoop_cmd") [1] "/usr/lib/hadoop/bin/hadoop" sys.setenv("rhive_fs_home"="/home/rhive") sys.setenv(java_home="/usr/java/jdk1.7.0_67-cloudera") library(rmr2) library(rhdfs) hdfs.init() ## map function map <- function(k,lines) { words.list <- strsplit(lines, '/t') words <- unlist(words.list) return( keyval(words, 1) ) } ## reduce func...

r - Unique combinations of two vectors without pair repetition -

this question has answer here: select equivalent rows [a-b & b-a] 1 answer i have problem need keep unique rows not have repeated pair e.g. if have table x1=c(1,2,3) , x2=c(2,1,3) first , third row kept. row (2,1) thrown out because (1,2) exists. can help? thanks! we can sort row using apply , logical index using duplicated remove duplicate rows. df1[!duplicated(t(apply(df1, 1, sort))),] # x1 x2 #1 1 2 #2 1 3 #3 1 1 #4 2 4 #6 2 2 #7 3 4 #8 3 2 data df1 <- structure(list(x1 = c(1l, 1l, 1l, 2l, 2l, 2l, 3l, 3l, 3l, 4l, 4l), x2 = c(2l, 3l, 1l, 4l, 1l, 2l, 4l, 2l, 1l, 2l, 2l)), .names = c("x1", "x2"), class = "data.frame", row.names = c(na, -11l))

Compare Strings from between 2 files using Java -

public class comparee { static int count=0; public static void main(string[] args) throws ioexception { string a,b; filereader fi = new filereader(new file("c:\\users\\ibm_admin\\desktop\\sam_public_monthly_20150802\\a.txt")); // new file filereader fii = new filereader(new file("c:\\users\\ibm_admin\\desktop\\sam_public_monthly_20150802\\b.txt")); // new file bufferedreader br =new bufferedreader(fi); //new bufferedreader br1 =new bufferedreader(fii); //old filewriter fw = new filewriter(new file("c:\\users\\ibm_admin\\desktop\\sam_public_monthly_20150802\\samnew.txt")); int count = 0; while((a=br.readline()) != null) { while((b=br1.readline()) != null) { if(!(a.equals(b))) { count++; fw.write(a); } } system.out.println(count); } } } hi, trying compare string a.txt , b.txt reading line line. writ...

TypeScript simplest way to check if item exists in array like C# Linq Any ( using any library ) -

typescript simplest way check if item exists in array c# linq ( using library ). var myarray=[1,2,3,4]; var is_3_exist=myarray.any(x=> x==3); use .some : myarray.some(x=>x==3);

How to disable default login box in windows universal app -

i want use unified ui handling different authentication type in win10 universal app, default login box(windows authentication) prompted when try access resource need authenticated windows authentication. is possible disable default popup login window in uwp application?

algorithm - Find the number of pairs where the first element is divisible by second element -

suppose, given numbers 8, 7, 6, 5, 4, 3, 2 you have find pairs (a, b) a appears in list before b , , a%b = 0 . here, such pairs are: (8, 4), (8, 2), (6, 3), (6, 2), (4, 2) is there better algorithm o(n 2 ) ? you can precompute list of divisors of possible integers in input = o(n^1.5) after iterate on input, while keeping track of how number worth (i.e. how many pairs form). for every number in input you'll need iterator on it's divisors, i.e. o(n^1.5) so total complexity o(n^1.5) n maximum of 100000 , size of input. class denominators { public static void main (string[] a) { int maxvalue = 100000; int[] problemset = {8, 7, 6, 5, 4, 3, 2}; system.out.println (new denominators().solve(problemset, maxvalue)); } ...

javafx - Include a main fxml with few controllers to other fxml layouts -

im doing fxml project using netbeans 8.0.2 , scene builder 2.0 use fx8. want add home button, logout button power button , background css containing fxml main fxml other fxml layouts main displayed , on top of sub fxml displayed. (just include property in php). im using anchor panes hold controllers in fxml. ive came across few methods googling none of them works. <children> <fx:include source="home.fxml"/> </children> was 1st code got included in main.fxml page. didnt work. <bottom> <fx:include source="home.fxml"/> </bottom> this did not work , gave error saying anchorpane doesnt support bottom tag. great if can point me out ive missed. thank you.

Android : Paint.getTextBounds returns width much greater than the width of the screen -

i have a textview width fill_parent under root layout means has width of screen 480 . trying measure bounds of text in text view. did : rect rect = new rect(); textview.getpaint().gettextbounds(text,0,text.length()-1,rect); log.v(tag,"width : height ="+rect.width()+" : "+width.height()); but prints 10278 : 79 . why printing width 10278 when scren width 480 ? if assuming single line , calculating point of having gettextbounds . the documentation states int end "1 past last char in string measure." http://developer.android.com/reference/android/graphics/paint.html#gettextbounds(java.lang.string , int, int, android.graphics.rect) you should have: textview.getpaint().gettextbounds(text, 0, text.length(), rect); this applies canvas.drawtext(). the textview displaying text "wrapping" text. method gettextbounds not aware of textview @ all. in fact, if build own custom view displaying text, gettextbounds useful achieving own...