Posts

Showing posts from February, 2015

reactjs - react css animation when component mounts -

here's fiddle of want do: https://jsfiddle.net/s7s07chm/7/ but want react instead of jquery. basically, put classname of element in state, , on componentdidmount update classname initiate transition. but isn't working. component rendering transitioned state. in other words, instead of sliding down, appears @ bottom beginning am doing wrong? if so, there way accomplish this? here's actual code getinitialstate: function() { return { childclass: 'child' }; }, componentdidmount: function() { this.setstate({ childclass: 'child low' }); }, the reason won't work because dom won't updated until component mounted. class you're assigning getinitialstate never appear in dom, 1 set componentdidmount will. ray mentioned, should take @ reactcsstransitiongroup.

List jenkins plugins and dependencides (with graph) -

i have added many plugins jenkins. how can list plugins , dependencies ? plugins depend on 1 ? 1 orphan, etc. ideally, explain how make graph (graphviz/dot...) ? copy-paste groovy snippet list of plugins (this snippet based on this exemple zendesk.com ): note: groovy must pasted in _manage jenkins >> script console def plugins = jenkins.model.jenkins.instance.getpluginmanager().getplugins() plugins.each { println "${it.getshortname()} (${it.getversion()}) => ${it.getdependencies()}" } to produce graph, execute snippet generate dot graph (graphviz) file... def plugins = jenkins.model.jenkins.instance.getpluginmanager().getplugins() println "digraph test {" plugins.each { def plugin = it.getshortname() println "\"${plugin}\";" def deps = it.getdependencies() deps.each { def s = it.shortname println "\"${plugin}\" -> \"${s}\";" } } println "}

haskell - Prefix lenses for a type -

i have following data declared: data = { self :: string , id :: string , description :: maybe string , name :: string } deriving (generic, show) instance fromjson makelensesfor [ ("self", "somethingself") , ("id", "somethingid") , ("description", "somethingdescription") , ("name", "somethingname") ] ''something is possible automate lenses creation naming convention following simple rules. after peek @ source code, can see there's lensrules instance, called abbreviatedfields, but, sadly, using makelenseswith abbreviatedfields ''something generates no lenses @ all. doing wrong? here's source code: https://hackage.haskell.org/package/lens-4.14/docs/src/control.lens.th.html#abbreviatedfields

spring-cloud-stream producer transactionality -

i've done little testing kafka binder , appears spring-cloud-stream producers don't participate in spring-managed transactions. given code @requestmapping(method = requestmethod.post) @transactional public customer insertcustomer(@requestbody customer customer) { customerdao.insertcustomer(customer); source.output().send(messagebuilder.withpayload(customereventhelper.createsaveevent(customer)).build()); if (true) { throw new runtimeexception("rollback test"); } return customer; } the customerdao.insertcustomer call rolled back, kafka message still sent. if have consumer on customer event inserts customer data warehouse, data warehouse , system of record out of synch on transation rollback. there way make kafka binder transactional here? the kafka binder not transactional, , kafka not support transactions in general. we intend address transaction management spring cloud stream 1.1: htt

sql - How can I call a function in another CFC file from within a query of a function in one cfc file? -

i have 1 cfc file (info.cfc) multiple functions shown below. <cfcomponent output="true" extends="datefunctions"> <cffunction name="getstatuses" access="remote" returntype="any" output="true" returnformat="plain"> ... </cffunction> <cffunction name="viewdate" access="remote" returntype="any" output="true" returnformat="plain"> <cfquery name="records"> select dbo.tickets.incident, dbo.tickets.start_date, dbo.tickets.days_due dbo.tickets </cfquery> </cffunction> </component> and other cfc file (datefunctions.cfc) containing function 2 arguments , returning date. datefunctions.cfc file follows: <cfcomponent output="true" name="datefunctions"&qu

How to apply a text file with multiple variables to the batch console -

