Posts

Showing posts from January, 2013

Mastermind Game in Python -

i have looked @ thread python mastermind game troubles on website question asking different have been given different task. this question: generate random 4 digit number. player has keep inputting 4 digit numbers until guess randomly generated number. after each unsuccessful try should how many numbers got correct, not position got right. @ end of game should congratulate user , how many tries took. i have made far: from random import randint n1 = randint (1,9) n2 = randint (1,9) n3 = randint (1,9) n4 = randint (1,9) numberswrong = 0 print (n1,n2,n3,n4) guess1 = input("guess first number") guess2 = input("guess second number") guess3 = input("guess third number") guess4 = input("guess fourth number") guess1 = int (guess1) guess2 = int (guess2) guess3 = int (guess3) guess4 = int (guess4) if guess1 != n1: numberswrong +=1 else: numberswrong +=0 if guess2 != n2: numberswrong +=1 else: numberswrong +=0 if guess3 != ...

media queries - javascript - detect which view? -

this question has answer here: get device width in javascript 5 answers i using @media queries in css responsive design. need 1 breakpoint. how use javascript detect state page in @ given moment (ideally when resizing window)? based on state (eg. below 640px width or over), run different js function. thank you with breakpoint @ 640px use following code execute different functions depending on current view. function executemqdependentcode() { var mq = window.matchmedia( "(min-width: 640px)" ); if (mq.matches) { // code wide screens } else { // code smaller screens } } if want have code executed when user resizes window, add event listener: window.onresize = executemqdependentcode;

javascript - Debouncing root scope digest invocations -

if invoke $scope.$apply() ten times in immediate succession presume ten root scope digests occur. can if call $scope.$apply() debounced trailing call completed final state of application same if debounce not in effect? can duration of successive root scope digests, given previous digest has completed? edit: i clarify purpose of question. say have controller mycontroller , instance instantiated each instance of directive mydirective . these controller instances listen event my-event , trigger root-scope digest each time my-event raised. ten instances of mydirective rendered ui via ng-repeat . another component raises event my-event . each of ten mycontroller instances trigger root-scope digest. if put sanity of state of affairs 1 side, question this: if debounce root-scope digest attempts made mycontroller , , ensure trailing attempt gets invoked, correctness of program maintained? var service = require('my-service'); function mycontroller($scope)...

How to crawl specific ASP.NET pages using Python? -

i want crawl asp.net website urls same how can crawl specific pages using python? here website want crawl: http://www.fveconstruction.ch/index.htm (i using beautifulsoup, urllib , python 3) what information should distinguish page other? if target website single page application, can't crawled. workaround can see requests (get, post etc) go when manually navigate through website , ask crawler use those. or, teach crawler execute javascript @ least what's on target website. it's website need change crawlable, need provide reasonable non-ajax version of every page needs indexed, or links page needs indexed. or use pushstate in angularjs.

javamail - Java Mail API Emails are not displaying in reverse order -

public class testemail { properties properties = null; private session session = null; private store store = null; private folder inbox = null; private string username = "xx@gmail.com"; // private string password = "xx"; public testemail() { } public void readmails() throws exception { properties = new properties(); properties.setproperty("mail.host", "imap.gmail.com"); properties.setproperty("mail.port", "995"); properties.setproperty("mail.transport.protocol", "imaps"); session = session.getinstance(properties, new javax.mail.authenticator() { protected passwordauthentication getpasswordauthentication() { return new passwordauthentication(username, password); } }); try { ...

How do I link python tkinter widgets created in a for loop? -

i want create button , entry(state=disabled) widgets loop. number of widgets created runtime argument. want every time click button, corresponding entry become enabled(state="normal"). problem in code button click, affects last entry widget. there anyway fix this.? here code: from tkinter import * class practice: def __init__(self,root): w in range(5): button=button(root,text="submit", command=lambda:self.enabling(entry1)) button.grid(row=w,column=0) entry1=entry(root, state="disabled") entry1.grid(row=w,column=1) def enabling(self,entryy): entryy.config(state="normal") root = tk() = practice(root) root.mainloop() few issues in code - you should keep buttons , entries creating , save them in instance variable, store them in list , w index each button/entry in list. when lambda: something(some_param) - function value of some_param() ...

java - SQL syntax error in pagination query -

i'm trying make pagination in jsp page. didn't data database. got error " you have error in sql syntax; check manual corresponds mysql server version right syntax use near '-10, 5' @ line 1 ". i didn't understand what's wrong. please check code , me solve problem? booksinfo.java package com.sreejonee.books; import java.sql.date; import java.sql.timestamp; public class booksinfo { private int book_id; private string bookname; private string filename; private string writername; private string book_details; private timestamp date_time; private int rating; private int parentscat_id; private string parentscat_name; private string thumcoverimag; private string filepath; public int getbook_id() { return book_id; } public void setbook_id(int book_id) { this.book_id = book_id; } public string getbookname() { return bookname; } public void setbookname(string bookname) { this.bookname = bookname; } public string getfilename() { ...

actionscript 3 - How to pass object, MouseEvent.CLICK and function to trigger -

i want pass function object, const of type mouseevent.click , function trigger. in case: my class assistant: public static function addeventlistenerto(obj:object, mouseeventconst:string, functintotrigger:function) { obj.addeventlistener(mouseeventconst, functintotrigger:function); } and class engine invokes assistant.addeventlistenerto(deck,"mouseevent.click",showobject); please give me advice how make work. thanks. in code provide there 1 compiler error ( the 1 tahir ahmed pointed in second comment ). fixing removing second :function in first code block: public static function addeventlistenerto (obj:object, mouseeventconst:string, functintotrigger:function) { obj.addeventlistener(mouseeventconst, functintotrigger); } will let code compile. ( i wrapped method signature avoid scrollbar, not required make compile. ) the other major problem configuration error (or maybe typo ): 1 mouseevent.click . ( the 1 tahir ahmed pointed in fi...

Probability Sum in R -

i'm trying run probability codes in r without using dice package. know when there 2 vectors, it's possible use outer command generate matrix calculate sums , values dice rolls. there similar can same thing 5 dice rolls? i'm working on rolling 5 six-sided dice in r , generating code calculate probability of getting between 15 , 20 sum of rolls. any suggestions? you simulation: set.seed(1020) nn<-1e6 #number simulations #on each simulation, check whether sum of 5 # independently rolled (6-sided) dice less # 2.5 away 17.5--equivalently, # sum between 15 & 20; probability # percentage of time happens, # or equivalently, mean of indicator function > mean(replicate(nn,abs(sum(sample(6,5,t))-17.5)<=2.5)) [1] 0.556971 the actual solution 4332/7776=.5570988, can found (inefficient, cares because 6^5=7776) loop: tot<-0l (i1 in 1:6){ (i2 in 1:6){ (i3 in 1:6){ (i4 in 1:6){ (i5 in 1:6){ s<-i1+i2+i3+i4+i5 ...

jquery - DropDownList value and text -

i using jquery populate dropdown list in asp.net mvc $(function () { $.getjson('/getfoo', function (result) { var ddl = $('#foo'); ddl.empty(); $(result).each(function () { $(document.createelement('option')) .attr('value', this.id) .text(this.text) .appendto(ddl); }); }); }); here's controller action return json used in process: public actionresult getfoo() { viewbag.idtable = new selectlist(db.table, "idtable", "description"); return json(viewbag.idtable, jsonrequestbehavior.allowget); } and here's how dropdown list goes view: @html.dropdownlistfor(model => model.idtable,enumerable.empty<selectlistitem>(), "-- loading values --", new { id = "foo" }) to clarify more i'm doing, want show description in select list options instead of idtable. everything works fine unt...

parsing JSON with / character in angularjs -

i have problem in displaying "/home/local" there in following json "parameter":{"name":"localdir","default_value":"/home/local","type":"string"} i need parse , display in text box using angularjs '<input type = "text" value="' + jsondata["default_value"] + '" name="htmlcomponent" ng-model="htmlcomponent" ng-init="htmlcomponent=' + jsondata["default_value"] + '" class="htmlcomponent" />' when tried getting following error: error: [$parse:syntax] syntax error: token 'home' unexpected token @ column 16 of expression [htmlcomponent=/home/local] starting @ [home/local]. the script below demonstrates, code does: var jsondata = { "name": "localdir", "default_value": "/home/local", "type": ...

Docker mongodb - add database on disk to container -

i running docker on windows , have database entries on disk @ c:\data\db. i want add database container. have tried numerous ways failed. i tried: docker run -p 27017:27017 -v //c/data/db:/data/db --name mongodb devops-mongodb in dockerfile have: run mkdir -p /data/db volume /data/db but doesn't add current database on disk container. creates fresh /data/db directory , persists data add it. the docs here https://docs.docker.com/userguide/dockervolumes/ under 'mount host directory data volume' told me execute -v //c/data/db:/data/db isn't working. any ideas? you're using boot2docker (which runs inside virtual machine). boot2docker uses virtualbox guest additions make directories on windows machine available docker running inside virtual machine. by default, c:\users directory (on windows), or /users/ directory (on os x) shared virtual machine. outside directories not shared virtual machine, results in docker creating empty directory @...

javascript - Jscript redirection to SMS editor -

is there way redirect user web page sms editor time delay? this: function redirect() { window.location="http://www.tutorialspoint.com"; } document.write("you redirected main page in 10 sec."); settimeout('redirect()', 10000); only instead of " http://www.tutorialspoint.com " using "sms:?body=hello world" example? after few tests on different browsers, i've came out this: function redirect() { window.location.href="sms:?body=hello world"; } document.write("you redirected main page in 10 sec."); settimeout('redirect()', 10000); this working in android guess modified work ios also. please notice: sms:& ios 8, sms:; ios 5,6 , sms:? android.

ruby on rails - Could not locate Gemfile or .bundle/ directory ----- rvm | cron | ubuntu | whenever -

i'm using whenever , dynamic_sitemaps gems generate sitemaps. here's schedule.rb job_type :rake, "{ cd #{@current_path} > /dev/null; } && rails_env=:environment bundle exec rake :task --silent :output" job_type :script, "{ cd #{@current_path} > /dev/null; } && rails_env=:environment bundle exec script/:task :output" job_type :runner, "{ cd #{@current_path} > /dev/null; } && rails_env=:environment bundle exec rails runner ':task' :output" set :output, "#{path}/log/cron.log" every 1.day, :at => '5:30 am' rake "sitemap:generate" end if use " bundle exec rake sitemap:generate rails_env="production" " sitemap generated properly. `bundle exec whenever rails_env="production"` seems working - 30 5 * * * /bin/bash -l -c '{ cd > /dev/null; } && rails_env=production bundle exec rake sitemap:generate --silent >...

xamarin - Enable swipe in tabbed page on Android? -

swiping pages doesn't work when using tabbedpage in xamarin.forms on android. is there way enable it? need create custom renderer? this type of behaviour not common on platforms need create custom renderer. the gesture recogniser in xamarin.forms tapgesturerecognizer think working on adding more. here useful examples point in right direction creating custom renderer: robgibbens mr.gesture another option mr.gestures adds down, up, tapping, tapped, doupletapped, longpressing, longpressed, panning, panned, swiped, pinching, pinched, rotating , rotated events each , every layout.

android - Only display current month's days in Caldroid -

i using caldroid library app, , have ran issue. i want current month's dates show on calendar. i have looked through caldroid documentation, not find anything. i know can set max date calendar, couldn't find setting max/min each month. hope out :) i had same issue , made that. create new selector in drawable example calendar_cell_text_color.xml . in file put sth this. <!-- caldroid days prev , next month --> <item android:color="@color/white" caldroid:state_date_prev_next_month="true"/> <!-- caldroid days current month --> <item android:color="@color/black" /> now, have change style of caldroiddefaultcell . in file style.xml add follows line. <!-- caldroid theme. --> <style name="mycaldroid" parent="caldroiddefault"> <!--if use compact view in caldroid --> <item name="stylecaldroidnormalcell">@style/caldroidcell</item> ...

c# - Why does my data flow finishes before all async calls are fully processed from BufferBlock? -

i have data flow follows. 1. task reads text file in chunks , adds them batchblock<chunksize> 2. actionblock linked above batchblock partitions data batches , adds them bufferblock 3. transformationblock linked bufferblock , spawns async task each batch 4. process finished when spanwed async calls finished. the below code isn't working expected. finishes before batches processed. missing? private static void dataflow(string filepath, int chunksize, int batchsize) { int chunkcount = 0; int batchcount = 0; batchblock<string> chunkblock = new batchblock<string>(chunksize); bufferblock<ienumerable<string>> batchblock = new bufferblock<ienumerable<string>>(); task producetask = task.factory.startnew(() => { foreach (var line in file.readlines(filepath)) { chunkblock.post(line); } console.writeline("finished producing"); chunkblock...

Swift 2.0 beta: are protocols kinda broken in Xcode beta 5? -

currently i'm working on new app written swift 2.0. today faced 2 strange errors in xcode beta 5 . i'd love if previous beta version of xcode can confirm if i'm right or not. misunderstand something, i'll appreciate feedback. here example code made me struggle while: // frist bug protocol someprotocol { var somearray: [string] { set } // #1 bug } extension someprotocol { func somefunction(somestring: string) { self.somearray.append(somestring) // #1: immutable value of type '[string]' has mutating members named 'append' } } // second bug protocol someinterfaceprotocol { var somebool: bool { set } // #2 bug } class someclass: someinterfaceprotocol { var somebool: bool = false func returninterface() -> someinterfaceprotocol { return self } } let someinstance = someclass() // can't set value someinstance.returninterface().somebool = true // #2: cannot assign property: function call retur...

.net - Pointers in Visual C++ Classes -

i updating program written else in c++/cli control variety of different cameras. program uses class control each camera type. class called zyladriver. new c++ , c++/cli, thank in advance , patience. the sdk camera using has 1 function,at_queuebuffer(), allocate memory read data into. once image has been acquired, at_waitbuffer() can used return pointer acquired data. i have 2 separate class functions call these functions, zyladriver::expose(), , zyladriver::readimage(uint16 * buffer). however, running problems memory access going between functions. stands, code below produces system.accessviolationexception when attempt assigned strideless_buffer in zyladriver::readimage(). i believe problem possibly related deficiencies in understanding of how managed memory works in c++/cli. or perhaps more basic deficiencies in understanding of memory management in c++. zyladriver.h: #include "driver.h" #include "atcore.h" ref class zyladriver : driver { public: ...

ios - How to access Core Data/CouldKit via Today Extension (iOS8) -

i have app uses core data standard apple core data stack in appdelegate. i've modified stack core data enhanced cloudkit. data synced across devices nicely. far good. i'd add today extension app have no idea how access data. i've been reading appgroup concept read shouldn't/can't use access data today extension. figured should using cloudkit learned nsmanagedobjects converted ckrecords upon upload icloud. how access data via icloud has been stored core data using cloudkit enhancement? data stored in icloud? while data syncing nicely, when check in icloud dashboard no data seem exist. articles read seem addressing part of problem. here modified core data stack i'm using in app: // mark: - core data stack lazy var managedobjectmodel: nsmanagedobjectmodel = { // managed object model application. property not optional. fatal error application not able find , load model. let modelurl = nsbundle.mainbundle().urlforresource("appname...

css - How to make a div expand to right side of page and bottom of page -

i need create div has top left corner aligned top left corner of parent div, right side aligned right edge of page, , bottom side aligned bottom of page. know how can done css? where <div> itself? you achieve vh , vw units if position absolute parent too; div.parent{ position: absolute; top: 10vh; left: 10vw; } div.child{ position: absolute; top: 0; left: 0; width: 90vw; // remainder of viewport width height: 90vh; // remainder of viewport height } this make div.child aligned left of div.parent , stretching length , height of browser. if want calculated, you'll ideally want use javascript/jquery.

angularjs - Ng-option directive cant get access to nested array value -

help i'm trying output different class options(economy/business) ng-options. here syntax , json information . cant working <select ng-model="myselect" ng-options="item item in items "> </select> $scope.items = [ { "id": 2, "codename": "class", "friendlyname": "class", "options": [ { "id": 15, "displayorderno": 0, "optionname": "economy" }, { "id": 16, "displayorderno": 1, "optionname": "business" }, { "id": 36, "displayorderno": 2, "optionname": "first class " } ] } ];

Python IDLE - Drag n Drop Text -

is possible drag , drop text in python idle code editor move or copy text, in notepad++ ? windows installation. you think there plethora of answers already, have come empty. i not think possible out of box idle. feature of free community edition of pycharm , check out this page .

c - Detecting EOF with fgets() where filesteam is stdin -

bit of background, i'm writing program plays game "boxes" runs in linux command line , written in c. there's prompt waits user input , read fgets() , interpretted etc. as part of task specification have return specific error if reach "end of file while waiting user input". understand fgets() returns null when reaches eof... have fgets(input,max_buffer,stdin); in prompt loop if user exits prematurely ctrl+c or ctrl+d mean input == null? can detect when user fgets? just trying head around this, in advance help. (os: unix) (compiler: gcc - c90) from here , fgets : reads characters stream , stores them c string str until (num-1) characters have been read or either newline or end-of-file reached, whichever happens first. a newline character makes fgets stop reading, considered valid character function , included in string copied str. a terminating null character automatically appended after characters copied str. so, ...

php - Laravel Query Builder orWhere returns false result -

i need query counts conversations not seen yet. works fine when want check if there conversations from_id returns wrong result. conversation::where('to_id', $this->id)->whereexists(function($query) { $query->select(db::raw(1)) ->from('messages') ->where('seen', 0) ->whereraw('messages.conversation_id = conversations.id'); })->count(); result: 0 conversation::where('from_id', $this->id)->whereexists(function($query) { $query->select(db::raw(1)) ->from('messages') ->where('seen', 0) ->whereraw('messages.conversation_id = conversations.id'); })->count(); result: 0 conversation::where('to_id', $this->id)->orwhere('from_id', $this->id)->whereexists(function($query) { $query->select(db::raw(1)) ->from('messages') ->where('seen', 0) ->w...

Can BigCommerce Private Apps use OAuth -

i confused bc documentation on api, because let create "draft apps" (private apps) , see in documentation "we not provide means of keeping oauth apps private.". my concern here made changes might have affected few of private apps had running fine month ago. if can provide insight, appreciate greatly! https://developer.bigcommerce.com/api/guides/oauth-transition there nothing wrong creating oauth credentials "draft app" sole purpose of accessing api of store. not ever have publish app , app never made "public" in case. don't have bother 'load callback url' , filling out details on draft app, unless want provide interface in store. the "draft app" function meant allow developers building apps bc app marketplace test apps in store before submission. however, can use make private application intended store - i'm including process here others! making private app oauth (or how generate oauth credentials...

Django - DRF - particular prefetch query -

i need particular query have list of missions, mission package of 1 or more service offers , service offer service customer specific parameters (price, duration, ...) , want filter missions on service. example: missions : [ name : 010101 service offers labels : facelift, painting date : 08/22/2015 2:00pm ] [...] if search missions "facelift" service : mission.objects.select_related('costumer') .prefetch_related( prefetch( 'service_offers', queryset = serviceoffer.objects.select_related('service') .filter(service__name__exact = "facelift") ) ) the result be name : mission 1 service offers labels : facelift date : 08/22/2015 2:00pm but want name : mission 1 service offers labels : facelift, painting date : 08/22/2015 2:00pm

Need clarification on term "Module" in Swift -

i new swift programming, , having little trouble understanding definition of module. apple's swift documentation states: a module single unit of code distribution—a framework or application built , shipped single unit , can imported module swift’s import keyword. the terminology above confusing me. can explain in layman's terms of module in swift is? thank patience :).

java - How to Execute AsyncTask in Android - erro in class Zygotelnit -

i have class extends asynctask receive context, string user , string password, i try execute asynctask, not working. when execute asynctask class, occurs problem in class zygotelnit public void run() { try { mmethod.invoke(null, new object[] { margs }); } catch (illegalaccessexception ex) { throw new runtimeexception(ex); } catch (invocationtargetexception ex) { throwable cause = ex.getcause(); if (cause instanceof runtimeexception) { throw (runtimeexception) cause; } else if (cause instanceof error) { throw (error) cause; } throw new runtimeexception(ex); } } follow below class execute asynctask mbuttonenter.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { username = medittextuser.gettext().tostring(); password = medittextpassword.gettext().tos...

New Android Face API limitations -

i have been testing new face api realesed android, , noticed "accurate_mode" enabled, doesn't detect faces old facedetector api used detect, know effect of bitmap coding "rgb_565" vs "argb_888" in producing results. update: the issue face detector set detect faces @ least 10% default (as performance optimization). the new google play services 8.4 release supports setting minimum face size lower, enabling smaller faces detected. see setminfacesize method here: https://developers.google.com/android/reference/com/google/android/gms/vision/face/facedetector.builder.html#setminfacesize(float)

Create interdependent association model in rails - Best pratice -

what best practice creating associated models e.g. not want save if 1 of validation fails(say c). also, show error each model if any. class has_many :b has_many :c end class b end class c end class acontroller def create afields = params[:a_params] bfields = params[:b_params] cfields = params[:c_params] = a.new(a_params) if a.save b.create(bfields) c.create(cfields) redirect_to a_index else redirect_to a_new_path end end end basically, want create lot of interdependent models , want save of them or none if single validation fails. can way or other know best way it. you can use activerecord validation's validates_associated method serve purpose: class < activerecord::base has_many :b has_many :c validates_associated :b, :c end edit: you alternatively use, validates_associated in b , c models this: class b < activerecord::base belongs_to :a validates_associated :a end class c...

python - Pywikibot Login SSLError 185090050 -

previously had no problem pywikibot library , site.login() . from last week, calling method returns following warning , error messages: warning: waiting 40 seconds before retrying. error: traceback (most recent call last): file "pywikibot/data/api.py", line 1556, in submit body=body, headers=headers) file "pywikibot/tools/__init__.py", line 1105, in wrapper return obj(*__args, **__kw) file "pywikibot/comms/http.py", line 279, in request r = fetch(baseuri, method, body, headers, **kwargs) file "pywikibot/comms/http.py", line 381, in fetch error_handling_callback(request) file "pywikibot/comms/http.py", line 297, in error_handling_callback raise request.data sslerror: [errno 185090050] _ssl.c:340: error:0b084002:x509 certificate routines:x509_load_cert_crl_file:system lib any highly appreciated. an expert @ http://webchat.freenode.net/#pywikibot solved problem. the problem httplib2 packa...

r - How to filter a dataframe of geocoordinates using a KML polygon? -

Image
i have csv of data points span entire earth ( the geological service's earthquake feed ), , want filter earthquakes within united states' border. the kml file i've pulled u.s. census bureau: https://www.census.gov/geo/maps-data/data/kml/kml_nation.html in r, rgdal library can load kml files: library(rgdal) kml = readogr("kmls/cb_2014_us_nation_20m.kml", 'cb_2014_us_nation_20m') how use dplyr / plyr /etc. filter data.frame (the columns geo data latitude , longitude ) rows fall within boundaries specified kml? edit, post-answer: here's used @hrbrmstr's answer quick visualization: library(sp) library(rgdal) # download earthquakes url <- "http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_week.csv" fil <- "all_week.csv" if (!file.exists(fil)) download.file(url, fil) quakes <- read.csv("all_week.csv", stringsasfactors=false) # create spatial object sp::coordinates(quakes) <- ~l...

ocaml - How to write a PPX rewriter generating lenses for records? -

i writing ppx rewriter ease definition of lenses . let me recall casual reader lenses are. about lenses a lens associated field of record pair of functions allowing extract record , update it. here example: module lens = struct type ('a, 'b) t = { : 'a -> 'b; set : 'b -> 'a -> 'a } end type car = { vendor: string; make: string; mileage: int; } let vendor_lens = { lens.get = (fun x -> x.vendor); lens.set = (fun v x -> { x vendor = v }) } the vendor_lens allows value of field vendor in our car , update – means returning fresh copy of car differing original value of vendor car. might @ first sound banal not: since lenses functions, can composed , lenses module filled useful functions. ability compose accessors crucial in complex code bases, eases decoupling abstracting path computation context nested record. refactored getopts , configuration file parser adopt functional interface, makes lenses m...

.net - C# WebBrowser - Help Adding Flags to Navigate Method -

i'm not greatest com objects but, have need extend webbrowser control support flags in navigate method (specifically prevent reading/writing cache). from gather i'll need implement iwebbrowser2 extent. can implement navigate method or need define methods in interface? i've found examples attaching/detaching event sink extend events of web browser little around actual methods. can use underling activexinstance of webbrowser control? if create class implements iwebbrowser2::navigate, , cast variable class, assigning webbrowser control activexinstance attempt navigate com exception hresult e_fail i found not sure if underlying control still shdocvw didn't see in com objects (target fw .net 3.5): web browser handle pop ups within application internal shdocvw.webbrowser activexwebbrowser { get; private set; }` new public void navigate(string url) { this.navigate(url, axnativemethods.webbrowsernavigateflags.noreadfromcache | axnativemethods.webbrowsernaviga...

java - How to define if the servlet request is initial? -

i want find out if servlet request first 1 (when getting page @ first time). i can write filter intercept requests (even initial one), how reliable approach? class myfilter implements filter { private atomicboolean isfirstrequest = new atomicboolean(true); public void dofilter(servletrequest servletrequest, servletresponse servletresponse, filterchain filterchain) throws ioexception, servletexception { if (isfirstrequest.get()) { isfirstrequest.set(false); } } public void init(filterconfig filterconfig) throws servletexception {} public void destroy() {} } can't use init method of servlet?

jquery - Embed slack on a html page -

i having trouble embedding slack feed onto html site. when try use iframe, shows white box. have tried using jquery <!doctype html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"> . </script> <script> $("#testload").load("http://www.slackurlhere"); </script> </head> <body> <div id="testload"></div> <iframe src="http://www.slackurlhere"></iframe> </body> </html> i have tried "http" , "https" on both iframe , jquery no luck. :( if have other methods please share! thanks just tried , looks reason won't display because of x-frame-options header set slack.com sameorigin. in other words, you're allowed embed page when on slack.com, not anywhere else.

oracle11g - Concerns about tight coupling between ODP.NET and Oracle Client causing deployment issues on webservers with large numbers of applications -

just deployed application using "oracle data provider .net" , received error "exception: provider not compatible version of oracle client" unless mistaken, appears version of odp.net 1 uses in code must match oracle client deployed server. i've worked system.data.oracle provider independent of oracle client version, , before adodb.. , ado (dao anyone?). of these technologies, work oracle client, , important, both organization-wide deployment of client applications , deployment of web-based applications servers used many developers. does oracle expect deploy 1 single oracle client version across our entire enterprise? under scenario, how upgrade version later, without re-compiling , re-deploying our entire application suite? am missing fundamental here, or there tight coupling between oracle's odp.net , specific oracle client? if so, how ever work in production environment?

batch file - Git commit hook to run in windows (auto JIRA prefix) -

i want write batch file commit hook check if users adding jira id prefix commit message. i have created scripts working in linux environment only. i unable find sample such. try latest git windows (the git-2.4.6-5th-release-candidate-64-bit.exe setup) as documented in issues 130 : a typical use case e.g. github windows start git bash in given working directory. i changed behavior of git-bash.exe require new --cd-to-home option behave git bash start menu item (which uses option now). the default not switch directory explicitly. if want switch home directory (as default of git-bash.exe before), have pass --cd-to-home option. it means contextual menu should work. , now, comamnd-line command git-bash.exe work (it opens bash in current folder)