Posts

Showing posts from June, 2015

c# - Self hosted WCF using WebSockets is not working using SSL -

Image
i have code in console application. trying connect dev tools chrome, error although problem sure in wcf side: websocket connection 'wss://127.0.0.1:5650/echo' failed: error in connection establishment: net::err_connection_reset wss not hitting server code, no exceptions not logs. ws minimum modifications working fine. used microsoft.websockets nuget simplify code: websockethost server = new websockethost(typeof(echowsservice), new uri("https://127.0.0.1:5650/echo")); var bindingssl = websockethost.createwebsocketbinding(true); server.addwebsocketendpoint(bindingssl); server.open(); i tried custom cert validator, said not hitting code. now have same code except server.open() in asp.net app using serviceroute , , working pretty fine! yes ssl , self signed cert generated vs iis express: routetable.routes.add(new serviceroute("echo", new trwebsocketservicefactory(), typeof(echowsservice))); the browser side is: var ws = new websocket('...

java - How do I run annotation processing via maven 3.3? -

for years, we've been running maven-processor-plugin separate goal (using proc:none on maven-compiler-plugin). finally upgrading maven 3.0.5 latest 3.3.3, , see maven-processor-plugin looks dead. far can tell, has not been migrated out of google code. we're using annotation processing generate dagger classes. can't remember reasons, @ time (in dagger-1), got impression better during generate-sources , generate-test-sources phases rather during compile , test-compile , why used maven-processor-plugin begin with. note want play nicely in eclipse/m2e well. is there new, better way run annotation processing maven eclipse-friendly? you can use maven-compiler-plugin annotation processing because functionality exists in javac . annotation processing , regular compilation in separate phases, can multiple executions of plugin, 1 annotation processing turned on , other turned off. configuration follows: <plugin> <groupid>org.apache.maven...

java - Spreadsheet API - Retrieving a list of spreadsheets -

i want display spreadsheets of account , i build 2 spreadsheets on account , try code below , my spreadsheets have been setting public, but got nothing , public class googlesheettest { private final static string[] scopes_array = {"https://spreadsheets.google.com/feeds", "https://spreadsheets.google.com/feeds/spreadsheets/private/full", "https://docs.google.com/feeds"}; private final static string spreadsheet_url = "https://spreadsheets.google.com/feeds/spreadsheets/private/full"; private final static string spreadsheet_id = "xxxxxxxxxx@developer.gserviceaccount,com"; public static void main(string[] args) throws malformedurlexception, generalsecurityexception, ioexception, serviceexception { jacksonfactory json_factory = jacksonfactory.getdefaultinstance(); httptransport httptransport = googlenethttptransport.newtrustedtransport(); final list scopes = arrays.aslist(scopes_array); ...

javascript - How can I prevent Angular from rendering and displaying a page before ng-if evaluation? -

i wrote code below shows block of code based on "ng-if" evaluation(true/false). problem have wehn vm.anyitems equals true, angularjs tries render <p>...</p> block , display on browser before <div>...</div> displayed. there ways prevent this? <div ng-if="vm.anyitems"> <div>...</div> </div> <div ng-if="!vm.anyitems"> <p>xxxxxxxxxxxxx</p> </div> try looking ngcloak. stop code being displayed until after application rendered angular. your code can following: <div ng-cloak ng-if="vm.anyitems"> <div>...</div> </div> <div ng-cloak ng-if="!vm.anyitems"> <p>xxxxxxxxxxxxx</p> </div> source: https://docs.angularjs.org/api/ng/directive/ngcloak

Wordpress Query about posting a private blog -

i want ask simple question wordpress.my question when make post private in website appears word "private" title.can resolve this? thank you! you can remove label in title using 2 filters private_title_format protected_title_format you need add code in theme functions.php file or using plugin. function tm_private_protected_from_titles( $format ) { return '%s'; } add_filter( 'private_title_format', 'tm_private_protected_from_titles' ); add_filter( 'protected_title_format', 'tm_private_protected_from_titles' );

ios - FBSDKShareDialog delegate not called -

i use latest facebook sdk ios platform.i use fbsdksharedialog share image facebook,the code can share image facebook.but want share result delegate. - (void)sharedimage:(uiimage *) sharedimage fromviewcontroller:(uiviewcontroller *) fromviewcontroller { fbsdksharephoto *photo = [[fbsdksharephoto alloc] init]; photo.image = sharedimage; photo.usergenerated = yes; fbsdksharephotocontent *content = [[fbsdksharephotocontent alloc] init]; content.photos = @[photo]; fbsdksharedialog *dialog = [[fbsdksharedialog alloc] init]; dialog.fromviewcontroller = fromviewcontroller; dialog.sharecontent = content; dialog.delegate = self; dialog.mode = fbsdksharedialogmodesharesheet; [dialog show]; } #pragma mark - fbsdksharingdelegate - (void)sharer:(id<fbsdksharing>)sharer didcompletewithresults:(nsdictionary *)results { } - (void)sharer:(id<fbsdksharing>)sharer didfailwitherror:(nserror *)error { } - (void)sharerdidcan...

ios - When a NavigationController push to a TabBarController , Why after the first tab bar item , TableViewController's contentInset is wrong -

my tabbaritems uitableviewcontroller . when navigationcontroller push in tabbarcontroller , after first items, tableview.contentinset uiedgeinsetsmake(0, 0, 0, 0) but sometimes, when set tableview.contentinset = uiedgeinsetsmake(64, 0, 0, 0) . tableview.contentinset became uiedgeinsetsmake(128, 0, 0, 0) . uncheck adjust scroll view insets in view controller attributes, or self.automaticallyadjustsscrollviewinsets = no if not using storyboard. introduced in ios 7, might version check if needed.

autoformatting - Formatting issue in Visual Studio 2015 -

there seem few changes (bugs?) in auto-formatting feature of vs2015. 1: has been reported rc not fixed release: if type: public string name { get; set; } it formatted to: public string name { get; set; } i have "leave block on single line" set. 2: if type, e.g. if (array.count() > 1) doone(array); else if (array.count() == 1) domany(array); it corrected to: if (array.count() > 1) doone(array); else if (array.count() == 1) domany(array);

ruby on rails - How to edit a method of a gem? -

i'm using gem acts_as_commentable_with_threading, , i'd add destroy method. currently, if delete comment , has replies delete comment , it's replies. i'd keep function root comment, not children. if this comment 1 / \ \ comment 4 comment 2 \ \ comment 3 where comment 2, 3, , 4 children of 1, 3 child of 2. want make if delete comment 2, comment 3 still there. however, keep if comment 1 deleted of comments under deleted because comment 1 root comment. have edit destroy method in gem allow this. how go doing this? (not asking how logic rather can edit method, i'd appreciate on logic) you can via monkey patching , involves defining additional aspects of class or module within file. place put this, i've found, in config/initializers . so, if want overwrite destroy method of class a::b, make file says like: require 'loads_a_b' module class b def destroy_with_child_preservation ...

android - Converting my app to a service -

i've created geo-location app collects location information of device , compares pre-defined lat/long coordinates perform actions when match. currently have activity page users can enter coordinates other parameters such radius , interval polling. also, app starts when user starts it. i wish convert service following runs in background parameters read configuration file (this part done) hence no need main activity (no ui) starts automatically (probably need android.intent.action.boot_completed broadcastreceiver) how do this? thanks. you have create service application, this: exampleservice.java: public class exampleservice extends service { @override public ibinder onbind(intent intent) { // todo auto-generated method stub return null; } @override public void onstart(intent intent, int startid) { // todo auto-generated method stub super.onstart(intent, startid); log.d(tag, "onstart()===>in"); // write applicati...

iOS: Identify User turned off Push Notification from APNS provider -

i trying find if user turned off push notification apns provider. here scenario user register apns , registers token provider. user turns off notification settings. the app not running.. if provider tries send push notification device fail? or if query feedback service report it? from testing far, apns returns success after user turned off push notification , feedback service not report token. whereas if user uninstall app can see device token on feedback service. the push notification workflow has been tedious no request/response model. every time send push notification, must poll apns feedback service check each device token still accepting pushes. based on wwdc video, since ios 9, feedback if push receiver turned off push notification when send push notification. check link the apns feedback server take time update push token status. looks not dynamic synchronise service, currently.

c# - Insert record to a table using linq query that contains auto increment ID -

i'm having issue insert record table contains auto increment id , i'm going insert values table using entity frameworks. this table creation query use [db_name] go set ansi_nulls on go set quoted_identifier on go create table [dbo].[table_name]( [discussion_id] [int] identity(1,1) not null, [discussion_name] [nvarchar](50) null, [discription] [nvarchar](255) null, constraint [pk_table_name] primary key clustered ( [discussion_id] asc )with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off, allow_row_locks = on, allow_page_locks = on) on [primary] ) on [primary] go this view page code @model albaraka.models.table_name @{ viewbag.title = "discussion_create"; layout = "~/views/shared/_layout.cshtml"; } <h2>discussion_create</h2> @using (html.beginform()) { @html.antiforgerytoken() <div class="form-horizontal"> <h4>ab_discussion</h4> ...

php - URL issue with route setting -

$route['allgrant'] = "grant/allgrant"; the above working fine url: http://localhost/grant/allgrant but getting error url http://localhost/grant/allgrant/6 my route setting below: $route['allgrant/(:num)'] = "grant/allgrant/$1"; my controller code: public function allgrant() { $this->load->library('pagination'); $config = array(); $config["base_url"] = base_url('allgrant'); $config['total_rows'] = $this->db->count_all("grant_data"); $config['per_page'] = 3; $config["uri_segment"] = 2; $this->pagination->initialize($config); $page = ($this->uri->segment(2)) ? $this->uri->segment(2) : 0; $data["allgrant"] = $this->grant_model->allgrant($config["per_page"], $page); $data["links"] = $this->pagination->create_links(); $data['maincontent'] = 'viewgr...

parse.com - Deleting object from array in Parse Cloud Code (Javascript) -

below js code supposed delete pointer reference 'game' object stored in array under key 'games' in 'team' object. fetching works , 'success' logs below called meaning .remove , .save functions called, reason, not , pointers still exist in arrays after execution of code. doing wrong? var queryteam = request.object.get("awayteamid"); queryteam.fetch({ success: function(awayteam){ console.log("success in fetching awayteam object. destroying now."); awayteam.remove(awayteam.get("games"), request.object); awayteam.save(); var queryteam = request.object.get("hometeamid"); queryteam.fetch({ success: function(hometeam){ console.log("success in fetching hometeam object. destroying now."); hometeam.remove(hometeam.get("games"), request.object); hometeam.save(); }, ...

azure - Strange replacement behaviour (braces + parentheses) -

i'm using azure translator ( https://www.microsoft.com/en-us/translator/translatorapi.aspx ). if translate swedish string: we {1} had it i i'd expect: vi {1} hade det but, puzzlingly, this: we {2} had it returns (notice braces got translated parentheses): vi (2) hade det what on earth??

php - Mysql getting json from nested queries -

i had 2 tables whch visitormaster , visitor comment. visitor master has unique visitorid , comment bt visitor stores in visitorcomment using visitorid foreign key there. want data in following format: [ { "visitorid":1, "visitorname":"abc", "comment": { "commentid":2; "comment":"xyz" } } { "visitorid":2, "visitorname":"lmn", "comment": { "commentid":4; "comment":"mno" } } ] $sql = mysql_query("select * visitormaster"); if(mysql_num_rows($sql) > 0) { $result = array(); while($rlt = mysql_fetch_array($sql,mysql_assoc)) { $result[] = $rlt[]; $vid=$rlt["visitorid"]; $sql1 = mysql_qu...

Python 2.7 + Scapy 2.3.1 -

i'm trying using scapy don't know why functions don't work: from scapy.layers.inet import * = ether() / ip(dst='192.168.1.1') / icmp() a.show() results in: traceback (most recent call last): file "/home/user/pycharmprojects/untitled/main.py", line 7, in <module> a.show() file "/usr/lib/python2.7/dist-packages/scapy/packet.py", line 819, in show ###[ ethernet ]### reprval = f.i2repr(self,fvalue) file "/usr/lib/python2.7/dist-packages/scapy/fields.py", line 191, in i2repr x = self.i2h(pkt, x) file "/usr/lib/python2.7/dist-packages/scapy/layers/l2.py", line 88, in i2h x = conf.neighbor.resolve(pkt,pkt.payload) file "/usr/lib/python2.7/dist-packages/scapy/layers/l2.py", line 38, in resolve return self.resolvers[k](l2inst,l3inst) file "/usr/lib/python2.7/dist-packages/scapy/layers/inet.py", line 727, in <lambda> conf.neighbor.register_l3(ether, ip, lambd...

python - Error with training logistic regression model on Apache Spark. SPARK-5063 -

i trying build logistic regression model apache spark. here code. parseddata = raw_data.map(mapper) # mapper function generates pair of label , feature vector labeledpoint object featurevectors = parseddata.map(lambda point: point.features) # feature vectors parsed data scaler = standardscaler(true, true).fit(featurevectors) #this creates standardization model scale features scaleddata = parseddata.map(lambda lp: labeledpoint(lp.label, scaler.transform(lp.features))) #trasform features scale mean 0 , unit std deviation modelscaledsgd = logisticregressionwithsgd.train(scaleddata, iterations = 10) but error: exception: appears attempting reference sparkcontext broadcast variable, action, or transforamtion. sparkcontext can used on driver, not in code run on workers. more information, see spark-5063. i not sure how work around this. greately appreciated. problem see pretty same 1 i've described in how use java/scala function action or transformation? transfo...

javascript - regex cannot force exactly 11 digits -

this question has answer here: matching 10 digits in javascript 3 answers i want force 11 digits, adding validator jquery validator plugin regex, problem allows more 11 , should not, should 11 exactly. /[0-9]{11}$/.test(value); it not allow less 11 correct allow more not correct, should 11, no more no less. you need add ^ match beginning of string: /^[0-9]{11}$/ that allow match exact, beginning end. current pattern match 11 numbers occurring @ end of string only. e.g., abc12345678901 considered valid.

javascript - What do display custom icon for google map Marker? -

currentposition = new google.maps.latlng(location.coords.latitude, location.coords.longitude); var mapoptions = { center: currentposition, zoom: 15, maptypeid: google.maps.maptypeid.roadmap, }; map = new google.maps.map(document.getelementbyid("map-canvas"), mapoptions) var home_marker = new google.maps.marker({ position: currentposition, map: map, icon: "../images/02_button_add.png" }); above code google map api , trying display custom icon on map. however, when delete icon file folder. map still show icon. anyone knows happen? if need display icon same folder, change file name , hard reload browser. if wish display default google marker remove icon property of marker code , hard reload browser

multithreading - C++ - Optimal number of threads for processing string -

i have std::string of length n , want insert substrings of length k std::set container, using threads. how many std::thread or pthread_t objects should use? consider n = 500,000 , k = 3. use threadpool . it pretty simple use, you'll have include "threadpool.h" , can set maximum number of threads based on number of cores available. code should contain following snipet. int max_threads = std::thread::hardware_concurrency(); threadpool pool(max_threads); auto result = pool.enqueue(func,params); here func function called, params parameters , value returned stored in result .

function - Javascript ReferenceError: min is not defined -

i'm trying wrap head around anonymous , named functions , have javascript code here: travelnode = min = function(travelnode) { console.log(travelnode); if(travelnode.left === null) return travelnode; else return min(travelnode.left); }(travelnode.right); when try , run block, referenceerror: min not defined . however, when change code this: travelnode = function min(travelnode) { console.log(travelnode); if(travelnode.left === null) return travelnode; else return min(travelnode.left); }(travelnode.right); and works fine. obviously, first 1 uses anonymous functions , second named function. however, why second 1 work first 1 doesn't? how fix first one? edit: here's entire code block - delete: function(data) { var deletehelper = function(travelnode) { if(travelnode === null) return null; if(data < travelnode.data) ...

Reshape a series of repeated data in R -

i have data frame in wide format repeated measurments id method day1 day2 day3 1 4,5 6 5,6 2. b 3 2,5 5 3 c 2 4,2 3 i want reshape format method time value day1 4,5 day2 6 day3 5,6 b day1 3 b day2 2,5 b day3 5 c................... but reshape function changing wide long gives me each group seperately, 1 have idea reshaping in order? we can use melt reshape2 convert 'wide' 'long' format. specify column index in measure . library(reshape2) dm <- melt(df1, measure=3:5)[-1] and order 'method' column expected output dm1 <- dm[order(dm$method),] row.names(dm1) <- null dm1 # method variable value #1 day1 4,5 #2 day2 6 #3 day3 5,6 #4 b day1 3 #5 b day2 2,5 #6 b day3 5 #7 c day1 2 #8 c day2 4,2 #9 c day3 3...

In shell script, storing an output into an array inside case statement -

i wanted store output array in shell script called inside case statement. running on bash version 3.2.39. windriver linux. the command used files_array_out=( $(ls | grep test) ) this command works fine , stores output array, when defined outside case statement. if same command called inside case statement, output not stored in array. stores output single variable new line in between. ex: created 3 files test1, test2 , test3. , example used #!/bin/bash #####outside case statement files_array_out=( $(ls | grep test) ) echo "outside case statement: first element of test files ${files_array_out[0]}" # inside case statement echo "enter 1" ifs="";read a case "$a" in "1") files_array=( $(ls | grep test) ) echo "inside case statement: first element ${files_array[0]}" ;; esac output got after running is: sh check.sh outside case statement: first element of test files test1 e...

How to convert "Tue Aug 25 10:00:00 2015" this time stamp to "2015-08-25 10:00" in python -

how convert "tue aug 25 10:00:00 2015" time stamp ‍‍ "2015-08-25 10:00" in python. from datetime import datetime date_object = datetime.strptime('jun 1 2005 1:33pm', '%b %d %y %i:%m%p') with correct format string, can use datetime.strptime parse string , format again: import datetime date = datetime.datetime.strptime('tue aug 25 10:00:00 2015', '%a %b %d %h:%m:%s %y') print date.strftime('%y-%m-%d %h:%m')

mysql - The Model tables in Django got deleted -

the database table created automatically django model definition,i kind of deleted using mysql command line.now when i'm running migration says table doesn't exist .i used makemigrations,syncdb ,nothing works.how make django create table columns again..without me have creating them manually. ok resolved it, deleted migration files app->migrations folder ,deleted database "mysql" .now created new migration using "makemigrations" command, , applied db using "migrate" command.

Manually delay audio in chrome or system-wide (Mac OSX) -

i got new bluetooth speakers , inherently seem have delay of 0.5 1s when watching streams or videos online. mailed manufacturer , told has how make use of bluetooth protocol (pair of speakers in master-slave mode stero sound) , how respective video player doing encoding/decoding. itunes instance seems fine while vlc , streams in browsers have delay. so wondering whether there way manually delay audio either in browser (chrome) or system-wide on macosx?! great if possible solution transient since not want delay when not using these speakers. additionally perfect if knew how on ios although don't think possible there, that's why did not include ios in title.

c++ - Error : An exception (first chance) at 0x76f6f9d2 in Boost_Mutex.exe: 0xC0000008: An invalid handle was specified -

i write program test multithreading. in main function thread t created. in function d , in thread t , 2 threads tt , ttt created. function process runs in thread ttt . in process member function doanotherthing of class dat called. in thread tt member function doonething called. when debug program, error occured: an exception (first chance) @ 0x76f6f9d2 in boost_mutex.exe: 0xc0000008: invalid handle specified. sometimes this error occured instead of error above : run-time check failure #2 - stack around variable 'odat' corrupted. can me solve problem , modify codes? these codes: "dat.h" #pragma once #ifndef dat_h #define dat_h #include <boost\thread\thread.hpp> using namespace std; class dat { public: dat(); ~dat(); void doonething(); void doanotherthing (); private: boost::mutex omutex; int x; }; #endif // dat_h "dat.cpp" #include "dat.h" dat::dat() { } dat::~dat() { } vo...

python - Django trusted server for file processing-distributing-retrieving -

i newbie in django having project in mind accomplish , wondering proper architecture , path take towards following scenario: i have trusted server has following duties: 1. authenticates user 2. receives file user , transforms n segments performing algorithm of mine (presume 1 rabin's ida or all-or-nothing transform (aont)), , stores each produced segment on other pre-defined distinct servers. 3. in downloading phase, server authenticates user, retrieves segments of corresponding requested file storage servers, combines segments construct file , delivers user. what opaque me needed elements on storage sides: how trusted server communicate storage severs , retrieves segments? how can provide trusted server request storage servers file x belongs user y? what had in mind provide each segment specific metadata generated using hash function has file id , users id inputs. i grateful if provided me road map , elements need consider on each side project. on view suffices. thank...

android - Alertdialog shows background three times on old devices -

i'm trying make dialog custom style. on android 5 works: http://i.stack.imgur.com/y7zsg.png but on older devices happens: http://i.stack.imgur.com/uixur.png styles.xml: <resources> <style name="apptheme" parent="theme.appcompat.noactionbar"> <item name="android:textcolorprimary">#ffffff</item> <item name="android:alertdialogtheme">@style/popupdialog</item> </style> <style name="popupdialog" parent="theme.appcompat.dialog"> <item name="android:textcolorprimary">#ffffff</item> <item name="android:background">@drawable/background_dialog</item> <item name="android:windowbackground">@android:color/transparent</item> </style> </resources> background_dialog.xml: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.a...

set the correct Tkinter widgets position in Python -

Image
i writing gui raw image converter in python using tkinter. gui divide in 3 part. part has button import raw file, part b has 4 checkbuttons, , part c has checkbuttons 2 entry spaces. the length of columns 0 (= first) given label "correct chromatic aberration" (the longest element). mean if change name example in correct chromatic aberration white balance" elements shifted image below, , part a, b, , c related each other. i wish make independent part part b, , on, in order have below image. in other words wish place each block of buttons own frame, , frames in main window. the original code is: from __future__ import division tkinter import * import tkmessagebox import tkfiledialog class mainwindow(frame): def __init__(self): frame.__init__(self) self.master.title("foo converter") self.master.minsize(350, 150) self.grid(sticky=e+w+n+s) self.save_dir = none self.filename_open = none ...

Include a picture in Visual Studio 2013 Template -

i trying include picture visual studio 2013 template. see picture added .zip file, not created when use template new solution. <project targetfilename="opencv template1.vcxproj" file="opencv template1.vcxproj" replaceparameters="true"> <projectitem replaceparameters="false" targetfilename="$projectname$.vcxproj.filters">opencv template1.vcxproj.filters</projectitem> <projectitem replaceparameters="false" targetfilename="test.cpp">test.cpp</projectitem> <projectitem replaceparameters="false" targetfilename="opencvlogo.jpg">opencvlogo.jpg</projectitem> </project> how can tell visual studio include logo.jpg when create new solution?

makefile - gnu make recreating directory structure in target -

i'd use gnumake image compression , preparations websites. i have structure like src www.site1.org images foo.jpg bar.png css style.scss www.site2.org images baz.svg css design.scss i want able recreate structure in target directory while using other tools optimize/compile sources e.g. convert --strip src/www.site1.org/images/foo.jpg target/www.site1.org/images/foo.jpg i can find jpegs using src:=$(shell find . -name '*.jpg') , create variable holding targets targets=$(src:src=target) . but don't find way of writing rule (naively) like: $(target): $(src) convert --strip $< $@ i've searched internet quiet time didn't find appropriate. you use: src := $(shell find src -name '*.jpg') targets = $(patsubst src/%,target/%,$(src)) all: $(targets) $(targets): target/%: src/% convert --strip $< $@ which says: eac...

sitecore - Sort treelistex by displayname, both available and selected items per language -

i'm working sitecore 8 update 2 i'm looking way sort items ( available items ) treelistex displayname per language. i've found way extend list of selected items not available items ( left column ). how sort selected items in sitecore treelist? i've found can't seem work ( sortby ) http://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2012/10/more-enhancements-to-the-treelist-field-type-in-the-sitecore-aspnet-cms.aspx can give me clear explanation on how achieve ? one of ways of achieving writing processor on save event pipeline. when item save called, can check treelistex field , sort selected values (since pipe separated guids, may need each item guid , re-arrange pipe separated guids based on sort) based on field on selection. think incur performance hit on save (likely not much).

jquery - scroll triggered animation extremely delayed -

using jquery, trying make navbar similar this wordpress plugin : navbar hidden/offscreen when page loaded, slides down fixed position when scroll position reached, , slides offscreen position when user scrolls top. i managed it, however, timing wrong: can take few seconds after scrolling until menu bar appears. , it's worse when scrolling up: @ first thought doesn't work @ all, then, after 15 seconds or more, moves up. here's code: $(window).scroll(function() { var scrollposition = $(window).scrolltop(); if (scrollposition > 100) { $("#main_navigation").animate({ top: "0px" }, 600); }; if (scrollposition < 100) { $("#main_navigation").animate({ top: "-82px" }, 400); }; }); html, body { margin: 0; height: 100%; } .content { height: 200%; background: #fda; padding: 5em 3em; } nav#main_navigation { position: fixed; z-index: 1; top: -82p...

c++ - Error C2678: binary '<<' : no operator found which takes a left-hand operand of type 'const std::ofstream' (or there is no acceptable conversion) -

i working on mfc application , have declared ofstream object in class header, object initialized in constructor , used in other methods of same class. got following error: error c2678: binary '<<' : no operator found takes left-hand operand of type 'const std::ofstream' (or there no acceptable conversion) i have searched issue , found many solutions i.e. there suggestions to: use #include <string> use #include <iostream> use #include <istream> and other information got when error occur. got doesn't fix issue. kindly have @ code: cgroupcombobox.h : private: std::ofstream fptr; cgroupcombobox.cpp : //constructor cgroupcombobox::cgroupcombobox() : m_dropdownlistautowidth(true) , m_autocomplete(true) , m_selectionundobyesckey(true) { fptr.open("test.txt",std::ios::out); //initialization of fptr } //member function int cgroupcombobox::findstring(int nstartafter, lpctstr lpszstring) cons...

c# - Unity Cardboard Orientation Landscape Right Upside Down -

hi have unity app uses google cardboard sdk enable stereoscopic view have vr enabled app. app runs fine. but there problem if set player settings orientation auto orientation landscape left , landscape right allowed. when in landscape left, works per normal when in landscape right cardboard view turn 180 degrees (settings button moved bottom of screen) unity objects not. have upside-down objects. any method fix this? thanks. it appears native code sdk uses read gyro hardcoded landscape left orientation only. can worked around editing basecardboarddevice.cs , replacing definition of updatestate() following code: private quaternion fixorientation; public override void updatestate() { getheadpose(headdata, time.smoothdeltatime); extractmatrix(ref headview, headdata); headpose.setrighthanded(headview.inverse); // fix head pose based on device orientation (since native code assumes landscape left). switch (input.deviceorientation) { case deviceorientati...

optimization - MATLAB-making intersect faster -

let there 2 arrays {a,b} of size 1xn i want find number of cases on same indices the condition a(ii)==1 & b(ii)==0 satisfied. i tried casess= intersect( find(a==1),find(b==0 )) but slow. i believe because intersect checks on every member if member of other group, still looking fastest solution smaller problem. the number of cases condition true can computed with: numcases = sum(a == 1 & b == 0); the expression a == 1 & b == 0 gives logical array can used, example, find indices condition true: ind = find(a == 1 & b == 0); or directly access matrix same size via logical indexing : c = zeros(size(a)); c(a == 1 & b == 0) = 5;

javascript - datepicker add a day to the end date -

appreciate help. have searched many pages on forum javascript datepicker dates. include 2 textbox calendars , not compound bootstrap one. i have compound calendar (one input , popup comes displaying 2 boxes , date , apply button). when search, works, long date searching doesn't end on date searching, example, searching 06/12/2015-06/18/2015 not include results 18th june (06/18/2015). case if enter same date start , end dates. summary: need way set "start" , "end" can add day "end" day: $('#picup-range').on('apply.daterangepicker', function(start, end) { submitfilter(); }); function submitfilter() { $('#filter').submit(); } ended having change java database query provided data.

c# - MVC 4 Dropdownlist Pass value by button? -

i have created dropdownlist using html helper. it's able value , bind dropdown. how can pass selected dropdown value controller? my view: @html.dropdownlist("language", new selectlist(viewbag.langlist, "text", "value")) <input type="button" class="btn" title="filter language" value="filter language" onclick="location.href='@url.action("surv_answer_result", "surv_answer", new { survey_id = model[0].survey_id, language = viewbag.langlist })'" /> my controller language , bind dropdown: public actionresult surv_getlanguage(int survey_id) { var getlanguagelist = r in db.surv_question_ext_model join s in db.surv_question_model on r.qext_question_id equals s.question_id s.question_survey_id == survey_id group new { r, s } r.qext_language grp select grp.firs...

c# - Domain Events Implementation -

we starting ddd, , need implement domain events (des). thinking "developping our own system" vs "prototyping exiting framework". know things des. need have real-life feedbacks features should expected such system, before taking decision : should des stored , duplicated in each domain centralized event-store, before being consumed (for maintenance , logging purposes) ? do domains pick events centralized event-store (if any), or need kind of orchestrator dispatching des ? if use relational database storing domains data (we know should ignore when desiging business logic), relational database fit des, or should prototype nosql database ? do need implement tools ensure events propagated target domains ? i know there many questions here, summarize ask : based on experience , key-features can expect "theorical des system" ? have develop own implementation, does-it make sense ? service-bus meet our needs ? i've built couple of librari...

jquery - window.focus not working on already open window in firefox -

my code not working firefox same code working in chrome. here code: $( "#confirm" ).dialog({ resizable: true, modal: true, buttons: { "yes": function() { newwindow = window.open(url,"mywindow","status=1,width=870,height=530"); newwindow.focus(); $( ).dialog( "close" ); } } }); i want bring focus if window opened. not working in firefox. for reason current window getting focus. solve problem add 1 more function below focus this: $( "#confirm" ).dialog({ resizable: true, modal: true, buttons: { "yes": function() { newwindow = window.open(url,"mywindow","status=1,width=870,height=530"); newwindow.focus(); newwindow.moveto(0,0); $( ).dialog( "close" ); } } }); so, add moveto(0,0)...

java - Restore Fragments State from back stack manually -

i have 4 fragments. when replace them, i've declared addtobackstack(null) . when switch firstfragment fourthfragment (or third, second - doesn't matter) , press button, fine. view's exist. but when change fragment fourthfragment fistfragment progromatically (with of bottom tabs), state isn't restored , views build again. i've tried use onsaveinstancestate() , never being called when change fragements. i've understood, onsaveinstancestate() called when activity destroyed. in case, suppose, fragments not destroyed. still need restore fragment state immediately. how can store state of fragments, when being changed between each other?

php - Shell_Exec error for directory listing? -

i found useful php code displays photos in folder directory image preview. issue host provider blocks 1 of script commands, "shell_exec()", php code doesn't work. any way of getting code run without using shell_exec? <?php // filetypes display $imagetypes = array("image/jpeg", "image/gif"); ?> <?php function getimages($dir) { global $imagetypes; // array hold return value $retval = array(); // add trailing slash if missing if(substr($dir, -1) != "/") $dir .= "/"; // full server path directory $fulldir = "{$_server['document_root']}/$dir"; $d = @dir($fulldir) or die("getimages: failed opening directory $dir reading"); while(false !== ($entry = $d->read())) { // skip hidden files if($entry[0] == ".") continue; // check image files $f = escapeshellarg("$fulldir$entry"); $mimetype = trim(`fi...

java - Specific instance/Non Singleton -

how instantiate java class parameters , use same instance through out application? what want when tibco esb requests web service call application,i capture user information(user name) in 1 pojo class can use pojo class , user information @ other places in application particular tibco request. this question might sounds crazy implement in application.waiting thoughts guys. you can use threadlocal solution: public class myclassinstanceholder { private static threadlocal<myclass> instance = new threadlocal<>(); public static setinstance(myclass instance) { instance.set(instance); } public static myclass getinstance() { instance.get(); } } ... myclass myinstance = myclassinstanceholder.getinstance(); so in thread you'll have access object stored in threadlocal.

Cordova InAppBrowser show location bar Cordova AngularJS Oauth -

hi i'm using cordova inappbrowser , angularjs oauth plugins. when press normal link button this: <a class="external" ng-href="https://www.website.com/" targe="_blank" >open link</a> in combination this: <script> $( document ).ready(function() { // open links in native browser (phonegap); $(document).on('click', '.external', function (event) { event.preventdefault(); window.open($(this).attr('href'), '_blank'); return false; }); }); </script> it opens link in in app browser. in inappbrowser when loading url showing url location @ bottom. working ok. when angularjs oauth plugin opens inappbrowser , starts load login page of facebook example doesn't show loading url location @ bottom. i tried add "location=yes" in oauth plugin this, still not showing url loading bar @ bottom: window.open('https:...

c# - How to get number of rows affected by ExecuteNonQuery and ignore rows of triggers? -

i using executenonquery run insert proc, returns 2, in actual inserting 1 record. getting 1 due trigger. there anyway actual number of rows affected. not want rows affected trigger. if don't have already, disable counting rows in trigger: set nocount on for example: create trigger [dbo].[triggername] on [dbo].[tablename] after insert set nocount on; ...... msdn

php - Laravel 5 - restricting a record from eloquent all() function -

i have accounttype model related user table. public function users() { return $this->hasmany('app\user','account_type_id'); } we have built website based on accounttype data (normal user, editor, admin) , want add new type superadmin site admin. don't want account type displayed accounttype::all() code called , in users search result. have used all() function in of places. don't want change everywhere. there way override default function accounttype model? the best way, (not easiest) create global scope. softdelete trait removes deleted entities queries. you add global scope accounttype permenently remove superadmin of queries. ex: accounttype::all() return ['normal user', 'editor'] and accounttype::withsuperadmin()->all() return previous array plus superamin type. see : http://softonsofa.com/laravel-5-eloquent-global-scope-how-to/ you don't have use sofa package make works. open softdelet...

osx - SMJobBless failed with CFErrorDomainLaunchd Code 9 -

does know error code mean? smjobbless error return error code value. failed bless helper: error domain=cferrordomainlaunchd code=9 "the operation couldn’t completed. (cferrordomainlaunchd error 9.)" i googled, looked answers in blogs posts, in apple docs, here there , couldn't find answer , how fix it. people say(on support form reinstalling os x helped them). it has happened ongoing project couple weeks ago, , thing helped me fix it, changing name of helper tool. happened again. same time code working on other computers, workstation affected issue. update: after renaming, works again. have 2 helper tool bundle identifiers "banned" on system :-( update 2: happens on other computers :-( in case error failed bless helper: error domain=cferrordomainlaunchd code=9 "the operation couldn’t completed. (cferrordomainlaunchd error 9.)" meant helper tool added permanent disabled services list here: /private/var/db/com.apple...

python - Validation of signed cookie fails with request lib -

our signed cookies implementation works in firefox, chrome , ie. we use requests library testing. for reason request library seem alter cookie data. we use session in docs: http://docs.python-requests.org/en/latest/user/advanced/ any idea why library changes cookie data? not characters allowed inside cookie. see https://github.com/kennethreitz/requests/issues/286 the library requests alters data. a solution might store cookie data base64 encoded. related: allowed characters in cookies

java - detector.isOperational() always false on android -

i'm using new google plays service : barcode detector , porposue i'm following tutorial : https://search-codelabs.appspot.com/codelabs/bar-codes but when run application on real device(asus nexus 7), text view of app showing me "couldn't set detector" , don't know how make work >< ... here code fast debugging: public class decoderbar extends activity implements view.onclicklistener{ private textview txt; private imageview img; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.layout_decoder); button b = (button) findviewbyid(r.id.button); txt = (textview) findviewbyid(r.id.txtcontent); img = (imageview) findviewbyid(r.id.imgview); b.setonclicklistener(this); } // [...] @override public void onclick(view v) { bitmap mybitmap = bitmapfactory.decoderesource(getapplicationcontext().getresources(),r.drawable.popi); img.setimagebitmap(mybi...

ios - PDF annotation highlight & search text -

how play pdf document in ios? i have perform operations on pdf document - read pdf document, adding annotations pdf, making note on pdf, search text in pdf, highlighting text in pdf document. how can achieved? can please suggest me sdk or tutorial? (except pdfkitten...)

python - Django: Cannot insert user profile data from model into the template -

i using django's default auth users , have created separate model extend user profile bit. when try access user profile info not showing on page. in view, pass profile objects view's context still not working. when try in shell, attributeerror: 'queryset' object has no attribute 'country' error when do: profile = profile.get.objects.all() country = profile.coutry country below models.py: from pytz import common_timezones django.db import models django.contrib.auth.models import user django_countries.fields import countryfield django.db.models.signals import post_save django.dispatch import receiver timezones = tuple(zip(common_timezones, common_timezones)) class profile(models.model): user = models.onetoonefield(user, on_delete=models.cascade) country = countryfield() timezone = models.charfield(max_length=50, choices=timezones, default='us/eastern') def __str__(self): return "{0} - {1} ({2})".format(se...