okay have batch program writes character's stats txt file when save game. unable load stats properly. thought maybe if saved them console commands , syntax use type command , run commands setting variables on console ones in txt file. there simple way writing of variables txt file reverse? sample code of variables being written: if not exist "%~dp0\users" md "users" ( echo set charname=%usercharacter% echo set level=%level% echo set health=%health% echo set expcap=%expcap% )> "%~dp0\users\%usercharacter%.txt" see wrote text file thinking load file , set variables file had. didn't work. if have questions ask. can't post pictures right think got point across. you're close. instead of type , run text file through loop. for /f "usebackq delims=" %%a in ("%~dp0\users\%usercharacter%.txt") %%a the set commands have automatically run. how works for /f loop takes in command, file, or string (in c

delphi - concurrency between OS processes -

this question has answer here: how ensure single instance of application runs? 2 answers the problem over-complicated. straightforward solution redesign uwe , david suggested: (1) worker app. (2) long-running tcpserver, awaits clients , calls workers (3) clients. ======================== i build sampleapp functions as: when started, checks if there sampleapp running; if not, starts tcpserver , tcpclient , passes command tcpclient tcpserver , work, closes tcpserver , , quits; if yes, starts tcpclient , passes command other's tcpserver , quits. (the other's tcpserver work.) there may multiple sampleapp started when first 1 still running. i have no idea how solve problem practically, example : which architecture start ? ( reputed omnithreadlibrary seems deal thread-based concurrency instead of os-process-based concurrency. ) there no s

python - Access class hierarchy attribute -

given class named datastream class datastream(object): def __init__(self): self.start = start self.input_val = input_val and class named indatastream : class indatastream(datastream): def __init__(self): super( indatastream, self).__init__() self.ready = ready stream = indatastream() i want send datastream part of stream function, like: function(stream.datastream) is there nice way task? if you're looking access instance of datastream instance of class indatastream , may consider using composition instead of inheritance: class indatastream(object): def __init__(self): self.ready = ready self.datastream = datastream() then can do: stream = indatastream() function(stream.datastream)

arrays - How does object[[["key"]]] evaluate to object["key"] in javascript? -

this question has answer here: why accessing element in object using array key work? 3 answers why javascript evaluate following true, given object foo has valid property bar ? foo[[[["bar"]]]] === foo["bar"] based on operator precedence, think foo[[[["bar"]]]] trying access property array [[["bar"]]] key, why still "flatten down" same foo["bar"] ? colleagues of mine saying javascript parsers have bracket simplifying ignores brackets. don't think true since saving [[["foo"]]] variable test gives same result: > test = [[["bar"]]] [array[1]] > foo["bar"] = 5 5 > foo[test] 5 what aspect of language or parser causing behavior? thanks! javascript bracket notation accepts expression, converts value of expression string. if pass in array, attemp

android - Firebase Offline Capabilities and addListenerForSingleValueEvent -

whenever use addlistenerforsinglevalueevent setpersistenceenabled(true) , manage local offline copy of datasnapshot , not updated datasnapshot server. however, if use addvalueeventlistener setpersistenceenabled(true) , can latest copy of datasnapshot server. is normal addlistenerforsinglevalueevent searches datasnapshot locally (offline) , removes listener after retrieving datasnapshot once (either offline or online)? how persistence works the firebase client keeps copy of data you're actively listening in memory. once last listener disconnects, data flushed memory. if enable disk persistence in firebase android application with: firebase.getdefaultconfig().setpersistenceenabled(true); the firebase client keep local copy (on disk) of data app has listened to. what happens when attach listener say have following valueeventlistener : valueeventlistener listener = new valueeventlistener() { @override public void ondatachange(datasnapsh

wix - Programmatically disable Windows online search for device drivers for one install -

i need find way programmatically prevent windows searching web new driver usb device when plugged in after have installed correct device driver it. i acknowledge question has been asked , answered before . answer accepted in case has reconfiguring machine’s group policy settings. modern, ms-official version of accepted answer can found here . not solve problem. don’t want reconfigure customer machines, if let us, not. i thought might have found answer on a related ms page modifying devicepath registry key . indicates windows search additional folder (that specify) device driver before going out web if can change registry key. read note-of-doom: if enabled, windows update driver search performed after devicepath search, , occurs if matching driver package found in devicepath specified folder. after enabled searches completed, windows ranks each package determine best match device. in other words, appears win7 assumes know best though not case . on other hand, o

