Posts

Showing posts from August, 2010

How to load external javascript file into Robomongo UI? -

i want load lodash while db scripting in robomongo's shell. i've tried doing load('lodash.min.js') in db script, shell doesn't see library. db script , library in same directory. what did workaround now, set absolute path loading library. load('/absolute/path/to/the/library/');

uwp - How to programmatically open a child view on a specified monitor in unversal windows platform app? -

in universal windows platform app, possible programmatically create second view (which possible) show on secondary monitor (or third.. )?? how that? update i've looked @ projection sample seems allow 1 secondary view projected. whenever new view created , projected, prior 1 closed. there anyway have multiple on multiple monitors? update able hwnd (thanks so) of uwp corewindow object. unfortunately, top level hwnd of corewindow still doesn't let me manipulate outer-most uwp window chrome. looks there's else sits on top of top-level hwnd of corewindow. directx component, perhaps? so ultimately, how manipulate uwp window beyond basics of maximizing, minimizing, etc, , able take uwp window, put on monitor of choice, , maximize it, code?? , app built targeting desktop, not arm.

php - Use preg_replace() to Isolate Number in Source Code -

i trying pick out single value (in instance, value 544007664) source code of page pulling of youtube. right now, script have loading source code youtube page , removing "<" , ">" symbols when echo source code, displays text , doesn't display page itself. 2 preg_replace() functions (here on lines 4 , 5) pull out before , after desired value not doing expect them do. the thing can think of preg_replace() refusing read single string text in reality several dozens of individual lines. <?php $str = file_get_contents('https://www.youtube.com/watch?v=5xr7naz_zza'); $str = $str; $str = preg_replace('~^(.)+(meta name="twitter:app:id:ipad" content=")~', '', $str); $str = preg_replace('~(" meta name="twitter:app:url:iphone")+(.)$~', '', $str); $str = preg_replace('~<~', '', $str); $str = preg_replace('~>~', '', $str); echo $str; ?> any appreciat...

java - Libgdx - 3 images in a group, best practice - also overdraw -

Image
i trying write card game, have image in middle, coloured border , potentially symbol in top left. using libgdx , stage/scene2d. the image change depending on suit (these not normal 52 deck type of cards), border colour change match suit, though colour can pre determined user can't pre-save coloured images (though guess pre save 15 diff colours , give user choice of 15) , symbol on cards , not others. as can see 2 images i've added have 2 diff images, border colours , symbols. my question relating groups , overdraw. 1) presume should set group 3 images in, , i'm hoping having won't slow game down have potentially 30 cards on screen @ once , 30 groups 3 images in each lot draw. right , libgdx able handle fine? 2) how should coloured border? should have entire card coloured rectangle , image drawn on top? draw method trying draw coloured section underneath image , wasting gpu/cpu time? friend of mine said have white image, , set colour using rgb values in ...

regex - Weird backslash substitution in Ruby -

i don't understand ruby code: >> puts '\\ <- single backslash' # \ <- single backslash >> puts '\\ <- 2x a, because 2 backslashes replaced'.sub(/\\/, 'aa') # aa <- 2x a, because 2 backslashes replaced so far, expected. if search 1 /\\/ , , replace 2, encoded '\\\\' , why this: >> puts '\\ <- 1 ... replace 1 2'.sub(/\\/, '\\\\') # \ <- 1 backslash, though replace 1 2 and then, when encode 3 '\\\\\\' , 2: >> puts '\\ <- 2 ... 1 3'.sub(/\\/, '\\\\\\') # \\ <- 2 backslashes, though replace 1 3 anyone able understand why backslash gets swallowed in replacement string? happens on 1.8 , 1.9. this issue because backslash (\) serves escape character regexps , strings. use special variable \& reduce number backslashes in gsub replacement string. foo.gsub(/\\/,'\&\&\&') #for string foo replace each \ \\\ edit: should ment...

iphone - Adding a sub row in table view cell -

this question exact duplicate of: toggle removal/addition of subviews tableview cell 1 answer i working on project in making to-do-application , making on table view give functionality add button on each cell , on click of button want add child cell in hierarchy clicked cell , same cells. can please tell me how this? thankful. thank in advance. here code: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; } uibutton *button = [uibutton buttonwithtype:uibuttontypecontactadd]; button.tag = indexpath.row; button.fra...

SQL Server query to remove the last word from a string -

there's answer question in mysql tag. decided make lives easier , put answer below sql server users. happy see different answers perhaps better performance. happy coding! select substring(@yourstring, 1, len(@yourstring) - charindex(' ', reverse(@yourstring)))

gsub - Get the encoding charset in R -

