Posts

Showing posts from July, 2015

python - Using subdomains in django -

please tell me whether possible (if so, how) use pages each user subdomains. example, have url of form: http://hostname.com/user/1 need http://username.hostname.com/ you have number of options depending on how in-depth want go. one option handle routing @ web server level. capture subdomain part of url , rewrite different location within server. for example http://username1.local.host/signin captured webserver , internally routed resource such /username1/signin . end user subdomains code handle url parts none wiser has happened. your urls.py handle normal request. url_pattern = [ ... url(r'(?p<subdomain>[a-z]+)/sigin/$', 'view'), ] for nginx need "subdomain subdirectory re-writing". i use option have stated in question. whilst method little more tricky setup (keep @ until works). lot easier maintain , work in long run. use option have stated in question. the other option handle subdomains @ django level using package su

javascript - Element added via jquery append does not persist on screen -

i trying make to list app. append list elements task list using append() function html <!doctype html> <html> <title>todo</title> <head> <meta charset="utf-8"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script type="text/javascript" src="script.js"></script> <h2>to list</h2> </head> <form name = "taskform"> task: <input type = "text" name = "task" > <input type = "submit" id = "submit" value = "add"> </form> <ul class = "list"> <li class = "item"></li> </ul> </html> script $(document).ready(function(){ $('input#submit').click(function(){ var newtask = $('input[name=task]').val(); $('.list'

mysql - What is the effect of performance of a SQL query when have aggregate function and where clause -

i have 2 queries : 1. select u.unitid unitid, u.unitscode 'unitscode', ( cast(count(vd.date) float) / u.timediff ) * 100 'bookingcount', u.tradestarttime, u.tradestoptime, u.minimumslot, u.maximumterm @alldates vd inner join commcmlbookingdetail cd on vd.date between cd.dtfromtime , cd.dttotime , datepart(minute, vd.date) = datepart(minute, cd.dtfromtime) inner join commcmlbooking cb on cb.hmy = cd.hbooking , cb.istatus = 1 , cb.itype = 525 inner join @unitsinfo u on u.unitid = cb.hunit , cast(vd.date date) between cast(@bookingfromdate date) , cast(@bookingtodate date) , cast(vd.date time) between cast(u.tradestarttime time) , cast(u.tradestoptime time) cb.hrecord = case when @amendmentid = 0 cb.hrecord else @amendmentid end

javascript - Get correct time if it's changed on Window -

as title, how can correct date, time if it's changed user (with , without internet connection) example: real time july 2nd 2015 , user changed july 1st 2015, how can true value: july 2nd 2015??? (it's if using php, javascript or cmd) me please, thanks. , sorry bad english. edit: thanks answer about project: want create key, has start , end date must current time check if key out of date, if user changes time of window previous day, key won't out of date (project installed , run on user pc) again.

How to know which X509 Certificate Signed another Certificate (Java) -

there 3 certificates in example, assume form chain don't know yet of them signed which: x509certificate c1 = .... x509certificate c2 = .... x509certificate c2 = .... i know certificate responsible signing other certificate. the plan " authoritykeyidentifier " , match " subjectkeyidentifier ". import org.bouncycastle.asn1. deroctetstring; private static string decodekey(byte[] e) { deroctetstring octet = new deroctetstring(e); return octet.tostring(); } string subjectkeyid = decodekey(c.getextensionvalue("2.5.29.14")); string authoritykeyid = decodekey(c.getextensionvalue("2.5.29.35")); im getting following certificates (in order of chain): subject/authority key id pair values of subjectkeyidentifier , authoritykeyidentifier after decoding: certificate 1: (end of chain) #0416041482b7384a93aa9b10ef80bbd954e2f10ffb809cde #04183016801482b7384a93aa9b10ef80bbd954e2f10ffb809cde certificate 2: signed certificate 1 #

wpf - C# Unsubscribe via IDisposable: Why Does it Work? -

other questions , answers advocate using idisposable interface unsubscribe events object subscribes in constructor. i'm failing understand why dispose() method gets called in first place. consider code (verbatim) this example : public class detailviewmodel : idisposable { public detailviewmodel(mydetailmodel detailmodel) { // retain detail model this.model = detailmodel; // handle changes model not coming viewmodel this.model.propertychanged += model_propertychanged; // potential leak? } public void dispose() { this.model.propertychanged -= model_propertychanged; } } so supposing model referenced datacontext of window, should have no references when window closed , garbage collected. event detailmodel.propertychanged still hold reference delegate (which why we're unsubscribing in first place). , each delegate implemented compiler-generated class hold reference instance (the detailviewmodel ) in

javascript - Rails unable to render ajax flash message -

i'm seeing strange behavior in app. it's rails 4 app uses jquery. app's use of javascript pretty vanilla (i.e. no angular, react, ember stuff in mix). on account settings page, there's form user can toggle value auto-renew subscription. when toggle, there's ajax call made subscriptions controller. class subscriptionscontroller < applicationcontroller def update subscription_id = params['id'] updated_preference = params['auto-renew'] update = subscription.update_attributes(auto_renew: updated_preference) respond_to |format| if update format.js { flash[:success] = "auto-renew information has been updated." } else format.js { flash[:error] = "something went wrong. please try again later." } end end end the desired behavior after update processed, flash message appears @ top of screen. set flash message in action above. inside template update action, scroll top of page. # insi

javascript - How to only use relative paths in Rails, instead of using the asset pipeline? -

i trying integrate components multiple websites own rails website. images, css files, , javascript files numerous , scattered in nested directories. if copy folders 'app/assets' folder, this: app/assets/website1/a/b/c/d/image1.jpg app/assets/website2/e/f/g/style.css app/assets/website3/h/i/j/k/custom.js if try reference above items with: <img src="/app/assets/website1/a/b/c/d/image1.jpg"> <link rel="stylesheet" href="/app/assets/website2/e/f/g/style.css"> <script src="/app/assets/website3/h/i/j/k/custom.js"></script> respectively, not load @ all. prefer use relative paths because using asset pipeline nightmare such nested directories. describing possible? have tried disabling asset pipeline in config/application.rb adding following line ? config.assets.enabled = false havn't tested it. let me know if works.

javascript - Apply style to span based on number of lines within a cycling banner -

context here jsfiddle i've been working with: http://jsfiddle.net/21r7uvgx/ for context, i'm using http://malsup.com/jquery/cycle/basic.html make rotating banner cycle through each <a> within .custom-banners wrapper. have script external resource within jsfiddle. starting point the idea make each span has multiple lines (purely window size) apply style a, , have 1 line apply style b. resizing window changes style each span gets. i'm doing span instead of a based on assumption achieve want, need target element displays block default. issue , goal the issue i'm running is cycling script, span not visible has height of 0, math isn't right , won't apply correct style, once span becomes visible. the goal find way have check span when becomes visible, , apply correct style. bonus goal if there's better way calculate lineheight , determine style needs applied, i'd suggestions. i using before, buggy when manually resiz

android bluetooth low energy status = 61 -

07-02 10:12:19.416: d/bluetoothgatt(31605): onclientconnectionstate() - status=61 clientif=5 device=78:a5:04:07:d1:3d what status 61 of bluetooth le in android? thanks as per spec, error 61 (0x3d) means "connection terminated due mic failure". message integrity check (mic) 4-bytes field added ble packet when encryption enabled. means mic failed on packet received on phone, causes disconnection.

jquery - Flot change bar opacity on hover -

the default flot bar chart changes opacity:.5 opacity:1 on hover. invert can not seem find has done this. code using. $.extend(true, opts.flot, { series: { points: { show: false }, bars: { align : 'center', order : (opts.stacked) ? null : true, show : true, border : false, fill : 1, fillcolor : null, horizontal : opts.horizontal, barwidth : (opts.stacked) ? 0.6 : 0.6 / opts.data.length, linewidth : 0 }, lines: { show: false }, pie: { show: false } } }); use in options give opacity 1 without hover , opacity 0.5 on hover (here red base color): color: 'rgba(255, 0, 0, 1.0)', highlightcolor: 'rgba(255, 255, 255, 0.5)', bars: { show: true, fillcolor: 'rgba(255, 0, 0, 1.0)' } see fiddle full example.

sts springsourcetoolsuite - SpringSource STS.ini 3.7.x (Eclipse Mars 4.5.x) Memory Settings -

i've seen question asked few times not of july 2015 anyway. understand @ 1 point in time adding memory in sts.ini file settings supposedly cause paradoxical performance issues in sts/eclipse. i'm not sure if that's still case , searches not fruitful. i've had frustration spring-source/eclipse performance on years , i'm hoping newest version(s) addressing issues pcs have 64-bit operating systems , higher memory. in case, have 6-core processor, 64-bit windows 8 , 16 gb of memory, , yet still have wait various tasks. here attempt @ sts.ini file. wondering if have suggestions on how can make of 16 gigs of ram without tripping ide. setting understand right xmx, should memory given eclipse. i'd love know how max them out , them down needed. i'm sort of surprised isn't the ide properties wouldn't have ui - take guess-work out of ranges. help! -startup plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar --launcher.library plugins/org.eclips

How do I return a value from a function in python that has an exception if it fails -

i have check when user enters values. example if user enters value outside range 250-10000 should show message warning them have entered bad value , renter value. code have works if enter correct value. if enter incorrect value message if enter correct value how fc in main(). open positive feedback!. in advance! import ctypes def build_fc(): print "please enter fc between 250-10000:" fc_string_input = raw_input() fc_float = float(fc_string_input) if (fc_float)>=250 , (fc_float<=10000): return float(fc_string_input) else: setup_fc_error_message() build_fc() def setup_fc_error_message(): lines = ['fc out of range: please enter value 250-10000:'] messagebox = ctypes.windll.user32.messageboxa messagebox(none, "\n".join(lines), 'setup info', 0) def main(): fc = build_fc() print fc if __name__ == "__main__": main() instead of, else: setup_fc_er

android - Toolbar like in the chrome app -

how can toolbar hides/shows when scrolling webview down/up, able refresh scrolling listview when webview @ top (pulldownrefresh), google chrome app android . for collapsing toolbar have use collapsingtoolbarlayout explained in android design support library has collapsing toolbar. and pull down refresh take @ swiperefreshlayout .

.net - How to display the current month records from Access database in a datagridview on form load in vb.net -

i can display records code below see current month records, or @ least last 31 days public sub display_data() con.open() 'opening connection dim dt new datatable("tblmph") dim rs new oledb.oledbdataadapter("select * tblmph", con) rs.fill(dt) datagridview1.datasource = dt datagridview1.refresh() label1.text = dt.rows.count rs.dispose() con.close() end sub first, change field data type date. dates should handled dates, not strings, no exceptions. second, can use dataview control filtering described here: how filter datagridview in vb.net your filter should >= monthfirst , <= monthlast , , these can found way: dim today datetime = datetime.today dim monthfirst = new datetime(today.year, today.month, 1) dim monthlast = monthfirst.addmonths(1).adddays(-1)

javascript - How to enact styles with React.js -

i trying use inline styles react.js, keep running errors: in render function, have: render: function() { var style = this.state.submitted ? {{"backgroundcolor": "#1abc9c", "opacity": "0.6"}} : {{}}; return ( <div> <h1 classname="home-two-question" style={style}>{text}</h1> </div> ) }, basically want toggle style on click. however, when run this, error react.js. correct syntax inline styles in react.js? thank you! in line: var style = this.state.submitted ? {{"backgroundcolor": "#1abc9c", "opacity": "0.6"}} : {{}}; you're in plain javascript, not inside of jsx tag. thus, want use single {} , not double {{}} : var style = this.state.submitted ? {"backgroundcolor": "#1abc9c", "opacity": "0.6"} : {}; in particular, when like: <div style={{"backgroundcolor&quo

Python Data table -

i have data textfile called “data” delimited comma in each row. the first 3 lines of file following: “(1,abc,abcde)”,”24” “(10,abd,abc11)”,”12” “(6,abe,aberd)”,”39” in file, values in each row string , integer. i first read file: target=pd.read_csv(’data',sep=',',names=[‘col1’,'col2’]) what want see in target table following 5 column table: cola colb colc col1 col2 1 abc abcde (1,abc,abcde) 24 10 abd abc11 (10,abd,abc11) 12 6 abe aberd (6,abe,aberd) 39 what tried was: for index,row in target.iterrows(): tup=tuple(row[0][1:len(row[0])-1].split(",")) target[’cola'][index]=tup[0] target[’colb'][index]=tup[1] target[’colc'][index]=tup[2] this done change string tuple can create new columns target datatable. delete col1 code above doesn't work reason. crashes.. your code peppered "smart quotes": “” instead of " , ‘’ instead of ' .

linux - Select SCP Copy -

i've seen example used rsync , ssh this, in specific case not working - gave me error protocol versions i'd copy on files of type .sh , .jar , .war directory structure on remote host 2 hop (ssh proxy) ssh away. i'm not sure of best way this. scp or sort of bash script? what know: find . | grep "\.sh" will give me nice list of files , can use xargs them. i guess options create tar.gz file , scp over, or perhaps write little bash script individual scp-ing? i came terrible way perl slow my $find = `find .`; $remote = "user\@machine:"; $remoteprefix = "/devel/test"; @files = split('\n', $find); foreach (@files) { if (/(.*\/)([^\/]*\.sh)$/ or /(.*\/)([^\/]*\.jar)$/ or /(.*\/)([^\/]*\.war)$/ ) { $fullpath = $_; $directory = $1; $file = $2; # print "$fullpath => $directory || $file\n"; $cmd1 = qq(ssh user\@machine mkdir -p $remotep

orm - Rails has_many :through association: retrieve foreign attribute through foreign key -

in our rails app, there 3 models: class user < activerecord::base has_many :administrations, dependent: :destroy has_many :calendars, through: :administrations end class administration < activerecord::base belongs_to :user belongs_to :calendar end class calendar < activerecord::base has_many :administrations, dependent: :destroy has_many :users, through: :administrations end and here corresponding migrations: class createusers < activerecord::migration def change create_table :users |t| t.string :first_name t.string :last_name t.string :email t.timestamps null: false end end end class createadministrations < activerecord::migration def change create_table :administrations |t| t.references :user, index: true, foreign_key: true t.references :calendar, index: true, foreign_key: true t.string :role t.timestamps null: false end end end class createcalendars < activerecord::m

java - working with constructor and accessor method -

package learning; public class matchscore { private string matchnumber; private string killsinmatch; private string deathsinmatch; public void setmatchnumber(string namein){ matchnumber = namein; } public string getname(){ return matchnumber ; } public void setkillsinmatch(string killsin){ killsinmatch = killsin; } public string getkillsinmatch(){ return killsinmatch; } public void setdeathsinmatch(string deathsin){ deathsinmatch = deathsin; } public string getdeathsinmatch(){ return deathsinmatch; } public void totalstatus(double stats){ system.out.printf("this game %s ", matchnumber); system.out.printf("you killed-this many %s", killsinmatch); system.out.printf("but died-this many time %s", deathsinmatch); } } this ^ constructor method. have created sets match number, kill number, , death number. these

vb.net - Get color of a chart series -

i need color of series set smart lables, want make cell in dgv same color. dim chtcolor(50) color each cur in mcurves ptang = estcurve(cur, bladeangle, hrfan) me.chtcurves.series.add(cur.tostring) me.chtcurves.series(cur.tostring).charttype = datavisualization.charting.seriescharttype.spline me.chtcurves.chartareas(0).axisx.labelstyle.format = "#.###" chtcolor(i) = me.chtcurves.series(cur.tostring).color the function me.chtcurves.series(cur.tostring).color returning list of colors , not series color. if not explicitly setting series color , want retrieve default assigned color, must call chart.applypalettecolors() . modify code call method after adding series chart's series collection me.chtcurves.series.add(cur.tostring) me.chtcurves.series(cur.tostring).charttype = datavisualization.charting.seriescharttype.spline me.chtcurves.chartareas(0).axisx.labelstyle.format = "#.###" me.chtcurves.applypalettecolors() ' a

Is this a good use for javascript eval? -

we have form many question, of displayed based on dynamic logic related other questions sent on in json. each question have logic similar to, possibly more complex than: display me if: (quest1 == value1 or quest1 == value2) , (quest2 == value3 or quest3 == value4) . simplified json example: [ "and", { "quest1": "value1,value2" }, [ "or", { "quest2": "value3" }, { "quest3": "value4" } ] ] as parent question values change seems 1 way determine visibility of child question parse json given question js-friendly syntax above, including actual current values , use eval() . there better alternative? thanks! i have built exact scenario. assembled questions , answers tree server-side , load model page via ajax call. each question object has question text , array of answer objects, , property (initiall

asp.net - Update Panel doesn't refresh content -

problem: i'm having problems updatepanel not refreshing contents. i have web page dropdown lists cascade selections such selecting value in 1 filters available options in next. my page structured this: dropdownlist1 updatepanel1 ( dropdownlist2 ) updatepanel2 ( dropdownlist3 ) when user makes selection in ddl1, filters options in ddl2 , ddl3. this works when user makes selection in ddl2, should filter remaining options in ddl3. does not work what i've tried: i have several breakpoints set , know update method ddl3 being called. if remove updatepanel2, contents of ddl3 updated expected, whole page refreshes , scrolls top. updatepanel2 has asyncpostbacktrigger pointing ddl2. if change postbacktrigger ddl3 correctly updates whole page refreshes , scrolls top. if remove triggers updatepanel2, ddl3 correctly updates whole page refreshes , scrolls top. help: i don't know else try. i fixed problem. for whatever reason, event

android - Adding a custom DateTimeField that can be updated through a PUT request (DjangoRestFramework) -

i'm new django , created django app following tutorial: http://www.django-rest-framework.org/tutorial/quickstart/ this tutorial gives pre-made user class includes various fields. trying add custom datetimefield can updated through put request in android. how add custom field "timestamp" class. here code: serializers.py from django.contrib.auth.models import user rest_framework import serializers django.contrib.auth.models import models class userserializer(serializers.hyperlinkedmodelserializer): class meta: model = user lookup_field = 'username' set_timezone = 'date_joined' fields = ('url', 'username','date_joined') views.py from django.contrib.auth.models import user rest_framework import viewsets tutorial.quickstart.serializers import userserializer django.conf import settings django.shortcuts import redirect, render dir(settings) settings.__dict__ class userviewset(

php - Codeigniter: Delete query with prepared statement -

i'm not sure if codeigniter thing or mysqli thing. in model class i'm trying delete using 2 arguments: $query = "delete users user_id = ? , company_id = ?"; $result = $this->db->query( $query, $user_id, '1' ); error message: have error in sql syntax; check manual corresponds mysql server version right syntax use near '? , company_id = ?' @ line 1 any ideas? i recommend use 'active record' $this->db->where('user_id', $user_id); $this->db->where('company_id', 1); $this->db->delete('users'); https://ellislab.com/codeigniter/user-guide/database/active_record.html

memory - Why would a program compiled for a SPARC ISA read an integer differently than on a Pentium ISA? -

a program compiled sparc isa writes 32-bit unsigned integer 0xabcdef01 file, , reads correctly. same program compiled pentium isa works correctly. however, when file transferred, program incorrectly reads integer file 0x01efcdab. going wrong? sparc , pentium use different byte ordering ("endianness") in memory , on storage: sparc uses big-endian : most-significant byte of integer comes first pentium uses little-endian : least-significant byte of integer comes first i.e. when file transferred machine different endianness, bytes of integer seem in reversed order.

excel - Set number of copies per worksheet -

i have workbook combines multiple reports. currently, using piece of vba code determine worksheets printed based on cell value in each worksheet. is there way add existing code set each worksheet print specific number of times per sheet? example, print sheet1 2 times, print sheet2 1 time, , on, using cell reference on worksheet. code i have printing far is: sub printsheets() dim ws worksheet dim arrws() dim long each ws in worksheets if ws.range("a1") = "print" redim preserve arrws(i) arrws(i) = ws.name = + 1 end if next ws sheets(arrws).printout end sub i've tried couple different items, each 1 sheet determine how many times printed, instead of allowing each page have own specific number of copies. try this sheets(arrws).printout copies:=range("a2").value

android - Why doesn`t my listview show any elements? -

i have viewpager want display listviews with. using single fragment has custom listview . fragment xml(fragment_list_view): <framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.popcristian.licenta.listviewfragment" > <listview android:id="@+id/productslistview" android:layout_width="match_parent" android:layout_height="match_parent" /> </framelayout> list item xml(fragment_list_item): <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <textview android:

ruby - Insert information from hash into iteration -

i trying insert information hash monthly_multipliers iterator. month_multipliers = { april: 1, may: 2, june: 3, july: 4, august: 5, september: 6, october: 7, november: 8, december: 9, january: 10, february: 11, march: 12} months = ['april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december', 'january', 'february', 'march'] i iterate through each month, , need inject monthly multiplier each month, june 3 august 5 etc. months.each |month| instance_variable_set :"@#{month}_income", (monthly_new_account_income * month_multipliers[month]) + previous_years_monthly_income end this bit doesn't work month_multipliers[month]) i tried sending , getting instance variable, cannot format right. month_multipliers has keys in symbol objects, months has keys string objects. use either symbol or string objects or convert keys correc

knockout.js - HotTowel modal dialog -

recently, started first visual studio knockout/breeze app using 1 of templates found online, , wanted modal dialog open similar this: <a href="#openmodal">open modal</a> <div id="openmodal " class="modaldialog"> <a href="#close" title="close" class="close">x</a> <div data-bind="foreach: userdetails"> <p>user details go here</p> <p data-bind="text: $data.name" /> <p data-bind="text: $data.role" /> </div> </div> here css .modaldialog { position: fixed; font-family: arial, helvetica, sans-serif; color:#ffffff; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,0.8); border:2px solid #4cff00; z-index: 99999; opacity:0; -webkit-transition: opacity 400ms ease-in; -moz-

google cloud storage - gsutil rsync with gzip compression -

i'm hosting publicly available static resources in google storage bucket, , want use gsutil rsync command sync our local version bucket, saving bandwidth , time. part of our build process pre-gzip these resources, gsutil rsync has no way set content-encoding header. means must run gsutil rsync , run gsutil setmeta set headers on of gzipped file types. leaves bucket in bad state until header set. option use gsutil cp , passing -z option, requires re-upload entire directory structure every time, , includes lot of image files , other non-gzipped resources wastes time , bandwidth. is there atomic way accomplish rsync , set proper content-encoding headers? assuming you're starting gzipped source files in source-dir can do: gsutil -h content-encoding:gzip rsync -r source-dir gs://your-bucket note: if , run rsync in reverse direction decompress , copy objects down: gsutil rsync -r gs://your-bucket source-dir which may not want happen. basically, safest way

bash - How to write pass input into this specific Unix Scripting -

this question has answer here: difference between single , double quotes in bash 4 answers i trying make commands, can create repo in own github account. #!/bin/bash a=$1 curl -u 'myname' https://api.github.com/user/repos -d '{"name":$a}' but not work expected. point that, how can pass $1, first argument, $a. by way, manual code works: curl -u 'myname' https://api.github.com/user/repos -d '{"name":"new_folder"}' moreover, if makes code curl -u 'myname' https://api.github.com/user/repos -d '{"name":"$1"}' the corresponding folder created named -1, not looking for. ps: if makes code curl -u 'myname' https://api.github.com/user/repos -d '{"name":'"$a"'}' then above turns out error. shawn:~$ ./gitcp test enter

jquery - Replacing Javascript string with an image -

i want replace word "orkid" displaying image. know bit css , html codes i'm not familiar javascript. // menu $('#menu') .mmenu({ extensions : [ 'widescreen', 'theme-white', 'effect-slide-menu' ], dividers : { fixed : true }, navbar : { title : 'orkid' }, navbars : [{ position: 'top', content : ['searchfield'] }, { position: 'top' }, { position: 'bottom', content : ['<div>lorem</div>',] }] });

mongodb - Update extended Meteor.user collection -

i have extended meteor-collection2 user profile user profile /// --- user profile --- /// userprofile = new mongo.collection("userprofile"); schema.userprofile = new simpleschema({ username: { type: string, optional: true }, usergender: { type: string, allowedvalues: ['male', 'female'], optional: true }, userage: { type: number, optional: true, regex: /^[0-9]{2}$/ }, userweight: { type: number, decimal: true, optional: true }, usergrowth: { type: number, optional: true }, userexpirience: { type: number, optional: true }, useravatarid: { type: string, optional: true }, profilecomplete: { type: boolean, optional: true } }); userprofile.attachschema(schema.userprofile); user /// --- user --- /// schema.user = new simpleschema({ userna

Google Analytics Dashboard API demo not working when implemented -

i can't seem demo of google analytics embeddable dashboard working: https://ga-dev-tools.appspot.com/embed-api/third-party-visualizations/ here link work area: http://goo.gl/2dfnox i copy , pasted code provided sample page, , added local visualization scripts required. any appreciated.

java - Verifying Hashed Password From MySQL Database -

i using java in eclipse , storing hashed password in database when new user created. done code.. string hashed_password = password.hashpassword(passwordfield.tostring()); string query = "insert user (username, password, usertype, license_code) values (?, ?, ?, ?)"; preparedstatement pst = connection.preparestatement(query); pst.setstring(1, usernametextfield.gettext()); pst.setstring(2, hashed_password); i left out out other details not associated password, however, hashed value stores in database. login, , following code... string test_passwd = passwordfield.gettext(); string test_hash = "$2a$12$n773ystmtu/1ziue9an.r.p9u5bqp4o6.qjk.j.zha6ztfytyuozc"; system.out.println("testing bcrypt password hashing , verification"); system.out.println("test password: " + test_passwd); system.out.println("test stored hash: " + test_hash); system.out.println("hashing test password..."); system.out.println(); string computed_hash

javascript - AngularJS full page refresh on the page I am visting, not the current one -

i using maphilight on main page if route different partial , return main page, maphilight stops working. however, if refresh page, works again. how force main page refresh every time navigate it? have seen people able refresh current page with $scope.reloadpage = function(){window.location.reload();} and <a ng-click="reloadpage()" href="index.html#/diagram">back search</a> but cant refresh page navigating to. in advance here controller page linking to , want refresh: roomcontrollers.controller('diagramcontroller', ['$scope', '$route', '$http', function($scope, $route, $http) { $http.get('js/master.json').success(function(data) { $scope.rooms = data; $scope.reloadpage = function(){window.location.reload();} }); }]); here link in page coming from <a ng-click="reloadpage()" href="index.html#/diagram">&laquo; search</a> and here app code var myapp = an

How to remove or edit title bar when nativescript app runs on android platform -

i've tried in every way call requestwindowfeature method, first inside page script (but raised nice error), second on app js, working inside application.launchevent closure: var application = require("application"); application.mainmodule = "main-page"; application.cssfile = "./app.css"; application.on(application.launchevent, function (args) { if (args.android) { // how work android activity in closure? } }); application.start(); i not able android activity instance in order hide default title bar. assuming "launchevent" event assimilable "oncreate" event, there way android activity in context? or necessary assume isn't proper way in order achieve goal? for time being can try this: application.on(application.launchevent, function (args) { if (application.android) { var activity = application.android.startactivity; // activity... }

c# - Excel Add-in connect to REST API -

i need write excel add-in communicates existing rest api created. api allows user upload data excel spreadsheet sql database. not sure how accomplish this, great if sample code. take @ these: vba-web github page excel services rest api msdn

teamcity - Creating a build configuration ID -

Image
brand new teamcity (~2hours), , ran problem. how 1 generate or create "build configuration id"? after searching google , stack, there doesn't seem more documentation of is. simple, or can make own? when create build configuration, pretty automatically generated parent(s) , config name you can edit field if want.

mysql - PHP-function for querying out of the database -

i want have simple admin-script allows me disable or enable different modules of website, e.g. changelogs or news. for have created datase table looks like: +----+--------------+---------+ | id | function | enabled | +----+--------------+---------+ | 1 | changelogs | on | | 2 | news | off | | .. | .. | .. |' +----+--------------+---------+ as said, want information whether module on or off php-function. did didn't work me. functions.php: $db = new mysqli("is correct", "is correct", "is correct", "is correct"); function function_enabled($function_module) { if ($function_module == "changelogs") { $sql = $db->query("select enabled functions function = '$function_module'"); while ($row = $sql->fetch_object()) { $return = $row->enabled; } return "$return"; } } index.php include("func

javascript - How can I pass Facebook Share API an object with no (real) canonical url? -

information: project in angular, makes heavy use of '#' , '?' in urls, objects have unique url running on apache 2.4 the "share" pane angular modal, html template site being developed on localhost goal able share individual objects app, not entire site what have tried: configured apache accept fake canonical urls, rewrite them angular dynamic urls, application formats dynamic urls "canonical" urls replacing special symbols "/"... piece working fine plug-ins "social sharing on angular" leave share pop-up truncated url, path root folder (full path visible , correct in address bar param) manually calling fb.ui() passes correct url, facebook throws "could not find object @ url" adding dynamically generated "meta" tags html template (longshot) seems have no effect. could issue because i'm sending "localhost" url testing? or facebook require shared content located @ it's own r

asp.net mvc - MVC Partial View throwing error on dropdownfor -

i have partial view want display search interface. every time tells me error there no viewdata item of type ienumerable has key resource_type_id. i have tried many things make work nothing helps. this view calls partialview @model ienumerable<newsamacentral2._0.viewmodel.memberresourcesviewmodel.memberresource> @{ viewbag.title = "add resource folder"; } <h2>add resource folder</h2> <div> @{html.partial("searchresource", new newsamacentral2._0.viewmodel.memberresourcesviewmodel.resourcesearch());} </div> @using (ajax.beginform("insertattendee", "meetings", new ajaxoptions { httpmethod = "post" })) { if (model.any()) { } } this partialview @model newsamacentral2._0.viewmodel.memberresourcesviewmodel.resourcesearch @using (ajax.beginform("addattendee", "meetings", new ajaxoptions { updatetargetid = "addattendee", httpmethod = "post&q

performance - How to fetch a subgraph of first neighbors in neo4j? -

i fetch first n neighbors of node query in neo4j: (in example, n = 6) i have weighted graph, , order results weight: start start_node=node(1859988) match start_node-[rel]-(neighbor) return distinct neighbor, rel.weight weight order proximity desc limit 6; i fetch whole subgraph, including second neighbors (first neighbors of first 6 children). i tried smtg : start start_node=node(1859988) match start_node-[rel]-(neighbor) foreach (neighbor | match neighbor-[rel2]-(neighbor2) ) return distinct neighbor1, neighbor2, rel.proximity proximity order proximity desc limit 6, rel2.proximity proximity order proximity desc limit 6; the syntax still wrong uncertain output: have table of tuples parent, children , weight: [node_a - node_b - weight] i see if performing better 1 query or 6 queries. can in clarifying how iterate query (foreach) , format output? thank you! ok, think understand. here's attempt based on comment: match (start_node)-[rel]-(neighbor) id(s

postgresql - Postgres: Selecting a 24 hour window for multiple dates and picking the initial date as start date -

i'm trying select 24 hour chunks of data list of days , retain start date. it's easier describe table i'll that: original table id localminute usage 1 01-01-2013 00:00:00-05 3 . . 1 12-31-2013 00:00:00-05 4 2 . . let's dates i'm interested in february 1st , february 12th. want aggregate usage 8 on february 1st 07:59 on february 2nd , likewise 8 february 12th 7:59 february 13th. this each individual person output be: id eventday total 1 02-01-2013 78 1 02-01-2013 89 2 02-13-2013 94 2 02-13-2013 67 . . my problem here adding date start counting on item event day i.e february 1st in case 1 , february 13th in second case i'm not sure how because of overlapping days. simple query getting aggregate minus date below: create table aggregates select id, sum(usage) total source_table localminute between '02-01-2013 08:00' , '02-02-2013 07:59' group dataid un

javascript - How to get Select2 to update a ajax call when country value is changed -

i can't seem find easy example of how update states list when country list has changed. examples i've seen using sorts of bits , peices work depending on version , giving solution. can me how can done without ugly hacks. i've tried far , whilst works, if change drop down second time, new values appended old ones instead of replacing them. i've tried destroying , rebuilding old values remain. the data coming server valid json id , text values. far i've had no luck in getting state list update new country state values when country changed <select id="country" name="country" class="form-control" data-placeholder="select..."> <optgroup label="country"> <option></option> <option value="us" > united states</option> <option value="au" > austrailia</option> </optgroup> </select> <select id=&qu

How to add pause/resume keys in python scripts in mac osx -

i wrote python script helping kids memorize chemical elements. there 'for' loop lasts minutes , add 'pause' , 'resume' functions pressing keys (as needed), in case kids want take break. posts mentioned "ctrl+z", stops script in terminal. others suggest using raw_input, needs press keys in every cycle of 'for' loop. script below: import os import random import time name = 'eric' element_table = {'h':'hydrogen', 'he':'helium', 'c':'carbon', 'n':'nitrogen', 'o':'oxygen', 'f':'fluorine', 'ne':'neon', 'mg': 'magnesium', 'na':'sodium', 'k':'potassium', 'ca':'calcium','fe':'iron', 'cu':'copper', 'ag':'silver', 'au':'gold', 'hg':'mercury', 'al':'aluminum', 'i'