git - How to prevent checked-in files from overwriting local versions? -

i have platform specific modifications checked-in files. how force git keep local version , ignore remote 1 when merge remote branch? basically, git-ignore, files tracked repository. the use-case i'm pushing 1 branch, , pulling branch on different platforms testing. doing testing first time on each platform required running ./configure script modified files platform-specific customizations. since changes automatically generated, don't want commit them history. add files .gitignore, however, of files part of original repository, git ignore ignored. this possibly duplicate of git pull keeping local changes first answer there in particular seems best solution if platform-specific changes aren't committed.

python - iterate through a dictionary that has a list within lists -

i'm trying figure out way match value in nested list in dictionary. let's have structure; dict2 = {'key1': [ 2, ['value1', 3], ['value2', 4] ], 'key2' : [1, ['value1', 2], ['value2', 5] ], 'key3' : [7, ['value1', 6], ['value2', 2], ['value3', 3] ] } now let's key1, want iterate through first value of lists data match. if data "value2" , want in key1, want skip '2' , check first object in 2 lists are; value1, value2 match , that's it. tried doing gave keyerror: 1; if 'value1' in dict2[1][1:]: print 'true' else: print 'false' is possible do? there way match search? thanks. the code in question using numeric index instead of string 'key1'. here's modified version should work: if 'value1' in {array[0] array in dict2.get('key1', [])[1:]}: print 'true' else: print 'false'

GridLayout ,android:layout_columnWeight,android:layout_rowWeight is only used in API 21 current mine is 16 -

so i'm using gridlayout in witch have multiple image view complete view <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:custom="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/bg" android:orientation="vertical"> <include layout="@layout/dashboard_action_bar" /> <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <gridlayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="center_hori

excel vba use command if -

i have 2 excel files (file 1 sheet 1 , file 2 sheet 2). both have inside, in column names (for example in a1: "a", in a2: "b" etc etc), in column b values of relative lenghts (for example in b1: "2", in b2: "3" etc etc) orders of things in 2 sheets different; so, want say: "if name in cell in column of sheet 1 same of name in cell in column of sheet 2, compare relative values in column b , write true in column c of 1 of sheet (if values identical) or false" possible? me, please? in advance if sheet1 has a 5 b 6 c 7 d 8 and sheet2 has c 3 d 8 5 then can type =iferror(if(b1=indirect("sheet2!b"&match(a1,sheet2!a$1:a$4,0)),"match found",""),"") into cell c1 of sheet1 , drag fill handle down , get match found match found in column c of sheet1. no vba needed. :) note: since second sheet in separate file, you'll want change sheet2 [file2.xl

javascript - Create just one object from an array of objects, to be used in a redux reducer -

i have array of objects like [ {id: example1, count: 2}, {id: example2, count:2} ] which turn object like { example1: { id: example1, count: 2}, example2: { id: example2, count: 2}, } ...and on. this supposed used in redux reducer uses es6 if in there available or in lodash. answer: for clarity, ended doing @james-emanon suggested in answer. of course matter of using reduce. case actiontypes.fetch_snapshots_success: let snapshots = action.payload.reduce((p, c) => object.assign({}, p, { [c.id]: c } ), {} ) return object.assign({}, state, { isfetching: false, lastupdated: action.meta.receivedat }, snapshots ) how this? (using es6 conventions) // assuming action pass object var = [ {id: 'example1', count: 2}, {id: 'example2', count:2} ] // snippet r

r - Weighted Least Squares with constraints on coefficients using quadprog -

i'm having difficulties using r's quadprog library implement weighted least squares 2 restrictions. first restriction coefficients need greater or equal 0. second restriction coefficients need sum 1. more formally, trying minimize respect w following equation: (y - xw)^t * v * (y - xw), v diagonal matrix. y (p x 1), x (p x s), w (s x 1), , v diagonal (pxp). below reproducible example: trying find proper parameters use quadprog::solve.qp library(quadprog) set.seed(1) y = rnorm(100) x = matrix(nrow = 100, ncol = 3) (i in 1:ncol(x)) { x[,i]<- rnorm(100, mean = i) } v_vec = rnorm(ncol(x)) v = diag(v_vec)

