Posts

excel - Determine the month of a week based on in which month a certain weekday is? -

excel - Determine the month of a week based on in which month a certain weekday is? - i want user come in year a1. i want user come in week number a2. i want user come in weekday (monday, tuesday, wednesday, thursday, friday, saturday or sunday) in a3. then want a4 calculate month of entered week number weeks counted belonging month depending on if specified weekday in month or not. what formula work in a4? (if can not solve problem, can give me formula works if specified weekday can thursday, welcome well. my thought that: (weeknumber-1)*7 + weekday -> mon = 1, tue = 2.... check day of year [0..365 or 366] , compare offset jan / feb / march... depending on whether year has 29th of feb - can calculated using year. now have convert code. edit: after read page reffered to, assume have problem understanding excels date syntax http://office.microsoft.com/en-us/excel-help/date-function-hp010062283.aspx so lets break code down: happens here? =choose(mo...

C# JSON - Serializing Objects depending on conditions -

C# JSON - Serializing Objects depending on conditions - i have on list of strings represent selected users. i want serialize json in 1 of properties selected. true if user in list , false if not. right have this: viewbag.json = jsonconvert.serializeobject(new { utilizadores = db.utilizador.select(u => new { id = u.id, nome = u.nome, info = u.nummecanografico, selected = false }) }); example final result: i want this, imagina user 1 , 2 in list. , have 4 users total. utilizadores = [id:1, nome: user1, selected: true],[id:2, nome: user2, selected: true],[id:3, nome: user3, selected: false],[id:4, nome: user4, selected: false] something this. right don't see how can status here. can shed light? i interpreted question in means "you have list of selected users, json property selected true if user in list" ilist<string> selectedusers = ... //the list of selected usernames viewbag.json = jsonc...

ios - Why is my regex in Swift not compiling? How do I give it a mutable string instead? -

ios - Why is my regex in Swift not compiling? How do I give it a mutable string instead? - when utilize next code strip http:// , www. off origin of url, error. var error: nserror? = nil allow regex = nsregularexpression(pattern: "^(http(s)?://)?(www(\\d)?\\.)?", options: nil, error: &error) var stringy = "http://www.google.com/" regex.replacematchesinstring(stringy, options: nil, range: nsmakerange(0, countelements(stringy)), withtemplate: "") the error being: 'nsstring' not subtype of 'nsmutablestring' how prepare this? doing wrong? you can create stringy nsmutablestring constructing nsmutablestring(string: ...) . you'll have few other things code work though: you can't pass nil options. if don't want pass options, right value nsmatchingoptions.allzeros in xcode 6.1 gm, init method you're using nsregularexpression returns optional ( nsregularexpression? ), you'll need u...

java - Plain Json String to HashMap -

java - Plain Json String to HashMap - there quite few questions raised convert json hashmap . hope helps everybody. the next code convert direct values or array of values, hashmap . // function called recursively private static map getmap(jsonobject object, string json) throws exception { map<string, object> map = new hashmap<string, object>(); object jsonobject = null; iterator<string> keys = object.keys(); while (keys.hasnext()) { string key = keys.next(); object value = object.get(key); if (value instanceof jsonobject) { map.put(key, getmap((jsonobject) value, json)); continue; } // if value in form of array if (value instanceof jsonarray) { jsonarray array = ((jsonarray) value); list list = new arraylist(); (int = 0 ; < array.length() ; i++) { ...

How to use wget with `&` from ruby -

How to use wget with `&` from ruby - i'm trying web page info http://example.com/foo.php?arg1=1&arg2=2 . i can page using wget without problem, when phone call wget ruby script like: `wget http://example.com/foo.php?arg1=1&arg2=2` then wget connect http://example.com/foo.php?arg1=1 . in short wget ignores sec argument. i tried system method, ends same error. how can utilize & wget ruby? surround url quote prevent shell interpreter & : `wget 'http://example.com/foo.php?arg1=1&arg2=2'` # ^ ^ or escape & : `wget http://example.com/foo.php?arg1=1\\&arg2=2` # ^^^ update or can utilize shellwords::shellescape Зелёный suggested: "foo&bar".shellescape # => "foo\\&bar" require 'shellwords' `wget #{shellwords.shellescape('http://example.com/foo.php?arg1=1&arg2=2')}` or,...

java - Do action when user crosses 2km distance from current location -

java - Do action when user crosses 2km distance from current location - i want method gets lon , lat , should homecoming true when user under 2km location using lon , lat fixed..but dont know how implement can 1 give idea google has feature called geofencing. there on sample app. utilize feature caution because can drain battery. java android methods

angularjs - Ionic + Auth0 hangs when emulating on iOS -

angularjs - Ionic + Auth0 hangs when emulating on iOS - i followed @mgonto 's adding auth ionic app in 5 minutes. works great in browser when "ionic emulate ios" hangs after seek authenticate facebook (see screenshot). any suggestions? ios angularjs authentication ionic-framework