Posts

Showing posts from June, 2010

properties - If Getter/Setter are replaced at compile time in java; how can their purpose be fulfilled? -

i'm new java. have been reading getter/setter ( why use getter/setter , getter/setter poor design ). while read on oracle understanding jit . i've 2 questions follows : my question that, if jit replaces getters/setters actual value while compiling code, how purpose of getter/setter being fulfilled? how achieve encapsulation ? if jit replaces getters/setters actual value while compiling code how purpose of getter/setter fulfilled in java particular ? because it's optimization. getters , setters still work expected - , if later change implementation use different fields or other mechanism, jit compiler have change how transforms code well. for part, reasoning program design shouldn't care jit compiler @ - that's implementation detail how program happens executed. may want care achieve better performance, doesn't change whether or not program design still holds up. just because jit may compile code uses getter field directly doesn'

java - DateTimeFormat ISO & Spring MVC -

i have controller i'm trying test using mockmvc @requestmapping(value = "/something/{language}", method = requestmethod.get, produces = { "application/json", "application/xml" }) public responseentity<someentity> getinfo( @pathvariable string language, @datetimeformat(iso= datetimeformat.iso.date_time) @requestparam(required = false) date fromdate ) so i'm expecting allow date formats in docs parsable: date_time common iso datetime format yyyy-mm-dd't'hh:mm:ss.sssz, e.g. however keep on getting things this: handler execution resulted in exception: failed convert value of type 'java.lang.string' required type 'java.util.date'; nested exception is org.springframework.core.convert.conversionfailedexception: failed conv ert type java.lang.string type @org.springframework.format.annotation.datetimeformat @org.springframework.web.bind.annotation.requestparam java.util.date v

angularjs - How to get scroll event when kendo-list-view scrolls -

i building cross platform application using angular kendo mobile. i have kendo list using "kendo-list-view". <div kendo-list-view > i want event when user scrolls list, in controller. i tried scroll event using pure angular code, mentioned in below question. bind class toggle window scroll event but in case nothing happens , code inside directive not getting called. update i have html list view below: <kendo-mobile-view id="mylistscreen" k-transition="'slide'" k-title="'my list'" k-layout="'default'" ng-controller="mylistctrl"> <kendo-mobile-header > <kendo-mobile-nav-bar style="background-color: gray"> <kendo-view-title style="color: white"></kendo-view-title> <kendo-mobile-button k-rel="'drawer'" href="#navdrawer" k-align="'left&#

Docker-machine and Openstack / SSH -

i have problem docker-machine , openstack running command docker-machine --debug create -d openstack --openstack-username admin --openstack-password admin --openstack-tenant-name admin --openstack-auth-url http://163.172.5.197:5000/v2.0 --openstack-flavor-id bea5cb42-c0b3-46fd-96a6-2f4c5d4448c2 --openstack-image-id 871a5ddf-a888-4b45-9201-78da07e6cdcb testmachine gives me output follow docker machine version: 0.6.0, build e27fb87 found binary path @ /usr/local/bin/docker-machine launching plugin server driver openstack plugin server listening @ address 127.0.0.1:46658 () calling .getversion using api version 1 () calling .setconfigraw () calling .getmachinename (flag-lookup) calling .getmachinename (flag-lookup) calling .drivername (flag-lookup) calling .getcreateflags found binary path @ /usr/local/bin/docker-machine launching plugin server driver openstack plugin server listening @ address 127.0.0.1:44014 () calling .getversion using api version 1 () calling .setconfig

C# automate constructors refactoring -

i got ask if there option in c#, lets got suche code : class { public a(int b); } class b : { public b(int b) : base(b); } class c : b { public c(int b) : base(b) } and if want change in class "int b" "car b" need change in every single class, possible refactor somehow automate? if possible, can use c# generics : class a<t> { public a(t b) {} } class b<t> : a<t> { public b(t b) : base(b) {} } class c<t> : b<t> { public c(t b) : base(b) { } } you can use following syntax int (and use same principle car) : var intvar = new c<int>(10); otherwise, there no tool change types @ once. if change parameter type car, resharper propose refactor constructor of derived class.

strategy/pattern to create working chain -

