Posts

Showing posts from September, 2014

haskell - In the lets-lens tutorial, how do you refactor out the call to traverse in order to implement over? -

in the exercises have implemented fmapt : -- let's remind ourselves of traversable, noting foldable , functor. -- -- class (foldable t, functor t) => traversable t -- traverse :: -- applicative f => -- (a -> f b) -- -> t -- -> f (t b) -- | observe @fmap@ can recovered @traverse@ using @identity@. -- -- /reminder:/ fmap :: functor t => (a -> b) -> t -> t b fmapt :: traversable t => (a -> b) -> t -> t b fmapt = error "todo: fmapt" now how implement over ? -- | let's refactor out call @traverse@ argument @fmapt@. on :: ((a -> identity b) -> s -> identity t) -> (a -> b) -> s -> t on = error "undefined" you can implement fmapt using traverse as: fmapt f s = runidentity (traverse (identity . f) s) now next exercise refactor function providing traverse parameter rather hard-coding in definition. if choose identity applicative type construct

evoking binary excecutable in a C++ project -

i have main project carry out control tasks involve processing provided binary executables proga.exe, progb.exe, progc.exe. bad disadvantage don't have source codes of these progx.exe nor libraries except binary executables is there way can write main project prepare input data, evoking & feed input data progx.exe , further process output? there such coding project? i don't know if possible idea or not there great documentation in msdn creating processes , redirecting input/output: creating child process redirected input , output

filesize - Responsive Filemanager doesn't upload files bigger than ~2MB -

i use responsive filemanager several websites host. have latest version (9.6.6) installed, , use tinymce plugin jquery tinymce version 4, problem occurs both standalone filemanager plugin, doubt important. anyhow, problem following: seems working fine when upload files smaller exactly 2 megabytes. using dummy file generator, have been able generate pfd file of 2097152 bytes, uploads fine, , pdf file of 2097153 bytes, doesn't upload. responsive filemanager says upload went fine (with both standard uploader , java uploader), file bigger 2097152 bytes doesn't uploaded. here's video demonstrating precicely problem is: https://youtu.be/ndtzhs6fyvg since rf config allows files 100mb (see entire config here: http://pastebin.com/h9fvh1pg ), i'm guessing might server settings? i'm using xampp windows. there settings in apache config or that, block uploads through http bigger 2mb? thank help! edit: typo's , added links + video showing problem. i ma

c++ - SDL_Init crashes without apparent reason -

i'm trying write simple sdl2 , opengl program sdl_init causes application crash right @ beggining. here's code: #include <iostream> #include <cstdint> #include <windows.h> #include <gl/gl.h> #include <sdl2/sdl.h> #define win_width 800 #define win_height 600 int callback winmain( hinstance hinstance, hinstance hprevinstance, lpstr lpcmdline, int ncmdshow) { int err; sdl_window *window; sdl_glcontext context; uint32_t win_flags = sdl_window_opengl; std::cout << "before"; if (sdl_init(sdl_init_video) < 0) { std::cout << "fail"; std::cout << "sdl init error: " << sdl_geterror() << std::endl; } std::cout << "success"; window = sdl_createwindow("rgb", sdl_windowpos_undefined, sdl_windowpos_undefined, win_width, win_height, win_flags); context = sdl_gl_createcontext(window); sdl_gl_deletecontext(context);

java - User defined Array dimensional and size -

i have unsolvable task, have task, have insert random number array. user can choose if array 1d, 2d, 3d,size of array optional . tried withot success. can not use arraylist. thank help. double[] array= new double[size]; ( int i;i<dimensional;i++) { double[] array= new double[size]; } edit: mind if effective way create array 1d , add array 1 or more dimension. multi-dimensional arrays in java arrays of arrays. user provides number of dimensions , sizes @ runtime need dynamically build array @ point. it's strange problem, , not 1 try solve arrays in production code, nevertheless should possible. try accepted answer this question , seems pretty attempt.

PHP website shows question marks insted of utf-8 characters although in Netbeans it's saved in utf-8 -

i have php website written in netbeans. contains meta: <meta charset="utf-8" /> and header: <?php header('content-type: text/html; charset=utf-8'); ?> also 3 other php files responsible changing language of site contains header. i've found here information due netbeans not saving files in utf-8. added -j-dfile.encoding=utf-8 in netbeans_default_options in netbeans.conf file. problem still exists. can problem now? website looked ok, when html. after adding posibility of changing language question marks started show.

flow router - Meteor - Flowrouter: generic vs variable route -

i want display posts different cities, defined cityid : flowrouter.route("/:cityid", { name: 'postlist', action: function() { console.log(flowrouter.getparam("cityid")); return blazelayout.render('mainlayout', { top: 'header', body: 'postlist' }); } }); alongside of course have generic routes 'admin', 'signup' , on. when go /signup , postlist route gets activated, treating 'signup' word city id, , 'signup' logged in console. defining route flowrouter.route("/postlist/:cityid") not option. actually, need control route definition order. define /signup route before generic one: /:cityid

