Posts

Showing posts from March, 2014

gunicorn, nginx, and using port 80 for running a django web application -

i have django, nginx, , gunicorn installed on web server. nginx listens on port 80 gunicorn runs django project on port 8000 this works fine. if go www.mysite.com:8000/myapp/ django application comes ok. if want users go www.mysite.com/myapp/ view django application? don't think getting rid of nginx answer, , i'm hoping missed configuration tweak can apply make work. any advice appreciated. no, getting rid of nginx not answer. answer follow very nice documentation configure nginx reverse proxy gunicorn.

ios - Unity 4.5.5f1 + Facebook SDK 6 -

unity game ios , android. when exported ios, try compile in xcode , get: .../assets/facebook/editor/ios/fbunityinterface.mm:22:17: method definition 'initwithcookie:logging:status:frictionlessrequests:urlsuffix:' not found i apple mach-o linker error ld: file not found: .../library/developer/xcode/deriveddata/unity-iphone-ailzvxifteluzgdrxapptghrbxca/build/products/xxx.app/xxx clang: error: linker command failed exit code 1 (use -v see invocation) and get: undefined symbols architecture armv7: "_iosfbsettingspublishinstall", referenced from: registermonomodules() in registermonomodules.o "_iosfbsettingsactivateapp", referenced from: registermonomodules() in registermonomodules.o "_iosfbappeventssetlimiteventusage", referenced from: registermonomodules() in registermonomodules.o "_iosfbappeventslogpurchase", referenced from: registermonomodules() in registermonomodules.o "_iosfbappe...

java - JavaFX (controlsfx-8.20.8) tabbed pane view displaying partially -

i building application using "javafx" (controlsfx-8.0.6) , working fine windows in macintosh , linux environment message box using, didn't work. so moved controlsfx-8.20.8 . fixed message box loading problem ui has tabbed pane become partial view. tried several things make right @ last found if comment setstage(stage stage, object[] obj) method ui work fine want use method in-order other operations in ui , if 1 know how resolve problem please me. all ui designed "javafx scene builder 2.0" if set ui size in setstage can achieve goal. sample code given below: public void setstage(stage stage, object[] obj) { this.stage = stage; stage.setheight(611.0); stage.setwidth(920.0); }

timestamp - Highcharts StockChart - xAxis data is different than data on Tooltip -

i'm having issue , multiplied timestamp mysql query 1000, working, problem inside tooltip says 9 nov , on xaxis saying 10 nov, 10 nov same in database, need displayed 10 nov inside tooltip, somehow managed using tooltip formatter option line on chart when mousehoverd on behind 10th nov, must on 10 nov. $('#chartviews').highcharts('stockchart', { rangeselector: { inputenabled: false }, title: { text: '' }, chart: { backgroundcolor: '#24222b' }, xaxis: { type: 'date' }, series: [{ name: 'views', data: json, tooltip: { valuedecimals: 2 } }] }); json string is: [[1414953000000,1],[1415039400000,2],[1415212200000,1],[1415557800000,1],[1415644200000,3]] it timezone issue, correct $x['date'] = (int)strtotime($x['timestamp'].' +5 hours 30 minutes') * 1000;

android - RecyclerView, StaggeredGridLayoutManager Refresh Bug -

Image
i used support library v7-21 , recyclerview isn't showing correctly. gridlayoutmanager , linearlayoutmanager ok. problem occurs when in staggeredgridlayoutmanager load dataset , refresh data. data refresh working fine recyclerview 's view exist out of screen. does knows how fix it? updated 2015-01-04 (at bottom) i have example project demonstrate @ https://github.com/dbleicher/recyclerview-grid-quickreturn . here few more details may out. when add/remove item recyclerview, should call notifyiteminserted/notifyitemremoved have adapter tell layout manager re-layout affected views. example, in adapter: public void additematposition(int position, string item) { mydataset.add(position, item); madapter.notifyiteminserted(position); } if call method add view, , view on-screen, sglm seems work expected inserting , adjusting layout. if, however, viewing top of list , add item @ position zero, view created off-screen (and won't see it)...

python - Give equal items in list a unique number if items > 1 -

i made functionality, not happy quantity of code. end result good, believe can made easier, don't know how. the functionality: if equal items > 1 in list equal items getting unique set number. below made unit test end result. i'm not happy class creatset . can advise me how can implemented better. import unittest class curtain(object): def __init__(self, type, fabric, number): self.type = type self.fabric = fabric self.number = number self.set_number = none def __str__(self): return '%s %s %s %s' % (self.number, self.type, self.fabric, self.set_name) def __eq__(self, other): return self.type == other.type , self.fabric == other.fabric class creatset(object): def make_unique(self, original_list): checked = [] e in original_list: # if curtain: type , fabric equal if e not in checked: checked.append(e) return checked def create_set(self, curtains): # un...