i need pattern/strategie solve problem. know book or read up? my problem (all theory): have kind of game , there have 2 npcs. workers, have repair stuff. need different materials depending on error. when error comes in calculate npc fastest. calculate each npc every move npc have take (walking, waiting,...). workers occupied time task, have consider in calculation. now thoght use same code (with little modification) let npc walk after decided 1 fit best task, in eyes that's huge redundancy , avoid that. have stop tasks midway , let npc go work somewhere else. don't think easy handle way. so second thought create working chain. in time calculation decide npc have to/where walk. could, @ point, add writes action list. loop execute actions , easy stop @ point. (of course have 2 lists after each calculation, 1 each npc. fastest used.) if there pattern or alike came with, appreciate if point me source. or there better way solve that? -regards edit: the time calcu

gwt canvas context.drawImage very slow -

i'm using gwt canvas draw 50 identical 16x16 images full screen (in draw()) requestanimationframe , main loop below: animationscheduler.get().requestanimationframe(new animationcallback() { public void execute(double timestamp) { mainloop(deltatimeinms); animationscheduler.get().requestanimationframe(this,canvaselem); } }, canvaselem); void mainloop(double deltatime) { calcfps(deltatime); clearcontext(); update(deltatime); draw(); } i store images using clientbundle dataresources . converted images , imageelement able call context.draw. the fps before 50 images rendered around 60fps. when rendered fps around 20fps. (both in chrome , mozilla) in dev mode. i think image loading might of problem. animationscheduler.get().requestanimationframe(new animationcallback() { public void execute(double timestamp) {

python - subprocess failed when used in supervisor -

i have celery task does: subprocess.check_call([script.sh, 'clean'], cwd=module_folder, stdout=fd_log_out, stderr=fd_log_err) when run worker command line ok. when celery workers started supervisor, in logs: [2016-05-09 10:31:30,129: error/mainprocess] task project_server.executions.tasks.execution_run[04e6295b-2aa4-4384-9218-fccb111a20df] raised unexpected: typeerror('expect bytes or str, not nonetype',) traceback (most recent call last): file "/home/benjamin/.virtualenvs/project/lib/python3.4/site-packages/celery/app/trace.py", line 240, in trace_task r = retval = fun(*args, **kwargs) file "/home/benjamin/.virtualenvs/project/lib/python3.4/site-packages/celery/app/trace.py", line 438, in __protected_call__ return self.run(*args, **kwargs) file "/home/benjamin/project/projectserver/project_server/executions/tasks.py", line 88, in execution_run fd_log_err=fd_log_err) file "/home/benjamin/project/projectc

vba - Search through Excel tabs -

i not familiar vba programming, though have written few basic modules. having difficulty in coding following problem. appreciate if show basic solution. problem: have 3 tabs in excel file, "rack1", "rack2" , "rack3". each have column called "tag". tag column contains code, made of numerals 0 9999 , 1 letter, or b. want first "a" code in rack1, find matching "b" code. if b code not in tab "rack1", want search tab "rack2", "rack3" if it's not found in either. after "b" part found, want have msgbox message - "found in rack..." or "b part not found" then ... go on next code. thanks please let know have tried far things working @ end. you may have loop through requirement sheets respective column , range. i not clear, exact requirement can this declare variables of sheets set sheet1 = worksheets("sheet1") set sheet2 = worksh

Custom Push Notification coming twice using Parse.com and Android -

Image
i working in custom push notification using parse.com android. push integrated in application, problem getting 2 notifications @ time. one custom receiver image , other 1 default notification os without image , notification not removing notification bar, if removing it, coming again , again on notification tray. paste code snippet , images below well. // custom receiver class public class custompushreceiver extends parsepushbroadcastreceiver { private final string tag = custompushreceiver.class.getsimplename(); private notificationutils notificationutils; private intent parseintent; public custompushreceiver() { super(); } @override public void onreceive(context context, intent intent) { super.onpushreceive(context, intent); if (intent == null) return; parseintent = intent; try { string action = intent.getaction(); jsonobject json = new jsonobject(intent.getextras(

xamarin - Resize Images for website like amazon -

i suggestion knowledgeable guys topic. if make website there lot of images (say 10000) , each image has copies of in different sizes, because need display different sizes of same image. it'd inefficient store these images , display requested. alternatively how do websites amazon, flipkart, alibaba - resize each image needed displayed. have 1 copy stored. i'd knows point me in direction. thanks how can develop site xamarin? xamarin native apps, not websites. mean mono , xamarin studio build asp.net website? if that´s case take @ library: http://imageresizing.net/

windows - Read variable values from file in CMD -

