Posts

Showing posts from January, 2011

javascript - Change normals after a reflexion on Z axis -

i have imported animated scene application. (the meshes, quaternions, , positions). z axis flipped. have make scale(1,1,-1). problem normals wrong making lighting inverted too. what's best strategy solve problem ? (i thought chaging in camera need invert z position of other objects) best regards , thank help, guillaume leclerc

Qt Creator 3.3.2: Moving views -

Image
in previous version of qt creator (i don't know one), drag , drop views. in version use (3.3.2), apparently not possible. is possible move views in 3.3.2, , if so, how? see below want achieve. also, screenshot of windows -> views menu. thanks! just disable "automatically hide view title bars" in views menu second screenshot. should have title bar above each view draggable.

python - print output of subprocess call into a label tkinter -

i trying create gui in tkinter. gui mcp23017 . trying configure input , output pins user change them according choice.. there option make inputs/outputs high or low.. now trying read pin using 'i2cget'(using seperate function).. need display output of subprocess call label on gui.. this code looks like: def read_p22(): output = subprocess.call(['i2cget -y 0x20 0x12 0xfd'],shell=true) x=print (output) label(tableframe,textvariable=x).grid(row=2,column=20) root.after(5000, read_p22) when function excutes(by pressing button), prints value '1' on python shell alternatly when press button... dont know how redirect output label.. suggest something? update:: on executing suggested commands: process = subprocess.popen(['i2cget -y 0x20 0x12 0xfd'], stdout=pipe, stderr=pipe, shell=true) output, code = process.communicate() i printed 'output' , 'process' , gave me follwing respectivley: b'' <subprocess

c# - Execute function if no user action was performed after certain time -

is there simple way how implement function (in form_activated or form_load ) if no action performed user after time app automaticly switch defaulf form? let's user log in(form change) , nothing , want system after 30 seconds automaticly execute "log out" function - go default form. i think, have implement on own. implement property "lastuseraction" or in class, needs updated each time, when user performs action. implement timer or thread, checks time, if last user action older 30 secs. if true, perform application.exit() or form closing.

php - Insert string into specific part of another string -

i've got url string, example: http://example.com/sub/sub2/hello/ i'd add subfolder php, before hello , should this: http://example.com/sub/sub2/sub3/hello/ i thought using explode separate url slashes, , adding 1 before last one, i'm pretty sure on complicate it. there easier way? this should work you: (here put folder between basename() , dirname() of string right before last part of url) <?php $str = "http://example.com/sub/sub2/hello/"; $folder = "sub3"; echo dirname($str) . "/$folder/" . basename($str); ?> output: http://example.com/sub/sub2/sub3/hello

html - Rails' Devise Edit Profile Page -

i'm trying place form field partial '_form.html.slim' when , render partial in 'edit.html.slim', form not being rendered. browser's inspector, says form element (not including input tags , submit button) being rendered in modified 'edit.html.slim'. here original 'edit.html.slim' .row .small-8.columns.small-centered .form-panel p.welcome | edit = resource_name.to_s.humanize = form_for(resource, as: resource_name, \ url: registration_path(resource_name), html: {method: :put}) |f| = devise_error_messages! .row .small-3.columns = f.label :username, class: 'right' .small-9.columns = f.text_field :username, autofocus: true .row .small-3.columns = f.label :email, class: 'right' .small-9.columns = f.text_field :email .row .small-3.columns = f.label :name, class: 'right' .small-9.colum

javascript - Are IceCandidate and SDP static? -

are icecandidate , sdp fixed values? idea store them in server database instead of retrieving on every connection? if updating these data unavoidable, when should it? no not fixed values. ice candidates locate user in network topology reside in at present , unless have static ip (which nobody has) , wired internet connection , static lan address, , desktop computer connects solely through these means , never through, say, wifi, change hourly, daily or weekly. sdp additionally contains media-setup call , other information, can change call call, , mid-call (requiring re-negotiation) if video or audio sources added, removed or altered during call. sdp may additionally contain other things expire, enough dissuade you.

javascript - i tried a html code for next and previous 5 years in a drop down.. i got next 5 years properly.. how can i get previous 5 years -

i tried html code next , previous 5 years in drop down.. got next 5 years properly.. how can previous 5 years please he;p me code function populatedropdown(yearfield){ var today=new date() var yearfield=document.getelementbyid(yearfield) var thisyear=today.getfullyear() (var y=0; y<5; y++){ yearfield.options[y]=new option(thisyear, thisyear) thisyear+=1 } yearfield.options[0]=new option(today.getfullyear(), today.getfullyear(), true, true) //select today's year } </script> </head> <body> <form action="" name="someform"> <select id="yeardropdown"> </select> </form> <script type="text/javascript"> //populatedropdown(id_of_day_select, id_of_month_select, id_of_year_select) window.onload=function(){ populatedropdown("yeardropdown") } </script> </body> </html> try this function populatedropdown(yearfield) { var today =

.Net Framework 4.5.3 missing from targeting list in visual studio 2013 -

i have installed .net framework 4.5.3 on machine visual studio not showing version in targeting list. thing happening loading project needs .net framework 4.5.3 . while loading, vs tells me have either change 4.5 or download version required. choosing download option opens browser link: http://go.microsoft.com/fwlink/?prd=12485&pver=12&sbp=targetpackmissing&plcid=0x409&o1=.netframework,version=v4.5.3 which not open , redirects me microsoft home page. any solutions?

objective c - How to filter a Parse query by an tableview index? -

i have uitableviewcontroller in application. in table performing parse query: -(ibaction)joinevent:(id)sender { pfquery *query = [pfquery querywithclassname:@"event"]; [query selectkeys:@[@"vacants"]]; [query wherekey:@"username" equalto:pfuser.currentuser.username]; [query findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error) { if (!error) { // find succeeded. nslog(@"successfully retrieved %lu scores.", (unsigned long)objects.count); // found objects (nsobject *object in objects){ nsstring *a = [object valueforkey:@"vacants"]; nslog(@"vacants %@", a); } } else { // log details of failure nslog(@"error: %@ %@", error, [error userinfo]); } [self.tableview reloaddata]; }]; } this query gets me vacants in parse cloud. what want able vacants indexpath.row of table. so far have tried use

objective c - Set a UIView in a fixed proportional position from the Right Edge of screen iOS -

say, have uiimageview or object , set in uiview subview cgrectmake this: uiview *headerview = [[uiview alloc] initwithframe:cgrectmake(0, 0, self.view.frame.size.width, 30)]; uiimageview *imgview = [[uiimageview alloc]initwithframe:cgrectmake(266, 0, 30, 30)]; [imgview setimage:[uiimage imagenamed:[self.imagedickey objectatindex:section]]]; [headerview addsubview:imgview]; here set position of imgview cgrectmake(266, 0, 30, 30)]; , counts it's position form left x position (which 266). if want set imgview 's position right side of screen? that,in different width of iphone screen shows in same ratio position. counted it's position right edge. lot in advanced. i recommend not hard coding exact positions , instead calculating x , y. way different sized screens it's not exact position , rather it's based upon views' size. uiview *headerview = [[uiview alloc] initwithframe:cgrectmake(0, 0, self.view.frame.size.width, 30)]; cgfloat p

java - Type mismatch: cannot convert from element type Object to Parent -

i'm trying develop e4 application have error : in part "error:type mismatch: cannot convert element type object parent" please in advance :) @creatable @singleton public class treecontrol { parentsholder parentholder = new parentsholder(); public parent parentexists(string str) { (parent p : parentholder.getparents()) if (p.gettag().equals(str)) return p; return null; } public child childexists(string p, string c) { parent parent = parentexists(p); if (parent != null) (child child : parent.getchildren()) if (child.gettag().equals(c)) return child; return null; } } this parent holder class public class parentsholder extends model { list parents = new arraylist(); public list getparents() { return parents; } public void setparents(list parents) { firepropertychange("parents", this.pare

intellij idea - How to hide the div structure thing next to the editor tabs -

Image
there's colored bar @ top of intellij idea editor, shows div structure. know how hide that? because everytime move cursor editor tabs, cross on bar makes editor blink. (maybe better way keep bar, turn off blinking when cursor moves across bar. possible that?) you can disable unchecking show html breadcrumbs in settings/editor/general/appearance .

html - How to set color to text within <a href> -

i have following auto-generated markup: <th id="__id__th__" class="__generated_classes__"> <a href="#" id="__id__a__" class="__other__generated_classes__"> text </a> </th> i need apply color: #21610b; . issue th , a tags generated ui -framework, can't directly affect them. thing can apply style attribute both th , a tags. html <th id="__id__th__" class="__generated_classes__"> <a href="#" id="__id__a__" class="__other__generated_classes__" style="color: #21610b;"> text </a> </th> as style inline, overwrite other styling set. javascript if unable that, can use bit of javascript change font color. pure js: var x = document.getelementbyid('someid'); x.style.color = '#21610b'; jquery: $( document ).ready(function() { $('#somei

ajax - DataTables how to use multiple data from json objects -

so i'm trying call data json file fill table. instead of having lot of json files, i'd keep of data in single file. example, have 2 types of clients (person , company) , want keep them both in same json , different objects, because each 1 goes in different table. the problem is: can't access data in json file. i can use if use 2 type of clients in different files (person.json , company.json - works fine). i did tried these 2 examples, none of them worked me. https://www.datatables.net/examples/ajax/deep.html https://www.datatables.net/examples/ajax/objects_subarrays.html so, how can data file? here json , datatable code: { "clients": { "person": [ { "cd":0, "id":"c-0010", "nm_cliente":"name aaa", "dt_nasc":"02/11/1990", "info":"some basic info&q

MySQL "Cannot add or update a child row: a foreign key constraint fails" -

i'm new mysql , databases in general. i've been tasked manually moving old database new 1 of different format. challenges include transferring columns table in 1 database database of similar format. made further difficult in source database myisam , destination innodb. so have 2 databases, source , b destination, , attempting copy 'most' of table similar table in destination database. here command run: insert b.article (id, ticket_id, article_type_id, article_sender_type_id, a_from, a_reply_to, a_to, a_cc, a_subject, a_message_id, a_in_reply_to, a_references, a_content_type, a_body, incoming_time, content_path, valid_id, create_time, create_by,change_time, change_by) select id, ticket_id, article_type_id, article_sender_type_id, a_from, a_reply_to, a_to, a_cc, a_subject, a_message_id, a_in_reply_to, a_references, a_content_type, a_body, incoming_time, content_path, valid_id, create_time, create_by, change_time, change_by a.article id not

Why eclipse creates two class files for Python? -

Image
this question has answer here: what __init__.py for? 9 answers i'm new in python loving it. i'm using eclipse ide, confused why creates 2 classes, please take @ screenshot can please tell used for? help appreciated! placing __init__.py file in folder tells interpreter/ide contain(may contain) python scrips. now in mentioned scenario, eclipse placed 2 __init__.py files 1 for/in com folder , 1 mypythonproject . means both folders contain(may contain) python files.

ember.js - Reset isDirty-flag -

i have 2 models: // subject export default ds.model.extend({ willbeactive: ds.attr('boolean') }) // studyplan export default ds.model.extend({ name: ds.attr('string'), subjects: ds.hasmany('subjects'), havachanges: function(){ var isdirty = this.get('isdirty'), subjectsdirty = this.get('subjects').isany('isdirty', true); return subjectsdirty || isdirty; }.property('isdirty', 'subjects.@each.isdirty') }) i use embeddedrecordsmixin , activemodeladapter embed inside studyplan payload subjects have changed, when promise resolved isdirty flag of each subject remains in true . can reset isdirty flag of each subject after saving studyplan ? you might interested in this package it marks parent dirty when child record dirty , clears isdirty field on child records when parent saved.

sails.js: download file in assets directory -

i create .xls file in assets/xls directory : fs.writefilesync('./assets/xls/data.xls', xls, 'binary'); and want download file : to file url : var downloadlink = req.headers.host+'/xls/data.xls'; i not understant why have 404 error on url : localhost:1337/xls/data.xls this isn't recommended practice storing generated or user-uploaded files. assets folder intended site's front-end assets. if want provide download links in app, you're encouraged save them in separate location , add controller action streams requested file client. allows add policies protect files, , avoids issues source control , grunt. see how authenticate access assets folder in sails.js example of such controller action.

c# - How to enable lazy loading of relations after INSERT in NHibernate -

i have 1 many relationship between 2 entities in nhibernate: public class application { public string taskid { get; set; } // foreign key reference public task task { get; set; } // relation/navigation property } the db.web.applications.create method calls "saveorupdate" method of nhibernate session inside transaction. the relavant mappings: internal class applicationmap : classmap<application> { public applicationmap() : base() { schema(...); table(...); compositeid() .keyproperty(app => app.userid, "...") .keyproperty(app => app.taskid, "task_id") .keyproperty(app => app.transactionid, "..."); // relations references(app => app.task, "task_id") .foreignkey("taskid") .unique() .not.insert() .cascade.persist(); } } internal class taskmap : classma

r - How do I prevent my packaged functions from being listed with ls()? -

i managed build , install r package , upon loading, functions in exported global environment , visible ls() . how can prevent behave packages on cran , not pollute global environment? you can have them start leading dot . , if not want them listed when ls() used default parameters. however, not change namespace or environment. can still see them using ls(all.names=true) .

c# - WebControl's constructor does not have correct attribute value -

i want constructor of webcontrol able access value of isspecial (from html). however, it's false . assume it's false in constructor because doesn't read value until after constructor method over. there way have knows correct value of isspecial in constructor? c#: [defaultproperty("text")] [toolboxdata("<{0}:webcontrolexample runat=server></{0}:webcontrolexample>")] public class webcontrolexample: webcontrol, inamingcontainer { private readonly int[] goodies; public webcontrolexample() { if (this.isspecial) { goodies = new int[24]; } else { //always reaches here goodies = new int[48]; } } private bool isspecial= false; public bool isspecial { set { this.isspecial= value; } } } html: <xyz:webcontrolexamplerunat="server" id="webcontrolexample" isspecial=&

R package creation questions -

i want create r package, i'm new in topic, , though i've checked excellent resources hadley wickham's r packages book , i've couple of questions i'd clarify: do need import stats package make use of lm function? how can make use of piping operator %>% in magrittr package since can not write library(magrittr) ? if created function utility purposes shouldn't available end user, how can hide it? any appreciated! do need import stats package make use of lm function? no. it's loaded automatically. need import packages not loaded when r boots (like lattice) how can make use of piping operator %>% in magrittr package since can not write library(magrittr)? i'd import hadley here in dplyr: #' @importfrom magrittr %>% #' @name %>% #' @export #' @rdname chain #' @usage lhs \%>\% rhs null if you're not using roxygen2 document i'd recommend it, if you're reading hadley'

php - Get Client Ip in Symfony2 -

i have searched, cannot seem find answer simple question: how force symfony give me ipv4 version of user's ip, or missing ? can both ipv4 , ipv6 ? thanks edit: question different, because not trying ip, know of function getclientip ( that's why in title ), want function return ipv4 , ipv6 version of ip. ( or function, way both, ipv4 , ipv6 ) edit2: how ip right now: public function getuserip() { return $this->request->getclientip(); } and returns ipv6 exclusively. ( function ran inside of own usermanager, checks , updates current user on every call, plugging event controller enter part symfony pipeline ) if user connected ipv6 there no ipv4 address display , vice versa. 1 version of ip.

c# - Create and Show a WinForm -

i´m trying create , show forms in vs 2013 generic method method: void showorupdateform<t>(ref form form) t : form { if (form == null) { form = activator.createinstance(typeof(t)) t; form.show(); } else form.windowstate = formwindowstate.normal; form.focus(); } this code got here. when try call method told that: myform1 form; showorupdateform<myform1>(ref form); it give me error: error 1 best overloaded method match 'gestioneas.gestioneas.showorupdateform(ref system.windows.forms.form)' has invalid arguments error 2 argument 1: cannot convert 'ref package.views.form' 'ref system.windows.forms.form' how can fix this? seems, want that: // i'd rather return potentially created form directly (not via "ref") // need "this" in method? that's why "static" static t showorupdateform<t>(t form = null) t: form, new() { if (null ==

python - Specify path of savefig with pylab or matplotlib -

i struggling on how find correct way specify save path (or repository) when calling function savefig in matplotlib or pylab. i tried several syntaxes, everytime python console returns : filenotfounderror: [errno 2] no such file or directory: '../mydocs/resource/frames/myimage.png' currently, have written following : pylab.savefig('../mydocs/resource/frames/myimage.png') does know how it? thanks in advance! the tilde operator , variable $home entered strings , therefore not function while saving. have provide either relative path (as did) or provide full path. eg. pylab.savefig("/home/username/desktop/myfig.png") .

html - Aligning a div with 2 divs inside it in Center -

Image
currently im trying 2 divs align in center, not quite sure how it. go left side default. i had margin-left:14 % , align in center, when re-sized window weird because aligned right side. tried with marign-left/right:auto, no result. html <div id="panels"> <div id="panel-left"> </div> <div id="panel-right"> </div> css #panels{ padding-top:15px; margin-left: auto; margin-right: auto; } #panel-left{ width:32%; min-width:209px; overflow:hidden; background-color:white; float:left; padding-left:25px; height:473px; } #panel-right{ width:32%; min-width:209px; height:473px; background-color:white; float:left; padding-left:25px; } try this: css #panels{ padding-top:15px; text-align:center; display: block; } #panel-left{ width:32%; min-width:209px; overflow:hidden; background-color:black; height:473px; display: inline-

ios - Animation for help overlay in iPhone Application -

Image
how create animations implement layout in iphone applications in below image: desired effect : when hand image moves , point icon, ripple effect shown. how implement ? you can implement using core animation. use uibezierpath make circle layer , animate radius. open source zfripplebutton provides similar effect, , starting point.

Unable to install pip in Docker -

unable install pip in docker running ubuntu version 14.04. see below log. root@57da7dd8a590:/usr/bin# apt-get install pip reading package lists... done building dependency tree reading state information... done e: unable locate package pip root@57da7dd8a590:/usr/bin# did apt-get update before that? and then apt-get -y install python-pip

c++ templates dependent on input from file -

i have complicated c++ scientific code, uses multiple libraries. imagine there 5 different types of libraries, linear solver, integration tool, etc. each library type there several different libraries same thing, have different internal implementation. in fact, every library wrapper class implemented, such libraries of same type have same interface. now, want give software user. want user able select libraries want use after code compiled. done means of input file. the problem coding in main program. when coding library selection, end using nested ifs, explicitly coding every possible combination of libraries, conditioned on parameters read file. wondering if there tidy way this. you can't implement templates dependent in input files, since template types resolved in compilation, not runtime. the tidy way polymorphism (also, elegant way ;d). define base class defines interface each implementation, create children classes each 1 it's own implementation, , th

sql - Pass value in php -

hi have modules links in student page after click on 1 of these links want pass id of specific module next page,so how can pass id value , code, please help. $sql = "select * module,user user_access_level = module_level , '$user_id' = user_login "; $result = $db->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { echo '<li><a href="personal.php?id=".$g['module_id']."\">'.$row["module_id"].' '.$row["module_name"].' '.$row["module_points"].'</a></li> '; } } here code of quotes, concatenations, backticks , backward logic corrected: $sql = "select * `module`, `user` `user_access_level` = 'module_level' , `user_login` = '". $user_id."' "; $result = $db->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()

javascript - History.js first load -

i'm using history.js jquery. my page search engine. the form submitted via $.ajax() , result loaded in div#results pagination. click on next page's link handled $.ajax too. each result link page. when first load form, want div#results empty. when click on result's link button, want div#results same results. $('.link_page').on('click', function(e){ e.preventdefault(); var page = $(this).data('page'); $.ajax({ url: '/search', method: 'post', data: { create_date : $('#create_date').val(), page : page } }).done(function( html ) { $( "#results" ).html( html ); history.pushstate({results: html}, "search", "/search"); }); }); history.adapter.bind(window, 'statechange', function (evt) { var state = history.getstate(); $( "#results" ).html( state.data.results ); }); history.adapter.ondoml

ruby - Appium iOS kill app without the plist being removed -

i trying run following steps: 1. launch app first time, see terms , agreement 2. agree terms , agreement 3. kill app , relaunch 4. should not see terms , agreement right now, appium running on without --no-reset flag, since need app reset between scenarios, following re-launched app plist deleted (it's remove app , relaunch again) sleep(3) pf_name = $driver.caps['platformname'] pf_ver = $driver.caps['platformversion'] dev_name = $driver.caps['devicename'] auto_accept_alert = $driver.caps['autoacceptalerts'] app_path = $driver.caps['app'] appium::driver.new({ caps: { platformname: pf_name, platformversion: pf_ver, devicename: dev_name, autoacceptalerts: auto_accept_alert, app: app_path, noreset: true} }) $driver.restart $driver.close_app $driver.launch_app i tried $driver.close_app , $driver.launch_app, did same thing (remove plist killing app). is there way can kill app without removing plist? i found answer. it's o

bash - Performing variable substitution in a string -

i have string contains use of variable, , i'd substitute variable's value string. right best have is #!/bin/bash foo='$name; echo bar' name="the name" expanded="$(eval echo "$foo")" echo "$expanded" which has obvious defects: prints the name bar while i'd print the name; echo bar instead of eval can bash's regex matching bash's string replacement: foo='$name; echo bar' name="the name" [[ "$foo" =~ \$([[:alnum:]]+) ]] && s="${!bash_rematch[1]}" && expanded="${foo/\$${bash_rematch[1]}/$s}" echo "$expanded" name; echo bar

java - is it possible to use @transactional annotation with a transaction opened by hand (spring/hibernate) -

i have spring application works hibernate , annotations. open session hand done in how manually open hibernate session? stack overflow answer. now want use method of service in method opens session itself. service annotated transactional statement. possible tell method use transaction opened hand? e.g. @transactional("transactionmanager") class service1 { public lazyobject somemethod(); } class metaservice { @autowired sessionfactory sf; service1 s1; public somemethod() { session s = sf.opensession(); s.begintransaction(); // tell method use s's transaction // without annotating somemethod() @transactional lazyobject lo = s1.somemethod(); ( lazyatt la : lo.getlazyatt() ) { la.dosomething(); } s.flush(); s.gettransaction().commit(); s.close(); } } for wondering why want it, check question: https://stackoverflow.com/questions/29363634/how-to-o

php - How to bypass %23 (hash sign) through RewriteRule without data loss? -

i have following .htaccess file: rewriteengine on rewritecond %{request_uri} !^/command rewriterule .* /command/rewritehandler.php?q=%{request_uri} [b] see specs @ unanswered question https://stackoverflow.com/questions/29376788/mod-rewrite-directives-and-valid-invalid-utf-8-characters-after-first-character . if request server following /aaa%23%23aa rewritehandler.php receives /aaa . looks request_uri handles data before %23 . should type instead? capture value rewritecond , use back-reference make work: rewriteengine on rewritecond %{request_uri} (.+) rewriterule !^command/ /command/rewritehandler.php?q=%1 [nc,b,l,qsa]

python - Django Time_Zone not saving correct values -

i have following settings in settings.py regarding time zones. time_zone = 'asia/kolkata' use_tz = true using datetime field, save particular time date: 2015-04-01 time: 22:00:00 it still gets stored 2015-04-01 16:30:00 in database on querying returns 04:30 pm 01/04/2015 in admin still shows date: 2015-04-01 time: 22:00:00 how fix error? there setting i'm missing in settings.py ? with windows, have change operating system timezone able reliably work: https://docs.djangoproject.com/en/1.7/ref/settings/#time-zone note django cannot reliably use alternate time zones in windows environment. if you’re running django on windows, time_zone must set match system time zone.

How do I ignore the initial load when watching model changes in AngularJS? -

i have web page serves editor single entity, sits deep graph in $scope.fieldcontainer property. after response rest api (via $resource), add watch 'fieldcontainer'. using watch detect if page/entity "dirty". right i'm making save button bounce want make save button invisible until user dirties model. what getting single trigger of watch, think happening because .fieldcontainer = ... assignment takes place after create watch. thinking of using "dirtycount" property absorb initial false alarm feels hacky ... , figured there has "angular idiomatic" way deal - i'm not 1 using watch detect dirty model. here's code set watch: $scope.fieldcontainer = message.get({id: $scope.entityid }, function(message,headers) { $scope.$watch('fieldcontainer', function() { console.log("model dirty."); if ($scope.visibility.savebutton) {

java - Why does AbstractStringBuilder.append behave differently for MIN_VALUE? -

consider following methods in java.lang.abstractstringbuilder long public abstractstringbuilder append(long l) { if (l == long.min_value) { append("-9223372036854775808"); return this; } int appendedlength = (l < 0) ? long.stringsize(-l) + 1 : long.stringsize(l); int spaceneeded = count + appendedlength; ensurecapacityinternal(spaceneeded); long.getchars(l, spaceneeded, value); count = spaceneeded; return this; } integer public abstractstringbuilder append(int i) { if (i == integer.min_value) { append("-2147483648"); return this; } int appendedlength = (i < 0) ? integer.stringsize(-i) + 1 : integer.stringsize(i); int spaceneeded = count + appendedlength; ensurecapacityinternal(spaceneeded); integer.getchars(i, spaceneeded, value); count = spaceneeded; return this; } why abstractstrin

shell - Searching for calls to a function with a certain number of arguments / where the N-th argument matches a regex -

i looking unix command line tools (to used on linux , mac os x gnu tools installed) allows me search through source code of large c++ (or java, or ...) project , 1 or both of following: given name of function , positive integer n, find calls function n-th parameter equal value resp. matches regex find calls function number of arguments function n (alternatively: @ least / @ / less / greater than). of course in full generallity, may arbitrarily hard, assuming here code base sufficiently nice, parameters function calls strings, numbers, other function calls, arithmetic expressions, etc., not, say, lambda expressions or other crazy stuff. not mind occassional false positive, , don't worry class names / templates etc. being confused function name. indeed, if 1 worries false positives / negatives, variation list occurance of function name, , each list number of arguments, or unknown if script failed determine it. i pretty sure write perl script of need, seems such usef

java - STS-3.6.4-RELEASE tcserver not configured after tcruntime-instance.sh -

i installed sts-3.5.4-release , used tcruntime-instance.sh script define new server. able create new server in sts using "new" menu item , selecting "existing instance" option pointing server created using tcruntime-instance.sh script. however, when attempt run new server, fails error message: apr 01, 2015 1:08:21 org.apache.catalina.startup.catalina load warning: catalina.start using conf/server.xml: error @ (23, 68) : org.apache.catalina.core.jasperlistener apr 01, 2015 1:08:21 org.apache.catalina.startup.catalina load warning: catalina.start using conf/server.xml: error @ (23, 68) : org.apache.catalina.core.jasperlistener apr 01, 2015 1:08:21 org.apache.catalina.startup.catalina start severe: cannot start server. server instance not configured. any suggestions of how solve issue appreciated, since using tcruntime-instance.sh script worked create new servers prior upgrading sts.3.6.4-release version. when created server tc server instance comman

resources - Changing the URL/IP of angularjs ngresource in ionic -

i use user selected ip address change rest url more 1 time, may have serval server ip addresses, after factory file loaded after app start, ip addresses ($rootscope.baseurl) cannot changed. is there anyway can change path again? p.s. console.log("$rootscope.baseurl") can output value, after return part, not working. controller: $scope.authenticateuser = function(){ $rootscope.$broadcast('ipchanged', $scope.user.ip); } factory: .factory( 'models', function ($rootscope, $resource, constants) { $rootscope.$on('ipchanged', function(event, data) { $rootscope.baseurl = "http://" + data + "/rest" console.log("$rootscope.baseurl") }); return{ appmaster_user_session: $resource($rootscope.baseurl + '/user/session', { app_name: constants.api.appname }, { '

python 3.x - django-nocaptcha-recaptcha always shows additional verification box -

i installed django-nocaptcha-recaptcha , integrated form: from nocaptcha_recaptcha.fields import norecaptchafield class clientform(forms.modelform): captcha = norecaptchafield() it shows fine on form, whenever click on additional dialog pops asking enter text , verify. happens every time. tested computer on network , still asks additional verification after clicking box. this looks like: additional verification dialog box here's how i'm handling form: @xframe_options_exempt def registration(request): if request.method == 'post': clientform = clientform(request.post) # check whether it's valid: if clientform.is_valid(): new_client = clientform.save() ... what doing wrong? problem django-nocaptcha-recaptcha? should use else? p.s. i'm using django 1.7.1 python 3.4 restart server , don't forget clear browser's cache. hope helps.

mysql - PHP comparing two datavalues -

i've been trying compare 2 strings, 1 username user entering, , 2nd 1 data program pulls database. here php code: $sqlcheck = "select username location username ='$usernamebeingreq'" ; $result2 = mysqli_query($con, $sqlcheck); $result2 = mysql_fetch_array($result2); $resultcheck = false; //mysqli_query($con, $sqlcheck); if((strcmp($result2, $usernamebeingreq) == 1)) { $sql="insert pending_req (fromuser, touser) values ('$username', '$usernamebeingreq')"; $resultcheck = true; } $usernamebeingreq equal user enter in, , result should equal when pulls database. i'm not sure why it's not working correctly. you cannot combine mysql_ , mysqli_ this. also, need iterate through result set value , compare then: $result2 = mysqli_query($con, $sqlcheck); while ($row2 = mysqli_fetch_array($result2)) { $username_to_check = $row2['username']; } $resultcheck = false; if((strcmp($username_to_check , $us

google chrome - GAS not working on windows machine -

i created application using gas , html service. works on safari , chrome on mac, using different logins google apps account, same accounts, not run on of browsers in windows machine. regards, arjun code load page function doget(e) { logger.log( utilities.jsonstringify(e) ); if (!e.parameter.page | e.parameter['page'] == 'index'){ var template = htmlservice.createtemplatefromfile('index'); var htmloutput = template.evaluate() .setsandboxmode(htmlservice.sandboxmode.iframe); return htmloutput; } return htmlservice.createtemplatefromfile(e.parameter['page']).evaluate(); } the page not loading <style type="text/css"> #header { height:100px; background:green; font-size:300%; color: black; align-content: centre; } body { padding: 50px; } .animate { transition: 0.1s; -webkit-transition: 0.1s; } .action-button { position: relative; padding: 10px 40px; margin: 0px 10px 10px

c# 4.0 - How can I display error icon in cell of datagridview -

i working datagridview. need display error icon in each cell of datagridview, if cell empty. cells validated on button click , error icon need displayed. can please share ideas regarding same. you can use cellpainting event custom visuals on cells. it's lot of work add icon 1 column, msdn provides lot of example code can steal , modify suit own needs.

audio - Java - playing some of *.wav files outside of IDE fails -

i have 3 wav files 3 different sources, , 1 file working. runs fine in eclipse, whenever compile it, doesn't. short clips < 1 second. 1 of them should played, when hover on buttons. here code use playblack: static eventhandler<mouseevent> menuhover =new eventhandler<mouseevent>() { @override public void handle(mouseevent event) { try{ clip clip = audiosystem.getclip(); file menuhover = new file("menuhover.wav"); audioinputstream inputstream = audiosystem.getaudioinputstream(menuhover.getabsolutefile()); clip.open(inputstream); clip.start(); clip.setframeposition(0); } catch (exception g) { g.printstacktrace(); } } }; the 1 working has format of (pcm_unsigned 22050.0 hz, 8 bit, mono, 1 bytes/frame) and 1 isn't (pcm_signed 48000.0 hz, 16 bit, stereo, 4 bytes/frame, little-endian) i converted not working files, same format working one, still doesn't work. checked, if file output has correct path, has. don't errors. do hav

sql server - getting error on pivot for syntax when converting rows as column -

i using sql server , wants table rows columns when convert query give me error on keyword incorrect syntax near '1'. query select strvalue,1,2 (select strvalue,nsectionattributeid, (row_number() on (partition nsectionattributeid order nsectionattributeid ) ) colum tblattributedata )temp pivot ( max(nsectionattributeid) colum in (1,2) )piv select strvalue,1,2 (select strvalue,nsectionattributeid, (row_number() on (partition nsectionattributeid order nsectionattributeid ) ) colum tblattributedata )temp pivot ( max(nsectionattributeid) colum in ([1],[2]) )piv

filenotfoundexception - External properties files in Webshpere Application server -

i placed properties file in profile_root/properties folder of server. when application searches file filenotfound exception. on other hand, able search existing properties file. should changed in server once property file has been added. properties properties = new properties(); properties.load(new fileinputstream(new file("c:\\websphere\\appserver\\profiles\\appsrv01\\properties\\example.properties"))); system.out.println(properties.getproperty("en"));

node.js - NodeJs - Refactored Authenticate middleware callback error -

i experiencing refactoring issue , cannot see how correct matter: 1. section of code, not refactored, works properly: 'use strict'; // use svcs when refactoring var svcs = require('../../../services/ensure-authenticated.server.service'), config = require('../../../config/config.server.config.js'), ctrl = require('../../../controllers/index.server.controller'), express = require('express'), router = express.router(); // remove when refactoring var jwt = require('jwt-simple'); var moment = require('moment'); // refactored function ensureauthenticated(req, res, next) { if (!req.headers.authorization) { return res.status(401).send({message: 'please make sure request has authorization header'}); } var token = req.headers.authorization.split(' ')[1]; var payload = jwt.decode(token, config.token_secret); if (payload.exp <= moment().unix()) { return res.

javascript - Creating a countdown timer script that instead of a specific date counts the duration of a sound file -

i've created sound installation exhibition. sound file last 24 hours. create site file. want stark , simple possible. dark background , white countdown start once file start's streaming , countdowns until file ends. that's hour 24 00:00. all countdown scripts count specific date , restart themselves. is possible? so if right want know how make progress bar? i'd if don't want niddy-griddy parts, i'd recommend bootsrap , jquery. i made example of do: http://jsfiddle.net/1tq6scga/3/ //js var song_seconds = 10; c = 0; = 0; var invt = setinterval(function(){ c = i/song_seconds; c = (math.round(c * 100 * 100)/100) + '%'; $('.progress-bar').html(c); $('.progress-bar').css({'width':c}); i++; if(i === song_seconds + 1) { clearinterval(invt); } }, 1000); so make variable max length of song in seconds. i'd wrap in function , once button play clicked code ran in background, ,

css - Bootstrap CCS ul width issue - list elements arent as wide as the parent element -

i'm trying create layout bootstrap 3 , finding odd property: here code: <div class="jumbotron"> <div class="container center-form panel admin"> <div class="col-md-12"> <ul class="list-unstyled" ng-repeat="app in apps | filter:query "> <li> <h4> <a ui-sref="/api/admin/{{app._id}}">{{app.name}}</a></h4> <div style="width:100%"> <p class="pull-right"><small> job id: {{app._id}}</small></p> <p>appointment date: {{app.appointment_date | date:'fulldate'}}</p> </div> <br> <address class="text-left"> {{app.address_1}}</br> {{app.city}}</br> {{app.postcode}}</br>

java - Android Canvas rendering -

Image
i'm making game , want partially hide canvas of surfaceview this: from this: this: is there way canvas methods? in advance. put code in method draws on canvas: path invertedcircle = new path(); int radius = (canvas.getwidth() < canvas.getheight()) ? canvas .getwidth() / 4 : canvas.getheight() / 2; invertedcircle.addcircle(canvas.getwidth() / 2, canvas.getheight() / 2, radius, direction.cw); invertedcircle.setfilltype(filltype.inverse_even_odd); paint p = new paint(); p.setcolor(color.black); canvas.drawpath(invertedcircle, p); this fills except circle (at center) black. if have drawn rectangles , white background first should close.

android - How Get height of the Status Bar and Soft Key Buttons Bar? -

is there way in android size of soft buttons bar , status bar togheter? or way go screen height without height of both these bars? (they not same, @ nexus 7 example) height of status bar the height of status bar depends on screen size, example in device 240 x 320 screen size status bar height 20px , device 320 x 480 screen size status bar height 25px , device 480 x 800 status bar height must 38px so recommend use script status bar height rect rectangle = new rect(); window window = getwindow(); window.getdecorview().getwindowvisibledisplayframe(rectangle); int statusbarheight = rectangle.top; int contentviewtop = window.findviewbyid(window.id_android_content).gettop(); int titlebarheight= contentviewtop - statusbarheight; log.i("*** value :: ", "statusbar height= " + statusbarheight + " , titlebar height = " + titlebarheight); to height of status bar on oncreate() method of activity, use method: public int getstatusbarheig

c++ - Error loading GLEW library (error LNK2001) -

this question has answer here: what undefined reference/unresolved external symbol error , how fix it? 27 answers i install glew library visual studio: x64/bin/glew32.dll %systemroot%/system32 x64/lib/glew32.lib {vc root}/lib include/gl/glew.h {vc root}/include/gl include/gl/wglew.h {vc root}/include/gl and add library in linker > input: glew32.lib , write #pragma comment #pragma comment(lib, "opengl32.lib") #pragma comment(lib, "glu32.lib") #pragma comment(lib, "glut32.lib") #pragma comment(lib, "glew32.lib") #include <iostream> #include <windows.h> #include <glew.h> #include <glut.h> but visual studio continues write error: 1>core.obj : error lnk2001: unresolved external symbol __imp____glewbindvertexarray 1>core.obj : error lnk2001: unresolved external symbol __imp____glewgenvert

java - Create an object instance of a subclass from an external class -

i've created application attaches events class of jbuttons , other swing components instantiate many times in gui class. the class menuitemeventhandler attached each menu item. works fine when menuitemeventhandler class external. need inside gui class instead of external. i'm left issue of not being able reference event handler subclass external class in same package. possible so? below guiclass , eventhandler subclass public class guiclass { // gui behaviour public class menuitemeventhandler extends abstractaction { private string avariable; private static final long serialversionuid = 1l; @override public void actionperformed(actionevent arg0) { // update jlist added item } } below external class want reference event handler can attach collection of gui objects. it's making reference menuitemeventhandler class cant achieve. public class menuitem { resturantgui.menuitemeventhandler action = resturantgui.ne

mysql - How to working with mx.rpc.Responder in AS3 -

i trying use library called assql serving operations mysql. in use, saw works method called asyncresponder mx.rpc package available flex applications ... question is, how can use method in conventional as3, or use function solve problem? package { import com.maclema.mysql.statement; import com.maclema.mysql.connection; import com.maclema.mysql.resultset; import mx.rpc.asyncresponder; import com.maclema.mysql.mysqltoken; import com.maclema.util.resultsutil; import flash.display.movieclip; import flash.events.event; public class crud extends movieclip{ //the mysql connection private var con:connection; public function crud() { oncreationcomplete(); } private function oncreationcomplete():void { con = new connection("localhost", 3306, "root", "", "banricoop-game"); con.addeventlistener(event.connect, handleconnected);

c++ - What is the current state of support for 'thread_local' across platforms? -

i'd summary of current state of support 'thread_local' keyword across different compilers , platforms. i'm interested in common desktop , mobile platforms. information find seems spotty @ best reports of working on platforms , not on others or mentions of support being wip. answers confirm support (or lack of support) single platforms welcome. please mention caveats support if there any. windows (gcc, clang, msvc) linux (gcc, clang) os x (gcc, clang) android (gcc, clang) ios blackberry windows phone/rt/etc in complement other excellent answer: msvc 2013 doesn't support it. this page on support of core language features claims it's partially supported. however, looking @ details appears that: thread-local storage listed "partial" because vc has provided non-standard extension __declspec(thread) many years. (notably, c++11 thread_local supports non-pods, __declspec(thread) doesn't.) it's implemented i

java - Bringing a joptionpane infront of all other windows -

the concept simple. i'd bring joptionpane frame in front of all other open windows/applications. i'd without of applescript (external java) or third party library. pure java. i have searched on couldn't find 1 single non-third party solution. (.tofront() "focuses" on window doesn't display in front.) the joptionpanel , jdialog code: joptionpane optionpane = new joptionpane(p4.msg, joptionpane.information_message, joptionpane.yes_option); jdialog dialog = optionpane.createdialog("important1!"); dialog.setvisible(true); where p4 object containing public string. try this, assuming calling joptionpane frame, pass frame reference using this, should show on top of @ least running program assuming has focus. joptionpane.showmessagedialog(this, p4.msg,"important1!", joptionpane.information_message);

c# - SQL SELECT depending on multiple variables and tables -

i'm trying create select query, problem here multiple variables suitable different table. to make clear i'll present database tables : category catid catname subcategory catid subcatid subcatname company companyid compname subcat model compid modelid modelname posts postid modelid now, parameters : cat, subcat, category, modelid , name, , need select matching results of postid suits parameters. e.g, if following parameters : cat = "electronics" subcat="computers" company="apple" modelname="macbook air" keyword="new" i need following results of posts category equals cat variables, , subcategory matches subcat variable , on.. , in addition filter result using %like% keyword variable got. unfortunately failed after lot of tries trying solve it. tried using inner join in different ways, didn't work. i appreciate if can me this, because got not ide

gorm - Grails 3.0.0 findOrCreateBy() missing -

unless i've missed seems findorcreateby() dynamic methods missing in 3.0. intentional? thanks you must missing something. it's still there, both in documentation , in source code on github.

c# - Why am I getting 30 draw calls from an empty GameObject in my scene in Unity3D? -

Image
first of all, i'm talking setpass calls, understand draw calls. i have empty gameobject use camera target in game. i've positioned above character , when reaches x height camera moves up. with camera target enabled, 60 setpass calls. when disable it, around 30. why simple object produce many setpass calls? here's screenshot empty gameobject enabled: here's screenshot without gameobject enabled: here empty gameobject: this reference empty gameobject(cameratarget): void fixedupdate(){ if (cameratarget != null){ if (cameratarget.transform.position.y > thistransform.position.y) { thistransform.position = new vector3 (0, mathf.smoothdamp (thistransform.position.y, cameratarget.transform.position.y, ref velocity.y, smoothtime), 0); } } } when disable empty gameobject during gameplay game runs fine , camera still follows empty gameobject though it's disabled , i'm getting way less setpass calls... weird. edit: the