Posts

Showing posts from February, 2010

java - Can class name be excluded from Lombok @ToString? -

project lombok's class annotation, @tostring , used automatically generate tostring() method within class annotates. for class: @tostring public class someclass { string field1="field #1"; string field2="field #2"; } invoking generated tostring() method produce output:   someclass(field1="field #1", field2="field #2") optional elements of annotation can used include or exclude specific fields, want know is...   "is there way tell lombok exclude class name output?" maybe like: @tostring(exclude="#classname") public class someclass { ... } no. @tostring annotation not have option let that.

winapi - Win32: C++: How do I re-focus on Parent Window after clicking in a child window? -

in win32 cpp program, have defined child window display various text strings using like: hnd_to_this_ch_window = createwindow( l"edit",l"some initial text", ws_visible | ws_child | es_left, position_of_this_window_x, position_of_this_window_y, textout_default_width, textout_default_height, handle_to_my_parent_window, null, hinstance_variable_used_by_create_window, null ) my problem if click mouse select text in 1 of such child windows (to, say, copy somewhere), focus of application goes child window , keypresses used handled through main windows callback (with case wm_keydown:) captured child window, appear inputted characters. magic function call have focus go parent (so wm_keydown) can work again? hoping click on ma...

php - Facebook apprequests can not send additional data to canvas page -

