Posts

Showing posts from September, 2014

Android RelativeLayout how to align two views horizontally -

Image
this code: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingleft="16dp" android:paddingright="16dp" > <textview android:id="@+id/tv_id" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:text="your text" /> <spinner android:id="@+id/s_country" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_below="@id/tv_id" android:layout_toleftof="@+id/city" android:entries="@array/...

java - Interview task: Limit number of concurrent requests with tokens -

during interview, got question. scenario: in database table there entries made common resources. lets column name "token". in total there 500 tokens. 1 web app using token table. whenever 1 user hits web app url, 1 token assigned user. once token assigned user, can not used other users. user, if token shows taken, system try assign token , on. problem: on given point of time, lets 600 user hits web app, how make sure 500 users token, rest 100 not. thank you. what need check whether there free token when request starts, take token if there free one, , release when work done. since question database, think hints @ how achieve atomicity of check , take : use transactions. for example, have table 500 rows tokens procedure select free token database and, if there one, update row mark taken. procedure run in transaction. if ends no free token available, serving thread wait , try again after short period of time. releasing token again trivial update of ro...

Can I write single bit to block device? -

question block devices hdd/sdd etc, not talking filesystems here. i wonder possible write single bit or exact amount of data (eg. 7 bits) block device hdd? read somewhere (can't tell where) not , whatever whole block written. can explain me?

c# - Add Current value to a list then compare with the last value -

suppose there series of moving numbers: 10, 20, 30, 50, 24, 26, 28 i add last (current) point 28 in example. list list<int> mynumber= new list<int>(); mynumber.add(currentnumber); //which 28 in example now, list contains 10, 20, 30, 50, 24, 26, 28 // wherein 28 current last value added then 30 added list the output should be current value: 30, last number: 30 mynumber[mynumber.count-1]; only returns same output current value: 30 last number in list: 30 the output should current value added list, , last number, before current value added note: index start in zero static void main(string[] args) { int currentnumber = 28; list<int> mynumber = new list<int> { 10, 20, 30, 50, 24, 26 }; mynumber.add(currentnumber); mynumber.add(30); console.writeline("last number: {0}", mynumber[mynumber.count - 1]); console.writeline("before last number {0}", mynumber[mynumber.count - 2]); console.r...

How to change the default endpoint of an azure vm? -

i have create new linux virtual machine on azure abcxyz.cloudapp.net. have webapp running on non standard port 12320. when user goes http://abcxyz.coudapp.net , how can point http://abcxyz.cloudapp.net:12320 ? this question serverfault. it's trivial (and should have seen if looked @ vm's endpoint settings): change internal port mapping of endpoint 80 12320.

mysql - Update a column in a table based on column in another table -

the tables 50k rows, , taking on hour run this. figure out way optimize query runs more quickly. tbl1 - serviceid, userid tbl2 - serviceid, userid, type tbl1.serviceid values unique tbl2.serviceid values not unique, come couple of different tables tbl2.type equals either or b (tbl2.serviceid, tbl2.userid, tbl2.type) unique, , set multi column primary key if needed here code using in system updates: $sql = "select * tbl1"; $rs = full_query ( $sql ); while ( $row = mysql_fetch_object( $rs ) ){ $sql = "update tbl2 set type='a' serviceid='" . $row->id . "' , userid='" . $row->userid . "'"; full_query( $sql ); $sql = "update tbl2 set userid='" . $row->userid . "' type='a' , serviceid='" . $row->id . "'"; full_query($sql); } here ended using: $sql = "update tbl2 t2 inner join tbl1 t1 on t1.id = t2.serviceid , t2.userid...

dom - JavaScript get elements by class name and tag name -

i wanted list of dom elements class name , tag name in javascript, not using jquery. for example need <ul> elements class .active var elements = document.getelementsbytagname("ul"); var activeelements = document.getelementsbyclassname('active') what fastest , best way in pure javascript. no external libraries jquery or cheerio document.queryselectorall('ul.active')

Get certain Processor CPU usage using C# -

Image
i google these code processor cpu usage int processorcount = environment.processorcount; performancecounter myappcpu = new performancecounter( "process", "% processor time", "chrome", true); float cpuusage = myappcpu.nextvalue() / processorcount; but in taskmanager,one disk image may have multi pids so,i want know ,is cpu usage code counted total usage chrome browser? you can use getprocesstimes function kernel32.dll. see .net usage here: http://www.pinvoke.net/default.aspx/kernel32/getprocesstimes.html the first parameter handle of process. use either system.diagnostics.process.getcurrentprocess().handle or system.diagnostics.process.getprocessbyid(123).handle or other process instance. using system; using system.collections.generic; using system.componentmodel; using system.linq; using system.runtime.interopservices; using system.runtime.interopservices.comtypes; using system.text; using system.threading...

java - Why are these different numbers the same? -

i'm doing unit testing , i've got line: assertequals(1.1886027926838422606868849265505866347, 1.18860279268384230000000000000000000000,0); with delta of 0 should have same in order pass , not, test passes, try yourself. changing delta 1e-50 still passes. why passing when 2 different numbers? this because java compiler rounds these 2 numeric literals same number. run experiment: system.out.println(1.1886027926838422606868849265505866347); system.out.println(1.18860279268384230000000000000000000000); this prints same number ( demo ): 1.1886027926838423 1.1886027926838423 the double primitive type can handle 16 decimal places, cannot represent these numbers way last digit. if want full precision, use bigdecimal instead.

sql - How does the Average function work in relational databases? -

i'm trying find geometric average of values table millions of rows. don't know, find geometric average, mulitply each value times each other divide number of rows. you see problem; number multiplied number exceed maximum allowed system maximum. found great solution uses natural log. http://timothychenallen.blogspot.com/2006/03/sql-calculating-geometric-mean-geomean.html however got me wonder wouldn't same problem apply arithmetic mean? if have n records, , n large running sum can exceed system maximum. so how rdms calculate averages during queries? very easy check. example, sql server 2008. declare @t table(i int); insert @t(i) values (2147483647), (2147483647); select avg(i) @t; result (2 row(s) affected) msg 8115, level 16, state 2, line 7 arithmetic overflow error converting expression data type int. there no magic. column type int , server adds values using internal variable of same type int , intermediary result exceeds range int . ...

java - Unable to catch the random number generated in main method? -

i running code, unable access class variables (pg , dg) in main method. output getting is dealer starting game has guessed number 0 9 time guess player guessing number player 1 guessed 0 player guessing number player 2 guessed 0 player guessing number player 3 guessed 0 dealer guess 0 have guessed correctly i unable catch random number generated in method. class player { public int pg = 0; public void pguess() { system.out.println("player guessing"); int pg = (int)(math.random() * 10); } } class dealer { public int dg = 0; public void guess() { system.out.println("dealer starting game"); system.out.println("he has guessed number 0 9"); system.out.println("now time guess"); int dg = (int)(math.random() * 10); } public void dealerdisplay() { system.out.println("the dealer guess " + dg); } } p...

webpack convert css unit with uglifyjs plugin -

Image
it's weird, actually, think quite easy come across, have found nothing issue~ i have tested / without uglifyjs plugin, , i'm quite sure plugin results in issue. in style files, px / em have been used, after compression, of px has been converted pc / pt, totally have no clue~ even though uglifyjs has js in name affects other loaders. answer hidden in uglifyjsplugin docs . minimize javascript output of chunks. loaders switched minimizing mode. (...) the discussion takes place here: https://github.com/webpack/webpack/issues/283 no workaround yet see. i long doesn't mess build, keep using uglifyjs. when starts, can try switching babili (babel based minifier) + babili-webpack-plugin. https://babeljs.io/blog/2016/08/30/babili https://www.npmjs.com/package/babili-webpack-plugin and minifying css css-loader minimize option. from https://github.com/webpack/css-loader : you can disable or enforce minification minimize query ...

java - Need to convert a String to a Intent that I can send? -

what code need on receiving end of broadcast receiver convert string working intent can send? in short need intent1 converted working intent can send! in advance everyone! edit came find out method of storing notification intent didn't work guess main question @ point how can notifications intent , send on broadcast sender , receive intent in broadcast receiver , being able send intent...thanks bearing me i'm confused on how make happen thank community helping me out broadcast sender public void onnotificationposted(statusbarnotification sbn) { string pack = sbn.getpackagename(); string ticker = sbn.getnotification().tickertext.tostring(); bundle extras = sbn.getnotification().extras; string title = extras.getstring("android.title"); string text = extras.getcharsequence("android.text").tostring(); intent intent = new intent(); intent.putextra("action", notification.contentintent); log.i("package...

php - call the ' id ' of the mysql database with varchar format but Unknown column 'GE' in 'where clause' -

this question has answer here: when use single quotes, double quotes, , backticks in mysql 10 answers i tried call data 'id' format id example id = ge-dis-001 join table codeigniter , result of "unknown column ' ge ' in 'where clause ' what's wrong ?? controller : public function detail(){ $id = $this->uri->segment(4); $detail = $this->mcrud->get_detail($id); $data = array( 'detail'=>$detail, 'lihat' =>$this->mcrud->lihat_komentar($id), 'isi' =>'instrument/read_views'); $this->load->view('layout/wrapper', $data); } model : public function get_detail($id){ $sql = "select * tbdetail join tbkalibrasi on tbkalibrasi.id = tbdetail.id joi...

osx - How to create custom toolbar in OS X? -

Image
i trying below effect in os x. i found out first step create custom toolbar, hide window title. i have managed hide window title new os x development not sure how create custom toolbar. here effect trying create (toolbar search field , maybe buttons). you can customize toolbar in interface builder. click on toolbar have dragged window . can remove items in there , add ones have. can add textfields , buttons custom views . add items dragging them object library "allowed toolbar items" section. there, drag them "default toolbar items" section. otherwise control available user, not in toolbar until customizes it. you can align controls using space , flexible space objects can found in objects library of xcode. aligning controls works via drag , drop. to center controls, add flexible spaces left , right of control.

amazon web services - Failed Create Launch Config with Ansible -

i've try create new launch config @ aws ansible after new ami create, here's script playbook : - hosts: localhost tasks: - name: create ami ec2_ami: region: "ap-southeast-x" instance_id: "i-xxxxxx" name: "my ami {{ ansible_date_time.date }} {{ ansible_date_time.hour }}-{{ ansible_date_time.minute }}" wait: yes state: present register: ami - name: create lc ec2_lc: name: "my lc {{ ansible_date_time.date }} {{ ansible_date_time.hour }}-{{ ansible_date_time.minute }}" image_id: "{{ ami.image_id }}" key_name: "my_key" security_groups: "sg-xxxx" instance_type: t2.medium register: lcnew but when try run, i've got message : error: ec2_lc not legal parameter in ansible task or handler if have ansible 2.0.0 , must have installed git guess. did clone repository recursive? modules implemented through git submodule. ...

c# - Hidden details option of dataTables when loaded through model MVC -

i have table of employees fetch using $.load ajax call sending partialview below: model class public class employeedetails { public string firstname{get;set;} public string lastname{get;set;} public string accountstatus{get; set;} public string lastlogin{get;set;} public string emailaddress{get;set;} public string contact {get;set;} public string gender {get;set;} } partialviewresult method in controller public partialviewresult getemployeedetails() { list<employeedetails> model=new list<employeedetails>(); using(var context=new contextconnection()) { var employees=(from e in context.tbl_employees select e).tolist(); foreach(var employee in employees) //fill model { model.add(new employeedetails(){ firstname=employee.fname, lastname=employee.lname, accountstatus=employee.acc_status, lastlogin=employee.last_login, ...

javascript - AngularJS dependency-injection -

i have 2 modules: foo.a foo.b and application module: angular.module("foo", ["foo.a","foo.b"]) i have service in module foo.b say: angular.module("foo.b", []) angular.module("foo.b").factory("helper",helperfn); which want use in 1 of controllers in foo.a . what have done simple dependency injection: angular.module("foo.a", []); angular.module("foo.a") .controller("mycontroller",["helper",mycontrollerfn]); which working. my questions how getting "helper" service module foo.b though not declared dependency module a? will break @ later stage? if correct, practice? put factory need access in both modules in third module. have 2 original modules inject dependency third module. angular.module("foo", ["foo.a", "foo.b"]); angular.module("foo.a", ["foo.c"]) .contro...

Javascript image preview always in landscape mode bug -

i'm trying dinamically preview image in javascript before uploading it, got code here: preview image before uploaded <input type="file" accept="image/*" onchange="loadfile(event)"> <img id="output"/> <script> var loadfile = function(event) { var output = document.getelementbyid('output'); output.src = url.createobjecturl(event.target.files[0]); }; </script> it works fine, when load picture that's in portrait format, rotates automatically , sets landscape. how can prevent happening? it's not rotating picture automatically. when tested it, it's showing me correct image , orientation. you experiencing problem exif orientation of image not being honored browser. i suggest open image in image editing software, photoshop, make sure it's in portrait, , save under new name. try script again , should work. if not, try image (a portrait image found on...

middleware - Oracle Service Bus - XML based proxy service -

i have xml file like <a> <b>abc</b> <c>1</c> </a> <a> <b>def</b> <c>2</c> </a> i have fetch value of 'b' based on value of 'c' input of proxy service in osb. please how create type of proxy service? an xquery , 2 simple assigns: create xquery resource return xml structure 1) inside proxy, first action assign xquery call file above local variable, ie: $xmlfile 2) assign $xmlfile/a[./c=$body/c]/b/text()

linux - Bash - Delete lines not ending with a number -

i need remove lines (in text file) not ending number. before: frog toad 8 snake 3 spider after: toad 8 snake 3 try gnu sed edit "in place": sed -i '/[^0-9]$/d' file

scheme - DrRacket gives the " '(#<procedure> #<procedure> #<procedure>) " output -

i doing ex2.22 of sicp, exercise gives procedure intends square list output reverses list. when type in drracket output unexpected. code: (define (square-list items) (define (iter things answer) (if (null? things) answer (iter (cdr things) (cons (square (car things)) answer)))) (iter items null)) (square-list (list 1 2 3)) the expected output (9 4 1) '(#<procedure> #<procedure> #<procedure>) .i don't know why. the result depends on definition of square , have defined in wrong way. here right definition of square returns correct answer: (define (square item) (* item item)) (define (square-list items) (define (iter things answer) (if (null? things) answer (iter (cdr things) (cons (square (car things)) answer)))) (iter items null)) (square-list (list 1 2 3)) (9 4 1) here can note result, given way in calculate it, reversed respect original list. if want obtain ...

javascript - jQuery Scale div to parent -

i stumped, have written code scale div within div. purposes of question have taken code out of context show working version. basically on load , if user resizes browser div made dynamically scale fits proportionately within container div. this works fine. have dropdown select enable user change size of smaller div. uses .removeclass , .addclass . scale function called, work if scale function delayed timer i.e; $("#pagesize").removeclass(); $("#pagesize").addclass($("#paper").val()); settimeout(function(){ scalepages(); }, 1000); this wont work; $("#pagesize").removeclass(); $("#pagesize").addclass($("#paper").val()); scalepages(); i confused why needs timer. have tried put in call function still dosent work. have better solutions this? scalepages(); //using underscore delay resize method till finished resizing window $(window).resize(_.debounce(function () { scalepages(); }, 0)); ...

cmd - Windows batch script with multiple commands -

ok, have windows 10 .bat script convert type videos in 1 folder , output in using handbrakecli multiple commands. in addition that, want use cpu usage limiter bes control cpu usage of handbrakecli. after each file converted, want send pushbullet notification myself stating conversion complete. the code below helps me achieve that, need run .bat file twice make start , after 1 iteration stops. initially had problems using multiple commands , did search , used "&" between commands, no joy. i have powershell script this, please don't suggest powershell, don't want use because powershell script requires elevated privileges don't want give anymore. for /r "d:\toconvert" %%i in (*.*) "c:\program files (x86)\bes_1.6.2\bes.exe" "c:\program files\handbrake\handbrakecli.exe" 33 --minimize & "c:\program files\handbrake\handbrakecli.exe" -i "%%i" -t 1 -c 1 -o "d:\done\%%~ni.mp4" --preset=...

r - How to plot predicted values with standard errors for lmer model results? -

Image
i have transplant experiment 4 locations , 4 substrates (taken each location). have determined survival each population in each location , substrate combination. experiment replicated 3 times. i have created lmm follows: survival.model <- lmer(survival ~ location + substrate + location:substrate + (1|replicate), data=transplant.survival,, reml = true) i use predict command extract predictions, example: survival.pred <- predict(survival.model) then extract standard errors can plot them predictions generate following plot: i know how standard glm (which how created example plot), not sure if can or should lmm. can or new user of linear mixed models missing fundamental? i did find post on stack overflow not helpful. based on comment rhertel, maybe should have phrased question: how plot model estimates , confidence intervals lmer model results can similar plot 1 have created above? sample data: transplant.survival <- structure(list(location =...

ruby on rails - Rails_admin, Assigning Devise's current_user to model inside action -

i have devise model person log in , manage rails_admin app. i have model called model has updater added mongoid-history . in order set updated story need this: model = model.new model.updater = person.first model.save according link github , can not set current_person , created devise automatically. that's means need set updater manually each time when happens model . how current_person , set model rails_admin's action happens? i know need write each action in initializers/rails_admin.rb there's no access current_user model, because activerecord models can used independently rails apps, can used without logging in. it controller (often) requires user login , has access user session , current_user method. controller must therefore work of setting updater on model. perhaps set callback method in controller acts on action modifies model , sets updater there.

c# - How do I deserialize json so that some json properties gets assigned to an array or List? -

using json.net, how deserialize following json orderdepthfeed class provided below? want bid1 go bid[0], bid2 bid[1] , on. { "i": "101", "m": 11, "tick_timestamp": 1440479701986, "bid1": 78.00, "bid_volume1": 60, "bid_orders1": 1, "ask1": 80.50, "ask_volume1": 500, "ask_orders1": 1, "bid2": 77.50, "bid_volume2": 500, "bid_orders2": 1, "ask2": 82.00, "ask_volume2": 1560, "ask_orders2": 2, "bid3": 77.00, "bid_volume3": 107, "bid_orders3": 2, "ask3": 82.95, "ask_volume3": 75, "ask_orders3": 1, "bid4": 76.30, "bid_volume4": 200, "bid_orders4": 1, "ask4": 83.40, "ask_volume4": 49, "ask_orders4": 1, ...

javascript - Click visible button in protractor? -

i have page looks this. it's wizard steps. depending on "step" scope variable, different part of wizard shown: <div ng-show="step == 'first'"> <button>next</button> </div> <div ng-show="step == 'second'"> <button>next</button> </div> <div ng-show="step == 'third'"> <button>next</button> </div> to click next button run problems though. because there 3 of them. following code returns of them: var next = element(by.buttontext('next')); and doing: next.click(); will click first one. how can find visible button only, , click one? first confused isdisplayed returning promise. function came with: function clickbutton(text) { var buttons = element.all(by.buttontext(text)); buttons.each(function(button) { button.isdisplayed().then(function(isvisible) { if (isvisible) { bu...

.net - Singleton in DependencyInjection -

i struggling concept of singletons in dependency injection. not sure whether classes should implemented in way support singleton / per instance instancing classes intended used singletons or whether should rely on proper settings of instancing programmer. following class work expected if marked singleton in dependency container ... builder.registertype<applicationsettings>().asself().singleinstance(); ... /// <summary> /// allows create many applicationsettings instances each of them have collection of settings. /// cannot guarantee 1 of class has complete settings /// </summary> public class applicationsettings { private readonly object _locker = new object(); private readonly dictionary<string, object> _settings; private readonly ilog _log; public applicationsettings(ilog log) { _log = log; _settings = loadsettings(); thread.sleep(3000); //inner hardwork, e.g. cashing of } public object getsettin...

sql server - SSIS Foreach ADO Enumerator with Data Flow Task & Script -

been working on day , driving me crazy. i'm new ssis (usually c# programmer) things don't work way i'd expect them :) (tl;dr - how can use ado foreach enumerator , pass whole row variable data task (which holds script component) inside?) scenario: using cdc splitter component in data task retrieve , split out inserts, updates , deletes cdc tables within database. assign each change package level object variable recordset. taking inserts object variable want check condition on provided string data, , if true want email change someone. to achieve dropped foreach container on surface , hooked inserts object variable. inside container dropped data flow task, , within data flow task dropped script component. the idea if condition met current row, row added script component's output buffer. what's bugging me seems though way achieve map each column in row foreach loops variables collection. every example i've seen shows variables mapped starting i...

jquery - Autocomplete Textbox from Active Directory usind LDAP Users in php -

Image
i trying autocomplete field picks names of users ldap. codes follows : index.php $(document).ready(function() { $("#search-box").keyup(function() { $.ajax({ type: "post", url: "readcountry.php", data: 'keyword=' + $(this).val(), beforesend: function() { $("#search-box").css("background", "#fff url(loadericon.gif) no-repeat 165px"); }, success: function(data) { $("#suggesstion-box").show(); $("#suggesstion-box").html(data); $("#search-box").css("background", "#fff"); } }); }); }); function selectcountry(val) { $("#search-box").val(val); $("#suggesstion-box").hide(); } body { width: 610px; } .frmsearch { border: 1px solid #f0f0f0; background-color: #c8eefd; margin: 2px 0px; padding: 40px; } #country-list { ...

sql - get four digit year from oracle date -

i have table a, has column fromdate . select to_date(fromdate,'dd-mon-yyyy') returns value 31-aug-99 but need know whether date 31-aug-1999 or 31-aug-2099 is there 1 help? use to_char function date in character format. try this: select to_char(fromdate,'dd-mon-yyyy') a; or if want want in date have change nls date settings. alter session set nls_date_format = 'dd-mon-yyyy' before executing original posted query.

Xdebug configuration is fine, but PhpStorm is unable to debug -

i'm using phpstorm version 8.0.4, server debian wheeze php 5.4.4 , xdebug 2.1.1. on phpstorm have 2 projects. debug on project works fine, debugger stops @ at breakpoint , i'm able watch variables , step functions. on project b, has same debugging configuration of project a, debugger not stop @ breakpoints. both project stored in same server, same apache, php , xdebug configuration. use different virtual hosts. differences have encountered on project phpstorm sets cookie xdebug_session on browser ide key, on project b cookie not set. next sample debug session on project b: log opened @ 2015-08-25 07:01:36 i: checking remote connect address. i: remote address found, connecting <client ip>:9000. i: connected client. :-) -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/projectb/script.php" language="php" protocol_version="1.0" appid="3137...

javascript - Matching an argument with a function in Jasmine -

i want perform custom assertion argument passed spied-on function call. can supply callback used within expectation against argument? expect(my.method).tohavebeencalledwith(jasmine.argumentmatching(mycustomcallback), jasmine.any({})); ... jasmine.argumentmatching(mycustomcallback) pseudo code. jasmine spy has property .calls , provides information number of calls, arguments particular calls, etc. take @ docs section - other tracking properties . depends on requirements 1 use, , in documentation described well, in general: .calls.argsfor(n) - returns array of arguments n-th call .calls.allargs() - returns array of arrays of arguments calls .calls.mostrecent() , .calls.first() - return object in form: { object: my, args: ['foo', 42'], returnvalue: undefined } .calls.all() - returns array of objects (like 1 above) in general like: spyon(my, 'method'); my.method('foo', 42); expect(my.method.calls.argsfor(0)).toequal(['foo...

java - How does this class work or how can you use it? -

i fell on class looks this: public final class databasetype{ public static final databasetype type_limited_text = new databasetype(); public static final databasetype type_unlimited_text = new databasetype(); public static final databasetype type_date = new databasetype(); public static final databasetype type_decimal = new databasetype(); private databasetype(){ } public string tostring(){ return "databasetype"; } } i need set type want understand what's happening here , have no clue how class works. whatever variable use return empty databasetype, no information. wonder how can use of such class. maybe there name type of class? basically, class lists 4 enumerable constants, can use in method signatures public databasetype gettypeofdb(); in client code, you'll have type-safe way compare constants: if (gettypeofdb() == databasetype.type_limited_text) { dosomething(); } even though implementation s...

php - How to get user details corectly with google api -

hi there have bug in code, tried user details need name, email code doesn't return email. how can fix ? <?php include_once "templates/base.php"; session_start(); require_once ('src/google/autoload.php'); $client_id = '1061700181920-5i9r----something-----k3mogj328g9sed3.apps.googleusercontent.com'; $client_secret = 'zsfesn-----gsomething----pgtzce0uvm'; $redirect_uri = 'http://localhost/easy_b/shop/user-example.php'; $client = new google_client(); $client->setclientid($client_id); $client->setclientsecret($client_secret); $client->setredirecturi($redirect_uri); $client->addscope("https://www.googleapis.com/auth/plus.login"); $service = new google_service_oauth2($client); //logout if (isset($_request['logout'])) { unset($_session['access_token']); } if (isset($_get['code'])) { $client->authenticate($_get['code']); $_session['access_token'] = $client-...

c# - Entity Framework 6 - lazy loading not working -

this first time using ef. such may have missed simple preventing lazy loading of bclass. when load aclass 'b' property null. have expected populated persisted. for example have 2 simple classes: public class aclass { public aclass() { id = guid.newguid(); b = new bclass(); } [key] [databasegenerated(databasegeneratedoption.none)] public guid id { get; set; } public string name { get; set; } public virtual bclass b { get; set; } } public class bclass { public bclass() { id = guid.newguid(); } [key] [databasegenerated(databasegeneratedoption.none)] public guid id { get; set; } public string description { get; set; } } in 'context' class: public dbset<aclass> aclasses { get; set; } public dbset<bclass> bclasses { get; set; } below simple test. expecting x.b loaded. instead null? using (var db = new testcontext()) { aclass = new aclass(); a.name = "a...

visual studio 2010 - vb.net: Using <see> Tags in XML comments -

i'm trying improve code documentation , decided give xml-comments closer look. if i'm not mistaken, <see> tag should allow create clickable "links" or references other parts of code. pe: public class form1 ''' <summary> ''' something. ''' </summary> private sub aaa() 'do end sub ''' <summary> ''' calls <see cref="aaa"/>. ''' </summary> private sub bbb() aaa() end sub end class this should create clickable link "aaa" in documentation of "bbb". the xml-code compiles fine, intellisense helps choosing reference, in objectbrowser doesn't work! reference "aaa" dead text. do have ideas on this? neat little feature if worked. (i'm working on vs2010premium) in visual studio 2015, see tag cause hyperlinks referenced objects appear within intellisen...

html - Update MySQL entry through PHP form -

i writing script right update mysql data entry through php form. know there lots of tutorials , lot of answers here on stackoverflow. problem "updated data successfully" message data not updated inside database. maybe find error or can tell me did wrong , have change. here needed code: form: <?php session_start(); if(empty($_session)) // if session not yet started session_start(); if(!isset($_session['email'])) { //if not yet logged in header("location: login.php");// send login page exit; } include 'header.php'; $get = "select * user email email = '".$_session['email']."'"; $result_get = mysqli_query($connect, $get); $_session['data'] = mysqli_fetch_assoc($result_get); ?> <form method="post" action="update_profile.php" class="form-horizontal form-label-left"> <div class="form-group"> <label class="contro...

javascript - How to alternate values in an array? -

i new javascript, , struggling 1 question class. easy, stuck @ moment. anyway, here problem: i have create table of alternating characters of x , o based on user-specified number of rows , columns. instance, if user wanted 3 rows , 3 columns, have this: xox oxo xox i lost on how can create alternating value in array. have far (below), logic of wrong. if can give me advice great! have been looking @ problem days, can’t seem piece together. // = user input # of columns // b = user input # of rows function firsttest(a,b) { var firstarray = []; var total = []; (i = 0; < a; i+=1) { firstarray.push("xo"); } (i=0; i<b; i+=1){ total.push(firstarray); } return(total); } you need check if sum of value of row , value of column odd or even: function firsttest(a,b) { table = []; ( x = 1 ; x <= ; x++ ) { row = []; ( y = 1 ; y <= b ; y++ ) { if (((x+y) % 2) == 0) { row.p...

DocumentDB and Azure Search: Document removed from documentDB isn't updated in Azure Search index -

when remove document documentdb wont removed azure search index. index update if change in document. i'm not quite sure how should use "softdeletecolumndeletiondetectionpolicy" in datasource. my datasource follows: { "name": "mydocdbdatasource", "type": "documentdb", "credentials": { "connectionstring": "accountendpoint=https://mydocdbendpoint.documents.azure.com;accountkey=mydocdbauthkey;database=mydocdbdatabaseid" }, "container": { "name": "mydocdbcollectionid", "query": "select s.id, s.title, s.abstract, s._ts sessions s s._ts > @highwatermark" }, "datachangedetectionpolicy": { "@odata.type": "#microsoft.azure.search.highwatermarkchangedetectionpolicy", "highwatermarkcolumnname": "_ts" }, "datadeletiondetectionpolicy": { "@odata.type": "#micr...