java - XmlPullParser can't find attribute with a colon in its name -

in xml there's tag attribute has name colon in it: <ggs:bericht stuf:bestandsnaam="bestand.txt" > i've tried these combinations try , return value of attribute: parser.getattributevalue(null, "stuf:bestandsnaam"); parser.getattributevalue("stuf", "bestandsnaam"); parser.getattributevalue(null, "bestandsnaam"); parser.getattributevalue("bestandsnaam", "stuf"); ... return null. if manually remove "stuf:" part of attribute name, works calling: parser.getattributevalue(null, "bestandsnaam"); so how value of such attribute? without using int-parameter version of getattributevalue(), is. the "name colon in it" means attribute in namespace. somewhere further in xml document should find namespace declaration on 1 of ancestors of element looks like xmlns:stuf="{something}" and it's {something} (which either http url or urn:... ) need pa...

Inno Setup - How to prevent it from asking the user if he wants to create a desktop shortcut -

i using inno setup create installer , have come across issue. i cannot tell inno skip page asks user if wants create desktop shortcut. i have removed entire [icons] section (just in case) , nothing changed. i have searched of [setup] settings , don't see relevant: disablestartupprompt=yes disableprogramgrouppage=yes disablereadypage=yes disablewelcomepage=yes disablefinishedpage=yes disabledirpage=yes now, don't understand how choses exe create link created link seems nothing. is there way skip installer screen , not create shortcut @ all? ok. have found solution. i hadn't noticed there section called [tasks] having code: [tasks] name: "desktopicon"; description: "{cm:createdesktopicon}"; groupdescription: "{cm:additionalicons}"; flags: unchecked when removing it, way want it.

c# parse xml array with attribute -

i'm trying parse xml array, has attribute in weird place. here my(found somewhere on stackowerflow) parser code: public static string serialize (object objecttoserialize) { memorystream mem = new memorystream (); xmlserializer ser = new xmlserializer (objecttoserialize.gettype ()); ser.serialize (mem, objecttoserialize); utf8encoding utf = new utf8encoding (); return utf.getstring (mem.toarray ()); } public static t deserialize<t> (string xmlstring) { byte[] bytes = encoding.utf8.getbytes (xmlstring); memorystream mem = new memorystream (bytes); xmlserializer ser = new xmlserializer (typeof(t)); return (t)ser.deserialize (mem); } this works in cases(that need), except here: <hr> <type n="easy"> <scores> <country name="usa"> <score nickname="steve" rank="1">1982</score> ...

css overflow-y not working -