i new windows shell scripting i have text file contents in following format input.txt find1=replace1 find2=replace2 find3=replace3 i have set of windows commands like findandreplace.exe -r "*.java" find1 replace1 findandreplace.exe -r "*.java" find2 replace2 findandreplace.exe -r "*.java" find3 replace3 i want make script reads each find-replace pair input.txt , performs above steps as suggested, command should of use here. split line 2 variables, %%a , %%b you. remove echo when produces commands want. for /f "usebackq tokens=1,2 delims==" %%a in (`type "input.txt"`) ( echo findandreplace.exe -r "*.java" %%a %%b )

c# - How to disable Download Prompt like 'do you want to open or save or save_as?' -

i'm trying download file located on internet site , know how webclient class. but @ case site re-directed web address , therefore, i'm considering use process.start("url address before re-directed") avoid bit complexity download through re-directed web address. succeeded download file through re-directed web address. however, i'm curious , want speed application removing intermediate steps if possible. if approach through process.start("url address before re-directed") , download prompt shown ask users 'do want open? save? save_as?'. and don't want download prompt shown , want save automatically utilize file in application.(if possible, want indicate location(path) saved.) thank ! process.start("some url") telling os handle url. os sees url , gives default browser. default browser whatever configured do. process.start("some url") can not force default browser not show download prompt. you l

php - Equal string comparisons are failing -