python - pip not working Windows -

Image
pip not working on windows giving me empty output using pip install virtualenv when try , use virtualenv virtualenv not recognized internal or external command, operable program or batch file. i've added both c:[pythonroute]\python35-32 , c:[pythonroute]\python35-32\scripts enviroment variables the cmd command python works maybe try use following command if can run python via cmd. python -m pip install virtualenv

csv - Grab array components from string created from text file using Swift 2.0 -

Image
i have text file in following format (abbreviated below): title";"seriesid";"channelname title1";"00000001";"channel1 title2";"00000002";"channel2 title3";"00000003";"channel3 ... title99999999";"99999999";"channel99999999 i have loaded text file resource in xcode 7 , parsing follows: class tvseriestableviewcontroller: uitableviewcontroller { var seriesdict = [string:string]() var seriesarray = nsmutablearray() override func viewdidload() { super.viewdidload() let path = nsbundle.mainbundle().pathforresource("series", oftype: "txt") let filemgr = nsfilemanager.defaultmanager() if filemgr.fileexistsatpath(path!) { { let fulltext = try string(contentsoffile: path!, encoding: nsutf8stringencoding) let readings = fulltext.componentsseparatedbystring("\n") [st

java okhttp adding headers using for loop dynamically -

many examples showed adding header should: request request = new request.builder() .url("https://api.github.com/repos/square/okhttp/issues") .header("user-agent", "okhttp headers.java") .addheader("accept", "application/json; q=0.5") .addheader("accept", "application/vnd.github.v3+json") .build(); but want dynamically add headers user's header requirements, how can implement it? headers h = new headers.builder().build(); (httpheader hh : ht.httprequestheader) { h.newbuilder().add(hh.name, hh.value); } //<<---nothing changed!!!!! headers.builder builder = new headers.builder(); (httpheader hh : ht.httprequestheader) { builder.add(hh.name, hh.value); } headers h = builder.build();

Confused about the million ways to reach inside Ruby Hash with the symbol sign -

i drowning in million ways access hash. condition1 = { "e" =>1 } condition2 = { "e":1 } condition3 = { :"e" =>3 } condition4 = { e:4 } condition5 = { # 100% sure not working because of syntax error e=>5 } condition6 = { # 100% sure not working because of syntax error :e:6 } condition7 = { :e=>7 } puts condition1["e"] puts condition2["e"] puts condition3[:e] puts condition4[:e] puts condition7[:e] output : 1 (nothing) 3 4 7 first question: first 2 puts statement, why working first 1 not second one? in both hashes, using strings keys. because used "=>" in first hash , string being read symbols? being processed :"e" =>1? second question: leads second question third condition , told if used symbol sign before quote, happens in background quote ignored. that's why able access through :e without quotes. true

go - Printing all values of a struct with mixed values? -

is there way of printing struct mixed value types, including pointer types, such value shown? example: package main import ( "fmt" ) type test struct { str string ptr *string } func main() { s := "some string" p := &s t := test{ str: s, ptr: p, } fmt.printf("%#v\n", t) } i want like: main.test{str:"some string", ptr:(*string)("some string"} instead of: main.test{str:"some string", ptr:(*string)(0x1040a120)} https://play.golang.org/p/ykzrpoeq_y there's no fmt verb use functionality. implement stringer on struct , have full control on how struct printed.

togetherjs with paperjs in react component -

i trying integrate togetherjs collaboration paperjs canvas. below code setting paperjs & togetherjs (added global object in window ) componentdidmount() { this.canvas = reactdom.finddomnode(this.refs.canvascontainer); this.paper = new paperjs.paperscope(); this.paper.setup(this.canvas); this.view = this.paper.view; this.tool = new this.paper.tool(); this.tool.mindistance = 5; this.tool.onmousedown = this.onmousedown; this.tool.onmousedrag = this.ondrag; this.tool.onmouseup = this.onmouseup; this.raster = new this.paper.raster({ source: null, position: this.view.center }); this.raster.scale(0.4); this.raster.size = this.paper.view.size; this.view.draw(); this.project = this.paper.project; this.drawinglayer = new this.paper.layer(); this.drawinglayer.activate(); } togetherjs events added below in constructor, window.togetherjs.hub.on('draw', this.collabdraw); window.togetherjs.hub.on(

Android java.lang.illegalargumentexception unable to find native library main -

i need help. struggling bug sometime. help. do let me know if need more information. i developing game custom android activities. created sample project , changed source code handle custom android activity. got compile , build app properly, when run it, error message. log cat has following error message: 6-08 14:15:37.548 14319 14319 w linker : /data/app/com.mytestcompany.puzzle-1/lib/arm/libue4.so: missing dt_soname use basename replacement: "libue4.so" 06-08 14:15:37.720 3751 6317 d audio_hw_primary: disable_audio_route: reset , update mixer path: low-latency-playback 06-08 14:15:37.721 3751 6317 d audio_hw_primary: disable_snd_device: snd_device(2: speaker) 06-08 14:15:37.734 3751 6317 d audio_hw_primary: disable_snd_device: snd_device(71: vi-feedback) 06-08 14:15:37.735 3751 6317 d audio_hw_primary: disable_audio_route: reset , update mixer path: spkr-vi-record 06-08 14:15:37.737 3751 6317 soundtrigger: audio_extn_sound_trigger_update_device_status: d

How to mix PHP with a string inside CodeIgniter function? -

i dynamically set id each iteration of radio button within loop. however have not been able figure out correct way of escaping strings , variables in id portion. quotes in portion failing parse. <?php echo form_radio($data['filename'], 0, '', 'class="uniform" id="'$data['ids']'"); ?> this uses form helpers codeigniter have layout . any idea how solve this? you must start double quotes expanded variables, escape nested ones backslash <?php echo form_radio($data['filename'], 0, '', "class=\"uniform\" id=\"$data[ids]\""); or use single quotes inside double <?php echo form_radio($data['filename'], 0, '', "class='uniform' id='$data[ids]'"); notice don't need quote single dimensional array indexes inside square braces if inside double quotes

ios - Preserving cookies in UIWebView? -

so have uiwebview in app, has php session inside it. under impression these cookies kept long user has app open. but whats happening user filling out form, locking phone while or switching in out , app. reason cookie missing , session gets reset , have restart. is there doing wrong? or there way save cookies after every page load, restore them every time user views app? if else stumbles across when trying fix themselves, opted fix using javascript on webpage. first include in base html file, or use php file put in every page on site:(since cant use php headers inside js file.) <script> function get_sid(){ return '<?php echo session_id(); ?>'; } function get_session_name(){ return '<?php echo session_name(); ?>'; } </script> then add code 1 of base js files: <script> function setcookie(cname, cvalue, exdays) { var d = new date(); d.settime(d.gettime() + (exdays*24*6

object literal - Javascript sub methods / namespacing with constructor functions -

i cannot thank enough time , help! i've searched 2 days , cannot find exact answer. begin: i've used object literal notation create objects. however, i've come across situation need create multiple instances of same object. believe i'm attempting create "constructor functions": i need have ability create multiple "window" objects: var window1 = new window(); var window2 = new window(); var window3 = new window(); i want ability able organize methods such: window1.errormessage.show(); window2.errormessage.hide(); window3.errormessage.hide(); instead of like: window1.showerrormessage(); window2.hideerrormessage(); window3.hideerrormessage(); an example of how build window object in literal notation: var window = { id: null, init : function(id) { this.id = id; }, errormessage : { show : function(message) { // jquery take id of window, // find errormessage html element with

What is the Meaning of "DEFAULT" in Mysql Datetime? -

in following mysql command seeing keyword default create table user ( id int(11) not null auto_increment, created_at datetime default null ) my question : why there default keyword if allowing datetime null is datetime syntax, should in default format. please explain me. found documentation page default in mysql. not understanding it. [n.b.: pardon me, if beginner question, or asked. did not find looking for.] why there default keyword if allowing datetime null you mistake null after default null allows column contain null values. read below difference. is datetime syntax, should in default format. the default keyword in create table statement doesn't tell format. specifies default value used column when insert statement doesn't provide value it. the complete definition of table column in create table statement contain following pieces, in order: field name; field type; null or not null - null valu

javascript - On load function checking for button controle -

i inherited vscript code create web service redirect button based on logged in user; if user not found button not created , error text displayed, asked set onload javascript function automatically click button-that did.i need check if button exists first before click it.what best way check if button exist onload in javascript? thnaks this should work fine: var button = document.getelementbyid("the button's id"); window.onload = function() { if (button != null) { // code } }

sql - Update column of one table from same table -

i need update 1 column of table other same table update table set table1.name = table1.nickname table userid = 5 is there problem in query, please help. looks you're adding syntax don't need...if data need there in table, so, regardless of flavor of sql (i think; wrong on part): update dbo.tablename set columntochange = columnwithcorrectvalue userid = 5

hadoop - Spark job with large text file in gzip format -

i'm running spark job taking way long time process input file. input file 6.8 gb in gzip format , contains 110 m lines of text. know it's in gzip format, it's not splittable , 1 executor used read file. as part of debug process, decided see how long take convert gzip file parquet. idea once convert parquet files , if run original spark job on file, in case use multiple executors , input file processed in parallel. but small job taking long time expected. here code: val input = sqlcontext.read.text("input.gz") input.write.parquet("s3n://temp-output/") when extracted file in laptop (16 gb ram), took less 2 minutes. when run on spark cluster, expectation take same or less time since executor memory using 58 gb. took ~20 minutes. what missing here? i'm sorry if sounds pretty amateur i'm new in spark. what's optimal way run spark job on gzip file? assume not have option create file in other file format (bzip2, snappy, lzo).

css - Why does computed style show more than one font-family? -

Image
i inspecting css on https://status.slack.com/ , noticed font in computed tab in chrome displaying font-family: lato, sans-serif . i have expected once computed, know font in effect. why computed tab show 2 fonts lato , sans-serif, instead of whichever 1 in effect? which font in effect? styles tab: computed tab: font-family uses first font defined. however, because fonts not available on client's computer, css allows many fonts clients "fallback" on. for example, font-family: arial, calibri, sans-serif; tells browser use arial if possible. if it's not available, use calibri. if both not available, use browser's default sans-serif font. if want force browser have font, can use @font-face .

linux - Manipulating a text file with grep -

ok, have text file formatted this, has several rows going down. example1:example2:example3 example1:example2:example3 example1:example2:example3 i want use grep change this example2:example3 basically want take out first part before : if please tell me how appreciated. you can use cut utility filter out columns given delimiter. in example, delimiter : , want every column starting second: $ cut -d: -f2- < input.txt

php - How to use Twitter API pagination for getting user tweets -

i fetching tweets of user. need show tweets ajax pagination. how can achieve that? https://api.twitter.com/1.1/statuses/user_timeline.json tried i using above link. heard max_id , since_id not know how use that. have tried max_id , since_id , collection repeating. not getting cursor response. my code $api_key = urlencode('*********'); // consumer key (api key) $api_secret = urlencode('***********'); // consumer secret (api secret) $auth_url = 'https://api.twitter.com/oauth2/token'; // want? $data_username = '********'; // username $data_count = 1; // number of tweets $data_url = 'https://api.twitter.com/1.1/statuses/user_timeline.json'; // api access token $api_credentials = base64_encode($api_key . ':' . $api_secret); $auth_headers = 'authorization: basic ' . $api_credentials . "\r\n" . 'content-type: application/x-www-form-urlencoded;charset=utf-8' . &q

string - Python str() : TypeError: 'str' object is not callable - the stop code -

this question has answer here: typeerror: 'str' object not callable (python) 7 answers code can run first time. after found mistake : typeerror: 'str' object not callable create : soup = beautifulsoup(r.content, "lxml") berat = soup.find_all("dd", {"class": "pull-left m-0 border-none"})[0].text var1 = str(berat) str = string.maketrans('us', '12') result = var1.translate(str) print (result) output error beka2 traceback (most recent call last): file "current.py", line 67, in <module> var1 = str(berat) typeerror: 'str' object not callable enough make me confused: want output : baru = bar1 bekas = beka2 i suspect run in python interactive console. in case problem due str variable, created when code run first time, hides built-in function str() intended ca

variables - Shared Preference Method Call From Activity to Java Class -

so i'm having issue context inside sharedpreferences says loginactivity.this. device.java class , loginactivity activity want call method from. device.this or along lines? methods: public void validatelogin(string username, string password, string ipaddress) { sharedpreferences sharedpreferences = preferencemanager.getdefaultsharedpreferences(loginactivity.this); if (sharedpreferences.contains("ip") && sharedpreferences.contains("username") && sharedpreferences.contains("password")) { string strusername = sharedpreferences.getstring("username", username); string strpassword = sharedpreferences.getstring("password", password); string stripaddress = sharedpreferences.getstring("ip", ipaddress); //performlogin(strusername, strpassword, stripaddress); } } public void savesp(string username, string password, string ipaddress) { sharedpreferences sharedp

ios - unexpectedly found nil while unwrapping an Optional value On UILabel -

in project have implemented protocol makes url call , return result, , intent show result in uilabel . following code : protocol restapiresult { func retrivedriverinfo() } class restapicall : restapiresult { func retrivedriverinfo() { self.dashboardviewcontroller.getdriverinfo(driverprofile) // calling function of next view lable setup } } getdriverinfo in nextview has outlet of textview class dashboardviewcontroller: uiviewcontroller { override func viewdidload() { super.viewdidload() restdeledate = restapicall() restdeledate!.retrivedriverinfo() // if label set here no error //totaltriplabel.text = "testing" // no error } func getdriverinfo(driverinfoarray : nsarray) { totaltriplabel.text = "testing" // here error } } if text set in viewdidload() doesn't crash. when tried set value in delegate function crash saying found null.

Common input data examples? -

i'm trying implement approximate memoization system. this kind of system create association between input data , result produced expensive computation. in way, if same or similiar input received again, don't need perform same computation again. in such system, it's important input data received assumes similar values. if doesn't happen, means system receives of times different , not similar values, , no association can present in system. consequence, in such scenario system useless. could please give me examples of such data, data not sparse or can clustered or related similarity function?

c# - Unity IOC and Factory pattern inside a large loop -

i want use factory pattern in application receive huge(500k) list , lets list,of objects , loop through it, 1 of property(seattype) decides class process list, if seat type premium handled different class , economy , on... class bus { public seattype type { get; set; } } since check on seat type , hence finding processor happening inside loop whats best way resolve/find instance of property has process bus? i know can group list seat type , process it, interested know if there better way without grouping , using loop. thanks in advance!!! edit: in case need processors @ 5th level, e.g. in loop calling classa.methoda , methoda calls classb.methodb , on till classe.methode. i need processsors in classe 4 level inside loop , don't want pass dictionary of processors classa classb , on. please help! i use dictionary has mapping between seattype , processing class. , in each iteration take correct processor dictionary . e.g. dictionary<steattype,

c++ - Processing large amount of rows chunked / unbuffered -

consider reading through rows of large table mysql connector/c++: std::unique_ptr<sql::resultset> res( stmt->executequery("select a, b table")); while (res->next()) { handle(res->getuint64(1), res->getdouble(2)); } from documentation : as of writing, mysql connector/c++ returns buffered results statement objects. buffered result sets cached on client. driver fetch data no matter how big result set is. future versions of connector expected return buffered , unbuffered results statement objects. this in accordance observation. on smaller tables (~1e8 rows), takes 3 minutes before first handle , rest completes in 7 seconds. larger tables (~1e10 rows), keeps gobbling more memory before runs out of memory. how can such queries handled without running out of memory while being reasonably efficient concise code? i must find hard believe there should no transparent solution. seems such obvious optimization chunked st

GMap.NET for WPF - IsMouseOverMarker is missing -

in gmap.net windows forms can use ismouseovermarker in gmapcontrol determine if you've clicked on marker on map. but i'm using gmap.net wpf , there can't find ismouseovermarker function... so question is: how can determine mouseovermarker click event in wpf?

javascript - Toggle(Hide/Show) <tr> using jQuery on specific attibute value -

i want hide <tr> based on value of attribute named status_id . , i'm using jquery datatable. this have tried, not working. this table, which, want toggle <tr> attribute status_id in <span> <button id="hide-tasks" class="hide-tasks" type="button">toggle</button> <table id='tbl_tasklist'> <tbody> <tr role="row" class="odd"> <td style="padding-right: 5px;"> <span data-title="new - unclaimed / unassigned" class="data-hover stat_195 clas clicktip badge stat-adjust btn-list fa fa-adjust" status_id="4" move-left="500">&nbsp;</span> </td> </tr> </tbody> and js that, $(document).on('click', '.hide-tasks', function (e) { var toggleval = [1, 9, 10, 11, 12]; var statustoggle = $(this).closest('tr').children('s

javascript - Checkbox is not checking though attribute values are updating -

i have checkbox want check/uncheck using setinterval in every 2 secs. but getting checked/unchecked once. also when inspecting dom , can see it's value , checked attribute updating, not reflecting in view. here code html <input type="checkbox" name="paid" id="paid-change" value = "1"> js var getcheckbox = $("#paid-change"); function check(){ getcheckbox.attr('checked',true); getcheckbox.val("1") } function uncheck(){ getcheckbox.attr('checked',false); getcheckbox.val("0") } // check/uncheck in every 2 seconds setinterval(function(){ switch (getcheckbox.val()){ //get checkbox value case "0": check() // if value 0 check break; case "1": uncheck() //uncheck break; } },2000) here jsfiddle . inspecting element,you attributes updating not reflecting on view. any idea making mistake? instead of attr() set checked a

IRS 1094C-1095C Submission using C# -

iam strugling submitting irs 1094c submission. irs status retrivel service works fine me. reffered jsill , fatherof wine codes during development stage.we in serious dedline stage. error facing gzip compression error messsage. jstill posted complete solution in file dropper cannot access those. can please share again, can compare code it.any sort of appreciated. i believe of did gzip compression work followed microsoft's gzipencoder sample . steps on additional changes necessary outlined in fatherofwine answer under initial question here . user jstill great in overall effort of project.

android - How delete a file from internal storage -

i need delete file internal storage. below code creating file. picasso.with(mcontext).load(imageurl).into(new target() { @override public void onbitmaploaded(bitmap bitmap, picasso.loadedfrom from) { try { string root = environment.getexternalstoragedirectory().tostring(); file mydir = new file(root + "/omoto images"); if (!mydir.exists()) { mydir.mkdirs(); } string name = imagename; mydir = new file(mydir, name); fileoutputstream out = new fileoutputstream(mydir); bitmap.compress(bitmap.compressformat.jpeg, 90,

javascript - Sticky Scrolling with div on Touch Devices -

i'm using the jquery simplemodal plugin adding modal windows site. modal windows have scrollable content in div. on desktop, when open 1 of modals, scrolling smooth. when open modal on touch device, scroll on modal not smooth, rather sticky , kind of stiff. has else experienced or know how can add more natural smooth scroll modal div?

javascript - Is it possible to make a smooth scroll to part of a webpage, even if the scrolling is disabled? -

i have used js stop scrolling: <script> window.onscroll = function () { window.scrollto(0,0); } </script> added css too: body{ overflow:hidden; width:100%; height:100%; } the main part of webpage lies in 100% height. , other part (" a ") lies below screen. all need smooth scroll part (" a ") of page on click @ anchor. still not making page scroll able arrow keys. view image please !! link the blog - " http://gaulifancy.blogspot.com " when click "get down deeper" should scroll down smoothly. note: page made scroll less. have tried move containers translatey view? codepen example of site great you.