Posts

Showing posts from January, 2014

java - Reading from new folders every x seconds and using their data -

currently writing application in java looks through files in directory (call 'topics'). within directory number of folders named after respective topics, maybe 'dog', 'cat', etc. i using scheduledexecutorservice through directory every 30 seconds, going through each topic folder , performing operation on contents in folder (we'll other independent piece of code writing these topic folders, maybe log file or something). what best way examine new subdirectories each 30 seconds? if start topic dog, , somewhere between 30 seconds topics 'cat' , 'bird' added, best way me through new folders? thinking comparing hashset or something, i'm not sure efficient way this. i ask because there potentially great amount of subdirectories being created, , seems me problematic try loop through each 1 directory.listfiles(). advice? use java's watchservice api. the watchservice api low level, allowing customize it. can use is, or c

SQL select near by values -

i have table " t_person " 2 fields search by: height int, birthdate datetime . when query table want rows values near searched. example when search people height of 175 cm, this: select * t_person height = 175 i rows height value near 175. eg 174, 173,176... same thing date column. when search '2003-06-25', dates close it. is possible? you need sort of measure on constitutes close. suspect want exact matches appear first. so, order rows "nearness" use: select p.* t_person p order abs(height - 175); filtering results useful, can add where clause: select p.* t_person p height between 175 - 2 , 175 + 2 order abs(height - 175); the same idea can work dates. however, don't specify database in question , date functions highly database specific.

Python matrix using min function in k-means -

i trying learn k-means book"machine learning in action" now. using code given book in ipython notebook, outcome matrix([[<map object @ 0x0000000008832c88>]], dtype=object) happened after input locmat = mat(loaddataset("user1.txt")) , min(locmat[:,0]) . what meaning of outcome? why not exact value 3.245555? code showed below, thank in advanced! def loaddataset(filename): datamat = [] fr = open(filename) line in fr.readlines(): curline = line.strip().split('\t') fltline = map(float,curline) #map elements float() datamat.append(fltline) return datamat def disteclud(veca, vecb): return sqrt(sum(power(veca - vecb, 2))) #la.norm(veca-vecb) def randcent(dataset, k): n = shape(dataset)[1] centroids = mat(zeros((k,n))) j in range(n): minj = min(dataset[:,j]) rangej = float(max(dataset[:,j]) - minj) centroids[:,j] = mat(minj + rangej * random.rand(k,1)) retu

java - Validation of Apache Commons Configuration Values -

i'm using apache's commons-configuration (v 1.10) library provide configuration values program. use compositeconfiguration of systemconfiguration , propertiesconfiguration in order allow users override properties file java's -d command-line argument. the problem i'm running validation of values in configuration (ensure value of x positive, example). near can tell, commons-configuration library (neither 1.10 nor 2.0-beta) not provide means of validating configuration values. yes, can validate xml document that's used xmlconfiguration (and that's hear if try google answer question). doesn't me values come systemconfiguration part of configuration class. so, missing something? library provide way validate values i'm missing, or there java library that's built on commons-configuration provides validation capabilities? or need build derivative of compositeconfiguration ?

java - The Execution of the following code fails to terminate despite giving the expected output, why? -

