Posts

Showing posts from April, 2014

android - hiding imagebutton1 on click then show imagebutton2 -

i have 2 image buttons. imagebutton & imagebutton2 , have place them both 1 on top , setted imagebutton2 ( invisible ). my goal click imagebutton1 hide imagebutton1 , show imagebutton2. here code have btn2.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { p.setflashmode(camera.parameters.flash_mode_off); camera.setparameters(p); camera.stoppreview(); islighon = false; findviewbyid(r.id.imagebutton).setbackgroundresource(r.drawable.offf); // imagebutton2.setvisibility(view.invisible); } }); btn1.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { p.setflashmode(camera.parameters.flash_mode_torch); camera.setparamet...

c# - How to automatically update the database on application start up? -

a run time error occurs when run code asking me code migration update database. not sure how this, can me? the model backing 'applicationdbcontext' context has changed since database created. consider using code first migrations update database you must enable automatic migrations in context configuration file internal class configuration : dbmigrationsconfiguration<yourcontext> { public configuration() { this.automaticmigrationsenabled = true; this.automaticmigrationdatalossallowed = false; }

multithreading - Java infinite loop performance -

i have thread has work when circumstance comes in. otherwise iterates on empty infinite loop: public void run() { while(true) { if(ball != null) { // calculations } } } does affect performance when loop nothing has check if has calculation every iteration? creating thread when needed not option me, because class implements runnable visual object has shown time. edit : following solution? or better use different method (concerning performance)? private final object standby = new object(); public void run() { while(true) { synchronized (standby) { while(ball != null) // should use while or if here? try{ standby.wait() } catch (interruptedexception ie) {} } if(ball != null) { // calculations } } public void handlecollision(ball b) { // more code.. ball = b; synchronized (standby) { standby.notify(); } } you might ...

regex - How to match (group2.*|^.*)group1 when no instance of groups 1,2,3, or 4 are in between? -

i'm using python 3.4. suppose have 4 groups composed of regular expressions g1 = 'g11|g22|...|g1m' g2 = 'g21|g22|...|g2n' g3 = 'g32|g32|...|g3p' g4 = 'g41|g42|...|g4q' for example, g1 might 'chickens|horses|bonnet(?>!blue )' . groups disjoint: no element in of 4 groups belongs more 1 group. groups can have number of elements greater 1. i want match on string if , if contains any instance of group_1 such either : no instances of of groups 1-4 precede said instance of group_1 or the instance of of groups 1-4 precedes said instance of group_1 not group_2. some strings on want match: 'g11' 'g31 g11' 'g41g11' 'g11 g21 g11' (the second instance of g11 violates rule 2. first instance of g11 not , rule 1 satisfied.) 'anything or nothing g11 or nothing' 'anything or nothing g31 or nothing g11' some strings on don't want match: 'g31 g21 g11' ...

HTML href - how to not rewrite GET parametrs -

i'm developing webpage , ran little trubble. there list of users need paginate ?page=5 , need search. can't figure how set href users/list?search=test&st=on&pa=on&te=on -> users/list?search=test&st=on&pa=on&te=on&page=5 can helps me? thanks, before. code: my pagination looks like: <li> <a href="?page={{ pagination.next_page_number }}" aria-label="next"> <span class="glyphicon glyphicon-triangle-right" aria-hidden="true"></span> </a> </li> and search form: ` <form class="form-inline" method="get" action=""> <div class="form-group"> <div class="input-group"> <input type="text" class="form-control" placeholder="search for..." id="search" name="search" value="{{ search }}"> <span class="inp...

c# - Where to put software version for WPF Application? -

Image
i'm working on new wpf project , i'm going label version 1.0.0 , on properties says assembly name , default namespace , target framework . no version . can find this? (along project name, description, contributors, etc. you close, under project properties--> application tab --> assembly properties button.

java - Best way to handle exceptions that can not occur -

i use following code build sql statement updates values of fields specific object has. question is, since check if object has specific field exception can never occur. best way make code more readable example avoid using try {} catch {} block. list<field> modelfields = arrays.aslist(model.getclass().getfields()); string updatestring = ""; (field field : fields) { if (modelfields.contains(field)) { try { updatestring += " " + field.get((object) model) + " "; } catch (illegalaccessexception e) { e.printstacktrace(); } } else { updatestring += " null "; } } if think exception should never happen, throw runtime exception wrapping original exception: try { updatestring += " " + field.get((object) model) + " "; } catch (illegalaccessexception e) { throw new illegalstateexception("this shoul...

javascript - Avoiding global scope? -

i include javascript in each page needs (more general js files go in document head): -- item.html -- <div id="item"> <script type="text/javascript" src="item.js"></script> ... </div> so in script file can grab container , use find things: -- item.js -- var container = $('scripts').last().parent(); var f = container.find('form'); however, if work needs done after page loads: $().ready(function() { var f = container.find('form'); }); i have problem because container scopes across files. consider: -- index.html -- <div id="item"> <script type="text/javascript" src="item.js"></script> ... </div> <div id="link"> <script type="text/javascript" src="link.js"></script> ... </div> <div id="part"> <script type="text/javascript" src="part.js">...

windows - Git -- QuickEdit on Command Line? -

Image
there 2 useful features git trying combine on windows: 1) quickedit mode, allows paste command prompt (this windows variable set on shortcut use launch). set shown here: 2) launching git context menu, allows jump straight directory, without having manually browse bash (i.e. if right-click on folder, select git bash, git bash open browsed folder). looks this: but, because quickedit mode windows variable (i think), , in case isn't turned on default, when launch git bash context menu, lose ability paste git bash... makes, among other things, cloning or setting remotes more annoying has be. any ideas on how can set quickedit mode turned on when launching git right-click context menu in windows? gui command prompt window menu defaults options quickedit mode reg file windows registry editor version 5.00 [hkey_current_user\console] "quickedit"=dword:1 command prompt reg add hkcu\console /v quickedit /t reg_dword /d 1 powershell sp -t d hk...

WHERE clause in INSERT statement using mysql/php -

after searching on google, came know that, can not use clause in insert query.. want insert value on column "book_4" "student_id = 1" how can ?? there alternate ? will thankful ! $query = "insert issued_books (book_4) values ('$issuedbooknumber')" ; edited: more details using insert query, when insert value in column "student_id" in table. columns in row of student_id (except student_id) shows 0 in db. dun know 0 means according db. might null or numeric 0. if numeric 0, should updated using update statement. whenever i'm trying update it, never updates using update statement. that's why i'm asking ! p.s: columns have datatype int. hope understand want :) here complete code. suppose: student_id created having value 2. issuedbooknumber = 51 using above values: result = new row created having columns 0 except column "issuedbooknumber" having value = 51. while want, result should be: on row studen...

python - Get (and sum) values of all attributes named 'test' in XML -

example xml doc: <main> <this test="500"> <that test="200"/> </this> </main> result: 700 all existing code snippets i've found on site , others rely on tag. example, "500" if reference both "this" , "test". i'm looking search "test" throughout entire doc/string. some modules i've tried (and resulted in failure) lxml, xml.dom, elementtree, xmltodict, , beautifulsoup, i'd suggest favor lxml parsing xml in python. lxml has full xpath 1.0 support, , xpath language/technology designed querying xml. once have right tool right job, can f.e : import lxml.etree et xml = """<main> <this test="500"> <that test="200"/> </this> </main>""" doc = et.fromstring(xml) result = doc.xpath("sum(//@test)") print(result) output : 700.0 brief explanation xpath being ...

ArrayList returning NullPointer Exception || Java || OOP -

this question has answer here: what nullpointerexception, , how fix it? 12 answers hey can please me understand why keep getting null pointer exception while trying run this? trying learn arraylist course taking. //////////////////////////////////////////// public class address { int housenumber; string roadnumber; string areaname; string cityname; public address(int hn, string rn, string an, string cn){ this.housenumber = hn; this.roadnumber = rn; this.areaname = an; this.cityname = cn; } public string tostring() { return "house # " + this.housenumber + "\nroad # " + this.roadnumber + "\n" + this.areaname + "\n" + this.cityname; } } ///////////////////////////////////////////////// import java.util.arraylist; public class addressreferences { arraylist<address> mycoll...

javascript - Is there a method so you'd find out which/name of functions that were being called? -

i trying handy in using google development tools. have method identify functions (specifically javascript) used/required before successful page load? inspect element, navigate each script in static html, open resource in sources, , put breakpoint @ beginning of each javascript file. refresh page, repeatedly click "step into" until functions have been called. can see call stack , scope every line of code executed in each resource.

javascript - Angular and Chosen Plugin -

i used chosen plugin in angular snippet of code <select ng-model="vendor_value" ng-options="vendor.text vendor in vendors" ui-jq="chosen" ui-options="{width: 300px}"></select> then rendered in browser <select ng-model="category_value" ng-options="category.text category in categories" style="border-color: red; display: none;" ui-jq="chosen" ui-options="{width: '300px', no_results_text: 'press enter add ', placeholder_text_single: '' }" class="ng-pristine ng-untouched ng-valid"> <option value="?" selected="selected" label=""></option> <option value="0" label="games">games</option> <option value="1" label="baby">baby</option> <option value="2" label="shoes">shoes</option> </select> ...

android - Theme.AppCompat.Light.NoActionBar issue -

in application i'm using parent="theme.appcompat.light.noactionbar" my style : <style name="apptheme" parent="theme.appcompat.light.noactionbar"> </style> the problem menu transparent, , need change - image1 image2

multithreading - how do i get a functon to repeat in java -

i making slapjack game deck need give cards slapzone every 5 seconds , flip image 2 seconds before turning picture over. know have use thread, can't figure out how repeat every 5 seconds know repeating part take loop though. code: public void run () { thread thisthread = thread.currentthread(); while (thisthread == mythread) { try { (int = 0 ; < numcards ; i++) { deck.giveslapzone(slap1); } mythread = null; // kills thread } catch (interruptedexception ie) { system.out.println(ie.getmessage()); } } } you can use scheduledthreadpoolexecutor if believe may grow past trivial implementation. scheduler thread handle multiple threads , exceptions in smoother manner. see example in... timertask vs thread.sleep vs handler postdelayed - accurate call function every n milliseconds?

How do I record my voice and make it a file in java? -

i'm trying code, after test 5 , test 9, code seems stop functioning @ audiostream.write() . nothing after audiosystem.write(audiostream, audiofileformat.type.wave, audiofile); is executed program. how fix or there way record voice? import javax.sound.sampled.*; import java.io.*; public class mic{ public static void main(string[] args){ system.out.println("sound test starting"); try { audioformat format = new audioformat(audioformat.encoding.pcm_signed, 44100, 16, 2, 4, 44100, false); dataline.info info = new dataline.info(targetdataline.class, format); if(!audiosystem.islinesupported(info)) { system.err.println("line not supported"); } final targetdataline targetline = (targetdataline)audiosystem.getline(info); targetline.open(); system.out.println("recording voice"); targetline.start(); ...

google api - Calendar "Created by" field -

i'm creating event google calendar api. when create events, 1 of fields in event called "created by" , lists email address of service account used create event (123456789-qwertyuiop@developer.gserviceaccount.com) rather gmail address of main account (my_address@gmail.com). can change created field of main account? the created field not marked "writable" in documentation https://developers.google.com/google-apps/calendar/v3/reference/events means it's read , cannot modify it.

email - PHP - Curl - Form Issues -

i have script check if email:password in site, want able mass check being able copy , paste bunch of email:password's seperate lines in textarea, when , click submit seperate email :pass aswell pass email: , put them variable , check them curl 1 one. no idea start email:pass seperation im guessing explode()? php: <?php if(isset($_post['email']) && isset($_post['pass'])){ $url = 'http://example.com/api/?checkere='.$_post['email'].'&checkerp='.$_post['pass']; $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_useragent, 'mozilla/5.0 (windows nt 6.3; wow64) applewebkit/537.36 (khtml, gecko) chrome/39.0.2171.95 safari/537.36'); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_ssl_verifyhost, 0); curl_setopt($ch, curlopt_ssl_verifypeer, 0); curl_setopt($ch, curlopt_followlocation, 1); $page = curl_exec($ch); if (strpos($page, '<title>works...

c# - Populating non-serializable object with Json.NET -

in test want populate object (a view model) json string. example, target object has property: public string query { get; set; } so want able this: var target = ...; jsonconvert.populateobject(target, "{ 'query': 'test' }"); however, query property not being set. debugging through code, appears properties on target ignored because member serialization opt-in. since target class not data contract , not populated in way outside of unit tests, cannot opt member serialization via attributes. i can't find way modify member serialization outside. hoping overload of populateobject taking settings allow me so, don't see way so. how can ensure populateobject sets properties on target though isn't data contract? you can create contractresolver interprets classes opt-out rather opt-in: public class optoutcontractresolver : defaultcontractresolver { protected override ilist<jsonproperty> createproperties(type type, memb...

c# - Xamarin: How to get HTML from page in WebView? -

xamarin: how html page in webview? i develop xamarin app ios , using webview. just html of page, use following code. webclient wc = new webclient(); using (stream st = wc.openread("http://study-csharp.blogspot.jp/")){ using (streamreader sr = new streamreader(st, encoding.utf8)){ string html = sr.readtoend(); console.write(html); } } however, want html data after user has logged in site in webview. i can't find method html in uiwebview. thanks in advance. you can use javascript webview.evaluatejavascript ("document.body.innerhtml")

The "Go to matching pair" feature of Emmet plugin for Notepad++ -

Image
i've installed emmet plugin notepad++ plugin manager (the python script plugin has been installed beforehand well). it's convenient web development. "go matching pair" feature doesn't work me. make work, there settings/configuration? you need install html tag plugin. use ctrl + t procedure , example :

java - Why do I get an "unreachable code" and "variable not initialized" compilation error? -

hi new java , trying develop existing anti-ragging application support newer api lollipop gingerbread. have decompiled apk , extracted source code , built in gradle system. although source code correct,i getting 3 errors in java code...not been able figure out week. the app contains 4 screens. main screen send button send message, second settings screen 2 buttons set message want send , set contacts whom want send message... other 2 screens custom dialog layouts of set meaasge & contact. no errors in main java file giving reference mainactivity.java: package com.eminem.sharath.antiragging; import android.content.intent; import android.content.sharedpreferences; import android.location.location; import android.location.locationlistener; import android.location.locationmanager; import android.os.bundle; import android.support.v7.app.actionbar; import android.support.v7.app.appcompatactivity; import android.telephony.smsmanager; import android.view.menu; import android.v...

How can I fix this switch case menu error in C? -

well first let me show code... #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> void load_menu(void); void flood(void); void dos(void); void scan(void); int main(int argc, char** argv) { // ip values const char* google_dns_server = "192.168.1.1"; int dns_port = 53; struct sockaddr_in serv; int sock = socket ( af_inet, sock_dgram, 0); //socket not created if(sock < 0) { perror("socket error"); } printf (" \n"); printf (" __ __ ____ ____ \n"); printf (" ( ) ( ) ( , |( , | \n"); printf (" )(__ )__( ) _/ ) _/ \n"); p...

java - JNI UnsatisfiedLinkError undefined symbol -

i trying load .so file (libinfexprparser.so) using jni. not have source code shared object. getting following error: exception in thread "main" java.lang.unsatisfiedlinkerror:/home/tomcat/sahithi/exprparser/libinfexprparser.so: /home/tomcat/sahithi/exprparser/libinfexprparser.so: undefined symbol: _zn8iustringc1epkcm @ java.lang.classloader$nativelibrary.load(native method) @ java.lang.classloader.loadlibrary0(unknown source) @ java.lang.classloader.loadlibrary(unknown source) @ java.lang.runtime.loadlibrary0(unknown source) @ java.lang.system.loadlibrary(unknown source) @ expressionparser.main.(main.java:20) java code: native void parseexpr(); static { system.loadlibrary("infexprparser"); system.out.println("loaded expr parser"); } public static void main(string[] args) { main mainobj = new main().parseexpr(); } i using redhat lin...

ios - NSNotification - observer with multiple events to trigger -

as stands, nsnotifications allow target-action mechanism in response 1 post / event. i have notification triggers action (runs function) after 2 events have been triggered. the scenario have 2 asynchronous processes need complete before can call function. perhaps i'm missing something, haven't found way this. or maybe i'm not thinking of obvious reason why bad idea? also, of terminology may off, please feel free edit , fix it. there many possibilities on how can implement this. center around keeping track of processes finished. best way depends on how background processes implemented. if using nsoperationqueue add third operation has other 2 operations dependency. way won't have take care of notifications @ all. otherwise can can count how many operations have finished , execute code when counter reaches right value. gcd has dispatch groups nice abstraction this. first create dispatch group: let group = dispatch_group_create() then enter gro...

string - count cells quantity with a special contained word and calculate the percentage -

Image
how can count cells quantity special contained word , calculate percentage in excel? for example have survey database product. feedbacks "good, not bad, bad". i want count quantity of each type of feedbacks , calculate percentages , draw diagram of that. this should achievable countif . https://support.office.com/en-us/article/countif-function-e0de10c6-f885-4e71-abb4-1f464816df34 formulas: e1 =sum($e$2:$e$10000) e2 downwards needed: =countif($b:$b,$d2) f1 downwards needed: =$e1/$e$1

fetch two values in python from .txt file -

i have .txt file containing values. need fetch 2 values @ time using python , perform operations on , fetch next 2 values. i want write python script can fetch 2 values @ time. new python. thanks! # read file first , split lines in list open('temp.txt', 'r') f: lines = f.read().splitlines() # loop through lines, 2 @ time in range(0, len(lines), 2): # notice last argument '2', makes loop step 2 @ time val1 = lines[i] val2 = lines[i+1] # perform calculation on val1 , val2 hope helps.

Python import : AttributeError: 'module' object has no attribute 'test' -

i think that's stupid problem, can't figure out why following attributeerror: 'module' object has no attribute 'test' when running test3.py . here project tree : . ├── __init__.py ├── test3.py └── testdir ├── __init__.py └── test.py my test3.py : #!/usr/bin/python import testdir if __name__ == "__main__": print(testdir.test.var) my test.py : #!/usr/bin/python import os var=os.path.abspath(__file__) i tried import var way : from testdir.test import var edit: 1 works -thanks @user2357112- still know how import whole test.py file without from ... import ... if possible. :) and tried import ..testdir relative import got syntaxerror . and if try import testdir.test nameerror: name'test' not defined . how import file? i'm bit confused. edit bis : i apologize, when tried import testdir.test , modified print(testdir.test.var) print(...

android - Visual Studio 2015 RC & Cordova: Could not reserve enough space for object heap (solved) -

environment vs 14.0.22823.1 d14rel jdk1.7.0_55 32 bit comes current android sdk windows 8.1 problem: create new project of type "appache cordova apps", leave default name "blankcordovapp3" build app default settings: works fine doubleclick config.xml; config editor opens; goto "platforms" , change cordova cli "5.0.0." rebuild solution several times and/or select "clean solution" error message: "error occurred during initialization of vm; could not reserve enough space object heap " solution: do not change jvm arguments, there reason cordova scripts use settings of minimum maximum heap size. in case: c:\program files\java\jdk1.8.0_31 instead, use 64 bit jdk , either set path environment variable (control panel => environment variables) or in vs goto "tools => options => tools apache cordova => environment variable overrides" clean and/or rebuild solution solved problem me d...

redirect - Grails: Carry forward params on hyperlink is clicked -

how carry forward parameters when hyperlink clicked? here gsp code: <g:link class="grid_link" controller="user" action="delete" id="${userinstance.id}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'are sure, want delete?')}');">delete</g:link> here controller code: def delete() { try { def userinstance = user.get(params.id) //deleting user //successful. redirect(action: "list", params: params) } catch (exception e) { log.error("deleted exception---->>" + e.getmessage()) } } redirect missing params . wanted carry forward params on redirect . the url before clicked on 'delete' hyperlink looks like: http://localhost:8080/message/list?offset=10&max=100 after 'delete' hyperlink clicked, url looks like: http://localhost:8080/message/list/11...

openstack - python-keystoneclient.', DeprecationWarning) -

i configuring openstack on centos 7 , getting below error when run keystone command have installed required packages openstack please suggest me fix issue. [root@controller ~]# keystone tenant-create --name=admin --description="admin tenant" /usr/lib/python2.7/site-packages/keystoneclient/shell.py:65: deprecationwarning: keystone cli deprecated in favor of python-openstackclient. python library, continue using python-keystoneclient. 'python-keystoneclient.', deprecationwarning) expecting auth url via either --os-auth-url or env[os_auth_url] [root@controller ~]# keystone user-create --name=admin --pass=admin4demo --email=admin@openstack.com /usr/lib/python2.7/site-packages/keystoneclient/shell.py:65: deprecationwarning: keystone cli deprecated in favor of python-openstackclient. python library, continue using python-keystoneclient. 'python-keystoneclient.', deprecationwarning) expecting auth url via either --os-auth-url or env[os_auth_url] [root@con...

javascript - How to get content from another website using JQ or JS -

how contents of website, mean entire html code using jquery , javascript , parse content parsing every tag , every attribute response. answer must appreciated. i guess u can achieve using iframe or using jquery.load

Android listview arrange alphabetically -

i have listview .item in listview come database . problem item have not arrange in alphabetically order.help me solve problem.this listview activity code this code of datalist activity. public class datalistactivity extends activity { listview listview; sqlitedatabase sqlitedatabase; fooddbhelper fooddbhelper; cursor cursor; listdataadapter listdataadapter; private button button1; listdataadapter dataadapter = null; button button; dataprovider dataprovider; arraylist<hashmap<string, string>> namesslist; edittext inputsearch; string search_name; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_no_title); setcontentview(r.layout.data_list_layout); listview = (listview) findviewbyid(r.id.list_view); listdataadapter = new listdataadapter(getapplicationcontext(), r.layout.row_layout) { @override protected void showcheckedbutton(int po...

Convert json to struct using reflection in golang -

func deserialize(request *http.request,typ reflect.type) (interface{}, *httpnet.handlererror){ data,e:=ioutil.readall(request.body) fmt.println(string(data)) if e !=nil{ return nil,&httpnet.handlererror{e,"could not read request",http.statusbadrequest} } v:=typ.elem() payload:=reflect.new(v).elem().interface() eaa:= json.newdecoder(request.body).decode(payload) if e!=nil{ fmt.println(eaa.error()) } fmt.println(payload) fmt.println(reflect.valueof(payload) ) return payload,nil } to call it: r,_:= deserialize(request,reflect.typeof(&testdata{})) it not throw errors , looks valid operation me , result empty structure of expecting type. whats problem that? the problem passing non pointer instance of type: payload:=reflect.new(v).elem().interface() means "allocate new pointer type, take value of it, , extract interface{} . you should keep at: payload:=reflect.new(...

java - Notifications not show up -

i working on messaging app, sends user notification when on different activty on app or on app if user on messagingactivity.java updates chat history , not send notifications fine, problem arises when user on messagingactivity.java meanwhile email or else happen user leaves messagingactivity.java open , checks app if in meantime message comes user not receive notifications public void parserequest(bundle extras) { if (extras.containskey("for") && extras.containskey("recipientid")) { if (integer.parseint(extras.getstring("recipientid")) == m.getid(this)) { switch (extras.getstring("for")) { case "chat": if (isrunning("messagingactivity")) { intent intent = new intent("update_messages_list"); intent.putextra("data", extras); sendbroadcast(intent); ...

c# - CSharpAPI.sln does not build solution -

i'm learning how integrate apis program, writing in c#. this, following tutorial based on visual studio 2010, using tutorial provided here: https://www.interactivebrokers.com/en/software/api/apiguide/csharp/csharpsampleapptutorial.htm and api available here: http://interactivebrokers.github.io/ now problem @ step 3, have build solution csharpapi.sln-file. open in visual studio, navigate "build solution" , following output build: ========== build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ========== this not yield .dll-file need. output need declare "1 succeeded" , compile .dll-file "/source/csharpclient/bin/release" i using visual studio express 2013 windows desktop. right click visual studio "run administrator".

postgresql - sql delete based on group by -

Image
i have following query: select user_id, trajectory_id, count(trajectory_id) point group user_id, trajectory_id it returns following result: and want delete records point table count in produced table < 5. right have following query, not compiling. wrong , how can fix it? delete point count(trajectory_id) < 5 group user_id, trajectory_id i using postgres. delete p1 point p1 join ( select user_id, trajectory_id point group user_id, trajectory_id having count(trajectory_id) < 5 ) p2 on p1.user_id = p2.user_id , p1.trajectory_id = p2.trajectory_id

is this equivalent to Dictionary() in R? -

i following book machine learning in r , got following code: sms_train<-apply(sms_train,margin=2,convert_counts) sms_dtm_train <- sms_dtm[1:4169, ] and in book says: to save list of frequent terms use later, we'll use dictionary() function: sms_dict <- dictionary(findfreqterms(sms_dtm_train, 5)) but problem new tm() library not have dictionary() function included in new version. know if line equivalent: sms_dict<-findfreqterms(sms_dtm_train,5) thanks below comment here, found can use terms() function like: sms_dict<-terms(sms_dtm_train) the main problem cannot use findfreqterms(sms_dtm_train,5), program not work correctly. any help?

canvas - Android. How can I make an ImageView draw itself as a PNG? -

an imageview has been loaded 1514 × 564 png image of 67kb. a linearlayout, containing several views including such imageview, needs drawn canvas. when calling method imageview.draw(canvas), canvas size in bytes increases 67kb 13mb! (because "draw" draws bitmap, not compressed png) is there easy way make imageview draw png? so far, i've thought of extending imageview , overriding draw method compresses bitmap before drawing. is there easy way make imageview draw png? no, because there no such concept. moreover, have png, unclear why calling draw()` in first place. if want png, use png. so far, i've thought of extending imageview , overriding draw method compresses bitmap before drawing. that pointless, need re-decompress image before drawing it. canvas draws bitmap , not png, , bitmap decompressed image.

c# - My logical is wrong somehow -

this should simple, somehow not. messagebox displays zero's both product quantity , product total price. not quite sure why. here code far: product page //will add qty of tshirts shop page. catch non-integers protected void linktshirtadd_click(object sender, eventargs e) { int intoutput = 0; lbltshirtwarning.visible = false; //determine value parsable - if is, assign values. else, display error if (int.tryparse(txttshirtqty.text, out intoutput)) { productclass.productname = "t-shirt"; productclass.productprice = 10; productclass.productqty = int16.parse(txttshirtqty.text); //price of tshirts int totaltshirtprice = productclass.productprice * productclass.productqty; //display summary of order messagebox.show (new form {topmost = true}, "order review" + "\n_______________________\n" + productclass.productname + "\n" + ...

angularjs - using ng-class on keyup function value -

i trying accomplish simple valid toggle on outcome of keyup function. basically, input keyup action triggers function. stuff, returns true or false. upon this, css class of span near input should changes. missing in ng-class? have searched similar topic still couldn't overcome problem. html code: <div ng-repeat="drug in inputdrugs track $index"> <label>type drug name</label><br/> <input ng-keyup="getrxcui(medvalue, $index)" ng-model="medvalue" placeholder="something advil" /> <span class="alert alert-danger" role="alert" ng-class="{'alert alert-success': getrxcui(medvalue, $index)}">?</span> </div> in controller.js: $scope.getrxcui = function(medvalue, index){ var rxcui = '', url = 'blabla' + medvalue; $http.get(url). success(function(data, status){ ...

java - Can't resolve symbol class plus client -

i used default login activity after building app got 2 errors in "plusbaseactivity" cannot resolve symbol class googleplayservicesclient changed googleapiclient , still cannot resolve symbol class plus client that's code below : package net.egy_develop.scci; import android.content.intent; import android.content.intentsender; import android.os.bundle; import android.app.activity; import android.util.log; import com.google.android.gms.common.connectionresult; import com.google.android.gms.common.api.googleapiclient; import com.google.android.gms.common.scopes; import com.google.android.gms.plus.plusclient; /** * base class wrap communication google play services plusclient. */ public abstract class plusbaseactivity extends activity implements googleapiclient.connectioncallbacks, googleapiclient.onconnectionfailedlistener { private static final string tag = plusbaseactivity.class.getsimplename(); // magic number use know our sign-in...