i need extract encoding charset web page, found regex syntax can different tag syntax (?<=([<meta|<meta])(.*)charset=)([^"'>]*) in general how make regular expression syntax works within gsub in r

python - Unicode Dash not detected by if statement -

using python 2.7.11 dashes utf-8 document i'm reading in being ignored if statements intended detect them. dash prints console '-' character, , when shown representation displays u'-'. character passed through ord() displays ordinal 45, same dash character. segment = line[:section_widths[row_index]].strip() line = line[section_widths[row_index]+1:] if segment: print 'seg' if segment u'-' or segment '-': print 'dash detected' continue print "ord %d" % ord(segment[0]) do not use is equality check. use == equality check. >>> 'stringstringstringstringstring' == 'string' * 5 true >>> 'stringstringstringstringstring' 'string' * 5 false is should used identity check.

xaml - How to force a WPF control or its bindings to load before it's visible -

for efficiency, appears wpf loads visual elements when necessary. if need them load when parent loads? for example, have split-button control drop-down checklistbox . each checklistbox item bound isselected property , select command. changing isselected in viewmodel has same effect clicking row in control, once drop-down portion of control loaded. before select command doesn't react changes in isselected property (presumably) because binding , command don't yet exist. there clean way force split-button's contents load @ same time it's parent loads, or otherwise connect it's bindings @ initialization rather when first entering visual tree?

html - new line with "NoWrap" -

it possible put labels above of each textbox without using table ? problem when try put "new line" inside "nowrap". basically got array of array, have "name" , "value", value changed user, first set of elements display side side, next set of elements display below, side side, , go on. can simple code, labels @ left of component. <style> .nowrap{white-space:nowrap;margin-top:5px;margin-left:5px;} </style> <div style="border:1px solid black; width:500px;height:800px;overflow:auto;"> <div class="nowrap"> label a1 <input type="text" /> label a2 <input type="text" /> label a3 <input type="text" /> label a4 <input type="text" /> </div> <div class="nowrap"> label b1 <input type="text" /> </div> <div class="nowrap"> label c1 <input type=...

Android sqlite tables to json file -

i new json. trying 2 sqlite tables json text file. able fetch each table , send text file results invalid if try read string file. here code: file f = new file(constants.default_backup_file_path); fileoutputstream fos = new fileoutputstream(f,true); printstream ps = new printstream(fos); string query1 = "select " + col_1 + "," + col_2 + " " + table_1; cursor cursor1 = db.rawquery(query1, null); cursor1.movetofirst(); jsonobject mobject = new jsonobject(); jsonarray tab1array = new jsonarray(); int = 0; while (!cursor1.isafterlast()) { jsonobject robject = new jsonobject(); try { robject.put("id", cursor1.getstring(cursor1.getcolumnindex(col_1))); robject.put("user", cursor1.getstring(cursor1.getcolumnindex(col_2))); cursor1.movetonext(); tab1array.put(i, robject); i++; } catch (jsonexception e) { ...

java - Android task: click a button, go to a layout to edit personal info. click the submit button, save and display the info -

i working on small task android app. , dont know things need or things should careful for. in user's personal page, there button user can click in. goes layout there 2 buttons "cancel" , "submit". below them, there blank space user can edit personal info. (here keyboard should automatically pop up). after clicks "submit", info saved , app goes personal page , info entered displayed. if user has text info, after clicks edit button, whitebox in layout should has info has entered. can re-edit , submit again. any type of hints , guidelines appreciated!! thank much!!! this sounds place use activity results. can make screen user enters information activity , , start calling activity.startactivityforresult() . once user finished , clicks done, store result activity.setresult() , call finish() close activity. original activity opened screen callback in onactivityresult() data set in setresult() . pretty common task there should pl...

Amazon EC2: How to restore ~/.ssh/authorized_keys file? -

i accidentally overwritten entries in .ssh/authorized_keys. no longer able connect ec2 instance using .pem file. tried generate new .pem file, hoping process add entries .ssh/authorized_keys, didn't. tried read documentation, confusing me. can give simplified explanation/instructions on appreciated. if instance ebs-based, can following: get correct copy of authorized_keys file ready. off 1 of instances, or reconstruct whole cloth, or grab off snapshot, or use new pem file, or whatever. stop instance can't reach ( do not terminate it ). step unavoidable. if can't stop instance because it's running important, you're sol. detach root volume stopped instance. should /dev/sda1 . sure give name can find in volume list. attach different instance @ mount point, /dev/sdp . mount volume tmpdir on instance. mkdir /tmp/myrootvol && mount /dev/xvdp /tmp/myrootvol . note device name vary based on version of linux (if you're using linux @ all). o...

sql - How to automatically create rows in table after updating another table -

i developing web application. in database of web application, have table named daily in making entries on daily basis. let has 3 columns a, b , c. have table named monthly in store same a, b, c values on monthly basis. want when 1 month completes i.e no of entries in daily table becomes 30 or 31 new row gets created automatically in monthly table a, b, , c values contain sum of values in daily table of corresponding a, b, c values. want know how can using sql , if not other way ? gordon linoff's response way go, depending on database, os, programming language etc. another way create "trigger" on daily table, automatically performs summarization when row last day of month inserted. please note: triggers tricky, , can complicate maintenance , replication. i'll make little more concrete, make explanation easier. also, details of syntax depend on specific choice of database. answer use postgresql syntax. here's daily table. have added column con...

django summernote create custom buttons -

i'd add custom button similar one: $('#makesnote').click(function(event) { var highlight = window.getselection(), spn = document.createelement('span'), range = highlight.getrangeat(0) spn.innerhtml = highlight; spn.classname = 'snote'; spn.style.color = 'blue'; range.deletecontents(); range.insertnode(spn); }); js fiddle http://jsfiddle.net/ypweuw1l/ i'm not sure how go adding django app? don't see in django-summernote docs. i don't know django-summernote well. can create custom button , use on toolbar options. for more details... http://summernote.org/deep-dive/#custom-button

c++ - Find argc and argv from a library -

how find program's argc , argv shared object? writing library in c loaded via ld_preload . i've been able find stack 2 different ways: read rsp via inline __asm__ call. read /proc/<pid>/maps , parse entry stack. i can create pointer, point @ stack segment, iterate through looking data. problem can't figure out efficient way determine bytes argc , pointer pointer argv strings. i know /proc/<pid>/cmdline contains arguments, each separated 0x00 , i'm interested in finding in memory. in gdb see dword argc followed qword first pointer. 20 bytes before address of argc pointer points main program's code segment. that's not deterministic way identify argc , argv . i've seen few posts no working code: http://linux.derkeiler.com/newsgroups/comp.os.linux.development.system/2005-07/0296.html https://sourceware.org/ml/libc-help/2009-11/msg00010.html this response in second link contains working source code w...

oracle - Query is not filtering data properly -

i have filteration gridview on basis of project_id , date , vehicle_no but query not filtering properly. issue is:- if filter today's date , check, record not show , data, correct. but if filter exact date , project_id , vehicle_no should show 1 record. still doesn't shows record. below query filteration. strquerry = "select distinct sv.mkey, vehicle_no, to_char (date_in, 'dd/mm/yyyy') || ' & ' || time_in vehicleindate_time, to_char (date_out, 'dd/mm/yyyy') || ' & ' " + "|| time_out vehicleoutdate_time, gate_no_in || ' & ' || gate_no_out ingate_outgateno, gd.good_type goods_type, net_weight netweight, to_char (challan_date, 'dd/mm/yyyy') " + "|| ' & ' || challan_no challandate_no,remark_in remarkin, null receipt_no, date_in xxcus.xxgid_supinv sv, xxcus.xx_supinv_goodtype gd, " + "xxcus.xxacl_xxgid_user_mst ms (gd....

android - KSOAP and web server communication (PropertyInfo) -

so i'm developing android app should connect web service. connection working fine. i've tested using simple method returns "hello christian". displayed correct in app. if try parameter (name) returns "hello null". technically i'm working android 4.2.2 , ksoap 2.6.5. web service running on oracle weblogic v12. following source code: private final string namespace_local = "http://test.com/"; private final string url_local = "http://168.185.226.69:7001/neuesprojekt/neuerwebserviceservice"; private final string soap_action_local = "hello_action_name"; private final string method_name_local = "helloname"; private final string url_local = "http://168.185.226.21:7001/mytest/mytestwebserviceservice"; private final string soap_action_local = "hello_action_extend"; private final string method_name_local = "hello_extend"; public void localserver(view view) {...

dom - Creating a document from url javascript -

this i've tried: function createdocumentz() { var doc = document.implementation.createhtmldocument('http://www.moviemeter.nl/film/270',null,'html'); return doc; } even though document gets created, if run firebug says body node has no childnodes, idea why? looks assume can use createhtmldocument() download , parse html file url you've passed first parameter. not case, createhtmldocument() creates empty document. also, parameters you've passed function of createdocument() . createhtmldocument() takes 1 parameter, document title. if you'd use createdocument() , first parameter uri of namespace , not source document. unfortunately there's no way download , manipulate external web site's html using javascript alone. closest can displaying document in iframe.

php - multidimensional array with unknow key's -

i'm having multidimensional array don't know keys , need key's value. my array database filled: $rows[$product_id][$productgroup_id] = $amount so array example filled 2 products: $rows[108][3] = 2 $rows[2][5] = 4 so array holds 2 product: product_id 108 productgroup 3 amount of 2 product_id 2 productgroup 5 amount of 4 now need walk through array , need keys , amount. i'm thinking in foreach loop foreach($rows $row){ foreach($row $key => $value){ echo "key:".$key." value: ".$value."<br>";" } } but echo's first key, product_id , amount. need product_id, productgroup_id , amount. how productgroup_id? the code have far there, need extract both id's foreach loop. foreach($rows $product_id => $group){ foreach($group $productgroup_id => $value){ echo "product id:" . $product_id . " group:".$productgroup_id." value: ".$value."<br>...

sql - select from v$lock in powershell -

i try run fragment (as sys/ sysdba): try{ $conn = new-object data.odbc.odbcconnection $conn.connectionstring= $connectionstring $conn.open(); $q = "select * v$lock "; $reader = (new-object data.odbc.odbccommand($q,$conn)).executescalar(); write-host $reader $conn.close() } catch { write-host ( $_.exception.message ) } on toad can select v$lock, in script have ansver like exception calling "executescalar" "0" argument(s): "error [42s02] [oracle][odbc][ora]ora-00942: table or view not exist where cause of problem? powershell thinks referring variable $lock on statement instead of string literial v$lock : $q = "select * v$lock "; you got either escape $ symbol backtick ` or use single quotes don't expand variables. what's more, idiomatic powershell doesn't use semicolon statement terminators. so, $q = 'select * v$lock ' # single quotes don't expand variables $q = "s...

javascript - Highcharts graph series multiplies -

Image
i'm using knockout.js towards otrs rest api generate graphs in highcharts, of odd reason series i'm adding highcharts seems multiplies itself. this knockout.js model: function otrsviewmodel() { var self = this; self.api_url = 'https://localhost/otrs/nph-genericinterface.pl/webservice/rest-api'; self.username = 'api_user'; self.password = ''; self.priorities = [ 'white', 'green', 'amber', 'orange', 'red' ]; self.queues = [ ‘queue1’, ‘queue2’, 'queue3' ]; self.selectedqueues = ko.observablearray(); self.selectedpriorities = ko.observablearray(); self.statsbyqueueandpriority = function() { var endpoint = '/ticket/search'; chart.xaxis[0].setcategories(self.selectedqueues()); // iterate on every queue async.each(self.selectedpriorities(), function(prio...

load balancing - HAProxy rewrite HTTP requests based on HTTP method -

i have rest api. for sake of simplicity lets have 2 services: read.request.com write.request.com how can rewrite read requests (get method) read.request.com , write requests (post, put, delete methods) write.request.com haproxy? not quite sure of these applicable situation 1 is. one backend i think situation. frontend http-in bind *:80 acl is_post method post acl is_get method http-request set-header host write.request.com if is_post http-request set-header host read.request.com if is_get default_backend api backend api server 1 localhost:8080 check all check method being used , sets host header accordingly before passing request on localhost:8080 . two backends in set have have 1 instance of code running read requests , instance write requests. in case read code running on localhost:8080 , write code running on localhost:8081 . frontend http-in bind *:80 acl is_post method post acl is_get method ...

Python JSON formatter -

i new python. starting experiment small programs. saw question : input of json can of format : '[ ["a","b","c"], [1,2,null], [null,3,4], [5,null,6] ]' or : '[ { "a":1, "b":2 }, { "b":3, "c":4 }, { "c":6, "a":5 } ]' we should convert : output = '{ "a": [1,null,5], "b": [2,3,null], "c": [null,4,6] }' so far can think of checking each element , appending result. there easy or better way in python. please enlighten me. try python 3 : def get_elements(json_txt): import json arr = json.loads(json_txt) new = {} list_of_keys = [] list_of_keys_from_dicts = [list(elem.keys()) elem in arr] # getting keys json keys in list_of_keys_from_dicts: key in keys: if key not in list_of_keys: list_of_keys.append(key) key in list_of_keys: new[key] = [] element in arr: key in list_of_keys: if key in...

ios - String to time format in objective c -

here code, nsstring *starttime =@"05:00:00"; it in string format ,i want in hh:mm:ss ,please how do, did, shows 1999-12-31 23:30:33 nsdateformatter *dateformat = [[nsdateformatter alloc] init]; [dateformat setdateformat:@"hh:mm:ss"]; nsdate *starttime = [dateformat datefromstring:starttime]; just add time zone so: nsstring *starttime =@"5:00:00"; nsdateformatter *dateformat = [[nsdateformatter alloc] init]; [dateformat setdateformat:@"hh:mm:ss"]; [dateformat settimezone: [nstimezone timezonewithname:@"utc"]]; nsdate *starttime = [dateformat datefromstring:starttime]; which convert : 2000-01-01 05:00:00 utc

r - how can I eliminate a loop over a datatable? -

i've 2 data.table s shown below: n = 10 a.dt <- data.table(a1 = c(rnorm(n,0,1)), a2 = na)) b.dt <- data.table(b1 = c(rnorm(n,0,1)), b2 = 1:n) setkey(a.dt,a1) setkey(b.dt,b1) i tried change previous data.frame implementation data.table implementation changing for-loop shown below: for (i in 1:nrow(b.dt)) { (j in nrow(a.dt):1) { if (b.dt[i,b2] <= n/2 && b.dt[i,b1] < a.dt[j,a1]) { a.dt[j,]$a2 <- b.dt[i,]$b1 break } } } i following error message: error in `[<-.data.table`(`*tmp*`, j, a2, value = -0.391987468746123) : object "a2" not found i think way access data.table not quite right. new it. guess there quicker way of doing cycling , down 2 datatables. i'd know if loop shown above simplified/vectorised. edit data.table data copy/paste: # a.dt a1 a2 1 -1.4917779 na 2 -1.0731161 na 3 -0.7533091 na 4 -0.3673273 na 5 -0.159569 na 6 -0.1551948 na 7 -0.0430574...

Installer built with install4j - Tab order on the License Agreement screen works partially -

on default license agreement screen on install4j-built installer, tab order (navigating across buttons using tab , shift+tab buttons) not work correctly. although tab order partially works (you can navigate between "back", "next", "cancel" buttons), once user hits couple of tab keys after "cancel", control lost , have use mouse on track. also, default, focus on agreement text box (or multi-line text panel) , there, tab order not work @ all.

ios - Cannot invoke initializer for type 'NSAttributedString' with an argument list of type -

this question has answer here: convert html plain text in swift 5 answers i followed example decode html values. to decode json parsed value: answered akashivskyy i had code , getting following error: let encodedstring = "the weeknd &#8216;king of fall&#8217;" let encodeddata = encodedstring.datausingencoding(nsutf8stringencoding)! let attributedoptions : [string: anyobject] = [ nsdocumenttypedocumentattribute: nshtmltextdocumenttype, nscharacterencodingdocumentattribute: nsutf8stringencoding ] let attributedstring = nsattributedstring(data: encodeddata, options: attributedoptions, documentattributes: nil, error: nil)! let decodedstring = attributedstring.string error: cannot invoke initializer type 'nsattributedstring' argument list of type '(data: nsdata, options: [string : anyobject], documentattributes: _, err...

c# - How should I share filtering logic between multiple LINQ-where clauses? -

let a class whith property hello . filter collections of a instances property in many places. i'd make somewhere static member of type expression<func<a, bool>> denotes filtering predicate , use in places filtering. (this predicate transformed orm concrete db-specific expression.) next. there exists class b property of type a . filter collection of b instances same logic used in first case (by property hello of class a ). question . correct way implement , reduce code duplication? my suggestion . add 3 things: 1) interface iwitha property of type a , 2) class witha<t> implementing interface iwitha , providing property of type t , 3) static property of type expression<func<iwitha, bool>> implementing filtering logic. demo code following. public static void main() { var listofas = new list<a>().asqueryable(); var query0 = listofas .select(a => new witha<a> { = a, ...

php - Twig Assignment operator -

i want calculate total numbers specific field in twig in php template, can make so <?php $tl = 0; ?> <?php foreach($loo $l):> <?php $tl += $l['amount'] ?> <tr> <td><?php echo $l['amount'] ?> </tr> <?php endforeach ?> <p><?php echo number_format($tl,2) ?> how in twig? i tried {% set tl = 0 %} {% task in tasks %} {% set tl += {{ task.amount }} %} {% endfor %} {{ tl }} it doesn't work ideas? looks twig doesn't support combined operators php do. (i not find example in http://twig.sensiolabs.org/doc/templates.html#setting-variables ) maybe relevant: how make addition 2 variable twig? could use try separate operator version? {% set tl = tl + task.amount %}

ios - UIView inside UIView, drag to show the content -

Image
i have view , inside have view, lower view should show top area of view, hard describe let following images talks :) 1- first case, when app launches see 2 uiview's, 1 added below other "in case lower view 1 below". 2- lets suppose put following picture image view in upper view: 3- when put image point 2 inside upper view should this: 4- , when drag upper view should expand on lower view , start showing rest of uiimageview follows: 5- , if drag in upper side of screen should following: so, idea how achieve that? not clear question. however, try dragging , dropping uiview libraries drop , drag uiview

javascript - Change the value of label with change in drop-down value using JQuery -

i trying change value of label change in drop-down value using jquery not working. please me fix this. <select id="myselect"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> <br/> <label id="label"></label> <br/> $("label").val("150.000.000"); $(("#myselect").val()).on('change', function() { if ($("#myselect").val() == '1') { $("#label").val("150.000.000"); } else { $("#label").val("350.000.000"); } }); your selector attached change event incorrect, need provide id of element string, not value of element itself. also, label elements don't have value ne...

java - Spring WS No adapter for endpoint error -

i trying create new spring web service in eclipse , test in soapui. when try run request in soapui gives me below error. no adapter endpoint [public org.jdom.element com.pmp.adminendpoint.handlesigninrequest(org.jdom.element) throws java.lang.exception]: endpoint annotated @endpoint, or implement supported interface messagehandler or payloadendpoint? below admin.xsd <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:admin="http://pmp.com/admin/schemas" elementformdefault="qualified" targetnamespace="http://pmp.com/admin/schemas"> <xs:element name="signinrequest"> <xs:complextype> <xs:all> <xs:element name="email" type="xs:string"/> <xs:element name="password" type="xs:string"/> </xs:all> </xs:complextype> </xs:element> ...

c# - When i pick an object from the ground, my script does something unexpected -

i'm working on script can pick item, , drop click of left mouse button. i'm planning on addint rotating of item , icons display whenever 1 of actions. i'm new this, might trowing myself out in depths. try. here's code: public class pickup : monobehaviour { public transform onhand; // use initialization void start () { } // update called once per frame void update () { if(input.getmousebutton(1)){ this.transform.position = onhand.position; } } void onmousedown () { getcomponent<rigidbody>().usegravity = false; this.transform.position = onhand.position; this.transform.parent = gameobject.find("player").transform; } void onmouseup () { this.transform.parent = null; getcomponent<rigidbody>().usegravity = true; } } so far kind of works.. i've trouble picking object, not let me. have click couple of times, before gets hold on object. when does, objects starts flying upwards weird reason not u...

javascript - AngularJS UI-Grid Sort -

how can sort following data response of ui-grid date this.$http.get(url) .success(data => { this.$scope.gridoptions.data = data //.slice(firstrow, firstrow + paginationoptions.pagesize); }).finally(() => { this.$scope.loading = false; this.$scope.loadattempted = true; }); i reponse array of objects , 1 of properties of type dob, 1 want sort by. here goes sample of array [ { "name":"john", "dob" : "12/07/1987" } { "name":"jack", "dob" : "12/07/1989" } { "name":"sara", "dob" : "12/07/1980" } ] thanks, you can use javascript sort method desired result this. result = response.sort(function(a, b) { return new date(a.dob).gettime() - new date(b.dob).gettime() }) the result should this. [ { "name":"sara", "dob" : "12/07/1980" }, { "nam...

angularjs - Avoid state transition occuring twice in $state.go or uisref -

using uirouter, trying navigate child state [a.childa url "localhost:90/a/childa/212"]to different state [b], transition occuring twice [like on click of button url changes "localhost:90/a/childa/212" localhost:90/a/childa , on clicking again changes localhost:90/b". need localhost:90/a/childa/212 directly change localhost:90/b using uisref or $state.go. how can it? $stateprovider.state('a', { url: '/a', templateurl: 'assets/templates/a.html', controller: 'actrl' }).state('a.childa', { url: '/childa/:id', templateurl: 'assets/templates/childa.html', controller: 'childactrl' }); $stateprovider.state('b', { url: '/b', templateurl: 'assets/templates/b.html', ...

android - Shared prefrenences input error due to Gson -

i io exception every time try save object json shared preferences. w/sharedpreferencesimpl: writetofile: got exception: java.io.ioexception: java.nio.charset.coderresult[malformed-input error erroneous input length 1] @ com.android.internal.util.fastxmlserializer.flush(fastxmlserializer.java:245) @ com.android.internal.util.fastxmlserializer.enddocument(fastxmlserializer.java:198) @ com.android.internal.util.xmlutils.writemapxml(xmlutils.java:193) @ android.app.sharedpreferencesimpl.writetofile(sharedpreferencesimpl.java:600) @ android.app.sharedpreferencesimpl.-wrap2(sharedpreferencesimpl.java) @ android.app.sharedpreferencesimpl$2.run(sharedpreferencesimpl.java:515) @ android.app.sharedpreferencesimpl.enqueuediskwrite(sharedpreferencesimpl.java:536) @ android.app.sharedpreferencesimpl.-wrap0(sharedpreferencesimpl.java) @ android.app.sharedpreferencesimpl$editorimpl.commit(sharedpreferencesimpl.java:458) from log seams give bad string do...

node.js - install express using npm install in windows 7 -

i getting following error. because behind network proxy. kindly tell me how install npm modules when 1 behind proxy. d:\nodemva-master\nodemva-master\07_basicexpress>npm install -g express npm err! windows_nt 6.1.7601 npm err! argv "c:\\program files\\nodejs\\node.exe" "c:\\program files\\nodejs\\ node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "express" npm err! node v4.2.1 npm err! npm v2.14.7 npm err! code enotfound npm err! errno enotfound npm err! syscall getaddrinfo npm err! network getaddrinfo enotfound registry.npmjs.org registry.npmjs.org:443 npm err! network not problem npm npm err! network , related network connectivity. npm err! network in cases behind proxy or have bad network settin gs. npm err! network npm err! network if behind proxy, please make sure npm err! network 'proxy' config set properly. see: 'npm config' npm err! please include following file support request: npm err! d:\nod...

ios - Autosize uistackview by device resolution size -

Image
i have stack view on layout, when try bigger device ipad, image views inside stackview doesn't autosize: i think did mistake on constraints or stack view can't resize resolution ? how can manage layout have grid format , resize image view inside ?

i need to rename a multiple files in a folder with numbers increament in python -

i need rename multiple files folder numbers increament in python.i.e. first file in folder gets renamed 1 , second file name 2.like that..how solve this you should first iterate through files in directory , , rename files. it might this: import os # let's want rename files in current directory index = 1 filename in os.listdir(os.getcwd()): os.rename(filename, '_'.join([str(index),filename])) index += 1 this can approach , should adapt needs.

html - Bootstrap Affix Problems: Adds Top Margin -

i have affix sidebar wich enables after data-offset-top="360" thing when affix enabled, sidebar doesn't keep it's place , gets top margin. here code using: <div class="col-md-4" class="page-sidebar"> <div data-spy="affix" data-offset-top="360" data-offset-bottom="0"> <ul class="nav nav-pills nav-stacked nav-categories"> <li role="presentation"><a href="#">telefoane mobile, tablete si laptopuri <span class="badge">0</span></a></li> <li role="presentation"><a href="#">pc, componente si periferice <span class="badge">0</span></a></li> <li role="presentation"><a href="#">tv, audio, foto si gaming <span class="badge">0</spa...

android - Start an activity from a fragment -

i have 2 fragments on both fragments button. when press button i'd start new activity. can't work. the error i'm getting: error here: type mismatch: cannot convert mfragmentfavorite fragment what doing wrong? myfragmentpageradapter import android.support.v4.app.fragment; import android.support.v4.app.fragmentmanager; import android.support.v4.app.fragmentpageradapter; public class myfragmentpageradapter extends fragmentpageradapter{ final int page_count = 3; /** constructor of class */ public myfragmentpageradapter(fragmentmanager fm) { super(fm); } /** method invoked when page requested create */ @override public fragment getitem(int arg0) { switch(arg0){ case 0: return new favoriteactivity(); //error: type mismatch: cannot convert favoriteactivity fragment case 1: return new settingsactivity(); default: return null; } ...

Java Factory using Generics, .class vs. .getClass() -

i searched , tried more day , not find solution common problem have in java. reason obvious - type erasure. question have is: there no solution problem in java? willing investigate more time since kind of problem pops every once in time. the error is: the method dostrategy(capture#2-of ? extends i) in type istrategy<capture#2-of ? extends i> not applicable arguments (i) so simplified problem following example. imagine model: package model; public interface { //there actual 30 classes implementing i... } public class implements { public void somespecificmagicfora(){ system.out.println("a"); } } public class b implements { public void somespecificmagicforb() { system.out.println("b"); } } and selection logic package strategy; import model.a; public interface istrategy<t> { public void dostrategy(t t); } public class astrategy implements istrategy<a> { @override public void dost...

android - Cannot set visibility after using ObjectAnimator -

i using nineoldandroids animations. trying achieve apply animation button before hiding it. so, apply animations button , call setvisibility(view.gone), seems it's not taking effect. button still on screen , handles clicks. should 'reset' somehow button state after applying animations? final button button = (button) getview().findviewbyid(r.id.user_to_button); button.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { objectanimator.offloat(animatorproxy.wrap(v), "alpha", 1, 0).setduration(100).start(); objectanimator.offloat(animatorproxy.wrap(v), "translationx", 0, -v.getwidth()).setduration(100).start(); v.setvisibility(view.gone); } }); if remove animations works expected - hides button. use before setvisibility after animation completed: anim.reverse(); anim.removealllisteners(); anim.end(); anim.canc...

java - Maven lifecycle mapping -

i have parent [project] pom have the <plugin> <groupid>org.eclipse.m2e</groupid> <artifactid>lifecycle-mapping</artifactid> <version>1.4.0</version> .... </plugin> in subproject [childpom], getting error on first line <?xml version="1.0" encoding="utf-8"?> incompatible lifecycle mapping plugin version 1.4.0 jump definition in parent pom. further env details: ide : jboss jeveloper studio v9.0.0 jdk : java 8 64 bit. maven : apache-maven-3.3.3 i new maven, pls suggest me went wrong? different eclipse depends different lots of locale jar files. try use relation version of eclipse version. can find version number installation folder. should in features or plugins. maybe 1.6.2. can try!

reactjs - Rails with react, react-router gems fails to precompile when pushing to Heroku -

remote: -----> preparing app rails asset pipeline remote: running: rake assets:precompile remote: rake aborted! remote: nomethoderror: undefined method `resolve' nil:nilclass remote: /tmp/build_c973337fb25108cb9d5546369a8b22b0/vendor/bundle/ruby/2.0.0/gems/react-router-rails-0.13.3.2/lib/react/router/rails/railtie.rb:11:in `block in <class:railtie>' remote: /tmp/build_c973337fb25108cb9d5546369a8b22b0/vendor/bundle/ruby/2.0.0/gems/react-router-rails-0.13.3.2/lib/react/router/renderer.rb:78:in `call' remote: /tmp/build_c973337fb25108cb9d5546369a8b22b0/vendor/bundle/ruby/2.0.0/gems/react-router-rails-0.13.3.2/lib/react/router/renderer.rb:78:in `setup_combined_js' remote: ... remote: ! precompiling assets failed. remote: ! remote: remote: ! push rejected, failed compile ruby app

visual studio - C# Suppress MS Fakes warnings -

how can suppress warnings generated ms fakes in build ? edited xml file generate elements need, it’s not enough. error message cannot generate shim restservicehelper`2+<>c: type not supported because of internal limitations. xml sample <fakes xmlns="schemas.microsoft.com/fakes/2011/"; diagnostic="false"> <assembly name="common.api"/> <stubgeneration> <clear /> </stubgeneration> <shimgeneration> <clear /> <add fullname="restservicehelper" /> </shimgeneration> </fakes> i have read thread before asking question: suppressing microsoft fakes warnings thanks

sublimetext2 - Sublime Text 2/3 - How to always have at least 10 lines under current line? -

is there way show @ least x number of lines below current line in st? cursor on line 55, want sublime display @ least 10 more lines below current line line 55 never @ bottom of screen. possible in sublime? you can achieve simple plugin, listens cursor movement events. from tools menu in sublime text, click new plugin . replace contents following: import sublime, sublime_plugin class showlinesunderselectionlistener(sublime_plugin.eventlistener): def show_lines_under_selection(self, view, number_of_lines_to_show): cursor_pos = view.sel()[0].end() row, col = view.rowcol(cursor_pos) desired_pos = view.text_point(row + number_of_lines_to_show, col) if not view.visible_region().contains(desired_pos): view.show(desired_pos, false) def on_post_text_command(self, view, command_name, args): if command_name in ('word_highlight_click', 'move', 'move_to', 'insert'): self.show_...

sql server - Which order of joins is faster? -

Image
i'm looking @ ms sql server database developed company expert @ database design (or i'm told) , noticed curious pattern of joins/indexes. it's upside down have done, wonder if has performance benefits (the db big). the table structure (simplified pseudocode) is: table jobs (about 1k rows): job_id [int, primary key] server_id [int, foreign key] job_name [string] table job_history (about 17m rows): history_id [int, primary key] job_id [int, foreign key] server_id [int, foreign key] job_start [datetime] job_duration [int] note denormalization server_id in both tables. what did is: select t1.job_name, t2.job_start, t2.job_duration jobs t1 inner join job_history t2 on (t1.job_id = t2.job_id , t1.server_id = t2.server_id) t1.server_id = @param_server_id , t2.job_start >= @param_from , t2.job_start <= @param_to and have indexes: jobs => (server_id) job_history => (job_id, server_id, job_start) in other wo...