What is difference between connector and extractor in import.io? When to use each of them? -

when connector , and extractor of import.io tool used? same or there differnce? extractor you can create api 1 type of page or more you can use bulk extract extractor you can use url of page connector you can create api extract data search results page after performing search you can't use bulk extract it you can use dataset or on api you can use search term not url

coffeescript - django-require and require-cs -

has used django-require , require-cs together? i stuck when deploying application. want coffee files compiled js , coffee-script.js excluded build. i added own build profile (using require_build_profile) , used this build file example, doesn't seem work. yeah, if post build.js , settings.py, that'd great ;) to use coffeescript requirejs, need load coffeescript files using cs! loader plugin. for example, given file structure this: js main.js // main script file, minimal javascript stub. cs.js // coffeescript loader plugin. coffee-script.js // coffeescript compiler. csmain.coffee // actual coffeescript main file. module1.coffee // coffeescript module. module2.coffee // coffeescript module. app.build.js // app build profile. then, in main.js file, can bootstrap coffeescript app this: require(["cs!csmain"]) your csmain.coffee file can run app, this: require([ "cs!module1", "cs!module2" ], (modu

assembly - Assembler stuck in sys_read loop -

i've written piece of code takes number in ascii characters prompt, converts decimal number , stores in 'dnumber'. conversion has been checked , goes well. goes wrong @ prompt. seems stuck in infinite loop while asking user ascii character number. want program stop asking input when user presses enter, termination value never seems reached though think i've set way. i've asked 2 related questions on forum lately , showed don't understand system calls properly. i've read documentation on ' http://www.tutorialspoint.com/assembly_programming ', ' http://cs.lmu.edu/~ray/notes/nasmtutorial/ ' , of ' http://www.x86-64.org/documentation/abi.pdf ' , apparently i'm still not getting it. can show me light. here compiler info: nasm -f elf64 convinput.asm ld -s -o convinput convinput.o here prompt: $ ./convinput enter number , press enter: 123 123 123 as can see i've pressed enter twice, prompt still asks input. here

excel - Finding a VBAS defnied Named Range definition -

a valuei've inherited large vba project , whilst have lots of dev expereince have small amount of vba. code reads data off sheet in form: intersect(range("colname"), .rows(intcurrentrow)).value where colname named range, or thought. have searched of project code , excel sheets , cannot find colname defined ? so far have searched code, looked in name manager on sheet , have googled furiously hit total blank. need read in value sheet prefer use code used value instead of colname reference new data field. is there obvious i'm missing ? edits: activesheet.range("colname").address gives value of "$l:$l" its hidden name.as doug glancy said, can unhide using vba activeworkbook.names("colname").visible=true if working defined names may find useful & jan karel pieterse's name manager addin (amongst many other things) handles hidden names. download from http://www.decisionmodels.com/downloads.htm

Android: Transformer tablet keyboard registering two Enter key inputs -

i'm doing quick log statement in mainactivity , getting 2 enter key presses logged whenever physical enter key pressed on asus transformer tablet physical keyboard. key not being held down. public boolean dispatchkeyevent(keyevent event) method being called when occurs, twice each time. any ideas? one onkeydown , 1 onkeyup . having 2 call every action. mentioned key not being held log twice

c# - Changing content of webpage -

i have web page content , button save . through c# code want change content of webpage , click save button. here code. string replace = webbrowser1.documenttext.replace("2013.0.0.1", "2013.0.0.2"); webbrowser1.documenttext = replace; links = webbrowser1.document.getelementsbytagname("input"); foreach (htmlelement link in links) { if ((link.getattribute("name") == "save")) { if (link.getattribute("type").equals("submit")) { link.invokemember("click"); break; } } } my website not save when clicking save. not navigate page should after clicking save button. i noticed 1 strange thing. when remove first 3 lines replace text , change content manually, works fine. webpage saves content , navigates proper location. any ideas workaround? ultimately got it. realized approach not correct. got text html , trying replace text in that. no

Prepend CSS class to @import with Less -

i'm trying prepend css class of imported css using less, can't apply comma separated selectors. this less i'm using: style.less .mystyle { @import "imported.less"; } imported.less .stylea {} .styleb {} .stylec, .styled {} the output .mystyle .stylea {} .mystyle .styleb {} .mystyle .stylec, .styled {} desired output .mystyle .stylea {} .mystyle .styleb {} .mystyle .stylec, .mystyle .styled {} what missing?

python - Django model translation - cannot import name 'Constraint' -