after hours of debugging, have determine reason on particular web-server running small script, 2 equal strings apparently being interpreted not equal each other. it makes absolutely no sense me have tried comparing using "==" , "strcmp". while code block works on hosting, person running script continues have fail. the results of logging is... data before explode: result=success; data after explode: result=success no $ch = curl_init(); curl_setopt($ch, curlopt_url, $globals["api_url"]); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_timeout, 100); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_postfields, $postfields); $data = curl_exec($ch); curl_close($ch); $data1_log = "data before explode: " . $data; log_activity($data1_log); $data = explode(";",$data); $data2_log = "data after explode: " . $data[0]; log_activity($data2_log); if (strcmp($data[0], "result=success&q

c# - Entity Framework Column Mapping -

i have issue mapping object property column database function. the database function returns column called [on hand] . therefore model property called onhand . this not map correctly , fails retrieve data correctly column. i have attempted following in order resolve this: editing model use annotation [column("on hand")] public int onhand { get; set; } using fluent api modelbuilder.entity<bindetail>() .property(e => e.onhand) .hascolumnname("on hand"); neither of these approaches have worked either or independently. the way can work on test database alter return column of function [onhand] , however, due other systems using function, not option use on live database. any suggestions has appreciated if you're using entity framework core 1.0 rc 1, there bug (it's fixed @ rc2 , onwards) causes this. a workaround ordering fields z, quick sample: "select " + getcolumnnames<unit>("r") +

android - Unable to set data into database -

in below code im trying , set data data base during execution im unable set data in data base ... settingup mwirelessrouters = walletwirelessrouter.get(getactivity()).getwirelessrouter(uuid); ontextchanged listner mbasestationname = (edittext) v.findviewbyid(r.id.base_station_name); mbasestationname.settext(mwirelessrouters.getbasestationname()); mbasestationname.addtextchangedlistener(new textwatcher() { @override public void beforetextchanged (charsequence s, int start, int count, int after) { } @override public void ontextchanged (charsequence s, int start, int before, int count) { mwirelessrouters.setbasestationname(s.tostring()); } @override public void aftertextchanged (editable s) { } }); note:- in above code im trying take base station name user , update in database..there no issue related view getwirelessrouter(uui

Define filename of attachment -

i'm attaching screenshots this: @attachment(value = "screenshot", type = "image/png") public byte[] makescreenshot(bufferedimage image) { ... return imageinbyte; } the filename beeing generated automatically , looks 4282ae45-5ca1-4621-91c7-ce8a3a2bd58c-attachment.png. there way change filename? i'd refer screenshots in second test , need have specific name "http_www_homepage_html.png". looking @ method public static string generateattachmentname() { return uuid.randomuuid().tostring() + config.getattachmentfilesuffix(); } in ru.yandex.qatools.allure.utils.allureresultsutils, fixed mechanism can't altered without major code changes, guess. i'm using testsuitereader reader = new testsuitereader(new file(test_folder)); read results of previous test runs path attachments. solved issue.

intellij idea - Android Studio IDE - how to change focused tab color -

Image
i realized focused tab hard distinguish: so question how change currently focused tab's color (either foreground or background help) ? search around in settings can't found. my platform android studio version 2.1, linux fedora 21, gnome 3.14.0. your shown tabs hard distinguish because in darcula theme, test class background unfortunatelly hard distinguish non selected test tabs. can see, can distinguish mainactivity.java fine. how change color tests described in question: how change active tab header's color in intellij 14.1.4?

ios - WKWebView how to load HTTPS? -

i use wkwebview load https , not work. function webview( webview: wkwebview, didreceiveauthenticationchallenge challenge: nsurlauthenticationchallenge, completionhandler: (nsurlsessionauthchallengedisposition, nsurlcredential?) -> void) can maybe, please tell me how use ? if server's certificate signed trustful ca, can default behavior nsurlsession, means can behave safari. if want use authentication method, can use delegate method mentioned customize authentication.

pageobjects - How can we get all element values, when more than element hold same class name -

how can element values, when more element hold same class name. eg: consider i'm having n number of elements having same class name follows <span class="country-name">country 1</span> <span class="country-name">country 2</span> <span class="country-name">country 3</span> <span class="country-name">country 4</span> <span class="country-name">country 5</span> how can element values having class name country_name. also have tried follows: span(:country, :class => 'country-name') puts country when execute it, only printing first value (country 1) other values not printed. how can values ? any suggestions? you can create collection accessor returns of related spans (ie class "country-name"). in page object, instead of calling span , call pluralized version - spans : class mypage include pageobject spans(:country, :clas

UML modeling - How to represent a multi-way inheritance onto a class diagram? -

Image
how may situation represented onto class diagram more elegant (and professional) way (using inheritances ?) ? an actor [class] can physical person [class] or company [class], not both. actor can inner actor [class] or external actor [class], not both. inner actor can physical person or company, not both. external actor can physical person or company, not both. of course, here, each said class has specific attributes, methods , relations other classes onto diagram. if don't mind multi-inheritance consider that: (the inner actor displayed tow times simplify diagram, same class.)

extraction - Automatic deletion of some pdf contents -

i've got extract specific data high number of .pdf files. problem first thing have convert .pdf .txt can find data i'm interested in. after conversion there's high amount of artefacts in .txt files ( page numbers, hyperlinks contents page, footers, headers etc. ). these .pdf files quite huge ones ( every single file transcription of 7-12 hours of people talking ) cannot afford deleting things manually ( i've got ~60 .pdf files ). question - know tool allows automatic deletion of such contents? i'd glad hear every proposition improve work :) thanks!

ios - Network operation could not be completed - Alamofire -

i using alamofire in swift app developing. whenever try perform network call in simulator iphone5 8.1 (or simulator 8.1) getting: optional(error domain=nsurlerrordomain code=-1005 "the operation couldn’t completed. (nsurlerrordomain error -1005.)" userinfo=0x7f9d148ac2c0 {nserrorfailingurlstringkey=https:[url removed], nserrorfailingurlkey=https:[url removed], _kcfstreamerrordomainkey=1, _kcfstreamerrorcodekey=57, nsunderlyingerror=0x7f9d1273f0a0 "the operation couldn’t completed. (kcferrordomaincfnetwork error -1005.)"}) this use work fine until day ago. things have changed servers sitting on windows/iis ec2 instances behind load balancer , request no longer http https. i had app transport configured when using http removed on https. tried putting still nothing. i have disabled keepalive headers on iis can't seem connection go through. i have read through comments here https://github.com/afnetworking/afnetworking/issues/2314 nothing in post works

mongodb - MotorEngine - How to represent the equivalent of the foreign key in model? -

in mongodb have document represents balance has stakeholder's id field. i need relate these 2 classes, balance , stakeholder, don't know what's proper way. i've seen there's field appropiate still don't understand it: embeddeddocumentfield() class balance(document): id = uuidfield() creation_date = datetimefield(auto_now_on_insert=true) gross_balance = floatfield(required=true, min_value=0, default=0) balances_description = stringfield(required=true, max_length=255) stake_holder = #fk stakeholder class stakeholder(document): ... any idea? if stakeholder represents document other collection , stake_holder objectid, should use referencefield() stake_holder = referencefield(reference_document_type=stakeholder)

split big matrix in subsets,R -

i make subgroups matrix, , each subgroup contains same amount of column. example, there matrix 1000 rows , 420 columns, , split 35 sub-matrix in order, first 1 contains first 12 cols, , second contains second 12 cols, , on. think use function iris. please me! iris[c()] not sure if you're after, here's reproducible example: # define matrix m = matrix( c(1:20), nrow=2, ncol=10) # split 5 submatrices of equal size lapply(split(m, rep(1:5, each = 4)), matrix, ncol = 2) $`1` [,1] [,2] [1,] 1 3 [2,] 2 4 $`2` [,1] [,2] [1,] 5 7 [2,] 6 8 $`3` [,1] [,2] [1,] 9 11 [2,] 10 12 $`4` [,1] [,2] [1,] 13 15 [2,] 14 16 $`5` [,1] [,2] [1,] 17 19 [2,] 18 20

html - Set a Fixed div to 100% width of the parent container -

i have wrapper padding, have floating relative div percentage width (40%). inside floating relative div have fixed div same size parent. understand fixed div removed flow of document , such ignoring padding of wrapper. html <div id="wrapper"> <div id="wrap"> relative item placed item <div id="fixed"></div> </div> </div> css body { height: 20000px } #wrapper { padding: 10%; } #wrap { float: left; position: relative; width: 40%; background: #ccc; } #fixed { position: fixed; width: inherit; padding: 0px; height: 10px; background-color: #333; } here obligatory fiddle: http://jsfiddle.net/c93mk/489/ does know of way accomplish this? i have amended fiddle show more detail on trying accomplish, sorry confusion: http://jsfiddle.net/evyre/4/ you can use margin .wrap container instead of padding .wrapper: body{ height:20000px } #wrapper { padding: 0%; } #

c - Is this the correct way to use va_arg with pointer to function? -

in function this: typedef double(*dfun)(double); void tab(double x, int n, ...) { va_list args; va_start(args, n); printf("%5.2lf \t", x); (int i=0; i<n; i++) { dfun tmp = va_arg(args, dfun); printf(" %5.2lf \t", tmp(x)); } va_end(args); } is wrong if pull arguments this: double(*tmp)(double) = va_arg(args, double(*)(double)); i came upon this article suggest different approach if doesn't work: q: can't va_arg pull in argument of type pointer-to-function. a: try using typedef function pointer type. type-rewriting games va_arg macro typically plays stymied overly-complicated types such pointer-to-function. in case works in both versions (gcc 5.2.1), that's why wondering 1 approach better other? there potential error when don't typedef pointer function first? using pointer without typedef can indeed cause problems in cases. standard explains type use

asynchronous - Is the use of ThreadStatic in .NET framework code a harmful relic of a bygone age? -

[threadstatic] used in various places in .net framework provide ambient context various features (e.g. transaction.current , used transactionscope ). unfortunately, means features thread juggling (asp.net, async keyword code) switch threads, don't copy transactionscope , features transactionscope don't work might expect . there mechanism, callcontext.logicalgetdata (more here ) copy across state during thread switches correctly (at least in .net 4.5). seems me transactionscope better if used rather [threadstatic] . if features using [threadstatic] written today, rather being existing features requirements of backwards compatability, written using callcontext.(g|s)etlogicaldata ? in reality have different use cases. threadstatic can't transfer value across await or similar context switch. callcontext can't retain value per-thread. so see, 1 can not replace other. threadstatic low-level primitive. don't think use cases have gotten fe

php - htaccess for creating clean url for application hosted on sub-domain -

here few examples of urls generated application on working. want make url clean, using htaccess: example: http://subdomain.domain.com/index.php?folder=abc&file=xyz&variable1=pqr&variable2=123 the final url should looke like: http://subdomain.domain.com/abc/xyz/pqr parameters should appear after forward slash. please help! you take in topic rewriteengine on rewritebase / rewriterule ^([^/]+)/([^/]+)/([^/]+)/?$ index.php?folder=$1&file=$2&variable1=$3

javascript - How can I specify the type of the "this" value for a closure in JetBrains IDEs? -

Image
jetbrains has old blog post jsdoc annotations explains how inform ide of variable types http://blog.jetbrains.com/webide/2012/10/validating-javascript-code-with-jsdoc-types-annotations/ . i still, however, cannot seem find way tell ide "this" value in many jquery callbacks htmlelements. example: /** * enable input * @returns {someconstructor} */ someconstructor.prototype.enableinput = function(){ this.$markup.find('input').each(function(){ this.disabled = false; }); return this; }; the above example still produce warning in ide - "potentially invalid usage of this". how can specify "this" refers htmlelement object? edit: after looking through jsdoc documentation found @this annotation http://usejsdoc.org/tags-this.html . @this allow specify "this" value entire function, in posted example ide think it's returning htmlelement rather someconstructor. @de1mar in comments nailed it. trick pl

Sorting in Struct -

typedef struct { int list; int deadline; }order; int c1[] = { 300,300,500,500,1000,1000,1000 }; order a[7]; int b, d; a[0].deadline = 500; a[1].deadline = 300; a[2].deadline = 500; a[3].deadline = 300; a[4].deadline = 1000; a[5].deadline = 1000; a[6].deadline = 1000; i want make sorting in struct according array , sorting result in a[].list. i want result; printf("%d\n", a[0].list);//3 printf("%d\n", a[1].list);//1 printf("%d\n", a[2].list);//4 printf("%d\n", a[3].list);//2 printf("%d\n", a[4].list);//5 printf("%d\n", a[5].list);//6 printf("%d\n", a[5].list);//7 i tried buble sorting, there mistake in somewhere.

php - converted to string database -

) wrote method display contents of database public function magazyn() { //return 'magazyn'; $this->magazyn = $this->conn->prepare("select * `products` order `nazwa`"); //$this->magazyn->bind_param('ssss', $id, $nazwa, $kategoria, $sn); $this->magazyn->execute(); $this->magazyn->store_result(); return $this->magazyn; if ($this->magazyn->num_rows > 0) { echo "jest cos w magazynie"; } else { echo "brak produktw w bazie"; } } function __tostring() { return $this->magazyn; } $web = new web(); echo $web->magazyn(); and in site have error: catchable fatal error: object of class mysqli_stmt not converted string in...

ios - Auto-Stretching UITextField on typing -

Image
i have uitextfield created programatically. want have uneditable prefixed characters on beginning , end, such "hello [textfield] world". first, tried adding characters manually , using shouldchangecharactersinrange make approach won't work because if user long press on textfield , come beginning, can edit first characters (so can mess prefixed characters). option didn't seem convenient. another option creating empty uitextfield , , 2 static uilabels (for "hello" , "world"). here, problem arises. uitextfield 's text center aligned (and vertically centered in view), giving width of view , 0 x-axis (so textfield touches both left , right edges of view). instead, if try give textfield fixed width while creating, width doesn't expand/stretch user types in. what want achieve starting width of textfield 0, , having static uilabel s on each sides "hello "[textfield]" world" ; user types in, increasing/stretchin

php - How to make my WebApp available offline? -

if using google calendar, may noticed have "offline" feature . can use google calendar if offline. interested know strategy using enable feature? i have php/mysql invoicing application, , i want allow users use system if offline , when internet back, data should synced online version . i don't want install codes in client's pcs, hope if has idea allows me same did in google calendar or other idea may help. there javascript variable called localstorage. can store there queue of commands executed , can can implement synchronize function, this: function synchronize(queue) { while (!queue.isempty()) { queue.pop().execute(); } } you can use else, including offline storage, remember offline storage supported html5, if want support older browsers, need have fallback logic well.

java - What is a NullPointerException, and how do I fix it? -

what null pointer exceptions ( java.lang.nullpointerexception ) , causes them? what methods/tools can used determine cause stop exception causing program terminate prematurely? when declare reference variable (i.e. object) creating pointer object. consider following code declare variable of primitive type int : int x; x = 10; in example variable x int , java initialize 0 you. when assign 10 in second line value 10 written memory location pointed x. but, when try declare reference type different happens. take following code: integer num; num = new integer(10); the first line declares variable named num , but, not contain primitive value. instead contains pointer (because type integer reference type). since did not yet point java sets null, meaning "i pointing @ nothing". in second line, new keyword used instantiate (or create) object of type integer , pointer variable num assigned object. can reference object using dereferencing operator . (a dot

php - Meaning of the ?act=Submit -

this question has answer here: what symbol ? mean in url? 2 answers $("#fm-form").attr("action", "<?php print $this->url; ?>index.php/general/geography/?act=submit"); here fm-form form id , line of code .phtml file(zend-framework) can explain me "?act=submit" this method. get associative array of variables passed current script via url parameters. explanation the method sends encoded user information appended page request. page , encoded information separated ? character. for example we have url http://www.test.com/index.htm?name1=value1&name2=value2 features the method produces long string appears in server logs, in browser's location: box. the method restricted send upto 1024 characters only. never use method if have password or other sensitive information sent server. get can&

ads - Roku_Ads.brs library error on Roku 4 with Roku Advertising Framework -

despite adding bs_libs_required=roku_ads_lib in manifest, getting an error occurred while attempting compile application: -------> bs lib provider not found: roku_ads_lib note: roku build running fine on roku3 code. error occurring on roku4. there other parameters needed on roku4. or did roku4 not support dfp ads?

php - how to extract API from websites in laravel 5.2? -

i new laravel5 framework , have no idea this.i want fetch data website , store in database.can provide sample coding come under model , view , controller , route, can understand in better way. everything except something's come under model controller view , routes. start tutorials docs , continue the basics navigate in left navigation top bottom

html - Sticky footer doesn't work -

Image
hi know there have been lot of questions before can't seem find problem footer. this did lot already when scroll down, footer stay @ same place when page loaded. there way fix this? body { font-family: trebuchet ms, verdana, arial, helvetica, sans-serif; line-height: 24px; font-size: 12px; background-color: #ff3333; height: 100%; } h1 { color: #777777; font-weight: normal; font-size: 19px; text-transform: uppercase; border-bottom: 3px #dddddd solid; padding: 3px 0px; margin-left: 5px; } p { display: block; -webkit-margin-before: 1em; -webkit-margin-after: 1em; -webkit-margin-start: 0px; -webkit-margin-end: 0px; margin-left: 5px; font-size: 1.5em; } h2 { display: block; font-size: 1.5em; -webkit-margin-before: 0.83em; -webkit-margin-after: 0.83em; -webkit-margin-start: 0px; -webkit-margin-end: 0px; font-weight: bold; margin-left: 5px; } .logo { position: absolute; padding-bottom: 5px; padding-right: 10p

python - Django - Find out which model instance I'm editing in an inline formset -

note: i'm new django , python. i'm not sure if i've misunderstood use of inline formsets in way. i needed able edit fields multiple instances of guest model (linked parent invite model) @ same time in 1 form. after lot of , forth, managed set inline formset submits successfully. however, interface confusing, because don't know guest you're filling in details for. each guest has guest_name field, , want display name each form, users know they're editing for. here's (condensed) view: def extra_view(request, code): # specific invite invite = get_invite(code) # context request. context = requestcontext(request) # store guests attending object guests_attending = invite.guest_set.filter(attending=true, invite=invite) # create formset each guest guestformset = inlineformset_factory(invite, guest, form=extraform, fields=('diet', &

c# - Null Password Char in Winform -

this question has answer here: how can unmask c# password textbox , mask password 6 answers i have textbox in c# windows form having problems in assigning null values passwordchar . want if checkbox checked passwordchar should null i.e actual text should displayed else passwordchar should * . have tried private void checkbox1_checkedchanged(object sender, eventargs e) { if (!checkbox1.checked) { txtpassword.passwordchar = '*'; } else { txtpassword.passwordchar = ''; } } but line txtpassword.passwordchar = ''; is generating error. have tried txtpassword.passwordchar = null; but still error. please me correct code. to reset passswordchar , txtpassword.passwordchar = '\0'; for convenience: private void checkbox1_c

r - Control alignment of two side-by-side plots in knitr -

Image
i cannot figure out how arrange 2 side-by-side plots explained in knitr graphics manual page 2 ( http://yihui.name/knitr/demo/graphics/ ). use following mwe , output below. them aligned shown in manual 2 cars plots (also on page 2 of manual). pdf generated in rstudio (knit pdf). --- title: "untitled" output: pdf_document --- ## r markdown ```{r,echo=false,out.width='.49\\linewidth', fig.width=3, fig.height=3} barplot(1:4) barplot(4:7) ``` to center 2 plots can add fig.align='center' to chunk options. if produces 1 plot above other add fig.show='hold' . result should 2 centered graphs. so final chunk option should like: {r,echo=false, out.width='.49\\linewidth', fig.width=3, fig.height=3,fig.show='hold',fig.align='center'}

fullcalendar background events: background color not shown in Safari / Firefox / IE -

i use fullcalendar scheduler add-on ( http://fullcalendar.io/docs/scheduler/ ) when use code below, background event not coloured silver in safari / firefox /ie (no color @ all...). shows silver color in chrome. $('#calendar').fullcalendar({ events: [ { start: '2016-04-01 06:00', end: '2014-04-01 10:00', rendering: 'background', color: 'silver', resourceid: 1 } ] }); how can fix issue? thanks in advance! kind regards, kim you can set classname attribute of events events: [ { start: '2016-04-01 06:00', end: '2014-04-01 10:00', rendering: 'background', classname: event_silver, resourceid: 1 } and in css: .event_silver { background-color: silver; } kind regards, romain

haskell - Is there any type-algebra function mapping an ADT to the set of elements of that ADT? -

for simple adts, can obtain adt of sets of adt data set = full set (*repeated n times) | empty set(*repeated n times) , n number of non terminal constructors of adt. more solid example, take nat : data nat = succ nat | 0 we can obtain type sets of nats follows: data natset = full natset | empty natset so, example, empty :: natset empty = empty empty insert :: nat -> natset -> natset insert 0 (empty natverse) = full natverse insert 0 (full natverse) = full natverse insert (succ nat) (empty natverse) = empty (insert nat natverse) insert (succ nat) (full natverse) = full (insert nat natverse) member :: nat -> natset -> bool member 0 (full natverse) = true member 0 (empty natverse) = false member (succ nat) (empty natverse) = member nat natverse member (succ nat) (full natverse) = member nat natverse main = let set = foldr insert empty [zero, succ (succ zero), succ (succ (succ (succ (succ zero))))] print $ member 0 set p

parameters - Change redundant value SPSS 23 -

while working in spss did glm univariate analysis obtain parameter estimates table. analysis sets last value of series zero. want set value 0 (as redundant value), in case cow_nr=0. how do this? my parameter estimates thank in advance. use constrast specification (the /contrasts subcommand or subdialog box) set reference categories appropriate contrast.

c - Brute forcing crypt() if salt and password hash are known? -

playing through wargames , curious if possible (they want solve in different way, still). there's .c file function has code looks this: char buffer[20]; scanf("%s", buffer); char* hash = crypt(buffer, "$6$") char* password = "$6$123456abcdef" #long string if (strcmp(password, hash) == 0) supersecretfunction(); is there way brute force considering salt , hashed password known already? unlike original des-based crypt() algorithm used in older unix variants, brute forced relatively modest modern resources, newer unices including gnu/linux flavours use extended encrypted password specification. can recognize if encrypted password (or salt) start "$id$" "id" algorithm identifier, see table below. "$6$" indicates sha-512 used encryption (well, hashing actually). after second '$' comes salt, '$' , sha-512 of password. the sha-512 algorithm used decribed in detail here: ftp://ftp.arlut.utex

c++ - Get year from boost date as string -

i using boost's date object want year object string or int i didn't find simple way thank you! ron #include <boost/date_time/local_time/local_time.hpp> #include <boost/lexical_cast.hpp> #include <string> std::string x = boost::lexical_cast<std::string> (second_clock::local_time().date().year()); should do.

version control - Is there a way to remove "pointless" commits from git history? -

suppose have git history this: a-b-c-d-e-f-g b added 60k files. f removed same files. any operation traverses git history, such git log , takes stupid amount of time if has cross f (or b). is there way remove b , f history, given cancel each other out? more point: there easy way this, , ensure other developers using repo date? (bear in mind said developers have feature branches sitting on machines.) suspect solutions going end resulting in a-c'-d'-e'-g' ... my gut says best i'm going create branch a, cherry-pick c through e, create new branch g, , merge onto first branch. or something. just git rebase -i a , remove lines b , f. said (or meant), rewrite published history, fellow developers need rebase branches based off manipulated branch described in man page of git rebase under section "how recover upstream rebase".

firemonkey - Delphi FMX TAnimator. How to animate a TPointF -

i have tscrollbox on form. placed onto scrollbox tlayout wider , taller device viewport horiz , vert scrollbars show , user can manually move layout. i have gesture setup user can longpress scrollbox , layout origin (0,0). procedure tfrmmain.scrollbox1gesture(sender: tobject; const eventinfo: tgestureeventinfo; var handled: boolean); begin if eventinfo.gestureid = system.uitypes.igilongtap begin scrollbox1.viewportposition := pointf(0, 0); scrollbox1.realigncontent; end; now works great, happens rather quickly. thought perhaps use: tanimator.animatefloat(scrollbox1, 'scrollbox1.viewportposition.x', 0, 0.3); to make movement current position 0 bit more gentle, of course, that's never going work because can't assign value pointf.x or pointf.y directly (and therefore neither can animator). so how can done? thanks as built-in pointanimation missing, here self written one. type tpointanimation = class(tcustompropertyanimatio