so have applied overflow-y:scroll; to body. so. body { font-family:'open sans', tahoma; background-color:#f4ffff; height:auto; overflow-y: scroll; } but page not scroll down. have no idea why. here page. the problem " position: fixed " in " #load ". try remove , see.

if statement - Simple code on Octave -

in case u vector of random numbers i=u if (i<1) i=i+1 endif endfor in end gives me vector i=u if trying count number of elements less 1 then: sum(u < 1) or if wanted use loop need separate variable total: count = 0 = u if < 1 count = count+1; end end

java - jpa/hibernate one-to-one mapping -

package com.sow.dao; import java.io.serializable; import javax.persistence.cascadetype; import javax.persistence.column; import javax.persistence.entity; import javax.persistence.generatedvalue; import javax.persistence.generationtype; import javax.persistence.id; import javax.persistence.joincolumn; import javax.persistence.onetoone; import javax.persistence.table; import javax.xml.bind.annotation.xmlrootelement; @xmlrootelement @entity @table(name = "empcre") public class empauth implements serializable { @id @generatedvalue @column(name = "id", unique = true, nullable = false) int id; @column(name = "username") string username; @column(name = "userpwd") string pwd; @onetoone(mappedby = "empcre")...

perl - Why does readdir() list the filenames in wrong order? -

i'm using following code read filenames directory , push them onto array: #!/usr/bin/perl use strict; use warnings; $directory="/var/www/out-original"; $filterstring=".csv"; @files; # open folder opendir(dir, $directory) or die "couldn't open $directory: $!\n"; foreach $filename (readdir(dir)) { if ($filename =~ m/$filterstring/) { # print $filename; # print "\n"; push (@files, $filename); } } closedir dir; foreach $file (@files) { print $file . "\n"; } the output running code is: report_10_2014.csv report_04_2014.csv report_07_2014.csv report_05_2014.csv report_02_2014.csv report_06_2014.csv report_03_2014.csv report_01_2014.csv report_08_2014.csv report.csv report_09_2014.csv why code pushing file names array in order, , not 01 10 ? unix directories not stored in sorted order. unix commands ls , sh sort directory listings you, perl's opendir function not; r...

streaming - Bind exception while running FlumeEventCount -

iam trying out spark streaming examples apache flume. installation, have unzipped spark-1.1.0-bin-hadoop1.tar.gz , apache-flume-1.4.0-bin.tar.gz running spark streaming examples.is correct way or else there other way, let me know. with above mentioned steps.. have tried executing examples, throws bind exception. can me issue ? flume running able push data on relevant port... the error iam facing mentioned below.. 14/11/07 23:19:23 error scheduler.receivertracker: deregistered receiver stream 0: error starting receiver 0 - org.jboss.netty.channel.channelexception: failed bind to: /172.29.17.178:65001 @ org.apache.avro.ipc.nettyserver.<init>(nettyserver.java:106) @ org.apache.spark.scheduler.resulttask.runtask(resulttask.scala:62) @ org.apache.spark.scheduler.task.run(task.scala:54) @ org.apache.spark.executor.executor$taskrunner.run(executor.scala:177) caused by: java.net.bindexception: address in use @ sun.nio.ch.net.bin...

sql - MySQL: sum cells in column and insert it in same table with condition -

i need sum specific cells in column condition , insert in same table table structure: id user_id type scores 1 1 daily 10 2 1 daily 20 3 1 500 4 1 daily 5 5 2 200 6 3 300 7 2 daily 23 8 1 cat 11 9 2 daily 25 10 3 daily 30 each user have 1 "all" score (in "type" column ) , multiple "daily" scores, how sum "daily" scores , insert in "all" row like: id user_id type scores 1 1 daily 10 2 1 daily 20 3 1 35 4 1 daily 5 5 2 48 6 3 30 7 2 daily 23 8 1 cat 11 9 2 daily ...

javascript - sharepoint field value show undefined -

i learning sharepoint 2013. trying show data in web part. below code <script unselectable="on"> window.onload = function() { myfunction(); }; function myfunction() { console.log("test"); $().spservices ({ operation: "getlistitems", async: false, weburl: $().spservices.spgetcurrentsite(), listname: "share point list", camlquery: "<query><orderby><fieldref name='id' ascending='true' /></orderby></query>", completefunc: function (xdata, status) { $(xdata.responsexml).spfilternode("z:row").each(function() { console.log(firstname); var firstname = $(this).attr("ows_first_name"); var lastname = $(this).attr("ows_last_name"); var gender = $(this).attr("ows_gender"); var dateofbirth = $(this).attr("ows_date_of_birth"); var email = $(this).attr("ows_email"); var city = $(this).attr("ows_city"); var country = $(this...

javascript - JQ and Js how to Validate content null (Spacebar) -

my js here: $('input[type=submit]').click(function () { var val = $('#message_content').sceditor('instance').val(); if( val == "" || !val ) { alert('content cannot null'); return false; } return true; }); i have 1 question: how validate? if content " "(spacebar) or "   "(full code spacebar)...judgment content null? $('input[type=submit]').click(function () { var val = $.trim($('#message_content').sceditor('instance').val()); if(!val) { alert('content cannot null'); return false; } return true; }); you can try this.

asp.net - Running a copy of a .cshtml file gives a 404 -

i've created copy(right-click copy & paste) of home page in vs2013 asp.net mvc5 project , named indexl10. when try run it, following error: description: http 404. resource looking (or 1 of dependencies) have been removed, had name changed, or temporarily unavailable. please review following url , make sure spelled correctly. requested url: /home/indexl10 so, i'm guessing there's more copying , pasting. i've tried googling around, i've not found answer, or search string takes me page of user similar problem. have ideas/suggestions? thanks *.cshtml files not *.aspx files. they're not directly exposed. url translated framework route. route points particular controller , particular action in controller, called framework. action returns actionresult , in mvc typically satisfied via viewresult . conventions in framework come play view render same name action called, not strictly required , can overridden. regardless, view (your...

MemoryError in loading Pybrain SupervisedDataSet -

i have training set of 2.4m data 100k dimension. when load data superviseddataset using addsample() , calls memoryerror 130k data loaded. is there method load big data onto superviseddataset ?

javascript - Error: [$injector:unpr] and [$injector:nomod] when using angular js -

using angular js. when using code error, "uncaught error: [$injector:nomod] occur angular.module('app1') .provider('post',function(){ this.$get = ['$resource', function ($resource) { var post = $resource('http'://localhost:7214/admn/university.aspx?/api/post/:_id', {}, { update: { method: 'put' } }) return post; }]; }); angular.module('app1') .controller('mainctrl', ['$scope', '$route', 'post', function ($scope, $route, post) { $scope.post = new post(); $scope.posts = new post.query(); $scope.newpost = function () { $scope.post = new post(); $scope.editing = false; } and when add 'ngroute' in module error occurs, "error: [$injector:unpr] .the code error angular.module('app1',['ngroute']) .provider('post',function(){ this.$get = ['$resource', function ($resource) { var post = $resource('http'://localhost:7214/admn/university.aspx?...

database - CouchDB View With OR Condition -

i have 2 kinds of documents in couchdb following json type: 1. { "_id": "4a91f3e8-616a-431d-8199-ace00055763d", "_rev": "2-9105188217acd506251c98cd4566e788", "vehicle": { "type": "string", "name": "vehicle", "value": "12345" }, "start": { "type": "date", "name": "start", "value": "2014-09-10t11:19:00.000z" } } 2. { "_id": "4a91f3e8-616a-431d-8199-ace00055763d", "_rev": "2-9105188217acd506251c98cd4566e788", "equipment": { "type": "string", "name": "equipment", "value": "12345" }, "start": { "type": "date", "name": "start", "value": "2...

Bring up vagrant boxes simultaneously -

vagrant brings 1 box @ time. there way make vagrant bring boxes @ same time? the vagrantfile configuration i'm using several boxes has following format: vagrant.configure("2") |config| config.vm.define :master |master| # master config... end config.vm.define :slave1 |slave| # slave config... end end now, when running > vagrant up vagrant start setting master , once done set slave1. depending on provider, can pass pass --parallel flag vagrant up. vagrant --parallel  as of march 17th, mitchell hashimoto noted virtualbox not provider supports parallelism. reference

swift - Comparing NSDate -

i compare 2 nsdates every date shows being "earlier" todaysdate . ideas? let compareresult = self.todaysdate.compare(self.date) if compareresult == nscomparisonresult.ordereddescending { println("today later date2") } else { println("future") } to "todaysdate" let todaysdate = nsdate() let calendar = nscalendar.currentcalendar() let components = calendar.components(.calendarunithour | .calendarunitminute | .calendarunitmonth | .calendarunityear | .calendarunitday, fromdate: todaysdate) let hour = components.hour let minutes = components.minute let month = components.month let year = components.year let day = components.day println(todaysdate) this print is: 2014-11-12 14:48:48 +0000 and print "date" is: 2014-10-24 07:24:41 +0000 this on parse.com server. thanks i think perhaps you're interpreting results of compare backwards. check out. each of asserts passes: let today = nsdate() let tomorro...

java - IntentService's onDestroy method getting called straight after onHandleIntent -

i have intentservice using record audio via audiorecord in app. in onhandleintent method, call .getinstance of seperate class used handling recording, , call couple of methods of class. however intentservice starts, ondestroy method gets called, , recording stops. in class gets instantiated in onhandleintent , audio still recording, until ondestroy gets called. surely ondestroy shouldn't called until recording finished. if offer suggestion why doing this, appreciated. the code intentservice below: public class recordservice extends intentservice { public file directory; audiorecord audiorecord; int samplerate = 44100; int channelconfiguration = audioformat.channel_in_mono; int audioencoding = audioformat.encoding_pcm_16bit; file file; short channels = 1; int bitspersample = 16; public recordservice() { super("record"); } extaudiorecorder extaudiorecord; @override protected void onhandleintent(...

mysql - how to get Even/Odd id numbers from a database table in codeigniter -

i new in codeigniter , stacked in query solve report emergency project. please me codeigniter's experts. i have large database table , wants show odd/even data rows table filtered table field named "sale_id". tried in phpmyadmin in raw coding , it's worked me. can not apply in codeigniter. select * ospos_pak_sub_cat id %2 =0; worked me in raw php coding. how can use in codeigniter. used condition on query , want add new query. existing condition given below, working fine. $this->db->where('sale_date between "'. $inputs['start_date']. '" , "'. $inputs['end_date'].'"'); it working , tried code below solution not working , getting error. $this->db->where('sale_id %2'=> 0); getting error line. says-- parse error: syntax error, unexpected '=>' (t_double_arrow) please me solutions. in advance. in model, write query that: $this->db->select(...

c# - Output not proper when calling batch file programatically -

i trying automate server patch installation product , came know wix toolset. hoping jboss version in installer. command same standalone.bat --version cmd. installer created 1 customaction tried run , output. public static string runrunnablebatch(string path){ process exploitversionservice = new process(); string runnablebinpath = path; exploitversionservice.startinfo.workingdirectory = path + "bin"; exploitversionservice.startinfo.filename = path + "bin\\standalone.bat"; exploitversionservice.startinfo.createnowindow = false; exploitversionservice.startinfo.arguments = string.format("--version"); exploitversionservice.startinfo.useshellexecute = false; exploitversionservice.startinfo.redirectstandardoutput = true; exploitversionservice.startinfo.redirectstandardinput = false; exploitversionservice.start(); exploitversionservice.waitforexit(); // /* string opt = ""; while (!exploitver...

python - Selenium on mac gives elementNotVisibleException -

here test case: #!/usr/bin/env python selenium import webdriver lxml.cssselect import cssselector import selenium.webdriver.support.ui ui import time def test(urlx): br = webdriver.phantomjs('phantomjs') start_time = time.time() br.get(url) restaurant_url_sel = u'.restaurants a' ta_restaurant_button = br.find_element_by_css_selector(restaurant_url_sel) print str(ta_restaurant_button.text) elapsed_time = time.time() - start_time print("---|||||||||||||||||||||||||| %s seconds |||||||||||||||||||||||||||||||---" % elapsed_time) print br.page_source url = 'http://www.tripadvisor.com/tourism-g150812-playa_del_carmen_yucatan_peninsula-vacations.html' test(url) the traceback: traceback (most recent call last): file "scrapeall_destination.py", line 20, in <module> get_restaurants(url) file "/users/pablocastelo/desktop/tripadvisor/get_restaurants.py", line 67, in get_restaurants ...

Wordpress theme showing blank page and wp-admin show PHP code -

i upload site on godaddy , site showed blank page. configurations have been done properly. the same site has been uploading on hosting account working fine. url not working: http://workshop.planvisionmn.com the main page blank, when u try access wp-admin shows php code never happened me before. note: tried rename plugin`s disable them , check if reason issue persisted.

Android: How pixel density is calculate? -

today saw nexus 7 specifications . has resolution of 1200 x 1920 pixels , physical screen size of 4.49 x 7.87 inches . the specs says has 323 density . how did calculated number? i been trying this: 1200 / 4.49 = 267.26 or this: 1920 / 7.87 = 243.96 but doesn't me anywhere. getting density value from? this use when calculating "on paper": http://labs.rampinteractive.co.uk/android_dp_px_calculator/ to calculate ppi: ppi=(squareroot(h^2+w^2))/inches ppi=(squareroot(1920*1920+1200*1200))/7 ppi=(squareroot(3686400+1440000))/7 ppi=(squareroot(5126400))/7 ppi=2264.155~/7 ppi=323.45~ can't think of clearer way explain you. oim~

amazon web services - How can I install java using CloudFormation -

i want install latest java using cloudformation template. instance redhat 7. currently wrote: "aws::cloudformation::init": { "config": { "packages": { "yum": { "httpd": [ ] } }, "services": { "sysvinit": { "httpd": { "enabled": "true", "ensurerunning": "true" } } } } } java installed, not latest version. new service depend on newer version of java. need change in "yum" block ? the following cloudformation init script: "packages": { "yum": { "httpd": [ ] } }, translates roughly: #/bin/bas...

java - App Stopped Working After Clicking A Button -

i extremely new java programming. started week or 2 ago. have experience turing , visual basic. please try , keep explanations simple possible. sorry if post kind of messy, first time posting here. this src java file package com.example.pokethedot; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.button; import android.widget.textview; public class pokethedot extends actionbaractivity { int counter; button add; textview display; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_poke_the_dot); counter=0; add=(button) findviewbyid(r.id.badd); display=(textview) findviewbyid(r.id.tvdisplay); add.setonclicklistener(new view....

java - ColdFusion 10 Update 14 Issue -

i installed update 14 cf 10 today , updated wsconfig. since then, site has not come up. noticed new folder (2) created in wsconfig folder. following error returned when trying view coldfusion page on server. service temporary unavailable! the server temporarily unable service request due maintenance downtime or capacity problems. please try again later. jakarta/isapi/isapi_redirector/1.2.32 () this appearing in error log. > java.lang.reflect.invocationtargetexception @ > sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ > sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:39) > @ > sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:25) > @ java.lang.reflect.method.invoke(method.java:597) @ > com.adobe.coldfusion.bootstrap.bootstrap.init(bootstrap.java:86) @ > com.adobe.coldfusion.bootstrap.bootstrap.main(bootstrap.java:161) > caused by: java.lang.nosuchmethoderror...

c# - create new Thread, passing two parameters -

i'm trying create new thread passing 2 parameters, have searched many times still no result. here method: public void add(int smallest, int biggest) { (int = smallest; < biggest+1; i++) { thread.sleep(500); result = result + i; } } and want below: static void main() { int x=10; int y=100; // in line appear error thread t=new thread(add); t.start(x,y); } you can't way. thread.start() method doesn't include overloads supporting more 1 parameter. however, general goal solved using anonymous method thread body: static void main() { int x=10; int y=100; // in line appear error thread t=new thread(() => add(x, y)); t.start(); } i.e. instead of add() method being thread entry point, wrap in anonymous method (declared here via lambda expression syntax). arguments x , y "captured" anonymous method, passed add() method when thread starts. one important caution: val...

ruby - Deserialize JSON Strings Directly into Models? -

i have ruby models populated responses of api calls in following way: json.parse converts response hash the hash passed initialize method of class the initialize method converts camelcase hash keys , assigns underscore_case instance variables this works fine, of these response objects large. others arrays of large objects. profiling shows process consumes lot of memory -- makes sense, create hashes in order create objects, , i'm sure camelcase underscore_case conversion expensive -- libraries or techniques have come across solve problem? (update) here oversimplified example: json response third party api (unlikely change): "{\"abcdef\": 123, \"ghijkl\": 456, \"mnopqr\": 789}" class definition (unlikely change): class data attr_accessor :abc_def, :ghi_jkl, :mno_pqr def initialize(attributes = {}) attributes.each |key, val| send "#{key.underscore}=".to_sym, val end end end creating...

vb.net - ComboBox FindString Contains -

i have such entries in winforms combobox: font 8 pt font 9 pt font 10 pt font 12 pt font 14 pt then have search string " 9 ". here native way find index search string without looping? i try this: dim integer = mycombobox.findstring(" 9 ", 0) ... without result. first, no, there no available method in framework searches sub-string in combobox items , returns index of first item contains search parameter. but combobox.findstring uses loop can see in source . so there nothing bad in using one, write extension method this: public static class controlextensions { public static int findsubstringindex(this combobox combo, string substring, stringcomparison comparer = stringcomparison.currentculture) { // sanity check parameters if(combo == null) throw new argumentnullexception("combo"); if (substring == null) { return -1; } (int index = 0; index < combo.items.count;...

javascript - Show footer when reaching bottom of page -

i saw similar questions, didn't give me solution. footer show (slideup) when reaching bottom of page , hide again when scrolling towards top. i'm using script shows footer after amount of scrolling. here fiddle does know how? $(window).scroll(function() { if ($(this).scrolltop() > 10) { $( 'footer').slidedown(300); } else { console.log('there'); $('footer').slideup(300); } }); var height; var trigger = 350; $(window).scroll(function() { height = $(document).height()-$(window).height(); console.log(height+" "+$(this).scrolltop()); if ($(this).scrolltop() > height - trigger) { $( 'footer').slidedown(300); } else { $('footer').slideup(300); } }); for better performance, put window height calculation , document height calculation outside of scroll function , run instead once after load ( $(){} ) , recalculate on wind...

jquery - Primefaces 5 datascroller - Setting scrollHeight with Javascript -

i using primefaces 5 , have lazyloaded data scroller set follows <p:datascroller value="#{controller.datamodel}" var="item" chunksize="10" lazy="true" mode="inline" scrollheight="100" id="scroller"> </p:datascroller> i want datascroller scrollheight set take full height of space on page can via javascript , not fixed size of 100. i have bound window resize method recalculate size , set , works, can't set initially. the javascript set looks this $("#scroller > div").css("height", $("#main").height()); and call after component using <h:outputscript> $("#scroller > div").css("height", $("#main").height()); </h:outputscript> as stated, works if resize window not when component rendered. two things coud wrong. having id="scroller" not render component id="scroller" rather prep...

C operator -- gives two different results -

#import <stdio.h> int main() { int a,d,b,c; = 10; c = 10; d = --c + --c+1; b = --a +1+ --a ; printf("b= %d, d = %d" , b,d); return 0; } b= 18, d = 17 the code , it's run why d&b not equal? can please explain why d=17? oh right, it's because it's undefined when value of a , c decrement. d = --c + --c+1; if c decremented twice , d calculated, gives d = 8 + 8 + 1 = 17 but if c decremented proceed left right, gives d = 9 + 8 + 1 = 18

java - get project Linked resources path from eclipse-plugin run -

i writing eclipse-plugin accesses opened projects in eclipse. in these projects need access source files, unfortunately can in different location project working directory. consider creating new project existing sources: the new project in folder c:/users/username/runtime-eclipseapplication/jabref whereas source files reside in c:/users/username/downloads/git/jabref/ this creates following entry in .project-file: ... <linkedresources> ... <link> <name>java</name> <type>2</type> <location>c:/users/username/downloads/git/jabref/src/main/java</location> </link> </linkedresources> ... and .classpath-file: <?xml version="1.0" encoding="utf-8"?> <classpath> <classpathentry kind="src" output="classes" path="java"/> <classpathentry kind="src" output="classes" path="gen"/> ...

pandas - Drop level from one specific column -

inspired pandas: drop level multi-level column index? i have multilevel dataframe: | l | | +---+---+---+ | | b | c | --+---+---+---+ 0 | ¦ 1 | 2 | 1 | b ¦ 3 | 4 | i need flatten column a @ level 0 so like: +---+---+---+ | l | b | c | --+---+---+---+ 0 | ¦ 1 | 2 | 1 | b ¦ 3 | 4 | df.columns = df.columns.droplevel() produces +---+---+---+ | | b | c | --+---+---+---+ 0 | ¦ 1 | 2 | 1 | b ¦ 3 | 4 | i struggling produce toy example well try this df.columns = [c[-1] c in df.columns]

combine text and files in a script -

i have following problem: i'm trying write script 2 files (file1.txt , file2.txt) should combined 1 file text passage in between. output should written in file (e.g. output.txt). the output.txt file should be: [content of file1.txt] text passage [content of file2.txt] after research on internet found following , works fine in terminal: cat file1.txt <(echo "text passage") file2.txt > output.txt however, not work in script: #!/bin/sh cat file1.txt <(echo "text passage") file2.txt > output.txt if execute script nothing happens (the output.txt isn't written). why doesn't line work in script , can make work? thank help! stephan you can this: cat file1.txt > output.txt echo "text message" >> output.txt cat file2.txt >> output.txt the >> operator means add end of file, rather overwriting contents. you can group commands using brackets: (cat file1.txt echo "...

r - Map fixed length string to an integer -

suppose map combination of string of length k integers (if count 26 latters uppers , lowers have (26+26) ^k combination. there fast way in r map, given string of length k unique integer? for example: 1. k=1 , c("a","d","z"), result c(1,4,26). 2. k=2 , c("aa","da","za"), result c(53,157,1379). conv <- function(strings, base = letters) { s <- strsplit(strings, "") vapply(s, function(x, base) { x <- match(x, base) as.integer(t(x) %*% (length(base)^(rev(seq_along(x)) - 1l))) }, 1l, base=base) } #test strtoi("5a3", base=16) #[1] 1443 conv("5a3", base=c(1:9, letters[1:7])) #[1] 1443 mystring <- c("a", "d", "z", "aa","da","za") conv(mystring, base = c(letters, letters)) #[1] 1 4 26 53 209 1379 other symbols can included in base parameter.

javascript - Auto capitalisation of input field using AngularJS -

i have directive on input field licence key validates against server side api. works fine want licence key auto hyphenate , appear capitalized. i.e. user typing in abcd1234qwer5678 have appear abcd-1234-qwer-5678 . (i first trying auto capitalisation working, ill try hyphenating) i have tried couple of things, firstly watch within controller $scope.$watch('licencekey', function (newvalue, oldvalue) { $scope.$apply(function () { $scope.licencekey = newvalue.touppercase(); }) }); and tried using second directive applied input myapp.directive('capitalize', function() { return { require: 'ngmodel', link: function(scope, element, attrs, modelctrl) { var capitalize = function(inputvalue) { if(inputvalue == undefined) inputvalue = ''; var capitalized = inputvalue.touppercase(); if(capitalized !== inputvalue) { modelctrl.$setviewvalue(capitalized); m...

visual studio 2013 - IISexpress reset and set configuration directory -

i using iis8 express server visual studio debug web application. in mid-time, reinstalled iis8 found iis8 express creating it's 'config,logs,tracelogfiles' folders under desktop not under c:/username/document/iisexpress file path default. , result facing problems debug visual studio web application. throwing error 'process id of not running' , cannot explore project solution tried solution. still not set actual file path iis8express. how can set reset iis8express , set default config path c:/username/document/iisexpress old question, had same problem. after doing backup, ended removing content of %userprofile%\my documents\iis express folder, recreating config folder, , copy content of templates under '%programfiles%\iis express\config\templates\personalwebserver' %userprofile%\my documents\iis express\config after restarting iisexpress , visual studio 2013 problem disappeared , iisexpress being started visual studio. of course, clears , re...

High numbers in SVG makes the element disappear -

if put big number coordinate svg elements, these elements doesn't show up. .line { stroke-dasharray: 10, 5; fill: none; stroke: #ff6600; stroke-width: 1; } <body> <svg height="500" width="800"> <polyline class="line" points="0,300 16000000,300"></polyline> </svg> </body> http://codepen.io/anon/pen/jojbkq if change 16,000,000 coordinate in polyline smaller (15m) shows up. see problem in chrome, appears in browsers in of them (firefox) higher numbers. crashes browser high-enough numbers(firefox). when remove stroke-dasharray attribute element, problem @ 3 orders of magnitude higher numbers. you may ask why need such big numbers there. have zoomable scene , reasonable coordinates reaches limit pretty once zoom in deep enough. does know kind of workaround? thanks

java - How to correctly specify a default value in the Spring @Value annotation? -

initially, have following spec: @value("#{props.isfpl}") private boolean isfpl=false; this works fine correctly getting value property file: isfpl = true however, following expression default results in error: @value("#{props.isfpl:false}") private boolean isfpl=false; expression parsing failed; nested exception org.springframework.expression.spel.spelparseexception: el1041e:(pos 28): after parsing valid expression, there still more data in expression: 'colon(:)' i tried use $ instead of #. @value("${props.isfpl:true}") private boolean isfpl=false; then default value in annotation works fine did not correct value properties file: try $ follows @value("${props.isfpl:true}") private boolean isfpl=false; also make sure set ignore-resource-no-found true if property file missing, default value taken. also, place following in - the context file if using xm based configuration : <context:property-pla...

python - Cannot make warning sign visible on OSX Terminal and ncurses -

this simple program on osx 10.6.8, python 3.4, terminal.app , font menlo prints 3 unicode characters: smiley, warning sign, , radioactive symbol, or maybe should should print, because in fact first , last. warning sign not there. from curses import wrapper def main(stdscr): # clear screen stdscr.clear() in range(1, 11): stdscr.addstr(i, 0, '\u263a \u26a0 \u2622'.encode("utf-8")) stdscr.refresh() stdscr.getkey() wrapper(main) additionally, if open font book, apparently menlo have glyph warning sign, puzzles me if go edit -> special characters, select warning sign, , click insert, warning sign @ command prompt. using print() shows warning sign. what's going on? edit : apparently it's bug in osx libc library. see here how ncurses output astral plane unicode characters i tried compiling small program wcinfo sbo@sbos-macbook:~$ ./wcinfo 26a0 code 26a0: width -1 sbo@sbos-macbook:~$ ./wcinfo 263a code 263a: width...

sql server - Advanced Sql query to identify missing data -

i dealing sql server table 'suburb' has suburb_id column , adjacent_suburb_ids column. adjacent_suburb_ids column comma separated string of other suburb_ids. i have found of records not reciprocating - e.g "suburba" has "suburbb" id in adjacent_suburb_ids "suburbb" not have "suburba" id in adjacent_suburb_ids i need identify suburbs not reciprocating adjacent_suburbs, can sql query? please not comment on data/table structure not in control , can't change it. assuming i'm understanding question correctly, can join table using like , not like operators: select s.suburb_id, s2.suburb_id s2id suburb s join suburb s2 on s.suburb_id <> s2.suburb_id , ',' + s2.adjacent_suburb_ids + ',' '%,' + cast(s.suburb_id varchar(10)) + ',%' , ',' + s.adjacent_suburb_ids + ',' not '%,' + cast(s2.suburb_id varchar(10)) + ',%...