i want translate content of models fields django-modeltranslation . when run 1 of these: python manage.py makemigrations python manage.py runserver i importerror: cannot import name 'constraint' here traceback of 'makemigrations' traceback (most recent call last): file "manage.py", line 10, in <module> execute_from_command_line(sys.argv) file "/home/mat/desktop/python/pmm/venv/lib/python3.4/site-packages/django/core/management/__init__.py", line 350, in execute_from_command_line utility.execute() file "/home/mat/desktop/python/pmm/venv/lib/python3.4/site-packages/django/core/management/__init__.py", line 324, in execute django.setup() file "/home/mat/desktop/python/pmm/venv/lib/python3.4/site-packages/django/__init__.py", line 18, in setup apps.populate(settings.installed_apps) file "/home/mat/desktop/python/pmm/venv/lib/python3.4/site-packages/django/apps/registry.py", line

sql - HIve CLI doesn't support MySql style data import to tables -

why can't import data hive cli following, hive_test table has user , comments columns. insert table hive_test (user, comments) value ("hello", "this test query"); hive throws following exception in hive cli failed: parseexception line 1:28 cannot recognize input near '(' 'user' ',' in select clause i don't want import data through csv file following testing perpose. load data local inpath '/home/hduser/test_data.csv' table hive_test; it's worth noting hive advertises "sql-like" syntax, rather actual sql syntax. there's no particular reason think pure sql queries run on hive. hiveql's dml documented here on wiki , , not support column specification syntax or values clause. however, support syntax: insert table tablename1 select ... ... extrapolating these test queries , might able following work: insert table hive_test select 'hello', 'this test query'

python - Restrict separator to only some tabs when using pandas read_csv -

i'm reading tab-delimited data pandas dataframe using read_csv, have tabs occurring within column data means can't use "\t" separator. specifically, last entries in each line set of tab delimited optional tags match [a-za-z][a-za-z0-9]:[a-za-z]:.+ there no guarantees how many tags there or ones present, , different sets of tags may occur on different lines. example data looks (all white spaces tabs in data): c42tmacxx:5:2316:15161:76101 163 1 @<@dffadddf:dd nh:i:1 hi:i:1 as:i:200 nm:i:0 c42tmacxx:5:2316:15161:76101 83 1 cccccacdddcb@b nh:i:1 hi:i:1 nm:i:1 c42tmacxx:5:1305:26011:74469 163 1 cccfffffhhhhgj nh:i:1 hi:i:1 as:i:200 nm:i:0 i proposing try read tags in single column, , thought passing in regular expression separator excludes tabs occur in context of tags. following http://www.rexegg.com/regex-best-trick.html wrote following regex this: [a-za-z][a-za-z0-9]:[a-za-z]:[^\t]+\t..:|(\t). tested on online regular express

sql - Issue calculating month end date in 4GL -

this routine returning 12/31/2016 instead of 12/31/2015 , messing report. idea going wrong? let date_month = month(p_selection.date_from) if date_month = 12 let date_month = 1 let p_selection.date_from = p_selection.date_from + 1 units year let date_thru = date_month,"/01/",year(p_selection.date_from) let p_selection.date_from = p_selection.date_from - 1 units year else let date_month = date_month + 1 let date_thru = date_month,"/01/",year(p_selection.date_from) end if let p_selection.date_thru = date_thru clipped if year(p_selection.date_thru) <> year(p_selection.date_from) let p_selection.date_thru = p_selection.date_thru + 1 units year end if let p_selection.date_thru = p_selection.date_thru - 1 assuming input p_selection.date_from 12/01/2015 ... if date_month = 12 returns true, date_thru gets calculated 01/01/2016 but second if statement returns true, adding year p_selection.date_thru (01/0

Python basemap - read shapefile given in map projection coordinates -

i trying read shapefile of san francisco police departments ( https://data.sfgov.org/public-safety/sfpd-districts-zipped-shapefile-format-/8yyx-6uur ) via basemap . when use basemap.readshapefile method, error shapefile must have lat/lon vertices - looks 1 has vertices in map projection coordinates. can convert shapefile geographic coordinates using shpproj utility shapelib tools (http://shapelib.maptools.org/shapelib-tools.html) is there way read or convert map projection coordinates in python (since dont want use c-library given in error)?

javascript - How to handle results of multiple async callbacks in Node -

i'm working on scenario in node involves multiple async.map calls, 1 of nested in _.map function need access nested arrays. i'm struggling combine results of these calls array return in end. more specifics on scenario: i start userid , query games db find games userid associated with. pull gameid , description each game. i query gameid of each of these games find userid s associated each game. filter original userid out of these results. next query users db each of these userid s in order details such user email , name . (note: _.map comes play userid s nested in array of arrays; each inner array representing game). the last step, , i'm struggling, how combine these results , return them. final desired array looks below. array of game objects. each game object has gameid , description , , users property. users array of users associated game , has id , email , , name properties. [ { gameid: 'dfh48643hdgf', description: 'lore

frequency - sas how to do frequencies for only certain values -

i have survey data possible responses, example be: q1 person1 yes person2 no person3 missing person4 multiple marks person5 yes i need calculate frequencies question, yes/no (other questions have varied responses such frequently, frequently, etc) counted in totals - not ones multiple marks. there way exclude these using proc freq or method? outcome: yes: 2 no: 1 total: 3 using proc freq, i'd this: proc freq data=have (where=(q1 in ("yes", "no"))); tables q1 / out=want; run; output: q1 count percent no 1 33.333333333 yes 2 66.666666667 proc sql: proc sql; select sum(case when q1 eq "yes" 1 else 0 end) yes ,sum(case when q1 eq "no" 1 else 0 end) no ,count(q1) total have q1 in ("yes", "no"); quit; output: yes no total 2 1 3

ios - Debugging Core Data __NSCFSet addObject nil exception -

i'm getting exceptions thrown during unit tests, on core data thread message: coredata: error: serious application error. exception caught during core data change processing. bug within observer of nsmanagedobjectcontextobjectsdidchangenotification. -[__nscfset addobject:]: attempt insert nil userinfo (null) *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[__nscfset addobject:]: attempt insert nil' *** first throw call stack: ( 0 corefoundation 0x00683a14 __exceptionpreprocess + 180 1 libobjc.a.dylib 0x02334e02 objc_exception_throw + 50 2 corefoundation 0x0068393d +[nsexception raise:format:] + 141 3 corefoundation 0x005595b9 -[__nscfset addobject:] + 185 4 coredata 0x001d47c0 -[nsmanagedobjectcontext(_nsinternalchangeprocessing) _processpendinginsertions:withdeletions:withupdate

java - Android write text file to internal storage -

using emulator able write text file /data/local when use device, same path /data/local permission denied. tell me path of internal storage read-write , can write file there. better if achieve without rooting device. android apps isolated 1 another, app has dedicated folder in internal storage read/write it. you can access via file path = environment.getdatadirectory(); as vary between devices. outside app (e.g. shell, or file explorer) can't read private data folders of apps, need rooted device (as emulator) it. if want file world-readable, put in external storage.

java - Search in listview using edittext -

i need search item in listview.i have easy array of string , array adapter,put code wich find @ different questions , work!but have 1 problem,this search slow , lags 1 letter.i have word "arbuz"(one many others) , print a-nothing,some letter-and words search "a",another-and no words this.i hope unterstand me.how can improve search? code: public class fragmentwithlist extends listfragment { listview mainlist; edittext inputsearch; public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view v = inflater.inflate(r.layout.fragment_with_list, null); mainlist = (listview) v.findviewbyid(android.r.id.list); inputsearch = (edittext)v.findviewbyid(r.id.inputsearch); return v; } public void oncreate(bundle savedinstancestate){ sethasoptionsmenu(true); super.oncreate(savedinstancestate); } public void onactivitycreated(bundle savedinstancestate) {

html - Styling <form> tag -

Image
i familiar html/css not advanced means. i having difficulty styling form element. i want add padding around form whenever pads top , left the other issue when re-size window small form tag seems protrude out of i know proper way is. also, if on simple code , let me know if there better/more standard way trying here. * { box-sizing: border-box; font-size: 15px; margin: 0; } body { padding: 5%; } section { height: 100%; float: left; position: relative; } div {} .left-section { width: 25%; } .right-section { width: 75%; } .body-left { background-color: #000000; height: 93%; } .body-right { background-color: #dcdcdc; height: 86%; } .header { background-color: #808080; height: 7%; } .footer { background-color: #808080; height: 7%; width: 100%; position: absolute; padding: 5px; } form { position: absolute; height: 100%; width: 100%; display: block; } input { background-colo

procedural generation - How do the permutation and gradient tables of Perlin and Simplex Noise work in practice? -

so have been doing bit of research how perlin , simplex noise work and, while core principles of regular perlin noise i'm little bit confused how permutation , gradient tables work. from understanding, provide better performance seeded random number generator tables of pre-computed values nicely indexed quick access. what don't entirely though how work practically. i've seen permutation table implemented array of shuffled values 0-255 so: permutation[] = { 151,160,137,91,90,15, 131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23, 190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33, 88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166, 77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244, 102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196, 135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123, 5,202,38,147,118,126,255,82,85,21

syntax - matrix manipulation SciLab -

i heard there way change matrix values without using loop. example: a = [1 2; 3 4] there suppose way can make values example less 4 , changed them other value, let's zero. this: a(...<4...)=0 and answer should be: ans = 0. 0. 0. 4. anyone know syntax this? you don't need use find this; can use indexing instead : a(a>=4) = 0;

Python : How can I access Lotus Notes 8.5 Inbox to read emails -

i want make script in python reads mails lotus notes 8.5 , create each email issue in jira returns me error when try read mails lotus: traceback (most recent call last): file "from_lotus_to_jira.py", line 46, in <module> main() file "from_lotus_to_jira.py", line 39, in main folder = notesdatabase.getview('$inbox') file "c:\python27\lib\site-packages\win32com\gen_py\29131520-2eed-1069-bf5d-00 dd011186b7x0x1x2.py", line 1849, in getview ret = self._oleobj_.invoketypes(1610743866, lcid, 1, (9, 0), ((8, 1),),pname pywintypes.com_error: (-2147352567, 'exception occurred.', (0, u'notesdatabase', u'database server_name!!c:\\users\\myname\\appdata\\local\\lotus\\notes\\data\\ma il202\\myname.nsf has not been opened yet', none, 0, -2147217441), none) here .py file import win32com.client import pywintypes import getpass def main(): # credentials mailserver = 'server_name' mailpath = 'c:\user

python - Extract topic keywords from text -

i'm trying extract list of ingredients cooking recipe. made list of many ingredients in file, check these ingredients against recipe. code looks this: ingredients = ['sugar', 'flour', 'apple'] found = [] recipe = ''' 1 teaspoon of sugar 2 tablespoons of flour. 3 apples ''' ingredient in ingredients: if ingredient in recipe: found.append(ingredient) i'm looking more efficient way because list of possible ingredients can big. ideas? you split input , use sets: ingredients = set(['sugar', 'flour', 'apple']) recipe_elements = set([i.strip() in recipe.split(' ')]) used_ingredients = ingredients & recipe_elements # intersection you may need various clean ups on input depending on though. you'd need benchmark see whether better though, , wouldn't match 'apple' user entered 'apples' in example without work (make singular example).

what does this statement mean for expect or for bash? -

exploring expect page 219 : #!/bin/bash set kludge { ${1+"$@"} shift shift exec expect -f $0 ${1+"$@"} } # rest of script follows i able execute expect script within bash interpreter,even can pass command line arguments like: ./scriptname arg1 arg2 arg3 , on when tried sh -x ./scriptname arg1 arg2 arg3 threw error. please clarify above statements , put expect scripts inside bash looking @ expect first, it's pretty simple. set command, when given 2 arguments, sets value of variable. here, variable name kludge , value multi-line string between {braces} . note in tcl (and expect) braces suppress expansion (variable substitution, command expansion, etc), in same way single quotes act in shell. assuming variable kludge never used, innocuous statement. a bit trickier shell. shell's set command in context set positional parameters. after command: $1 = "kludge" $2 = "{" $3, $4, ... <= original command line parameter

c# - WpfAninatedGif NuGet package event usage with MVVM -

i've encountered problem events using wpfanimatedgif nuget package. package has 2 additional events <image> i'm unable use them mvvm pattern. i've tried interactivity: <window xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:gif="http://wpfanimatedgif.codeplex.com"> <image gif:imagebehavior.animatedsource="animation.gif"> <i:interaction.triggers> <i:eventtrigger eventname="animationcompleted"> <i:invokecommandaction command="{binding somecommand}"/> </i:eventtrigger> </i:interaction.triggers> </image> </window> but fails, command doesn't called. i've messed around bit , got kinda working (not realy). if leave eventtrigger 's eventname unspecified command called on animationloaded event only: <i:eventtrigger> <i:invokecommandaction

javascript - Keep default value and pass it on -

i have following piece of code grab value of drop down list. problem have due onchange event attribute first value not passed if user not select option. there way can define when there no change first value passed on? <!doctype html> <html> <head> <meta charset="utf-8"> <title>demo getselectoptiondata</title> <select name="myselect" id="myselect" onchange="getselectedvalue();"> <option value="aaaaaaaaa.xml">text 1</option> <option value="bbbbbbbbb.xml">text 2</option> </select> <form action="test"> value1: <input id="myfield" type="text" value=""><br> <input type="submit" value="submit"> </form> <script type="text/javascript"> function getselectedvalue() { var value = document.getelementbyid('myselect').valu

c# - Nancy create singleton with constructor parameters -

i'm using nancy tinyioc solve dependencies. one dependency in particular needs application-lifecycle singleton. if default constructor works: container.register<ifoo, foo>().assingleton(); // works but if try arguments on contructor not: container.register<ifoo>((c, e) => new foo("value", c.resolve<ilogger>())).assingleton(); // fails error "cannot convert current registration of nancy.tinyioc.tinyioccontainer+delegatefactory singleton" whithout .assingleton() , works again, don't singleton: container.register<ifoo>((c, e) => new foo("value", c.resolve<ilogger>())); // works, foo not singleton any ideas? think mistake should obvious can't find it. i've used google-foo. edit the code runs here: public class bootstrapper : defaultnancybootstrapper { protected override void configureapplicationcontainer(tinyioccontainer container) { base.configureapplicationconta

Php redis extended interger overflow -

why? guess overflow,but can't fix it. <?php /*redis*/ $redis = new redis(); $redis->connect('127.0.0.1'); $res = $redis->eval('return 32140378*16777216'); var_dump($res); exit; //result:1509949440 //right:539226064027648 i have repaired myself, more details: https://github.com/phpredis/phpredis/pull/721

uitextinput - My textinput in react native blurs directly after focus -

Image
i have 2 forms in react-native. 1 of works perfectly, other (in component) has bug. textinput s in form keep blurring when getting focus. the video made (see gif below) shows whenever click in input gets focus , blurs right after it. the code input (now debugs): <textinput value={group.name} bluronsubmit={false} onblur={() => console.log('i blur')} onfocus={() => console.log('i focus')} autofocus={true} style={styles.textinput} /> i found answer... , confused why answer, here go: apparently when render textinput inside of tabbarios component , set selected={true} on tab make impossible type textinputs. have no idea why. had on true in order not have click on tab every time while building views. guess set default differently :)

php - I get NULL retrieving JSON from especific website -

i want retrieve json data here : { "input_address": "1bee32k9fxvrnbneukwdym26vz4gsggqzg", "callback_url": "http://example.com", "fee_percent": 1.5, "destination": "12za1i1zhytcehwbg8yjb72beegqveumdt" } ... if put on browser you'll see json data correctly formatted. no problem there. however, when try retrieve data php using standard script: <?php $url = 'https://blockchain.info/api/receive?method=create&format=plain&anonymous=true&address=12za1i1zhytcehwbg8yjb72beegqveumdt&callback=http%3a%2f%2fexample.com'; $json = file_get_contents($url); $data = json_decode($json); var_dump($data); echo 'url: '.$url; ?> ... no data; var_dump writes "null" (you can test previous code @ http://bitstamina.com/theamazinghat/thehat.php ). , yet, if try other url returns json data code works perfectly. what doing wrong? must either stupid mistake on pa

javascript - Ramda Js: Setting property on an object using a value from the same object -

using ramda js, need create function can set 1 object property using value of different property on same object. attempt far follows: var foo = r.set(r.lensprop('bar'), 'foo' + r.prop('foo')); var result = foo({foo:"bar"}); desired result: {foo:"bar", bar:"foobar"} actual result: {foo:"bar", bar: "foofunction f1(a) {... etc"} clearly i'm misunderstanding here, , insights how approach appreciated. lenses not fit when value of 1 property depends on value of property. lambda best here: const foo = o => r.assoc('bar', 'foo' + o.foo, o); foo({foo: 'bar'}); // => {foo: 'bar', bar: 'foobar'}

java - Why doesn't this if statement work properly? -

i'm trying remove in array have has more 7 letters , less 5. the program runs doesn't remove words have more 7 letters , less 5 letters. i have used iterator read array, seems ignores if statement iterator<string> = muligeord.iterator(); while (it.hasnext()) { if(it.next().length()<=5 && it.next().length()>=7){ it.remove(); } } okay, have 2 major issues in 1 line if(it.next().length()<=5 && it.next().length()>=7){ .next() move curser, since using && , if length of object <= 5, next call move curser next object in collection; not want. if is not want, , want chacking same object, how can length both >7 , <5 @ same time? try using this, move curser once , object, change && || , remove not 6 characters in length. string = it.next(); if( something.length() <= 5 || something.length() >= 7 ) { it.remove(); } in post the program runs doesn't remove words have

c# - Cant get Async (async await) download of JSON to work -

i've been struggling while now, can't work. i'm trying download json string windows phone 8 application, using 'sort of' async await. i'm using the promising solution of matthias shapiro . httpextensions.cs public static class httpextensions { public static task<stream> getrequeststreamasync(this httpwebrequest request) { var taskcomplete = new taskcompletionsource<stream>(); request.begingetrequeststream(ar => { stream requeststream = request.endgetrequeststream(ar); taskcomplete.trysetresult(requeststream); }, request); return taskcomplete.task; } public static task<httpwebresponse> getresponseasync(this httpwebrequest request) { var taskcomplete = new taskcompletionsource<httpwebresponse>(); request.begingetresponse(asyncresponse => { try { httpwebrequest responserequest

ios - Best way to implement push notifications with Firebase -

i iphone app coder, , i'm using firebase backend server. firebase doesn't support push notifications, i've been trying figure out how include them in app. i've read question: how send alert message special online user firebase seems more of work-around actual solution. is there answer on how this? there third parties or apis might seemlessly implement functionality? one solution have tried use zapier connect firebase pushover. at point, i've been able observe events in app i'm coding , notifications in pushover app on iphone. however, ideally, i'd receive notifications in app, not in pushover app, because don't want users need have pushover in order use app , because want users receive own distinct notifications, not notifications everyone. does have suggestions on how should handle issue? thanks help! edit isn't duplicate of question: does firebase handle push notifications? because know firebase doesn't directly handle push n

elixir - Ecto inserted_at, how to get only part of the date? -

i starting lear elixir - phoenix, coming rails, , loving it. have problem date ecto: need display day auto-generated inserted_at. try achieve timex , timex_ecto plugin, no luck now. you can pattern match on result of ecto.datetime.to_erl/1 : iex(4)> {{_, _, day}, _} = ecto.datetime.to_erl(date) {{2016, 1, 5}, {16, 49, 19}} iex(5)> day 5 if want use timex, once have result in erlang datetime format ( {{y, m, d}, {h, m, s}} ) can use timex.date.from/1

seo - Using noodp meta tag in a robots.txt file -

is possible add seo tags such 'noodp' robots.txt file instead of using <meta> tags? trying avoid messing our cms template, although suspect may have to... could try similar this... user-agent: * disallow: /hidden sitemap: www.example.com noodp: i think robots.txt takes precedence on meta tags? noindex instance, crawler not see page in question. noodp however, still case? you can't robots.txt, can same effect using the x-robots-tag response header . add appropriate part of .htaccess file: header set x-robots-tag "noodp" this tells server include following line in response headers: x-robots-tag: noodp search engines (that support x-robots-tag) interpret header line same way interpret 'noodp' in robots meta tag. in general, can put in x-robots-tag header can put in robots meta tag. note page must not blocked robots.txt, otherwise crawler never request page, , therefore never see header.

java - Spring mvc http 400 error on submit -

whenever want save entity, throws error : http 400 error, "the request sent client syntactically incorrect." edit.jsp: <f:form action = "update.html" modelattribute="dolgozo"> <input type="hidden" name = "id" value="${d.dolgozoid}"> <label for="nev">név: </label> <input type="text" name = "nev" value="${d.nev}"> </br> <label for="szulido">születési idő: </label> <input type="date" name = "szulido" value="${d.szulido}"> </br> <label for="anyjaneve">anyja neve: </label> <input type="text" name = "anyjaneve" value="${d.anyjaneve}"> </br> <label for="telefonszam,">telefonszám: </label> <inpu

Nested $and or grouped $and in MongoDB -

consider following document: { "_id" : objectid("5130f9a677e23b11503fee55"), "itemtype" : "bicycle" "attributes" : [{ "attributename" : "spare tire", "attributevalue" : "1" }, { "attributename" : "with helmet?", "attributevalue" : "0" }, { "attributename" : "number of locks", "attributevalue" : "1" }] } how write query bicycles spare tire , no helmet ? i tried following doesn't give me want. { "$and" : [ { "itemtype" : "bicycle" }, { "$and": [{ "attributes.attributename" : "with helmet?" }, { "attributes.attributevalue" : "0" } ]}, { "$and": [{ "attributes.attributename" : "

Automatically scaling game graphics to maintain at least 60 fps -

i have noticed several graphics settings in games rely on restart of game take effect, having said, technically possible make game read computers specs , automatically , dynamically scale games graphics settings live, game maintains @ least example 60 fps. i'm thinking of games mmo:s might fps drops if there more people running around. no first of all: reading hardware not enough, programs interfere (use cpus) then, when know (and able predict) cpu usage, there little cpu time left 60 fps not within reach

Static variable in class java -

i want ask if static variable in class add memory the initialized class. lets have class this: public class sample{ public static string name[] = {"1", "2", "3", "4"}; private int id; private string uuid; private string name; public void setuuidstring() { uuid uuid = uuid.randomuuid(); this.uuid = uuid.tostring(); } public void setname(string name) { this.name = name; } public void setcustomuuid(string uuid) { this.uuid = uuid; } public void setid(int id) { this.id = id; } public int getid() { return id; } public string getuuid() { return uuid; } public string getname() { return name; } } and create sample class multiple times initializing , adding array of sample class static variable adds memory the class or only 1 memory location when static? since static variables initialized @ s

ArrayList IndexOutOfBoundException JSP -

i taking 12 records database , storing in resultset since cannot fetch each element resultset whereever want. using arraylist store resultset data , using arraylist.get() method retrieve each element. but problem data coming database can less 12 records have accessed arraylist.get(12) throws indexoutofboundexception. want check whether array.get(12)th element out of bound or not before printing value of it. i have tried if(arraylist.get(12)!=null) doesn't work because again trying access 12th record not exist in arraylist. if list contains 12 items , want last one, have use .get(11) , since lists, arrays, sets, etc., 0-based indexed in java. on other hand, if want first one, have use .get(0) instead of .get(1) (which returns second one).

angularjs - Why is my custom filter predicate filter not working -

i have use case wherein have filter array based on selection 2 dropdowns. both selections md-select (from angular material) hence both selection array. record original array matches of record selection arrays should returned filter. i have returned following logic, can't figure out why data not filtered. $scope.filtertasks = function (t, i, array) { if ($scope.filter.tradedir.length === 0 && $scope.filter.cluster.length === 0) { return true; } else if ($scope.filter.tradedir.length !== 0 && $scope.filter.cluster.length === 0) { $scope.filter.tradedir.foreach(function (td) { if ((t.trade.code === td.trade.code) && (t.direction.code === td.direction.code)) { return true; } }); } else if ($scope.filter.cluster.length !== 0 && $scope.filter.tradedir.length !== 0) { $scope.filter.tradedir.foreach(function (td) { if ((t.trade.code === td.trade.code) && (t.direction.code === td.direction.code

c# - How do I prevent the creation of multiple background processes working on the same request? -

i have simple webapi controller method that's purpose trigger background processing , return 202 accepted response (without having completed background processing consistent 202 response.) public async task<ihttpactionresult> dosomething(string id) { hostingenvironment.queuebackgroundworkitem(async ct => { //do work } return responsemessage(new httpresponsemessage(httpstatuscode.accepted)); } however, want able prevent multiple requests same endpoint same id triggering multiple instances of same background processing simultaneously. effectively, if 2 requests same id's made @ same time (or near enough), first 1 processing id , second 1 able identify , take action accordingly , not duplicate work that's being done. i'd avoid databases/persistent storage if @ possible , i'm aware of risks of running async tasks within iis worker process - sake of argument, background processing not critical. how can go doing this? appreci

java - how to distinguish between a checkbox field and a group of radio buttons -

when retrieve pdf field name using pdfbox pdfield field = acroform.getfield('my_field'); i can't determine whether field single checkbox or group of radio buttons neither type of field nor field.getfieldtype() , because same in both cases. i this boolean ischeckbox = field.getwidgets().size() == 1; but not entirely reliable either, because radio group could contain 1 button. instanceof can used determine type of field. if it's checkbox, type pdcheckbox . if field group of radio buttons type should pdradiocollection . code below trick on pdfbox version 1.8.10. appears class structure acroforms has changes on pdfbox 2.0.0. if(field instanceof pdcheckbox){ type="checkbox"; }else if(field instanceof pdradiocollection){ type="radio"; } for version 2.0.0, according api documentation found here , pdbutton superclass of pdcheckbox , pdradiobutton . change code above, checking field instanceof pdcheckbox , field instan

regex - Parsing BBCode in Javascript -

i using ( http://coursesweb.net/javascript/convert-bbcode-html-javascript_cs ) script parsing bbcode. have extended bbcodes can process, encountering problem when newline follows opening tag, e.g. [code] code.... [/code] the problem not occur if code 'inline' [code]code.... [/code]` the regex being used match what's inside these tags (.*?) know not match newlines. have tried ([^\r\n]) match newlines hasn't worked either. i imagine it's simple issue have little experience regex appreciated edit: full list of regex's using var tokens = { 'url' : '((?:(?:[a-z][a-z\\d+\\-.]*:\\/{2}(?:(?:[a-z0-9\\-._~\\!$&\'*+,;=:@|]+|%[\\da-f]{2})+|[0-9.]+|\\[[a-z0-9.]+:[a-z0-9.]+:[a-z0-9.:]+\\])(?::\\d*)?(?:\\/(?:[a-z0-9\\-._~\\!$&\'*+,;=:@|]+|%[\\da-f]{2})*)*(?:\\?(?:[a-z0-9\\-._~\\!$&\'*+,;=:@\\/?|]+|%[\\da-f]{2})*)?(?:#(?:[a-z0-9\\-._~\\!$&\'*+,;=:@\\/?|]+|%[\\da-f]{2})*)?)|(?:www\\.(?:[a-z0-9\\-._~\\

Maven Transitive Dependency causing NoClassDefFound error -

i getting noclassdeffounderror while trying load class seems due dependency version conflict. project -> project b -> project c. we have included version 2.0 project c within project a. whereas project b needs version 1.0 project c. right when project b code tries load class project c, gets version 2.0. is there way, can explicitly define refer project c (version 1.0 ) if project b tries , in other cases should pick version 2.0 i mean way can exclude transitive dependency, there way explicitly define inclusion ( reference respective project , not whole application code ). thanks. i doubt that. if understand question correctly, build result in loading jar of project c in 2 different versions simultaneously jvm (one project b , 1 project a). share same packages , class names, there no way jvm distinguish them. if project c own project , change version 1.0 2.0 breaks something, think using new package name, org.example.c2 instead of org.example.c (lik