i used javascript sdk send apprequests user's friends, need additional data displayed on canvas page when user clicks notification. after parsing signed request haven't found related data. here code: fb.ui({ method: 'apprequests', message: 'message', data: 'data here', }, function (response) { if (response) { alert('successfully invited'); } else { alert('failed invite'); } }); what doing wrong ? i have found solution. maybe else. in canvas page need make 1 more call apprequests method using oauth_token signed_request , apprequest_id params , there see data passed app call. fb.api( '{your_apprequest_id}?access_token=caahoneepb5ibaczbs4n9muvwhwz9csozc82jjrqqezc2kxwzcp8scmxck92qjkvh37h1zayzcm7dc1w8ils31m5ogvnzaoe7bnhtt8tg9dgsdzcfypr0ej5hu5bcogwvcxorcghoedrfq426we0q70o3dqinvrrlozcjt0xrrspebbrqxzahevxrfzrw8pojjoiqbnjzckaaavurwjzct5jnm7bhzb2w6czco...

xcode - UIView `readableContentGuide` in Interface Builder? -

Image
the ios 9 readablecontentguide uilayoutguide (essentially, thing can pin constraints to) uiviews have. idea keep subviews text being wide on ipad in landscape. it's easy configure in code ( v1 subview, v superview): nslayoutconstraint.activateconstraints([ v1.topanchor.constraintequaltoanchor(v.readablecontentguide.topanchor), v1.bottomanchor.constraintequaltoanchor(v.readablecontentguide.bottomanchor), v1.rightanchor.constraintequaltoanchor(v.readablecontentguide.rightanchor), v1.leftanchor.constraintequaltoanchor(v.readablecontentguide.leftanchor) ]) now then. far good. however... in 2 different wwdc videos, claimed quite explicitly can configure pinning subview superview's readablecontentguide in interface builder . but don't explain how that. so question is: how do it? pin subview's edges superview's margins usual. now, in superview's size inspector, check follow readable width checkbox:

class - Data Structure for KeyBoardEvents C++ -

i working on input system part of tutorial watching, , google searching, find 1 method online handling input via switch statement in application loop. i can't find examples tutorial takes in mod keys shift, alt , ctrl. found enough can pull current mods can not find convenient way achieve do. my plan have input class part of application class. input can passed window , game objects way have single input state system entire program. wanted register callback functions within game or window necessary, , way know how via <functional> . thought have std::map<key scancode,std::function<void()>> sort of situation. however, since need account modding of key, there way generate unique key value combined of scancode , mods, example a , shift + a , ctrl+a ? right solution think bit hacked need have unique std::map set each modifier combination. current registration (minus implementation of inserting key/func pair map), need individual map each if block ...

sorting - how to sort alphanumeric values in excel in a specific format i desire other than the one done by default -

Image
i have values in excel column 1 6 5 2 3 1a 3b1 3b4 3b3 2c 2d. when sorted result 1 2 3 5 6 1a 2c 2d 3b1 3b3 3b4. supposed 1 1a 2 2c 2d 3 3b1 3b3 3b4 5 6. how desired result? with data in column a , in b1 insert: =a1 & char(1) and copy down. sort cols a & b b : afterwards, column b can cleared.

python - Django Rest Framework list of dict field -

i'm trying serialize 2 model fields provided list of dicts using django rest framework. this model.py : class translation(models.model): translated_term = models.charfield(max_length=200) translated_meaning = models.textfield() language = models.charfield(max_length=200) vocab = models.foreignkey(vocab, related_name='translates') def __unicode__(self): return '%s: %s' % ( self.language,self.translated_term) view.py : class vocabviewset(viewsets.modelviewset): queryset = vocab.objects.all() serializer_class = vocabserializer serializer.py : class vocabserializer(serializers.modelserializer): ... translates= serializers.stringrelatedfield(many=true) ... class meta: model = vocab fields = (...,'translates',...) api result : { ..... "translates": [ "en: abyssal zone" ], .... } my question how set translates list ...

functional programming - Standard ML: Operator and Operand Don't Agree (Circularity) -

i'm trying write function in sml flip alternate elements of list. here's function: fun flipalternate(nil) = nil | flipalternate([x]) = x | flipalternate(x::y::xs) = y::x::flipalternate(xs); when go use file (ullman.sml) in interactive interpreter, compilation error: - use "ullman.sml"; [opening ullman.sml] ullman.sml:5.31-5.54 error: operator , operand don't agree [circularity] operator domain: 'z list * 'z list list operand: 'z list * 'z list in expression: x :: flipalternate xs so sml saying requires list of lists of integers i'm giving pair of lists of integers? i'm bit lost here appreciated. thanks, bclayman your second case wrong; want fun flipalternate(nil) = nil | flipalternate([x]) = [x] | flipalternate(x::y::xs) = y::x::flipalternate(xs); sml looking @ second case , concluding flipalternate :: 'z list list -> 'z list which isn't compatible recursion in...

Tabular DAX Daily Many To Many Association -

i @ end of tether on problem have in model currently... basically, have 'temporal' many many mapping table maps commission rates managers on time... these can change daily, (but rarely), i've tried avoid having huge table same values repeated albeit different specific dates, if anyway end 200 million record table, crucially though more 1 manager can commission sale of product type :s note : some commissions go single manager, , go multiple, , can switch on time.. what i've done instead hold validfrom, , validto dates in mapping table... every solution come deathly slow, , have no idea if there solution @ point... here link small sample:- http://1drv.ms/1gor7uw the area think troublesome getting correct "rate" given manager, on given day... way can seem able nested sumx, there must slicker i'm missing?! one thing thought (but failed implement) hold effective date, , filter using , leverage lastnonblank() or something? perhaps fresh eyes can ...

Reuse same framgent object in FragmentTransaction android -

i trying add fragment(b) inside fragment(a). , using code below. fragment fragmentb = new fragmentb(); public void navigatetofragmentb(){ //adding data fragmentb. //fragmentb.addqueryparams(); fragmenttransaction fragmenttransaction = getchildfragmentmanager().begintransaction(); fragmenttransaction.replace(r.id.fragmentarootlayout, fragmentb); fragmenttransaction.commit(); } let's say, @ first, trying inflate fragmentb inside fragmenta queryparams queryparamold. it's working fine. now, problem arises when trying inflate fragmentb again different queryparams queryparamnew. it's not working. can me find out solution? one possible solution move fragment fragmentb = new fragmentb() inside method(navigatetofragmentb()). but, don't want re-create object.

osx - Using Office for Mac 2016 to edit a document using WebDAV -

i had rebuild mac , installed office mac 2016 (from office 365 subscription). not able click on link on web page , edit document webdav (ithit implementation not sharepoint). using office mac 2011 before rebuild , working...when clicked on link using safari, pop allowing sharepoint browser plug-in did not display. since site connecting uses basic authentication on non-ssl connection, used terminal , ran following command: defaults -currenthost write com.microsoft.registrationdb hkey_current_user\hkey_local_machine\software\microsoft\office\15.0\common\internet\basicauthlevel -int 2 not able have document open word. uninstalled office mac 2016 , deleted , file reference microsoft..then installed office mac 2011 , ran command above \14.0\ instead of \15.0\. can edit documents webdav. settings allow use of office mac 2016? i having similar problem , trying open / edit office documents browser via webdav / sharepoint plugin. used work prior office versions, not office 2016...

java - Thymeleaf validation: .hasErrors does not trigger -

i'm trying validate input values of form fieldset , make thymeleaf show error message when invalid inputs occur. somehow following thymeleaf command never gets resolved in right way: <p th:if="${#fields.haserrors('itemid')}" th:errors="{*all}">name error</p> more information environment won't hurt guess: based on spring gs-guide "validating form input" implemented relevant controller method followed: controller: [...] @requestmapping(value = "/explorer/optaresultrequest", method = requestmethod.post) public string optaresultrequestpost( httpservletrequest httprequest, modelmap model, @modelattribute("request") @valid somerequest userrequest, final bindingresult bindingresult) { /* destroy existing "request" attribute: */ model.clear(); /* check invalid values: */ if (bindingresult.haserr...

command line - What is the function of git bash for windows? -

is git bash can used windows alternative terminal on ubuntu? can use cmd.exe same purpose? git bash provides bash emulation used run git command line. unix users should feel right @ home, bash emulation behaves "git" command in linux , unix environments. also used run commands of linux such ls,cd etc. if want use commands in windows go install git bash. you cannot use command prompt same purpose.

asp.net - Perl: Execute aspx 'login' script from Perl -

i have aspx script called login.aspx. receives 2 parameters - username , password. authenticates user. run in browser this: https://www.website.com/login.aspx?username=myusername&password=mypassword when execute browser correct username/password runs , loads web page. when run perl (completely same url, correct username/password) error: 500 connect failed: connect: unknown error; unknown error @ test2.pl line 24. my perl scripts follows. please me understand why fails perl. #!/usr/bin/perl use strict; use warnings; use data::dumper; use lwp::useragent; # url addresses $url_auth = 'https://www.website.com/login.aspx?username=myusername&password=mypassword'; $ua = lwp::useragent->new; $ua->env_proxy; $response = $ua->get($url_auth); if ($response->is_success) { print $response->decoded_content; } else { die $response->status_line; } thank much!

android - RX Java RecycleView -

i'm not familiar rx java. trying use recycleview. reason code not working here code. fragment recycle view public class cheeselistfragment extends fragment { private final compositesubscription subscriptions = new compositesubscription(); private publishsubject<string> timespansubject; private final func1<string, observable<liveinfo>> trendingsearch = new func1<string, observable<liveinfo>>() { @override public observable<liveinfo> call(string s) { radioliveinfoobservableservice radioliveinfoobservableservice=apiprovider.getinstance().getradioobserverinfo(); return radioliveinfoobservableservice.radioinfo(type.interval) .observeon(androidschedulers.mainthread()) .doonerror(trendingerror) .onerrorresumenext(observab...

io - Treat a space(or tab) separated file "like" and array - C++ -

i have short tab/space separated file (i can create accordingly) structure [data00] <space> [data01] <space> [data02] <space> [data03] <newline> [data10] <space> [data11] <space> [data12] <space> [data13] <newline> ... the first column representing numerical id. create file feed executable, format fixed. after feeding it, executable outputs file similar structure: [data00] <space> [data01]<newline> [data10] <space> [data11]<newline> ... given id, need read corresponding [datax1] , perform operations on [datax3] in first file, feed executable, , iterate. i think of 2 way of doing this: operate on 2 textfile "as if" array, given structure fixed, lost on function/syntax use. should small function allow me read interesting bit passing relevant numeric id hiding pesky i/o code, need repeat operation lot in different context keep first file in arrays , trick executable feeding stream (is poss...

javascript - Proper Practice when Calling a Function with a Return value From Button Click -

<html> <head> <script type="text/javascript"> function add(a,b) { var result = parseint(a) + parseint(b) return result } </script> </head> <body> <input type="text" name="numberone" id="txtnumberone" /> <input type="text" name="numbertwo" id="txtnumbertwo" /> <!-- <input type="button" id="btnclick" value="add" /> --> <button id="btnclick">add</button> <p id="answer"></p> <script> document.getelementbyid("btnclick").addeventlistener("click", function(){ var view = add(document.getelementbyid('txtnumberone').value, document.getelementbyid('txtnumbertwo').value ) document.getelementbyid("answer").innerhtml = view; }); ...

php - Twitter API and duplicate tweets -

i'm using twitter api via codebird php display tweets using ajax on site. i'm having trouble preventing duplicates after first call since max_id shows tweets after including max_id. seems silly why they'd way, me, can't seem find else asking same question. though lot of people come across. leads me think i'm not doing correctly. // prepare args $tw_args = array( 'count' => 5, 'trim_user' => true ); // if havea last id, set if (isset($last_id)) { $tw_args['max_id'] = $last_id; } // new tweet arr $tweets = array(); // raw tweets $raw_tweets = (array) $cb->statuses_usertimeline($tw_args); // loop through tweets ($i = 0; $i < count($raw_tweets); $i++) { // add id , text our new tweets array $tmp = array( 'id' => $raw_tweets[$i]->id_str, 'text' => $raw_tweets[$i]->text ); ...

java - Insert big string (>4000) into Clob jdbc -

i'm stuck on this: i've followed hundreds procedures found on internet store big string clob object , oracle db. in particular: prepared statement (insert into) empty clob: executer.add("s_nota_globale", clob.getemptyclob()); the line above populate the bind vars in query long. so, @ point, let's i've empty clob inserted (which true). then: string sqltext = "select s_nota_globale " + "from sn_denunce " + "where id_denuncia = ? " + "for update"; preparedstatement psclobupdate= conn.preparestatement(sqltext); psclobupdate.setlong(1,denuncia.getid()); resultset rset = psclobupdate.executequery(); rset.next(); clob notaglobale = (clob) ((resultset) rset).getclob("s_nota_globale"); writer writer = notaglobale.setcharacterstream(0); try { writer.write(denuncia.getnotaglobale().tochararray()); writer.flush(); writer.close(); rset....

Django url parsing error -

ok, have 2 different views, both in project site-wide area. urls.py url(r'^accounts/login/$', 'taxo.views.login'), url(r'^accounts/invalid/$', 'taxo.views.invalid'), ... taxo/views.py def login(request): c = {} c.update(csrf(request)) return render_to_response('login.html', c) def invalid(request): return render_to_response('invalid.html',{'title':'invalid'}) templates/login.html <form action="/accounts/auth/" method="post">{% csrf_token %} <label for="username">user name</label> <input type="text" name="username" value="" id="username"> <label for="password">password</label> <input type="password" name="password" value="" id="password"> <input type="submit" value="login" /> </form> t...

security - LAMPSecurity CTF8 -

i trying use code provided me penetration test exercise. according author created enter code , users hashes machine trying compromise. when enter code not return database. ":" on screen. not seem right code can please help. job not fix code query information database hashes users. going based on instructions of lampsecurity ctf8 pdf provided me. <?php $res = db_query('select name,pass users'); while ($rec = db_fetch_object($res)) { print $rec→name . ":" . $rec→pass . "<br/>"; } ?> somewhere during parsing of pdf, characters -> have been turned utf8 equivalent of → . however, → not valid operator in php. replace → -> , try again. also, code doesn't connect db anywhere, may cause further issues.

android - How can I set progress bar color accent programmatically? -

Image
i'm creating progressdialog compatible appcompat. color accent not applied in created progressbar. link source of progressdialogcompat: https://github.com/krystian71115/androidhelperlibrary/blob/master/src/com/krystian71115/android/app/progressdialogcompat.java#l160 the result: in screenshot can see progress bar in main layout applied correctly. when create programmatically doesn't work. second screenshot after close dialog: the coloraccent working correctly not working when create progress bar programmaticaly. oncreate method: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); progressdialogcompat dialog = new progressdialogcompat(this); dialog.settitle("loading"); dialog.setmessage("loading data..."); dialog.setprogressstyle(progressdialogcompat.style_horizontal); dialog.setprogress(150); dialog.setmax(300); dia...

android - Can not update user information & ParseCloud.callFunction() missing User information -

whenever call these query, can't update user information & parsecloud.callfunctioninbackground() missing user information (request.user in cloud function null)! query#1 ((user) parseuser.getcurrentuser()) .getchats() .getquery() .include(chat_teacher1) .include(chat_student1) .findinbackground(); query#2 parsequery.getquery(rate.class) .include(rate_rater) .include(rate_rateto) .include(rate_lesson) .whereequalto(rate_rater, parseuser.getcurrentuser()) .whereequalto(rate_rated, false) .findinbackground(); query#3 parsequery.getquery(message.class) .include(message_from) .include(message_lesson) .whereequalto(message_chat, parseobject.createwithoutdata(chat.class, chatid)) .orderbydescending(message_order) .setlimit(message_per_page) .setskip(message_per_page * page) .findinbackground(); common stuff of these 3 queries ...

python - Checking if a link is active from an array -

hey guys have array , want check if websites in array active or not.one of websites in array active other not..so find out wrote code like import httplib = ['www.nri.com','www.kundis.com'] b in i: c = httplib.httpconnection(b) c.request("head", '') if c.getresponse().status == 200: print('web site exists') c2 = httplib.httpconnection(b) c2.request("head",'') if c2.getresponse().status == 302: print('website not exists') when run code prints website not exists . when used i[0] , i[1] instead of b in httplib.httpconnection() works. can guys tell me why happening ??..how can make right giving b parameter in httplib.httpconnection() .thanx help the if c.getresponse().status == 200: print('web site exists') part outside for loop, checks status code of last url called inside for loop. maybe you're looking this: import httplib = ['www.nri.com','...

datagridview - vb.net SQL causing - "Must declare the scalar variable " -

i've been stuck on error while, in vb.net trying connect sql , pull data table within day, using parameters this, datetimepicker - data saved sql in custom datetime format dd/mm/yyyy hh:mm:ss , when execute code "must declare scalar variable "@line" when remove code " [line] = @line , date >= @startdata , date < @enddata " works shows data without date range should. connect() datagridview1.autogeneratecolumns = true cmd.parameters.clear() cmd.commandtext = @"select board, defect, date, detail_x, detail_y, detail_width, detail_height [sqlccmdefects] [line] = @line , date >= @startdata , date < @enddata"; cmd.parameters.add("@line", sqldbtype.varchar, 30).value = form1.line.text cmd.parameters.add("@startdata", sqldbtype.datetime).value = datetimepicker1.value...

php - Find the students whose time interval clashes with themselves? -

in simple words. have query displays table. (students usn group concatenated, , displayed whole row foreach). row 1 => subject 1 - 22/07/2015 - 08:00 - 1xx10xx086 , 1xx10xx087, 1xx09xx088 row 2 => subject 2 - 22/07/2015 - 09:00 - 1xx10xx086, 1xx10xx087, 1xx09xx088 row 3 => subject 3 - 22/07/2015 - 08:00 - 1xx10xx096, 1xx10xx086 , 1xx09xx098 row 4 => subject 4 - 22/07/2015 - 10:00 - 1xx10xx096, 1xx10xx086, 1xx09xx098 row 5 => subject 5 - 22/07/2015 - 08:00 - 1xx10xx106, 1xx10xx107, 1xx09xx108 how shall highlight in jquery or html or php or 1xx10xx086 roll no cant attend both subject 1, subject 3 @ same day , same time can attend subject 2 @ different time slot. how shall hight light them.? assuming table , want highlight required td jquery, can next example: the idea loop table rows , compare td date info if 2 rows have td same date split , compare td groups info, if first array(all values in group td exploded , ) contains 1 or more values s...

c# - MSBuild How to pass same task to multiple projects -

i wanting run same task on multiple projects 1 build file without having copy task each project file. i getting project files in solution and: <itemgroup> <projectstobuild include="..\modules\**\*csproj"/> </itemgroup> i calling msbuild task on each projecttobuild <msbuild projects ="@(projectstobuild)" targets="dostuff" continueonerror ="false" properties="configuration=$(configuration)"> <output itemname="outputfiles" taskparameter="targetoutputs"/> </msbuild> this doesn't work, target must exist in project building. from msdn the targets must occur in project files. if not, build error occurs. is there way can pass dostuff task projects being passed msbuild task? would msbuild import element help? https://msdn.microsoft.com/en-us/library/92x05xfs.aspx just put tasks common task file, , import e...

smartface.io - Deploy or Publish iOS app on iStore using Smartface IDE without Mac -

is possible publish ios app on istore using smartface ide without mac? if please send me details same. regards, suyog you need open ios publish xcode. so, should have mac or @ least should have virtual mac in order send application apple store.

php - Send push notification to ios app : Google cloud -

i have hosted php code on google cloud. i want send push notifications ios app. have enabled port 2195 , 2196. while sending push notification got following error : warning: stream_socket_client(): ssl: connection reset peer warning: stream_socket_client(): failed enable crypto warning: stream_socket_client(): unable connect ssl://gateway.push.apple.com:2195 (unknown error) i not familiar google cloud. should make working? here code: $ctx = stream_context_create(); stream_context_set_option($ctx, 'ssl', 'local_cert', pem_file_path . 'apns-dev.pem'); $fp = stream_socket_client("ssl://gateway.push.apple.com:2195", $err, $errstr, 60, stream_client_connect, $ctx); if (!$fp) { $data['msgs'] = "failed connect $err $errstr \n"; } else { $payload = json_encode($body); $msg = chr(0) . pack("n", 32) . pack("h*", str_replace(" ", "", $devicetoken)) . pack(...

Conveniently import several classes from modules in a Python package -

i'm creating framework syntax tree. have folder/package syntax contains 1 syntax tree element class in each file, structure looks like: syntax/list.py -> contains class list syntax/block.py -> contains class block syntax/statement.py -> contains class statement now i'd import folder source file in way can access classes like block = syntax.block() is possible @ all? far, ended need syntax.block.block() not nice... project structure syntax ├── block.py ├── __init__.py the class # syntax/block.py (this file ought lowercase, leave pascalcase class names) class block(object): pass imports in __init__ # syntax/__init__.py .block import block # relative import . using package in [5]: import syntax in [6]: b = syntax.block() in [7]: b out[7]: <syntax.block.block @ 0x108dcb990> alternative if open re-organization unlike languages require put single class file same name (class block inside file block.py ), python pretty f...

visual studio - Refactoring Essentials vs. Resharper -

i'm using resharper heavily in work. i've heard visual studio 2015 there's new product available called refactoring essentials . my question how of resharper refactorings available in refactoring essentials ? how compare resharper in performance aspects? the important refactorings me: convert linq extract base class introduce [variable, parameter, field, property] extract method also wanted know if supports languages other .net javascript , typescript , css , .. the refactoring essentials tools not work languages other c# , vb - rely on roslyn, works languages. see this page comparison between vs2015 , resharper (note jetbrains product site). don't think anyone's done similar refactoring essentials.

python - how to get many2one filter value? -

i have following code calender.event inherited class . there create events number sequence . , have other field other fields 'inspection_name' etc openerp.osv import fields, osv openerp import api import logging class feedback_form(osv.model): _name = 'feedback.form' _rec_name = 'inspec_type' _columns={ 'folionum' : fields.many2one('calendar.event','maintainace id',), 'folio_number' : fields.many2one('asset.asset','folio number',), 'inspec_type' : fields.many2one('asset1.inspection','inspection type',domain="[('inspec_type' , '=' , folio_number)]"), 'frequency' : fields.char('frequency'), 'shutdown' : fields.char('shout down'), 'insp_msr1' : fields.many2one('results.measure','result',domain="[('inspec_type', '=', ins...

PHP with input form with text - do a MySQL query when form focus changes -

i looking how make input form handling in php. what need when user writes data text form (table1), , moves text form (like pressing tab, or selecting mouse), should start , mysql query see if such data written @ table1 existing in matching mysql table. my goal without pressing submit button. when google checks if username want register exists. i thinking this: $duplicate_data_test =""; if (focus has moved form field - how check ?) { $query = "select table1 testdatabase table1 = "' . (table1 form below - how data form field without post?) .'"; $result = mysqli_query($con,$query); if(mysqli_num_rows($result)>0) { $duplicate_data_test = "this data found in database. choose else"; } } echo '<form action="'.htmlspecialchars($_server["php_self"]).'" method="post">'; echo '<input type="text" maxlength="30" name="table1">'; echo...