Posts

Showing posts from May, 2012

JavaScript Sort by date multidimensional Json array -

this question has answer here: sort array of objects string property value in javascript 31 answers i have following multidimensional array want sort loc_time. var json = [{ "id": 5, "lieu_depart": "la rochelle", "lieu_arrivee": "lyon", "condlocalisation": [{ "id": 1, "longitude": "-3.120830", "latitude": "52.801452", "adresse": "paris", "loc_time": "25 jun 2012, 8:00 am" }, { "id": 3, "longitude": "2.130122", "latitude": "48.801408", "adresse": "versailles", "loc_time": "15 may 2013, 6:40 pm" }, { "id": 5,

java - Implementing an adapter for RecyclerView in Android -

i trying implement flexible space image pattern of material design. in order so, followed this tutorial . the problem is, tutorial uses recyclerview , , have view i'd use simple scrollview relative view: <scrollview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="fill_parent" android:layout_height="fill_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingleft="20dp" android:paddingright="20dp" > <textview android:id="@+id/loggedintitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_ali

unity3d - facebook unity sdk 7.0.2 - FB.IsLoggedIn returns false when you reopen the app but should still be logged in -

prior upgrading 7.x version of unity fb sdk, fb.isloggedin return true after fb.init. now, returning false , have new login every time. this seems bug. i'm on unity 5.1.1p4 , building android. haven't tried ios yet. reproduction steps: start app, login fb close app start app again, not automatically logged in fb (fb.isloggedin false) expected behavior: fb.isloggedin should true if logged in. how worked before. in fbunityinterface.mm : add - (id)init : [[fbsdkapplicationdelegate sharedinstance] application:[uiapplication sharedapplication] didfinishlaunchingwithoptions:null]; replace in - (void)configureappid : [fbunityutility sendmessagetounity:fbunitymessagename_oninitcomplete userdata:@{} requestid:0]; with: if ([fbsdkaccesstoken currentaccesstoken]) { fbsdkaccesstoken *token = [fbsdkaccesstoken currentaccesstoken]; nsinteger expiration = token.expirationdate.timeintervalsince1970; [fbunityutility sendmessagetounity:fbunity

ruby - Keep google analytics tracking id confidential Rails 4 -

my question within google analytics how keep ga_tracking_id out of source code ? tried achieve through environment variable value of key in source see. here relevant code. production.rb config.ga_tracking_id = env['ga_tracking_id'] application.html.erb <%# google analytics (only in production environments) %> <% if rails.env.production? %> <script> (function(i,s,o,g,r,a,m){i['googleanalyticsobject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new date();a=s.createelement(o), m=s.getelementsbytagname(o)[0];a.async=1;a.src=g;m.parentnode.insertbefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', '<%= rails.configuration.ga_tracking_id %>', 'auto'); ga('send', 'pageview'); </script> <% end %> then set k

html - Unexpected CSS Positioning Bug -

Image
i have following code : <!doctype html> <html> <head> <title>kastflix</title> <style type="text/css"> .moviepane { background-color: #181816; top: 41px; left: 181px; position: fixed; width: 100%; height: 100%; } .movietile { background-color: #181816; margin-top: 13px; margin-left: 12px; margin-right: 12px; width: 135px; height: 235px; display:inline-block; vertical-align: top } .movieposter { width: 135px; height: 197px; border:1px solid #000000; border-radius: 3px; transition: 0.5s; position: absolute; } .movieposter:hover { border:1px solid #0094ff; } .linkoverlay { width: 137px; height: 199px; background-color: #000000; opacity: 0; transition: 0.5s; pointer-events: none; } .movieposter:hover + .linkoverlay { opacity: 0.6; } </style> </head> <body> <div class="moviepane"> <div class="movietile"> <a href="a"> <img class="movieposter&quo

objective c - Vendored framework inside of pod not recognized by project or other pods (Cocoapods/Cocoapods #3810) -

in project, reference several private pods company uses. 1 of these pods called dkkit dependent on private pod i've included called baseprokit. baseprokit contains 3 frameworks references inside of header , implementation files, believe considered vendored_frameworks . in existing header files of baseprokit, there references these frameworks via imports #import <ppcommon/ppcommon> work fine (usually) when compiling while solely relying on baseprokit pod. however, when dkkit included, there header alias dkkit looks when importing ( baseprokit.h ) contains above import. however, in context of dkkit, seem dkkit pod unaware of existence of ppcommon framework, , sees header files' aliases referenced via pods-baseprokit. because of this, , references <ppcommon/anything> create compilation errors (not found), , way i've been able figure out far referencing via #import "ppcommon.h" require me adjust of imports in entire baseprokit project, , doesn'

dictionary - Now I have map marker for categories. I want to add a default map marker to google map. How? -

from demo here here . can see if clicked check box restaurants or parks. markers show up. these markers item of both 2 categories. i want add 1 more map marker default position of map. i tried add this, it's not working. var map; var var_location = new google.maps.latlng(45.430817,12.331516); function map_init() { var var_mapoptions = { center: var_location, zoom: 16, maptypeid: google.maps.maptypeid.roadmap, pancontrol:false, rotatecontrol:false, streetviewcontrol: false, scrollwheel: false, }; map = new google.maps.map(document.getelementbyid("map"), var_mapoptions); var contentstring = '<div id="mapinfo">'+ '<p><strong>peggy guggenheim collection</strong><br>'+ 'dorsoduro, 701-704<br>' + '30123, venezia<br>'+ 'p: (+39) 041 240 5411</p>&

javascript - Fade in web elements on page load using jQuery -

trying main logo , enter button fade in when web page loads. tried below code in addition taking divs out after code, no luck. any ideas? thank in advance. <!doctype html> <html> <head> <title>the webspace of reality</title> <meta charset="utf-8" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="stylesheet" href="style.css"> </head> <body> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> <script> $(function() { $("#mainimage").hide().fadein("slow", function() { $("#enterbutton").hide().fadein("slow") }); }); </script>

Programming selectable Pebble Watchfaces (Time) -

i have started pebble watchfaces programming on pebble time, , although watchface displays fine, loaded application , not watchface, in available in list of applications, not watchfaces sub-menu. found there watchface online development sites produce actual watchfaces installed such. what difference ? have add code make watchface ? or manifest file ? samples sdk applications, not watchfaces. thanks :-) watch apps can more things watch faces can. example, watch faces can't respond button clicks. sdk (cloudpebble or c sdk) generates different code 2 types of programs. have tell trying build. in appinfo.json file there section "watchapp": { "watchface": false }, change false true , should start showing watch face

javascript - Simple Return to Top Button Does Not Work with AngularJS -

i writing web app using angularjs on frontend , i'm implementing return top button @ bottom of page. <h1 id = "top"> .......... <a href="#top">return top</a> however, not work @ all. i'm lost because has worked before on other apps not use angular. have different here? add target="_self" href solve problem. @chandermani

twitter4j - setSince and setUntil don't work -

i'm having problem filter tweets specifics dates, using setuntil come no tweets, using setsince come tweets.. code following , after output result.. public void readtweetfromkeyword(string keywordstring) throws twitterexception { twitter4j.query query =new twitter4j.query("#clt20"); queryresult result; query.setsince("2014-12-12"); int cont = 0; result = twitter.search(query); (status status : result.gettweets() ) { system.out.print("original "+status.getid()); system.out.println("\t\tdata "+status.getcreatedat()); if(!status.gettext().substring(0, 2).equals("rt")){ system.out.println(status.gettext()); cont++; } } system.out.println(result.gettweets().size()); system.out.println("cont = "+cont); return; } console: original 619433499116896256 data fri jul 10 06:10:29 gmt-03:00 2015 if @bcci look

fragment conversion error in Android -

myfragment frag = fragmanager.findfragmentbyid(r.layout.testing_res); testing_res layout hosting activity . it's spitting error @ me though **required**: com.example.blahblah.blah.myfragment; **found** :android.app.fragment; any suggestions why? code fragment class public class myfragment extends fragment { @override public void oncreate(bundle savedstate) { super.oncreate(savedstate); } @override public view oncreateview(layoutinflater i, viewgroup v, bundle state) { return i.inflate(r.layout.my_fragment, v, false); } } try changing following import import android.app.fragment to import android.support.v4.app.fragment

html - Bootstrap navbar items not spacing to my adjustments no matter how many I make -

i'm trying make navbar items responsively space end or @ least close i'm using media queries , padding space them no matter how increment padding or size increase increment at, of navbar buttons still drop line below i'm trying avoid. here's navbar code followed css. site i'm working on http://staging.kareemhackett.com/home.html i'm working on around fix not catching breaks it's small oversight, appreciated. <nav class="navbar transparent navbar-static-top" role="navigation"> <nav class="navbar-inner"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#example-nav-collapse"> <span class="sr-only">toggle navigation</span> <span class=

regex - Java Find Substring Inbetween Characters -

i stuck. use format read player's name in string, so: "[player_yourname]" i have tried few hours , can't figure out how read part after '_' , before ']' there name. could have help? played around sub strings, splitting, regex , no luck. thanks! :) btw: question different, if split _ don't know how stop @ second bracket, have other string lines past second bracket. thanks! you can do: string s = "[player_yourname]"; string name = s.substring(s.indexof("_") + 1, s.lastindexof("]"));

How to awk every nth line starting from different lines each iteration -

i awk print every nth line out of file starting line 0. then, after awk has gone through whole file, print every nth line starting line 1...then print every nth line starting line 2...etc, printing every nth line starting line n-1. sad attempt far: #!/bin/bash rm *.sad *.sadd *.out #create loop index in $(seq 20 1 36); listm+=($i) done #create input file j in "${listm[@]}" if [ $j -eq 20 ]; awk 'nr % 20 == 0' vel_vmdout > atomvel.dat awk '{print $2,$3,$4}' atomvel.dat > velocity.dat else awk 'nr % 20 == 1' vel_vmdout > $j.sad egrep -v "^[[:space:]]*$|^#" $j.sad > $j.sadd awk '{print $2, $3, $4}' $j.sadd > $j.out paste velocity.dat $j.out > taste fi done let me try clarify providing input , output should like. th input xyz file of md simulation consisting of frames of at

css - Unable to connect the Bootstrap stylesheet -

i brief , concise believe there quick fix current issue. using bootstrap using blank template , cannot stylesheet connect reason? files live within same directory. patience wearing thin due unnecessary set backs. if have answers or suggestions appreciataed:). i've posted html below, thanks! justin <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- above 3 meta tags *must* come first in head; other head content must come *after* these tags --> <title>justin henderson</title> <!-- bootstrap --> <link href="../css/bootstrap.css" rel="stylesheet"> <!-- html5 shim , respond.js ie8 support of html5 elements , media queries --> <!-- warning: respon

Alert box is not showing inside codeigniter controller -

in controller alert box not working inside if loop.if condition working,only problem alert box,but not showing dialog box.please help. tried many times. controller erp_c function tabl() { $result['query2']=$this->erp_m->getregion(); $this->load->view('head1'); $this->load->view('header3'); $this->load->view('userregionview',$result); } function userregioninsert($user) { if($this->input->post()) $m1=$this->input->post('reg'); // print_r($m1);die; $result['query']=$this->erp_m->insertregion($m1,$user); $result['query2']=$this->erp_m->getregion(); // print_r($result['query']);die; if(($result['query'])>0) { ?> <script type=text/javascript>alert("region added");<

Using Groovy with Multiple TestNG Parameters -

i trying pass in multiple parameters testng annotated method class written in groovy. understand correct formats multiple testng parameters following: @parameters({"category", "exampledesc"}) //option 1 @parameters(value = {"category", "exampledesc"}) //option 2 however, i'm using groovy, see following error: ';', '}' or new line expected if follow either option 1 or 2 in error see cannot assigned 'class' 'string[]'. this problem not exist when using java. there way pass in multiple parameters testng annotated methods groovy? curious, i'm using @dataprovider in area of code. thank in advance! here's snitbit of code: public class test { @beforeclass @parameters({"a", "b"}) public def before(a, b) { //code here } } in groovy make list or array of strings, need use [] instead of {} , annotation becomes: @parameters([&q

objective c - Capturing NSEvent to add modifier Issue -

i'm trying programmatically hold down option key user in cocoa app. for life of me can't seem grab nsevent modify , re-post it. still want capture mousedown event because use location - i've been trying grab event , add modifier flag doesn't seem work. on appreciated. this i've done: - (void)mousedown:(nsevent *)theevent { [super mousedown:theevent]; if(!(theevent.modifierflags == nsalternatekeymask)){ nsevent *newevent = [nsevent keyeventwithtype: theevent.type location:theevent.locationinwindow modifierflags:nsalternatekeymask timestamp:theevent.timestamp windownumber:theevent.windownumber context:theevent.context characters:@""

java - How can I convert a HashMap<String, ArrayList<String>> to a HashMap<String, String[]>? -

i have hashmap<string, arraylist<string>> . trying convert hashmap<string, string[]> . hashmap<string, arraylist<string>> arraylistmap = new hashmap<>(); hashmap<string, string[]> arraymap = new hashmap<>(); (map.entry<string, arraylist<string>> entry : arraylistmap.entryset()) { arraymap.put(entry.getkey(), entry.getvalue().toarray()); } however, entry.getvalue().toarray() , ide giving me error: wrong 2nd argument type. found: 'java.lang.object[], required 'java.lang.string[]'. i don't know why, because arraylistmap specifies working string s. why not working, , how can fix it? arraylist has overloaded toarray method. the first form, toarray() , return object[] back. isn't want, since can't convert object[] string[] . the second form, toarray(t[] a) return array typed whatever array pass it. you need use second form here array correctly typed. arraymap.put(ent

android - WearableListView LongClick -

i have been trying add longclicklistener wearablelistview this have done: listview.setonlongclicklistener(new view.onlongclicklistener() { @override public boolean onlongclick(view view) { toast.maketext(getactivity(), "long", toast.length_short).show(); return false; } }); here listview wearablelistview. when long click function not called. understand single click have set listview.setclicklistener() , not listview.setonclicklistener() there similar approach long clicks? thanks! try use onitemlongclick instead of longclick listview.setonitemlongclicklistener(new onitemlongclicklistener() { public boolean onitemlongclick(adapterview<?> arg0, view arg1, int pos, long id) { // todo auto-generated method stub log.v("long clicked","pos: " + pos); return true; } });

Javascript : looping array of arrays. If match found, push to array, if not, create new innerarray -

i'm retrieving information database. data looks (i've simplified it): var example = [ {'start': 1966, 'end': 1970}, {'start': 1969, 'end': 1971}, {'start': 1972, 'end': 1980}, {'start': 1974, 'end': 1985}, {'start': 1975, 'end': 1979}, {'start': 1986, 'end': 1990}, {'start': 1991, 'end': 1995} ]; what want sort dynamically new, empty array newarr . when sorting done newarr should like var newarr = [ [ {'start': 1966, 'end': 1970}, {'start': 1972, 'end': 1980}, {'start': 1986, 'end': 1990}, {'start': 1991, 'end': 1995} ], [ {'start': 1969, 'end': 1971}, {'start': 1974, 'end': 1985} ], [ {'start': 1975, 'end': 1979} ]]; i

.net - error when adding Custome C# template, VS2010, new computer -

i have custom template built in vs2010. new user able open template previously, can not longer. did reimaged , vs2010 reinstalled. there specific needed add new item based off custom template project. other users not reporting issue know install. error gets is: unable cast com object of type 'system._comobject' class type 'envdte.dteclass'. com components enter clr , not support iproviderclassinfo of not have interop assembly registered wrapped in _comobject type. instances of type cannot cast other class; can cast interfaces long underlying com component support queryinterface calls iid of interface. any clue how resolve. assume since works on every other computer, there nothing in code needs fixed (maybe message thrown user explain better) feels environmental. thanks;

sql - Is there a point to wrapping a stored procedure in a transaction if no try/catch or exception logic to rollback is used? -

i have noticed company has lot of stored procedure scripts similar this: alter procedure myprocedure @itemid int begin transaction -- stuff, maybe 1 insert/update statement, maybe many commit transaction the point is, there no try/catch blocks, , no 'if' statements rollback. rollback never used anywhere in code. so point of transaction, then? there other benefits wrapping inside transaction don't know about? thought reason use rollback if goes wrong. could there logic outside scope of procedure gives meaning this? given limited knowledge, not seem pointless seems dangerous because if goes wrong, commit never executed (correct?), , have open transaction , table locked indefinitely. if update fails part way through rollback (well more fail commit, amounts rollback) when session closes. it's discussed in detail here , relevant part is: transactions ... has no persistent effect whatever on database, through: action of rollback

java - Websocket server using Netbeans and Tomcat 8 -

i'm having trouble accessing websocket server using netbeans , tomcat 8.0.9 (error during websocket handshake: unexpected response code: 404). here java code: package websocketserver; import java.util.collections; import java.util.hashset; import java.util.set; import javax.websocket.session; @javax.websocket.server.serverendpoint("/endpoint") public class websocketserver { private static set<session> peers = collections.synchronizedset(new hashset<session>()); @javax.websocket.onmessage public string onmessage(string message) { return null; } @javax.websocket.onopen public void onopen (session peer) { peers.add(peer); } @javax.websocket.onclose public void onclose (session peer) { peers.remove(peer); } } javascript: var wsuri = "ws://" + document.location.host + "/websocketserver/endpoint"; var websocket = new websocket(wsuri); websocket.onerror = func

validation - Javascript: Ensure Input is Numbers Only -

i have unit conversion script; html contains radio buttons (to pick units), input field, output field , button. here's sample of javascript file: [...] window.addeventlistener("load", function(){ document.getelementbyid("convert").addeventlistener("click", function(){ var initial = document.getelementbyid("initial").value; document.getelementbyid("answer").innerhtml = convertobj.converted(initial); }); [...] }); function convertclass(){} convertclass.prototype.converted = function(initialamount){ if(document.getelementbyid("kilograms").checked) { this.calculation = this.multiply(initialamount, 2.2046); } else if(document.getelementbyid("pounds").checked) { this.calculation = this.divide(initialamount, 2.2046); } return this.calculation.tofixed(2); } [...] var convertobj = new convertclass(); i add ensures a) empty input field isn't c

r - Testing multiple time -

i trying test multiple stationarity tests on data set: > library(data.table) > library(fpp) > library(xts) > > dput(datsel) structure(list(gesamtbaukost = c(59373l, 59209l, 58935l, 58551l, 58496l, 58458l, 58368l, 58039l, 57582l, 57472l, 57289l, 56742l, 56156l, 56248l, 56046l, 55919l, 55243l, 55075l, 55045l, 53988l, 53436l, 53298l, 52930l, 52915l, 52947l, 53834l, 52946l, 51567l, 50433l, 50449l, 50357l, 49557l, 48932l, 48671l, 47722l, 46772l, 46213l, 45865l, 45919l, 45826l, 45612l, 45276l, 44994l, 44041l, 43225l, 42983l, 42715l, 42232l, 41870l, 41843l, 41777l, 41321l, 41132l, 41240l, 41172l, 40743l, 40587l, 40352l, 40127l, 39814l ), lohn = c(96819l, 96819l, 96090l, 94632l, 94632l, 94632l, 93727l, 91917l, 91917l, 91917l, 90779l, 88503l, 88416l, 88416l, 88270l, 87978l, 87996l, 87996l, 87566l, 86706l, 86706l, 86706l, 85794l, 83970l, 83970l, 83970l, 83007l, 81081l, 81081l, 81081l, 80423l, 79107l, 79107l, 79107l, 78321l, 76749l, 76533l, 76533l, 75983l, 74883l

not getting post value from tinyme in php -

i new tinymce editor. have used on site facing little problem is, when add class textarea content not update, means not values $_post. when remove editor class textarea values , content updated.. below code please ?? <script type="text/javascript" src="javascript/tinymce/tiny_mce.js?1"></script> <textarea id="wysiwyg" name="longdescription" style="padding: 0; width: 100%; height: 250px;" placeholder="type description product here..."><?php echo $editdetails;?></textarea> if( $_post['update']){ $details= mysql_real_escape_string( strip_tags( $_post["longdescription"] ) ) ; //update query// } how post value ?? in $details variable ?? getting value without using id="wysiwyg" found solution i removed mysql_real_escape_string( strip_tags()) from mysql_real_escape_string( strip_tags( $_post["longdescription"] ) ) ;

multithreading - Is this a valid way to subclass a python thread to accept a variable update? -

i'm looking @ threading module in python (version 3.4.3), , having difficulty finding way update variable in target function called. think create global variable share between main program , thread starting, found myself creating following subclass instead. seems work purposes, i'm curious if hack or if it's valid. the goal here create separate thread regularly (and quietly) pings server, , updates specified widget status of update: from tkinter import * import threading class ipthread(threading.thread): def __init__(self, ip=none, labelobj=none): self.ip = ip threading.thread.__init__(self, target=self.checkconnection, args=(labelobj,)) def newip(self, ip): self.ip = ip def checkconnection(self, widget): while true: self.response = os.system("ping -c 1 -w 10 " + self.ip + " > /dev/null 2> /dev/null") if self.response==0: widget.config(text="connecte