the execution of following code used update redirected urls urls present in excel, fails terminate despite giving expected output. program selects excel file in urls checked present updates url url present in excel redirects. can give me reason. import java.io.file; import java.io.fileinputstream; import java.io.fileoutputstream; import java.io.ioexception; import java.net.url; import java.util.arraylist; import java.util.list; import javax.net.ssl.httpsurlconnection; import javax.swing.jfilechooser; import javax.swing.jframe; import org.apache.poi.ss.usermodel.cell; import org.apache.poi.ss.usermodel.row; import org.apache.poi.xssf.usermodel.xssfsheet; import org.apache.poi.xssf.usermodel.xssfworkbook; public class selenium_sample1 extends jframe { public static void main(string[] args) throws ioexception { string s, sss = null; int rownum = 6; jframe jf = new jframe(); jfilechooser filechooser = new jfilechooser(); filechooser.setcurrentdi

Find and Replace in Visual Studio using Regex -

i found out can use regex search queries in find , replace in visual studio. have lot of similar lines so: datum["id"] = id; datum["name"] = name; i have more lines so: this.id = datum["id"]; this.name = datum["name"]; i want turn first lines to: datum.set("id", id); datum.set("name", name); and second set of lines to: this.id = datum.get<int>("id"); this.name = datum.get<int>("name"); how possible find , replace , regex? can't figure out. after enabling regular expression clicking on 'use regular expression' button, place following in find: datum\[\"id\"\]\s*=\s*id\; and place following in replace (no need use regex in replace): datum.set("id", id); similarly: in find: datum\[\"name\"\]\s*=\s*name\; in replace: datum.set("name", name); in find: this\.id\s*=\s*datum\[\"id\"\]\;

Performance tuning for data quality in SQL Server -

i working in sql server 2008. have database use run data quality validations on test files receive our source system before load our production data warehouse instance. in past, these test files have been small. but, receiving large amounts of data (on order of 3 [gb]). have been asked performance tune our database handle this. because run data quality validations, have designed tables in db handle trashiest data possible. instance, though equivalent tables in production have appropriate data types, had create columns varchar(255), such import of test data tables doesn't run data type conflicts. also, there duplicates. so, tables simple. they're bunch of varchar(255) columns, no constraints, indexes, or key relationships defined. also, tables truncated. general process follows: -a user loads test files tables -the user executes stored procedures against table, run our data quality tests -the next user loads test files tables , runs data quality tests ... -the t

javascript - why don't inline events with function names work on divs? -

Image
i feel such noob question cannot life of me figure out. http://jsfiddle.net/37pj3bro/5/ <div onclick="dingo()">click me</div> <div onclick="alert(this)">click me 2</div> <script type="text/javascript"> function dingo() { alert("hi"); } </script> the first click me not alert second 1 does. can't figure out why.... the code in question works fine: <div onclick="dingo()">click me</div> <div onclick="alert(this)">click me 2</div> <script type="text/javascript"> function dingo() { alert("hi"); } </script> the code in js fiddle doesn't work because you've configured dingo not global.

Google Search Appliance indexing MySQL DB -

we running gsa 7.2.0.g.114 trying fetch data mysql db. connector 4.1.0 support ● oracle 11g ● microsoft sql server 2008 cant use out of box (content sources > databases settings) requires manual syn. know how indix mysql database in gsa? thanks - manju have tried it? if can connect using jdbc driver, don't see why wouldn't work.

titlebar - hide project path in Android Studio title bar? -

Image
is possible hide path of project being shown in title bar of android studio? i have as: "project name - android studio" but instead have like: "project name [path/to/project/] - [app] - [/path/to/file/] - android studio - version number" i looked everywhere in settings couldn't find option that. no, there no option of intellij idea 14.1 , android studio 1.2.

Android - first launch interactive tutorial -

i'm writing new app android , implement first launch tutorial. in particular, tutorial has interactive. basically, after user registers service, minimum settings required. i'd today have google apps, sheets, docs , far. exception there tutorials have aim explain how app works. here want have user can input data. i looking @ showcaseview seems deprecated , old in style. so here question is: best way implement that? viewpager? i had other question , did not much. any advice appreciated. edit: have found other nice alternative. appintro seems looking for. :) there few found quick searching github: https://github.com/seishin/showcaseview-android https://github.com/worker8/tourguide https://github.com/amlcurran/showcaseview i'm pretty sure can find right 1 ;)

haskell - Handling exceptions thrown by pure code with `try` -

i playing exceptions in haskell , stumbled upon 1 thing can't understand yet. in ghci do: prelude control.exception> let thrower = (read "a") :: int prelude control.exception> :{ prelude control.exception| let main = prelude control.exception| x <- (try $ return thrower) :: io (either someexception int) prelude control.exception| print x prelude control.exception| :} prelude control.exception> main this defines thrower , test expression fail exception. then define main wraps expression try (wrapping io first, since try accepts io ) , unwraps io (produced try ) , print s it. everything looks great far - evaluating main in repl gives exception wrapped either: right *** exception: prelude.read: no parse however, if try compile , execute same code app: module main import control.exception thrower = (read "a") :: int main = x <- (try $ return thrower) :: io (either someexception int) print x ... gets crash

html - How do I line up input fields with bootstrap? -

i don't think quite understand how bootstrap works grid. want name , actual field match unless screen size xs every field own row. each row, want text boxes aligned. here's i've tried. <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/> <div class="container" style="width:80vw"> <form role="form"> <div class="row top-buffer"> <div class="col-sm-4 "> <div class="form-group"> <label for="inputlabel3" class="col-sm-3 control-label">date:</label> <div class="col-sm-8"> <input type="date" class="form-control" id="inputlabel3" placeholder="date"> </div> </div> </div> <div class="col-sm-4 &qu

database - Tracking number of times web content has been viewed within a page? -

i reading more quora's answer rank algorithm, , came across following feature i'm trying reverse engineer: http://blog.quora.com/improved-answer-ranking-follow-up "with new answer ranking, not focusing solely on absolute number of upvotes , downvotes; considering level of attention answer has received. example: if 20 people see answer , , 20 of them upvote it, may stronger quality signal if thousands of people see answer 100 upvote it." little background on quora: it's similar stack exchange in layout. posts question, people reply answers, , site ranks/displays answers in single page. given answers compiled single page, how quora keep track of number of views each individual answer has gotten? potential hypothesis: each individual answer stored in database, counter of how many times has been fetched. when user first visits page, first few answers fetched database , shown on page. user scrolls down, more answers dynamically fetched through additio

responsive design - CSS font sizing relative to parent -

is there font sizing unit in css allows me specify sizes relative parent element; vw , vh example relative viewport width , height respectively. i want parent relative size responsive design. example parent element 400px wide, want text half of width, i'm not sure if can specify - or if such feature supported. just use font-size value ising em instead of px or pt. example, if have div width , height of 400px, use font-size: xxem (where xx numeric value). alternately, can include % in font size well.

string - substr() method in C++ -

i trying substring expressions individual tokens such !, &, | (), etc. having trouble fact when try make sub-string of "!(s&b|h)&!(s&j|r)&!(p)" cout line below, get: "(s&j|r)&!(p)", when thought should be: "(s&j|r)". either beyond have seen or simple not getting it. lot. thanks. #include <iostream> #include <string> using namespace std; int main(int argc, const char * argv[]) { string name = "!(s&b|h)&!(s&j|r)&!(p)"; cout<<name.substr(10,16)<<endl; return 0; }//main i did not understand question if want get (s&j|r) you should do: name.substr(10,7) the second parameter length.

java - How to send bulk SMS with ProgressDialog in Android Studio? -

here problems : i know how send sms, i'm using in loop like this , , know it's not send sms, i'd add delay (i.e. 1000 milliseconds). how ? i'd use progressdialog show progress of sending sms. know i've use thread or asynctask this. don't find working code... for moment, i've code, doesn't work : button sendbutton = (button) findviewbyid(r.id.sendbutton); sendbutton.setonclicklistener(new button.onclicklistener() { @override public void onclick(view v) { if (!studentlist.isempty()) { (int = 0; < studentlist.size(); i++) { student currentstudent = studentlist.get(i); currentstudent.sendsms(); } } else { toast.maketext(getapplicationcontext(), "the list empty.", toast.length_short).show(); } } }); if need more information, not hesitate. i'd have working sample code... beginner in java , android development, remember how d

c++ - Does std::async started with std::launch::async span not more that one thread per scope and block on function exit? -

reading article on async , future : void fun() { std::async(std::launch::async, []{ f(); }); // temporary's dtor waits f() std::async(std::launch::async, []{ g(); }); // not start until f() completes } got impression if fun called block until g() executed. please tall me wrong , there reasonable tasks pool behind std::async logic?

making a one to many form html that serializes no javascript -

i trying make simple form allows multiple photos added before upload. creating object manually javascript var objarr = []; for(var = 0; < <arrayofinputs>.length; i++){ objarr.push({ img://image file caption://caption text title://image title tags://image tags }); } and submit form. there way structure html markdown have same effect. i tried <form> <fieldset name="img[]"> <input type="file" name="img"/> <input type="text" name="caption"/> ... </fieldset>//repeat each photo this not have desired effect. pure html solution possible or need use javascript serialize form manually? after serialization object should this:(im using mongodb shouldn't effect structure of form) { 'name':'some name', 'description':'some description', 'images':[{ 'img'

pointers - Decimal to Binary in C -

i'm creating program adds , subtracts 2 numbers. have output answer different bases. my answer in decimal format, of type long double, such as: long double answer; answer = numberone + numbertwo; i want convert answer binary. have code used earlier in program this, char pointer: char * decimalbinary (char * decimalnumber) { bool zerofront = true; int i; int z; int j = 0; int n = atoi(decimalnumber); char * binarynum = malloc(32+1); binarynum[32] = '\0'; int current_index=1; int end_index = strlen(decimalnumber)-1; //error check valid decimal input, needed error check beginning of code while(current_index <= end_index) { if(decimalnumber[current_index] != '0' &&decimalnumber[current_index] != '1' &&decimalnumber[current_index] != '2' &&decimalnumber[current_index] != '3' &&decimalnumber[current_index] != '4' &&decimalnumbe

Developing a gui for optimization of image correlation (Matlab) -

i programming novice (just started using matlab month ago), apologize if asking lot. basically, being asked to: develop approach scoring image match between 2 images develop geometric shape program in matlab generate synthesis images few parameters develop gui run global optimization toolbox i able complete first 2 tasks. first one, use function "corr2" compute correlation between 2 images. second task, wrote program outputs shaded red upside down isosceles triangle. here code wrote: function [ output_args ] = trianglefit( x,y,m ) % script finds vertices of inverted triangle % 3 input, 3 output x_2 = (m^2 / (1 + m^2))^(0.5) + x; y_2 = m * (x_2 - x) + y; x_3 = -(m^2 / (1 + m^2))^(0.5) + x; % (x_2 , y_2) = right vertex of triangle % (x_3 , y_3) = left vertex of triangle % y_2 = y_3 axis([x_3-2 x_2+2 y-2 y_2+2]); patch([x x_2 x_3],[y y_2 y_2],'red') axis off end i'm stuck on task #3. being asked use global optimization toolbox find best x,y, , s

java - Why is old generation bad? -

an object can copied between survivor spaces 7 times before relocated old generation space , understand object has every chance of being garbage collected before being put old generation space. lecture listening states avoid object promotion young generation space old generation space. my question why promotion old generation bad? lecture doesn't explain that. why old generation bad? the lecture listening states avoid object promotion young generation space old generation space. it's not promotion old generation bad in general . it's bad when objects short lifetime promoted accident. you want long-lived objects in old generation not interfere minor collections. allocation rates inverse object lifetimes (which gives rise weak generational hypothesis) . in means short-lived objects generated @ high rate. , in turn means: if short-lived objects promoted old gen old gen filled @ high rate. minor gcs less expensive major gcs, in terms of pause t

ios - UIView doesn't scroll inside UIScrollView in vertical -

Image
i have uiviewcontroller . has uiview 3 objects( uilabel , uiimageview , uitextview ) inside uiscrollview . when try scroll vertical nothing happens. use autolayout. before made without uiview inside uiscrollview there empty space in bottom. @iboutlet weak var scrollview: uiscrollview! { didset { scrollview.delegate = self scrollview.scrollenabled = true self.scrollview.frame.size = scrollview.contentsize //12 } } if using auto layout no need set frame of scrollview, give view subview of scrollview height constraint e.g. 800 , set scrollview , outer view width constraint match width each device , set scrollview frame using autolayout, start scrolling. refer link further details

linux - How to print file/directory details using ls and AWK? -

i trying print output below using command: ls -l| awk '/777/{print $0}' or ls -l| awk '/0777/{print $0}' but not print anything. o/p should like, drwxrwxrwx 2 sbcoper sbcprd 4096 apr 20 2015 work (i using 0777 or 777 because of find . -type f -perm 0777 ) you've got right idea, 777 octal representation of permissions, , you're looking @ output of ls, lists permissions string, "drwxrwxrwx", simple modification of command work nicely, ls -l | awk '/rwxrwxrwx/{print $0}'

sql server - SQL Most efficient way to create int value from dateTime -

using sql server 2008 r2, have trigger updates field after update. inserts date each of updated rows. line in trigger action: set t.lastupdateddatetime = current_timestamp using yyyymmddhhmmss above line insert 2015-07-16 16:19:00. have situation business wants integer version of this. what effective way achieve this. have work seems long , expensive: set t.lastupdateddatetimeint = cast('' + cast(year(getdate()) varchar(4)) + right('0' + cast((month(getdate())) varchar(2)), 2) + right('0' + cast((day(getdate())) varchar(2)), 2) + right('0' + cast((datepart(hh, getdate())) varchar(2)), 2) + right('0' + cast((datepart(mi, getdate())) varchar(2)), 2) + right('0' + cast((datepart(ss, getdate())) varchar(2)), 2) bigint) is there better more efficient way this? desired outcome 20150716161900 a secondary question. not fan of storing dates integers @ all. in fact have never done before current role. can ask opinions on

r - gridsvg does not work when used inside a function -

i want define plot saving function uses gridsvg device package gridsvg. library(ggplot2) library(gridextra) mtcars$gear <- factor(mtcars$gear,levels=c(3,4,5), labels=c("3gears","4gears","5gears")) mtcars$am <- factor(mtcars$am,levels=c(0,1), labels=c("automatic","manual")) mtcars$cyl <- factor(mtcars$cyl,levels=c(4,6,8), labels=c("4cyl","6cyl","8cyl")) myplot <- qplot(mpg, data=mtcars, geom="density", fill=gear, alpha=i(.5), main="distribution of gas milage", xlab="miles per gallon", ylab="density") saveplot <- function(filename, plot, plotwidth = 15, plotheight = 10){ gridsvg:::gridsvg(name = filename, width = plotwidth, height = plotheight) print(plot) dev.off(which = dev.cur()) } however if try use function not work. error results: saveplot(&

python - How to change language on the template in django-rosetta -

i installed django-rosetta in project. created .po , .mo files. template have code shows text translated in django-rosetta (from django docs). how create link direct each of translated pages? {% get_current_language language_code %} <!-- current language: {{ language_code }} --> <p>{% trans "welcome our page" %}</p> <p>{{ language_code }}</p> {% language 'pl' %} {% get_current_language language_code %} <p>{% trans "some text translate" %}</p> {% endlanguage %} {% language 'en' %} {% get_current_language language_code %} <p>{% trans "some text translate" %}</p> {% endlanguage %} {% language 'ru' %} {% get_current_language language_code %} <p>{% trans "some text translate" %}</p> {% endlanguage %}

Windows Python 2.7 multiprocessing.Manager.Queue deadlocks on put from child process -

i'm trying code similar following example working correctly: from multiprocessing import process, queue, manager, pool import time datetime import datetime def results_producer(the_work, num_procs): results = manager().queue() ppool = pool(num_procs) multiplier = 3 #step = len(the_work)/(num_procs*multiplier) step = 100 in xrange(0,len(the_work), step): batch = the_work[i:i+step] ppool.apply_async(do_work1, args=(i,batch,results))#,callback=results.put_nowait) return (ppool, results) def results_consumer(results, total_work, num_procs, pool=none): current = 0 batch_size=10 total = total_work est_remaining = 0 while current < total_work: size = results.qsize() est_remaining = total_work - (current + size) if current % 1000 == 0: print 'attempting retrieve item queue empty? %s, size: %d , remaining work: %d' % (results.empty(), size, est_remaining) item = res

Android: NullPointerException in onTextChanged() method with EditText -

hello android developer, i keep getting nullpointerexception in ontextchanged() method when edittext changes text. but not on smartphones. lg g2 not throw errors, eg samsung galaxy s 4 does. have 2 edittexts. entering numbers program takes both values , calculates something. , strange when keyboard opens , press key , del-key works. here code: edittext bestellt = new edittext(this); bestellt.setinputtype(inputtype.type_class_number); bestellt.setgravity(gravity.center_horizontal); bestellt.setems(3); bestellt.settextappearance(this, android.r.style.textappearance_medium); bestellt.setbackgroundcolor(color.parsecolor("#dbf2fc")); bestellt.sethint(html.fromhtml("<small><small><small>" + "bestellt" + "</small></small></small>")); //bestellt.setoverscrollmode(view.over_scroll_never); bestellt.setimeoptions(editorinfo.ime_flag_no_extract_ui|editorinfo.ime_flag_navigate_next); temptablerow

php - ErrorException array to string conversion on migrate --seed -

i'm trying set first laravel project when try have artisan seed database faker throws [errorexception] array string conversion i'm working stock users migration file , using command php artisan migrate --seed any guidance appreciated use illuminate\database\schema\blueprint; use illuminate\database\migrations\migration; class createuserstable extends migration { /** * run migrations. * * @return void */ public function up() { schema::create('users', function (blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('email')->unique(); $table->string('password', 60); $table->string('role', array('user', 'admin', 'superuser')); $table->remembertoken(); $table->timestamps(); }); } /** * reverse migrations. * * @return void */ public function down() { schema::drop(

jquery - Javascript AJAX insert value -

so making site shows value of .txt file, got far: <script> $(document).ready(function() { $("#responsecontainer").load("info.txt"); var refreshid = setinterval(function() { $("#responsecontainer").load('info.txt'); }, 1000); $.ajaxsetup({ cache: false }); }); </script> so get's string info.txt , puts inside div resonsecontainer. but want same string in value of meter, , auto updater that. code is: <meter id="cpumeter" value="60" min="0" max="120.47" title="gb"> <div class="meter-gauge"> <span style="width: 46.42%;"></span> </div> </meter> how autoupdate value="60" string of info.txt? thanks! you can give callback argument .load() , , receive contents of file. $(document).ready(function() { function loadinfo() { $("#responsecontainer").load('info.txt', fun

javascript - adding the selected text on the webpage inside a field in an injected sidebar chrome extension when clicked -

hi have chrome extension injects sidebar when clicked.what want if select location on webpage , click on extension, automatically fills location input bar selected text , call maps api inside iframe location name query.i have tried using window.getselection().tostring() inside script.js gives me empty string on console log. new chrome extension, not have hang on how the selected text. appreciated. thanks script.js var place; function handlerequest(request, sender, sendresponse) { if (request.method == "getselection") //sendresponse({data: }); if (request.callfunction == "togglesidebar") { togglesidebar(); console.log("adasda"); place = window.getselection().tostring(); } } chrome.extension.onrequest.addlistener(handlerequest); var sidebaropen = false; function togglesidebar() { if(sidebaropen) { var el = document.getelementbyid('mysidebar'); el.parentnode.removechild(e

php - Debug class as singleton? -

my question simple: should create debug class singleton? i know the singleton pattern bad practice , debug class not take part in logic in app, , complexify entire application inject debug class every class. my debug class contain methods such as: debug::message(); debug::dump(); debug::spot(); // create timeline // etc it should noted use the debugbar package , , present in dev mode, debug class if package present, if so, pass informations it, otherwise, nothing (or maybe log important things). ok, want do static calls avoid tossing around instance of debug class. makes sense. and if want use static calls, alternative singleton write class consists of static properties/methods. the decision whether go or singleton pretty simple: class have internal state and/or require constructor? example, if open log file or instantiate other objects, you’ll want singleton. singleton frowned upon, , there are reasons this . there still situations makes sense , valid appro

javascript - Variable "iii" declared as a counter in for loop not working -

tl;dr version: there reason variable name of "iii" wouldn't work expected when used counter in loop? longer, funnier version: i'm writing javascript iterate through layers , pageitems in adobe illustrator cc 2014 , stuff them. in third nested loop, used variable named "iii" counter so: for(var iii = 0; iii < curitem.pageitems.length -1; iii++){ //try stuff curitem.pageitems[iii], "undefined" } i spent long while trying figure out wrong logic , kept coming nothing. went through colleague line-by-line, desperate, hoping (or i) might notice trivial might have overlooked (he's not of programmer understands bits , pieces). asks me why named counters "i", "ii", , "iii". said saw use "ii" nested loop , thought "that's kinda neat, it's short , communicates nesting level of loop!" tell him doesn't matter, "iii" valid variable name. convinces me humour him replace "

scala - Play 2.4.1: How to replace all the occurrences of one or more keys in a JSON tree -

given following json... { "id" : "52fe942b790000790079b7d0", "email" : "joe@domain.com", "username" : "joe", "subscriptions" : [ { "accountid" : "72fe942b790000790079b755", "name" : "test 1", "isdefault" : true }, { "accountid" : "72fe942b796850790079b743", "name" : "test 2", "isdefault" : false } ] } .. need transform each id objectid required mongodb (i.e. id -> _id \ $oid , accountid -> accountid \ $oid : { "_id" : {"$oid" : "52fe942b790000790079b7d0"}, "email" : "joe@domain.com", "username" : "joe", "subscriptions" : [ { "accountid" : {"$oid" : "72fe942b790000790079b755"}, "name" : "test 1

My simple form activity does not run (Android) -

this might basic question, don't know how fix it. i'm trying run simple example code create forms (android 5.1.1. api 22) using library called nexusdialog here , when want run (given after referencing required library code), see popular fatal exception error shown bellow. how can fix it? 07-16 14:24:07.959: e/androidruntime(22469): fatal exception: main 07-16 14:24:07.959: e/androidruntime(22469): process: com.example.test, pid: 22469 07-16 14:24:07.959: e/androidruntime(22469): java.lang.runtimeexception: unable instantiate activity componentinfo{com.example.test/com.example.test.mainactivity}: java.lang.classnotfoundexception: didn't find class "com.example.test.mainactivity" on path: dexpathlist[[zip file "/data/app/com.example.test-2/base.apk"],nativelibrarydirectories=[/vendor/lib, /system/lib]] and here main code (exact project folder uploaded here ) package com.example.test; import java.util.arrays; import com.github.dkharrat.nexusdia

ios - Receiver has no segue with identifier ... programmatically created segue -

programmatically created segue crashes app on performseguewithidentifier:, don't want use storyboard though. - (void)viewdidload { [super viewdidload]; // additional setup after loading view. viewcontroller *viewcontroller = [[viewcontroller alloc] init]; self.segue = [[uistoryboardsegue alloc] initwithidentifier:@"showinfo" source:self destination:viewcontroller]; //change background color white self.view.backgroundcolor = [uicolor whitecolor]; //create table view uitableview *tableview = [[uitableview alloc] init]; //initialize data source , delegate self - methods going specified in script tableview.datasource = self; tableview.delegate = self; //register class tableview [tableview registerclass:[uitableviewcell class] forcellreuseidentifier:@"cell"]; //now assign table view our our viewcontroller's property self.view = tableview;} segues can't created programmatically. apple's documentation says: you not create segue ob

jsf - javax.servlet.ServletContainerInitializer: Provider org.apache.myfaces.ee6.MyFacesContainerInitializer not a subtype -

i'm trying migrate jsf (myfaces, trinidad) project 1.2 2.0. i've followed this link . below i've did. 1. updated xmlns of faces-config.xml, web.xml, facelets.xml 2. updated jar files (myfaces 2.0.16, trinidad 2.0.1) 3. removed facelets 3. removed alternate_view_handler tag web.xml 4. changed classloadermode parent_last in 8.5 using jspx alone , not xhtml pages. el-api 2.2 , el-ri 1.1.11 in our lib folder when start server, i'm getting below exception. please me resolve problem. containerhelp e wsvr0501e: error creating component com.ibm.ws.runtime.component.compositionunitmgrimpl@8d7ccd79 com.ibm.ws.exception.runtimewarning: com.ibm.ws.webcontainer.exception.webappnotloadedexception: failed load webapp: <b>failed load webapp: javax.servlet.servletcontainerinitializer: provider org.apache.myfaces.ee6.myfacescontainerinitializer not subtype </b> @ com.ibm.ws.webcontainer.component.webcontainerimpl.install(webcontainerimpl.java:432) @ c

posix - ssize_t data type in XDR for RPC -

i writing rpc application. need use ssize_t data type in c portion , needs sent on wire. should represent ssize_t in idl? can cast int want know correct way casting int, not sure if correct way. xdr type int (iow, should use hyper) represents 32 bit integer. check onc+ developer's guide details.

transactions - arules package in R , some methods won't work -

i doing function given transaction x , set of rules y, if x whole subset of y interested in cause can recommendation based on rules (i using "groceries" dataset) trying using %ain% crazy seems rstudio not recognizing it, leave code , error throws. install.packages("arules") library(arules) myfunction <- function(t,w,z){ lav <- (t %ain% w,arr.ind=true) lav <- z[lav,] lav <- unique(lav) return (lav) } data("groceries") x <- list(c("pip fruit","root vegetables","yogurt","soda","fruit/vegetable juice")) reglas = apriori(groceries, parameter=list(supp=0.0006, conf=0.98)) t <- as(x,"transactions") z <- slot(reglas,"rhs") w <- slot(reglas,"lhs") inspect(myfunction(t,w,z)) and error: error in evaluating argument 'x' in selecting method function 'which': error in (function (classes, fdef, mtable) : unable find inh

ruby on rails - omniauth.auth for Facebook not returning full hash and not able to successfully login with facebook -

i'm working on facebook clone project http://www.theodinproject.com/ruby-on-rails/final-project . i'm stuck omniauth-facebook portion, , i'm not able login facebook. think problem might due request.env["omniauth.auth"]. when try raise request.env["omniauth.auth"].to_yaml. following incomplete hash. it's missing lot of information such first_name, last_name, gender, etc. --- !ruby/hash:omniauth::authhash provider: facebook uid: &#39;10206926404981253&#39; info: !ruby/hash:omniauth::authhash::infohash name: thomas pan image: http://graph.facebook.com/10206926404981253/picture credentials: !ruby/hash:omniauth::authhash token: <token> expires_at: 1442277104 expires: true extra: !ruby/hash:omniauth::authhash raw_info: !ruby/hash:omniauth::authhash name: thomas pan id: <id> ** replaced info <> security. i'm using along devise well. everything else seems set correctly i've followed instruct

Doing math in vb.net like Eval in javascript -

is there way parse string in vb.net (like, built in methods), can math eval can? example, 3+(7/3.5) string return 2. i not asking code me, want know if there built in way this, if there not code myself. i can wager not able parse stuff sin(90) on own, , understand need replaced math.sin(90). if there built in method, how use it? there's shortcut limited (ie. simple) math expressions using datatable.compute method . obviously, isn't robust (limited functionality) , feels hackish misuse datatable purpose, figured add current answers. example: var result = new datatable().compute("3+(7/3.5)", null); // 5 "sin(90)" wouldn't work approach. refer datacolumn.expression property page list of supported functions, under "aggregates" section. using system.codedom namespace option. some helpful links: codedom calculator evaluating mathematical expressions using codedom related question: is there string math evaluator in

html - Switching to Meteor -

i have website , decided switch on using meteor. created meteor project , copied previous files new meteor folder followings error each html page. index.html:1: bad formatting in html template i new meteor, missing something? have old files work in meteor ? if had html files , dropped them meteor install, result quite bit different might expect, sounds of it. i'll explain briefly, suggestion tutorial on meteor.com website , read through of documentation. the way meteor works templates, html, example: <body> {{> main}} </body> <template name="main"> <h1>this title</h1> {{> text}} </template> <template name="text"> <p>some example text</p> </template> to have different pages, you'll need set router, means installing routing plugin (like iron router or flow router), , dynamically displaying different templates depending on url (which pretty router does). ro

angularjs - When I change the value of an input clicking on a button $bindTo doesn't work firebase -

so i'm beginner angularjs , firebase , i'm trying develop app adds values(numerical) on input. far have this: app.js: var app = angular.module("app", ['firebase']); app.directive('addone', function() { return { link: function(scope,element) { element.bind('click', function() { console.log(element.parent().find('input')) element.parent().find('input')[1].value++; }); } } }); and view: <section class="form-group"> <label for="">$</label> <input type="button" value="+" add-one> <input ng-model="user.level" type="text" class="form-control" /> </section> and controller: app.controller('mcontroller', ['$scope', 'user', function($scope, backhome, user, adicionar){ $scope.user = user(1);

javascript - jquery function on textbox value change when checkboxes are checked -

i have text-area getting populated values of checkboxex being checked. want call jquery function when content of text-area changed. tried following function working when content changes via key not due checkbox value mapping. $(document).ready(function(){ $('#message_sent_to').on('propertychange change keyup paste input',function() { alert("hello"); var limit = $('#promo_limit').val(); alert("<%= @p_limit %>"); }); the text-area is <%= f.text_area :sent_to, :class => 'form-control'%> there 2 checkboxes, 1 mapping value of checkbox , 1 mapping individual checkbox value. <%= check_box_tag "contact_no[]", staff.contact_no %> <%= check_box_tag "contact_nos[]", @staff_members.map(&:contact_no).join(', ') %> note: code checkbox mapping long, not posting here. you can using javascript checking textbox value, i.e changed

c++ - Qt reading file and mapping to QVector very slow (crashes) -

so trying read file , map 2 dimensional qvector. here code far void datamodel::parsefilebylines() { qvector<qvector<qstring> > dataset; lasterror = ""; qregexp reg(filedelimiter); qfile infile(inputfile); if (infile.open(qiodevice::readonly)){ qtextstream fread(&infile); long totalsize = infile.size(); qstring line; while(!fread.atend()){ line = fread.readline(); dataset.append(line.split(reg,qstring::keepemptyparts).tovector()); } }else{ lasterror = "could not open "+inputfile+" reading"; } } my issue when dealing 1000,000 lines or more program crashes message saying "this application has requested runtime terminate in unusual way". there more efficient way can achieve goal ? if how ? the input file may in format so id,name,age,gender...etc 1,sam,12 ... ... 1000000 i appreciate or advice i have tested (qlist) version here on computer , runs faster qvector vers