Posts

Showing posts from May, 2011

python - searching a csv file and then outputting a term associating to the term -

i creating code, read csvs file , search specific item code , output name of item. how this? don't have code yet thanks you can use pandas install it, try import pandas pd df = pd.read_csv('yourfile.csv') print df

wpf - Show/Hide items in itemscontrol on condition -

i have itemscontrol using display list of start information sent timing system. i need able "switch off"/stop displaying set of lane info if lane number isn't showing (if it's null or blank) , if timer sends info switch lane on show data again. i can't set delete because timer sends information , except lane number reappear again. is possible show/hide items on condition? what happening lanes 1 ------ 2 ------ ------ <- other info remains 4 ------ what want happen lanes 1 ------ 2 ------ 4 ------ here sample of itemscontrol code <itemscontrol itemssource="{binding cheat.swimlist}" margin="10,0" horizontalalignment="left" verticalalignment="top"> <itemscontrol.template> <controltemplate targettype="itemscontrol"> <stackpanel> <stackpanel orientation="horizontal">

java - Beans Binding in JTextField doesn't work -

i tried work beans binding in java. followed code in sites. , tried make work. here, did is, tried update person's first name value entered in textfield user during run time. when click button, contains "omg". if replace "" contains value. refer looks work once. what's wrong it? did miss here? can resolve this? i interchanged source , target , tried also import java.beans.propertychangelistener; import java.beans.propertychangesupport; public abstract class abstractmodelobject { private final propertychangesupport propertychangesupport = new propertychangesupport(this); public void addpropertychangelistener(propertychangelistener listener) { propertychangesupport.addpropertychangelistener(listener); } public void addpropertychangelistener(string propertyname, propertychangelistener listener) { propertychangesupport.addpropertychangelistener(propertyname, listener);

cluster analysis - K-modes clustering in R for categorical data with NAs -

> dat <- data.frame(x=sample(letters[1:3],20,true),y=sample(letters[7:9],20,true),stringsasfactors=false) > dat[c(1:5,9,17,20),1] <- na;dat[c(8,11),2] <- na > dat x y 1 <na> h 2 <na> 3 <na> g 4 <na> h 5 <na> 6 c h 7 c g 8 <na> 9 <na> g 10 c g 11 b <na> 12 g 13 g 14 g 15 b 16 g 17 <na> h 18 19 g 20 <na> g i'm trying clustering on categorical data using klar::kmodes , have trouble dealing these nas. a workaround came treating nas new category: > dat[c(1:5,9,17,20),1] <- "na";dat[c(8,11),2] <- "na" > (cl <- kmodes(dat,modes=dat[c(6,7),])) k-modes clustering 2 clusters of sizes 11, 9 cluster modes: x y 1 "na" "h" 2 "a" "g" clustering vector: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 1 1

google cloud platform - What type of timestamp does "gcloud compute instances list" produce -

when output gcloud compute instances list json, timestamps this: 2016-05-22t12:22:29.285-07:00 but can't find explanation of format in documentation. interpret as: yyyy-mm-dd-t<hours>:<minutes>:<seconds>.<fraction>-<timezone> i doubt there's documented guarantee on how timestamps emitted appears rfc3339 fractional seconds. interpretation correct except that: yyyy-mm-dd-t yyyy-mm-ddt, simple typo i'm sure -<timezone> +/- time offset utc

Stack-overflow using recursion in C -

i've been looking frantically answer no avail; i've created quadtree supposed sort array of more 1000 objects declared struct: typedef struct node { char is_leaf; struct particle *p; double m; double center_x; double center_y; double width; struct node *sw; struct node *nw; struct node *se; struct node *ne; } node; into quadtree function: node* quadtree_insert(node *n, struct particle *p, double center_x, double center_y, double width) { if(n == null) { n = (node*)malloc(sizeof(node)); n->is_leaf = 1; n->p = p; //n->m = 0.1; n->sw = null; n->se = null; n->nw = null; n->ne = null; if(width < 1e-300){ n->width = 1e-300; } else n->width = width; return n; } else{ //n = (node*)malloc(sizeof(node)); double x; double y; i

numpy - Generating random vectors of Euclidean norm <= 1 in Python? -

more specifically, given natural number d, how can generate random vectors in r^d such each vector x has euclidean norm <= 1? generating random vectors via numpy.random.rand(1,d) no problem, likelihood of such random vector having norm <= 1 predictably bad not-small d. example, d = 10 0.2% percent of such random vectors have appropriately small norm. seems silly solution. edit: re: walter's comment, yes, i'm looking uniform distribution on vectors in unit ball in r^d. based on wolfram mathworld article on hypersphere point picking , nate eldredge's answer similar question on math.stackexchange.com, can generate such vector generating vector of d independent gaussian random variables , random number u uniformly distributed on closed interval [0, 1] , normalizing vector norm u^(1/d) .

jaxb - How to get formatted output when marshalling to XMLEventWriter? -

i trying marshal jaxb annotated object stax xmleventwriter, when set marshaller property jaxb_formatted_output true in result marshalled object not formatted. thanks ps: using oracle java 8 ri , woodstock stax ok have found solution. if have used xmlstreamwriter, there built in wrapper called indentingxmlstreamwriter, not find same eventwriter. than found answer reference stax utils. have added maven manifest <dependency> <groupid>net.java.dev.stax-utils</groupid> <artifactid>stax-utils</artifactid> </dependency> and able use indentingxmleventwriter.

Is there any function which checks a mathematical expression and returns a valid number in SQL server? -

i have below code im using isnumeric function check validity of expression math in sql. but if use isnumeric function here returns 0 both 2 conditons listed below. need function or method identify valid mathematical expression. is there alternative 1 ? begin declare @rcnt varchar(100) declare @ncnt varchar(100) --condition1 set @rcnt = '(5918800.000 / 4963400.000) * (slaughter(1023))' --condition2 set @ncnt = '(5997200.000 / 5059900.000) * (400000.000)' select isnumeric(@rcnt) validittcheck select isnumeric(@ncnt ) validittcheck end isnumeric() check variable valid numeric datatype, not result of evaluation of string expression valid numeric value. values became non-numeric first '(' evaluated. the way know desired result use dynamic sql. here example, notice put try catch in there because slaughter() function not exist , exception raised, return 0 not number: declare @rcnt nvarchar(100) declare @ncnt nvarchar(100) --condition1 set @rcnt

android studio - Blank Activity Fit To Screen -

Image
in android studio 2.1, want create main activity 2. how can ? please see attachment. can fix exact screen size of device android game ? simple way: in activity need extends activity instead of appcompatactivity : public class youractivity extends appcompatactivity ==> public class youractivity extends activity update: put in oncreate() method, go full screen mode getwindow().getdecorview().setsystemuivisibility( view.system_ui_flag_layout_stable | view.system_ui_flag_layout_hide_navigation | view.system_ui_flag_layout_fullscreen | view.system_ui_flag_hide_navigation | view.system_ui_flag_fullscreen | view.system_ui_flag_immersive_sticky);

Bash: if then match on multiple conditions if all are true -

i'm writing script checks 3 different variables , matches on true. need return true if conditions match. right returning true if 1 or 2 conditions match list of operators. if [ -z "$var3" ] || [ "$var1" -ge 10 ] || [ "$var2" != "working" ]; echo "app failed "$var1" check-ins" exit 2 elif [ -n "$var3" ] || [ "$var1" -le 10 ] || [ "$var2" == "working" ]; echo "$var3" pid active connection "$var2" exit 0 fi should replace || && ?? yes, || represents or logical operator, returns true if @ least 1 of operators true. && represents , logical operator, returns true if , if o operators true if [ -z "$var3" ] && [ "$var1" -ge 10 ] && [ "$var2" != "working" ]; echo "app failed "$var1" check-ins" exit 2 elif [ -n "$var3" ] &&am

How do you display a literal {{ in Angular 2 -

i have template in angular2 rc 1 need display chunk of code different language. language has {{ in it. import {component, input} '@angular/core'; @component({ selector: 'blue-box', template: ` <div class="blue-box"> <div class="blue-box-title">{{boxtitle}}</div> {{define "bob"}}this template bob{{end}} <span> <ng-content></ng-content> </span> </div> `, styleurls: ['../css/blue-box.css'], }) export class bluebox { @input() boxtitle: string; constructor() { } } how template processor treat {{ literal string instead of start of template expression? problem occures @ {{define "bob"}} need literal {{. the error on browser (chrome) console is: exception: template parse errors: parser error: unexpected token 'bob' @ column 8 in [ {{define &qu

multithreading - python - update thread variable -

how update variable inside running thread, infinite loop based on such variable? simplified version of tried follows, no results of course, , can't find pointer. import some_module mod import threading class thr (threading.thread): num = 5 # set default value start script def run (self): mod.num = num mod.main_loop() try: thr().start() time.sleep(1) thr().num = 2 time.sleep(1) thr().num = 6 time.sleep(1) thr().num = 8 the problem you're creating new thread each time "call" (i.e. instantiate) thr . change code to t = thr() t.start() time.sleep(1) t.num = 2 time.sleep(1) t.num = 6 time.sleep(1) t.num = 8 time.sleep(1)

rgdal - Trouble merging shapefiles in R -

i having trouble merging shapefiles in r. here code far: library(rgdal) library(maptools) library(gridextra) setwd("/users/cornelius/dropbox/cornelius_sharedfolder") #load geodatabase fgdb = "/users/cornelius/dropbox/cornelius_sharedfolder/rwandagdb.gdb" subset(ogrdrivers(), grepl("gdb", name)) fc_list = ogrlistlayers(fgdb) print(fc_list) #get shapefiles geodatabase: residence=readogr(dsn=fgdb, layer="résidence") territoire = readogr(dsn=fgdb,layer="territoire") chefferie=readogr(ds=fgdb, layer="chefferie") sous_chefferie=readogr(ds=fgdb, layer="sous_chefferie") rwandapre2002=readogr(ds=fgdb, layer="rwandapre2002") country_boundary2012=readogr(ds=fgdb, layer="country_boundary2012") province_boundary2012=readogr(ds=fgdb, layer="province_boundary2012") sector_boundary2012=readogr(ds=fgdb, layer="sector_boundary2012") district_boundary2012=readogr(ds=fgdb, layer="di

android - Parse json's element that can be different types using gson -

i have json object inside can have property can array or boolean value. question how can parse json without having issues while parsing it? here im talking about: { "offerid": "24", "image1": "1452678081_56961bc195cf8.jpg", "image2": "1452678081_56961bc195f38.jpg", "image3": "1452678081_56961bc196124.jpg", "featured": false, "hide_button": false, "categoryid": "1", "locations": [ { "address": "problemveien 13, 0313 oslo", "long": "10.722052800000029", "latitude": "59.9409999" }, { "address": "akersgata 68, 0180 oslo", "long": "10.744572199999993", "latit

gridview - Automatically collapsing a detail when opening another in a shieldui grid hierarchy -

i have shieldui grid, , i'm using hierarchy open detail underneath individual rows. works well. thing don't when open hierarchy leaves other detail panels open. i'd behave accordion---when 1 opened other closes. is there straightforward way this? the desired functionality can achieved via custom code. each expansion of row, can collapse others. can done via method below: http://www.shieldui.com/documentation/grid/javascript/api/methods/collapserow

r - Expand data.frame into distinct rows -

this question has answer here: r creating sequence table 2 columns 4 answers i trying figure out how can expand data.frame in r distinct rows. this, mean using startyear , toyear variables create annual data.frame id replicated each distinct year in sequence from=startyear to=endyear. i have example data.frame: testdat <- data.frame(id=seq(1,10), startyear=c(1946,1960,1965,1976,1955,1999,2013,1981,1983,1995) ) testdat$endyear <- testdat$startyear+sample(1:10,10,replace=true) this creates: id startyear endyear 1 1 1946 1951 2 2 1960 1966 3 3 1965 1969 . . .... .... what desired result this: id year 1 1946 1 1947 1 1948 1 1949 1 1950 1 1951 2 1960 . .... any advice on how great. thanks. try "hadley'verse", namely dplyr , tidyr : library(dplyr) library(tidy

angular - Is there any destroy hook for pipes in angular2 (same as for components)? -

after investigating several days(!?!) huge memory leakage of current angular2 application, came new discovery: apparently, async pipe, heavily used throughout application, subscribing observable, never released (unsubscribed) when component , pipes cleaned-up. it accumulated number of ~11,000 observers single observable few user actions (which caused app crash). i need unsubscribe observable, , in order need hook destruction, similar ngondestroy, pipes. is there such hook, or if not, how suggest unsubscribe? if take @ async pipe code, can see using ngondestroy how in directive. snippet asyncpipe code: @pipe({name: 'async', pure: false}) @injectable() export class asyncpipe implements ondestroy { ... ngondestroy(): void { if (ispresent(this._subscription)) { this._dispose(); } } ... } the key using: pure:false , from ondestroy to create stateful pipe, should implement interface , set pure parameter false in pipemetadata

database - Titan index update takes too long -

even on empty database, creating index in titan 1.0 takes several minutes. time seems exact, suggests there unnecessary delay. my question this: how shorten or eliminate amount of time titan takes reindex? conceptually, since no work being done time should minimal, not 4 minutes. (n.b. have been pointed solution makes titan wait full delay without timing out. wrong solution - want eliminate delay entirely.) the code i'm using setup database scratch is: graph = ... local cassandra instance ... graph.tx().rollback() // 1. check if index exists mgmt = graph.openmanagement() = mgmt.getgraphindex('byident') if(! i) { // 1a. if index not exist, add idkey = mgmt.getpropertykey('ident') idkey = idkey ? idkey : mgmt.makepropertykey('ident').datatype(string.class).make() mgmt.buildindex('byident', vertex.class).addkey(idkey).buildcompositeindex() mgmt.commit() graph.tx().commit() mgmt = graph.openmanagement() idkey = mgmt.get

sms - Android Number sendMessage to New Number -

i have 2 classes 1 selecting pets called selectpetsscreen has button called change number .this button allows user change number message sent new number (device) problem tried make new value of number 1 written in textedit number=input.tostring(); but says number cannot resolved variable (but set public in other class) next try included in code , still have same number try created object calls setnumber() method still no hope :( selectpetsscreen.java package com.set.petshome; import android.app.activity; import android.app.alertdialog; import android.content.*; import android.media.mediaplayer; import android.os.bundle; import android.text.editable; import android.view.*; import android.widget.button; import android.widget.edittext; import android.widget.imagebutton; public class selectpetsscreen extends activity { fishtank ii=new fishtank(); imagebutton fbutton,sbutton,tbutton; private mediaplayer mp0,mp1; string value; @override public vo

Does Firebase offer a visual way to view and update tabular data? -

does firebase offer way view , update our data in more human-readable format, rather large trees of text? parse has great browser viewing , updating tables of data, found invaluable. easy find specific data, , columns had helper menus creating pointers , references objects in other objects/tables. easy translate spreadsheet data databases of users/places/etc. guess i'm looking similar in firebase, if exists. any appreciated. firebase schemaless database. since stores data json, offers visualization of data editable tree in firebase console. not offer table view, although create yourself.

authentication - google authenticator vs vbscript -

i have implemented http://jacob.jkrall.net/totp/ in vbscript. my code given same hex gives right 6-digit otp, part working. i've verified hmac-sha-1. encoding against online generator, http://www.freeformatter.com/hmac-generator.html#ad-output , same input gives same output. my time same http://www.currenttimestamp.com/ i've generated qrcode @ http://www.qr-koder.dk/ string otpauth://totp/$label?secret=$secret , google authenticator app reads code , starts outputting 6 digit code changing every 30 seconds. but codes app not match 6-digit code vbscript generates! i've tried trunc(time/30) +/-7500 steps see if timezone/daylight saving problem, no avail. as other parts of routine generate 6 digits seem work i've come conclusion don't understand this: the url on qr-code otpauth://totp/$label?secret=$secret with explanation label can used describe key in app, while secret 16-character base32-encoded shared secret, known both client , se

swift - Set Use Storyboard Id Programmatically iOS -

Image
i trying set property of viewcontroller: use storyboard id . can set in storyboard easily: (use storyboard id checked) how can programmatically using swift? thanks!

serialization - SignalR not serializing NodaTime types despite JsonSerializer settings -

i having serialization issues (exceptions) nodatime types , signalr parameters such error converting value type 'nodatime.zoneddatetime error converting value \"2016-06-01t18:33:36.7279685+01 europe/london\" type 'nodatime.zoneddatetime'. path '[0].datecreated', line 1, position 79. this despite following docs , replacing default jsonserializer , using nodatime extension methods , json.net nuget package e.g. jsonserializersettings js = new jsonserializersettings(); js.configurefornodatime(datetimezoneproviders.tzdb); var serializer = jsonserializer.create(js); globalhost.dependencyresolver.register(typeof(jsonserializer), () => serializer); happily found workaround here brannonking essentially uses customer resolver signalr parameters uses correct serializer instead of creating default. also referenced on so here of course found once had started post own question ;) reposting here others googling (the excellent) nodatime sp

oracle - sqlnet.ora SQLNET.AUTHENTICATION_SERVICES= (NTS) -

sqlnet.authentication_services= (nts) this oracle configuration file parameter. what's nts meaning? network service? windows nt service? what's nts abbr&&full name? oracle documentation link : authentication methods available oracle net services: none - no authentication methods, including windows native operating system authentication (to use windows native operating system authentication, set parameter nts). when sqlnet.authentication_services set none, valid user name , password can used access database. - authentication methods nts - windows native operating system authentication

module - Can we avoid creating a local variable if an optional argument is not PRESENT? -

i having problem present statement fortran 95. using silverfrost's plato , ftn95 compiler (in "release win32" mode). wanted create subroutine sub(a,b) , b optional variable. far good, problem arises when try give new value b if (.not. present(b)) b=0 . code: module mod contains subroutine sub(a,b) implicit none integer :: integer,optional :: b if (.not. present(b)) b=0 print*, a,b end subroutine sub end module mod program test use mod implicit none integer :: i=2, j=1 call sub(i,j) call sub(i) call sub(j) end program test is there elegant way out of situation, or need create variable, b_aux instance, , use following code?: if (present(b)) b_aux=b else b_aux=0 endif you can't use non-existent variable, approach such auxiliary local variable needed.

mocha - Meteor not loading <filename>.app-test[s].js files in --full-app test mode -

i using meteor 1.3.2.4 practicalmeteor:mocha run unit , integration tests. testing works expected in normal test mode both server , client-side test reporting browser expected. issue when invoke meteor test --full-app parameter none of full app test suites loaded. have tried naming them variations of <filename>.app-[test|spec]s?.js no avail. test files live within /imports directory. regardless of report shows 0 tests run on client , server. adding console.log in test file yields nothing it's pretty clear file not being loaded. created test file within /server directory , reported test run it's issue meteor loading specially named files it's supposed to. ideas? stumped. this known issue introduced in v1.3.2. either downgrade v1.3.1 or use v1.3.3 (currently beta, released soon) or higher.

internet explorer - call function after react-router-redux push -

in app have modal form once submitted needs change route , close modal (in order). code below working fine in browsers ie , edge change route , never close modal or call closemodal function. store.pushroute push react-router-redux. know edit store take callback wondering if there way without editing store component. onsuccess(formdata, formobject){ store.pushroute(`/${this.props.team_id}/${workspaceid}`); this.closemodal(); }

winapi - When can an HMONITOR be associated with multiple physical displays? -

in 1 msdn article, read following: hmonitor , device context each physical display represented monitor handle of type hmonitor. however, article seems contradict statement: getphysicalmonitorsfromhmonitor function a single hmonitor handle can associated more 1 physical monitor. so question is: under circumstances hmonitor associated multiple physical monitors?

stored procedures - Which approach promises better performance - a megaquery or several targeted queries? -

i creating ssrs report returns data several "units", displayed on row, unit 1 first, right unit 2 data, etc. i can either data using stored proc queries database using "in" clause, or multiple targeted ("unit = bla") queries. so i'm thinking can either filter each "unit" segment "=unit:[unit1]" or can assign different dataset each segment (witht targeted data). which way more "performant" - getting big chunk of data, , filtering same thing in various locations, or getting several instances/datasets of targeted data? my guess latter, don't know if maybe ssrs smart enough make former approach work or better doing optimizing "behind scenes" i think depends on how big big chunk of data is. experience has been ssrs can process quite large amount of data after comes database, , quickly. if report going aggregate data in end, try of can on database end. reason, database server has more resources

linux - shell - get exit code of background process -

i have command cmd called main bourne shell script takes forever. i want modify script follows: run command cmd in parallel background process ($cmd &). in main script, have loop monitor spawned command every few seconds. loop echoes messages stdout indicating progress of script. exit loop when spawned command terminates. capture , report exit code of spawned process. can give me pointers accomplish this? 1: in bash, $! holds pid of last background process executed. tell process monitor, anyway. 4: wait <n> waits until process id complete (it block until process completes, might not want call until sure process done). after wait returns, exit code of process returned in variable $? 2, 3: ps or ps | grep " $! " can tell whether process still running. how understand output , decide how close finishing. ( ps | grep isn't idiot-proof. if have time can come more robust way tell whether process still running). here's skeleton

Why is the parents field in Google Drive API an array? -

perhaps irrelevant other appease ocd, why parent field in google drive api (i'm using v3, believe same in v2, too) return array? there ever situation there multiple parents file? good question, because many people make mistake of thinking parent folder sort of container. isn't. in gdrive should think of parents (aka folders) labels. works pretty same way gmail, ie. individual email can have many labels.

html - How can I select a dynamically limited range of nodes without using non-dynamic positions? -

<li></li> <th> <li></li> <strong>"jeff"<strong> <li></li> <a>"mary"<a> <li></li> <th> <li></li> <strong>"rich"<strong> <li></li> <strong>"alex"<strong> <li></li> <a>"bob"<a> <li></li> <th> <li></li> <strong>"dave"<strong> <li></li> <a>"joseph"<a> <li></li> <th> i need select list items contain "jeff" , "mary" using "jeff" in xpath, , without selecting else , without using non-dynamic positions. example: //li[following-sibling::li/strong[contains(text() , "jeff")]]/following-sibling::li[th][1]/preceding-sibling::li[not(th)] this works great first set(jeff , mary), once applied ranges further down code, falls a

concurrency - Is 'require' preferrable to 'autoload' with Ruby 2 in a multi-process fork server? -

i reading this article. concern benefits of autoload vs require . reading article, gather using autoload multi-threaded servers bad because 1 thread might try load object not in memory yet. the article says multi-process servers? autoload those? says depends. if server uses fork (which spawns new process each request), such phusion passenged, , using ruby 2, autoload not beneficial. the reason because ruby 2 uses copy-on-write semantics. means better use require autoload . copy-on-write semantics, if load foo::bar on boot, have 1 copy of foo::bar shared between processes. hence, there no big memory footprint. however, if not using ruby 2 , not using multi-process server uses fork, each process end loading own copy of foo::bar possibly leading higher memory usage. therefore, in case autoload preferrable require . is interpretation of article correct? i think you've got it, restate couple of points clear: the important distinction isn't quite betwe

python 3.x - Filter elements within object in DynamoDB -

i have dynamodb table contains objects looking following: { 'username': ..., 'subscriptions': [ ... ], ... } and filter subscriptions each user based on criteria, , objects have subscriptions matching criteria, filter objects matching subscriptions present. if user has subscribed 50 things, 3 of them match, object `subscriptions' field 3 elements long. need other information contained in object. to give more specific example, suppose have 2 elements in table: { 'username': 'alice', 'subscriptions': [ 1, 2 ], 'email': 'alice@a.com' }, { 'username': 'bob', 'subscriptions': [ 2, 3 ], 'email': 'bob@a.com' } and filter subscription `1'. back { 'username': 'alice', 'subscriptions': [ 1 ], 'email': 'alice@a.com' } or pe

amazon web services - AWS DynamoDB Attempting to ADD to a Set - Incorrect Operand -

i creating api using nodejs , dynamodb end. attempting update item add set of "friends". when update user, error, "invalid updateexpression: incorrect operand type operator or function; operator: add, operand type: map". understanding when adding set not exist, set created. if exists, new value should added set. not understand why set attempt add being read map. how users created: var params = { tablename: "users", item:{ "id": number(id), "name": name, "password": password } }; documentclient.put(params, function(err, data) { if(err) res.json(500, err); else res.json(200, data); }); how friends added: var params = { tablename: "users", key: { "id": id }, updateexpression: "add friends :friendid", expressionattributevalues: { ":friendid": { "ns": [friendid] } },

html - How to hide text of an anchor tag that uses i element -

i have anchor tag not have text in , uses <i> element along glyphicons . while doing accessibility testing found out anchor tags should have text. 1 strategy put text , visibly hide it using css. i hide visually using css: font: 0; line-height: 0; color: transparent; however, makes glyphicon go away well. there way can hide anchor tag keep glyphicon as-is? my achor tag below example: <a class="something"><i class="glyphicons glyphicons-some-icon"></a>

python - getting the id from a foreignkey relationship django -

i want id or pk of foreignkey relationship post_comment i've tried many different ways catch , not have result, please guys give me hand in situation in views.py class createcomment(view): form_class = commentform template_name = "createcomment.html" def get(self, request): form = self.form_class(none) return render(request, self.template_name, {'form':form}) def post(self, request): obj = self.form_class(none) obj.title_comment = self.request.post['title_comment'] obj.body_comment = self.request.post['body_comment'] obj.post_comment = self.pk obj.save() in models.py class comment(models.model): user_comment = models.foreignkey("auth.user") title_comment = models.charfield(max_length=50) body_comment = models.textfield() timestamp_comment = models.datetimefield(auto_now=true) post_comment = models.foreignkey("post",

javascript - How to display model attribute in AngularJS using Spring MVC -

i trying switch pure javascript implementation using angularjs. unable figure how use model attribute form using angularjs. controller @modelattribute("frequencies") public frequency[] frequencies() { return frequency.values(); } @modelattribute("genders") public gender[] persongender() { return gender.values(); } @requestmapping(value="uform", method=requestmethod.get) public string loaduformpage(model m) { return "usermanagment"; } the initial jsp displayed enum s as: <form:select path="gender" id="genderoptions"> <form:option value="">select gender</form:option> <c:foreach items="${genders}" var="gender"> <form:option value="${gender}">${gender}</form:option> </c:foreach>> </form:select> i looking angularjs equivalent of jsp code since in angularjs data passed json.

mysql - How to automatic update data in database in PHP -

i want make toefl test. make table score_structure in database containing 4 columns (email, right, false, score). if user has done on previous test , perform test again, user data updated according user's email pitch. i have tried failed, data not update. please me. this structure.php <?php $email = $_session['email']; $cek = mysql_num_rows(mysql_query("select email score_structure email='$email'")); if($cek > 0 ) { $simpan = "update score_structure set right='$right', false='$false', score='$score' email='$email'"; if(mysql_query($simpan)) { header("location:test_listening.php"); } else { echo mysql_error(); } else { $simpan = "insert score_structure values ('$email', '$right', '$false', '$score')"; if(mysql_query($simpan)) { header("location:test_listening.php"); } else { echo mysql_

php - Installation of Homestead -

my whole log. fresh command prompt, followed laravel documentation asked me problems keep popping no where.... directory right? run command in project directory laravel asked me "make sure place ~/.composer/vendor/bin directory in path homestead executable found when run homestead command in terminal." please help. ~\composer\vendor\bin>composer global require "laravel/homestead=~2.0" changed current directory ~/roaming/composer ./composer.json has been updated loading composer repositories package information updating dependencies (including require-dev) requirements not resolved installable set of packages. problem 1 - conclusion: don't install laravel/homestead v2.2.1 - conclusion: don't install laravel/homestead v2.2.0 - conclusion: don't install laravel/homestead v2.1.8 - conclusion: don't install laravel/homestead v2.1.7 - conclusion: don't install laravel/homestead v2.1.6 - conclusion: d