Posts

Showing posts from May, 2010

javafx 8 - GridPane Ignoring TextField.setPrefColumnCount -

i'm attempting use textfield.setprefcolumncount() give me different sized text fields within gridpane. gridpane sizing of fields longest field. doing wrong here, or need explicitly set maximum size of fields preferred size fields? public class testproject extends application { @override public void start(stage primarystage) { borderpane base = new borderpane(); gridpane inner = new gridpane(); inner.sethgap(4); inner.setvgap(4); inner.setpadding(new insets(8)); inner.setmaxwidth(double.max_value); inner.setgridlinesvisible(true); inner.setstyle("-fx-border-color:red"); label la = new label("label a"); label lb = new label("label b"); label lc = new label("label c"); textfield ta = new textfield(); ta.setprefcolumncount(30); textfield tb = new textfield(); tb.setprefcolumncount(15); textfield tc =

java - How to make an action bar like the Zomato app? -

Image
like in zomato app this screen opens when click on action bar location i using android studio 2.2 targetsdkversion 23

java - HQL how to use sum function for list in entity -

hi need help; how use sum function of hql list of entity onetomany. i try explain problem via code examples. here invoice entity @entity public class invoice extends extendedbaseentity { @column(nullable = true,length = 50) private string invoiceno; @column(nullable = true) @jsonformat(shape = jsonformat.shape.string, pattern = "yyyy-mm-dd't'hh:mm:ss.sssxxx", timezone = "eet") private date invoicedate; @column(nullable = true,precision = 10,scale = 2) private bigdecimal amount; getters , setters..... and here file entity.this entity hold invoice list onetomany @entity public class file extends extendedbaseentity { @column(nullable = true, length = 50) private string name; @column(nullable = true, length = 50) private string surname; @column(nullable = true, length = 50) private string lawyercode; @column(nullable = true, length = 50) private string sellercode; @onetomany(cascade = cascadetype.remove, fetch = fetchtype.eager) @fe

python Long to Byte Array of 2 byte using struct -

i converting long or int bytearray in python using struct ba = struct.pack('h',12) output : '\x0c\x00' length 2 bytes but if convert ba = struct.pack('h',12345) output : '90' need encode hex desired out put ba.encode('hex') in case output output : 3930 , length 4 why happening, should give 2 byte result without encoding ? my usecase need convert long bytearray of desired bytearray size. '90' 2 bytes. first byte 0x39 , second 0x30. >>> hex(12345) '0x3039' tl;dr: getting correct result.

java - Reducer loop strange behavior -

i'm new in mapreduce i'm trying join of 2 different type of lines 2 different csv files. the map ok, load 2 files , b, match lines want same key. in reducer having strange behavior can not understand. lines start accident# , lines b start meteo# . want identify if line or b , rest of line, when testing code for(text val : values){ stringtokenizer line = new stringtokenizer(val.tostring(), "#"); string comparable = line.nexttoken(); context.write(key,new text(comparable)); } i receive following output, ok 2015-12-31;x meteo 2015-12-31;x accident 2015-12-31;x accident 2015-12-31;x accident 2015-12-31;x accident then this for(text val : values){ stringtokenizer line = new stringtokenizer(val.tostring(), "#"); string comparable = line.nexttoken(); if (comparable.equals("meteo")) comparable = line.nexttoken()

java - Saving image in Gallery -

i taking screenshot , saving in storage application name. it's not giving error , saving photo in storage, appears in gallery after restart phone. my save method photo below: public void savequoteimage(bitmap quoteimage){ date = new date(); android.text.format.dateformat.format("yyyy-mm-dd_hh:mm:ss", now); try { // image naming , path include sd card appending name choose file string dirpath=environment.getexternalstoragedirectory().tostring()+file.separator+"quotes_king"; file dirfile=new file(dirpath); if(!dirfile.exists())dirfile.mkdirs(); // string mpath = environment.getexternalstoragedirectory().tostring() + "/" + + ".jpg"; // create bitmap screen capture file imagefile = new file(dirfile.getpath()+file.separator+ + ".jpg"); fileoutputstream outputstream = new fileoutputstream(imagefile); int quality = 100; quoteimage.compress(bitmap.compressformat.jpeg, quality, outp

How do i animate GMSPolyline in google maps ios -

Image
i using google maps sdk , have draw polyline when user moves, animates marker only, path drawn before pin moves specific location. have draw path , move pin @ same time. check video : https://www.dropbox.com/s/q5kdjf4iq0337vg/map_sample.mov?dl=0 here code func locationmanager(manager: cllocationmanager, didupdatelocations locations: [cllocation]) { let location = locations.last! userpath.addcoordinate(location.coordinate) //userpath -> gmsmutablepath let polyline = gmspolyline(path: userpath) polyline.strokecolor = uicolor(red: 0, green: 191/255.0, blue: 1, alpha: 0.8) polyline.strokewidth = 5 catransaction.begin() catransaction.setanimationduration(2.0) self.usermarker.position = location.coordinate self.usermarker.rotation = location.course polyline.map = self.googlemapview catransaction.commit() } also here screenshot how works i trying similar thing ( https://youtu.be

python - How to get the Hometown and Gender of Users from Facebook -

Image
is there way hometown , gender of users comment on specific page post, using facebook graph api or other? more precisely, when extract comments on page post graph api, shows me ids of users had posted comments. need hometown live in order assign results of sentiment analysis each city. get /v2.6/{pageid_postid}/comments?fields=from&limit=150 so far know twitter api has such possibility (using python’s tweepy library), possible extract such data facebook? i appreciate might have. vahid that´s not possible, need permission authorize user in order hometown, , can´t gender without authorization either.

Is it possible to get bigrams from significant_terms aggregation in Elasticsearch? -

i wondering if possible bigrams significant_terms aggregation in elasticsearch. i querying index 200 million sentences have been indexed using additional bigram analyzer. bigrams indexed. however, when run significant_terms aggregation, unigrams es. is possible @ all?

javascript - catching Angular Bootstrap UI $uibModal closed event after the modal was closed -

i'm opening modal window using $uibmodal.open controller, , need notified when modal window closed (and not during closing...) i'll able run function. the code opens modal follows: var modalinstance = $uibmodal.open({ templateurl: "mymodalcontent.html", controller: "termmodalctrl", windowclass: 'app-modal-window', resolve: { 'params': function () { return id } } }); i saw suggested solutions use: modalinstance.result.then(function(result) { }); the problem function callback called prior actual closing of modal window (when modal window still open) , not behavior want cause means catches "closing" event , not "closed" event of modal. is there neat , simple way implement this? i'd surprised if not since behavior common in ui frameworks on planet... please help! try this. .open method returns promise chained .closed 1 of many properties of .open method. i tested , shows aler

wordpress - How to use Widgets in css -

i trying create widget in wordpress when go dashboard , click under appearance, don't see option widgets. can see themes,customize, menus, theme check , editor. do widgets can start creating own ones? you need register sidebar widget first in functions.php file: <?php add_action( 'widgets_init', 'my_register_sidebars' ); function my_register_sidebars() { /* register 'primary' sidebar. */ register_sidebar( array( 'id' => 'primary', 'name' => __( 'primary' ), 'description' => __( 'a short description of sidebar.' ), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget-title">',

java - InfoWindow's subDescription will go out of bounds of the bubble in osmdroid bonuspack -

Image
i trying set subdescription markers code this: marker marker = new marker(map); marker.setposition(tempgeopoint); marker.seticon(markericon); marker.setanchor(marker.anchor_center, marker.anchor_bottom); marker.setsubdescription("lat : " + points.get(i).get(0) + ", long : " + points.get(i).get(1)); marker.settitle("this title"); overlays.add(marker); but get: as can see sub description out of bounds , bubble won't expand contain it. options here? ps: bubble won't expand @ all, neither sub description nor long snippet

How to append the string to textarea using javascript -

i want append given string textarea have, want append text in way should typing on texture,because have voice playing in background 6 seconds which says same thing written. <textarea id='typeable' style='font-size:18px;background:#f8e71c'></textarea> <script> function addtext(event) { document.getelementbyid("typeable").value += "hello welcome new world of javascript" } </script> how can count number of characters in sentence, , calculate time each char dividing total time no. of characters , call time interval , run until characters printed. still can decide time taken print each character , modify per need. please note time taken in milliseconds. var chars = "hello welcome new world of javascript".split(""); var textarea = document.queryselector('textarea'); var total_time=6000; var index = 0; var time_per_char = total_time/chars.length; var

php - How to echo / embed laravel view output in layout as variable -

i want use view helper {{ render_part("user_profile"); }} in laravel layout, , render_profile return , html, right prints plain string , not rendering html, need guide understand laravel blade/view compilation architecture can write custom classes overriding core methods. i've upvoted gerard reches answer. if want render views controller , display html in views: by default, blade {{ }} statements automatically sent through php's htmlentities function prevent xss attacks. if not want data escaped, may use following syntax: {!! $myhtml !!} hope helps.

javascript - Dismissing UIAlert window through Instruments script run through CLI -

when running instruments test suite through instruments cli, i'm unable programatically dismiss uialert window on device asks push notification permissions app in test. on first run of app. since permissions alert blocks test script running @ all, defined alert handler not called. running suite through instruments ui app calls default alert handler, taps default button dismiss alert. how can dismiss alert programatically, if script blocked? there way preset permission, alert not displayed? edit: alert in ios 9; not pop in ios 8

android - what this methods does isExternalStorageRemovable and isExternalStorageEmulated -

sorry if question have been asked before . didnt understand . can 1 give me explanation of example . difference between both of them isexternalstorageremovable , isexternalstorageemulated in old android devices external storage directed sd card physically remove. in new android devices external storage directed directory on data partition (with fuse on top of it) - emulated sd card. so, isexternalstorageemulated tell if storage on data partition , isexternalstorageremovable tell if storage sd card. of time return opposite output guess can find rare device external storage separated partition both of them return false.

asp.net - SQL Server Permissions -

this typical sql server error, know: the execute permission denied on object 'getstaffdirectorylistingsbycompany', database 'mydb', schema 'dbo'. i able fix in ssms adding execute permission 'iis apppool\defaultapppool'. tried add specific apppool application 'iis apppool\myapppool' not locate in ssms. why happening? my question simple: db dozens of stored procedures, how add permission once instead of having manually each stored procedure? i couldn't following work: https://msdn.microsoft.com/en-us/library/ms187940.aspx update i should point out background problem: first, win7 dev machine upgraded windows 10 , somehow projects associated defaultapppool in iis (as own app pools). second, db restored version on production server local dev machine (maybe why permissions messed up?). you can either grant execute permission on schema or on whole db, example: use [mydatabase] go -- grant execute permission on sc

Scala Either : simplest way to get a property that exists on right and left -

i have template using valueobject might 1 of 2 flavours depending on used in our app. importing either: valueobject: either[ objecta, objectb ] both objects have identically named property on them retrieve calling valueobject.propertya which doesn't work. what concise/ best way of doing this? assuming 2 objects have same type (or supertype / trait) defines property - can use merge returns left if exists , right otherwise, lowest common type of both: scala> class myclass { | def propertya = 1 | } defined class myclass scala> val e1: either[myclass, myclass] = left(new myclass) e1: either[myclass,myclass] = left(myclass@1e51abf) scala> val e2: either[myclass, myclass] = right(new myclass) e2: either[myclass,myclass] = right(myclass@b4c6d0) scala> e1.merge.propertya res0: int = 1 scala> e2.merge.propertya res1: int = 1

How do I set up "userid" equivalent view from Google Analytics in Firebase Analytics? -

i trying use firebase analytics in ios app. have been using google analytics (ga) before. in ga, make sure true user count (i.e. user had app, uninstalls app , reinstalls app, should still treated 1 user), using userid view in ga works me. per how firebase analytics define "user" (for purposes of audience)? , seems firebase doesn't have such mechanism. how capture stats in firebase analytics? have updated same question still don't have comment access in stack overflow yet. thanks, abhijit you can use firebaseanalytics.setuserid set user ids. can link account bigquery , count distinct users using bigquery. bigquery has free tier should sufficient app.

android - RoboGuice injection -

i using code in android app (roboguice library): @singleton public class usersessionprovider { private user user; @inject private injector injector; public synchronized user createsession() { this.user = injector.getinstance(user.class); return this.user; } public synchronized user getuser() { return user; } public synchronized void destroysession() { this.user = null; } public synchronized boolean issessionalive() { return getuser() != null; } } sometimes build gets bugged up, , application fails inject instance of injector in provider. when clean app , rebuild again works ok (for time). using gradle build chain , android studio. know how can stop happening?

fpga - How to see content of look up table -

Image
imagine have simple code fpga, want know if there way watch content of specific lookup table after synthesis, data written in sram module test8(a,b,c ); input ; input b ; output c; assign c = a&b; endmodule simple , gate the possibility depends on fpga vendors tool. some tools has gui floor-plan view used luts can found, , these luts can have associated code attached memory contents of lut. in altera queatus chip planner may like: another option generate netlist of complete design, writable fpga tool, , netlist contain luts code lut contents. in altera quartus generated verilog netlist may like: ... // location: labcell_x10_y34_n0 cyclonev_lcell_comb \c~0 ( // equation(s): // \c~0_combout = ( \a~input0 & ( \b~input0 ) ) .dataa(gnd), .datab(gnd), .datac(!\b~input0 ), .datad(gnd), .datae(gnd), .dataf(!\a~input0 ), .datag(gnd), .cin(gnd), .sharein(gnd), .combout(\c~0_combout ), .sumo

html - make a div screen size dependent -

i'm working on app ionic framework , i'm still novice in css. created images slider timer , size of fixed. however, change depends on screen size , resolution. this html content: <ion-content> <div class="container"> <div id="content-slider"> <div id="slider"> <div id="mask"> <ul> <li id="first" class="firstanimation"> <a href=#><img src="../img/coffe_and_sweet_sale.jpg"/></a> <div class="tooltip"><h1>text 1</h1></div> </li> <li id="second" class="secondanimation"> <a href="#"><img src="../img/pizza_sale.png"/></a>

javascript - Hide DIVs by ID on page load -

i have following js in page layout (running ror): <script> $(document).ready(function() { document.getelementbyid('1').style.display = 'none'; document.getelementbyid('2').style.display = 'none'; document.getelementbyid('3').style.display = 'none'; document.getelementbyid('4').style.display = 'none'; document.getelementbyid('5').style.display = 'none'; }); </script> i trying have 5 div s hidden on page load can not seem work. can use js or jquery. have tried well: $(window).load(function() { ...js code... }); and still not hide div s on page load. what need write in js have div id 1..5 hidden? first, isn't recommended id s start numbers. compatibility issues, don't ask me. second, code particularly redundant , nullifies purpose of having id s. use common class or less redundant yet nest them in container , grab children. <div id

apache - Redirect subdomain to PHP page and mask it -

basically has own pages setup @ domain.com/site?name=whatever my host subdomains automatically (for example if create folder named dalton i'd automatically able visit dalton.domain.com) anyhow want people able go whatever.domain.com , querying domain.com/site?name=whatever (i want mask still on subdomain) any ideas? possible? if set index.php page every subdomain points to, could retrieve "subdomain" part of url create iframe contains actual page want show this typically how lot of domain-hosting companies "masking". index.php (abridged): <?php //get subdomain $subdomain = array_shift((explode(".",$_server['http_host']))); //rewrite url $url = "http://www.domain.com/site?name=" . $subdomain; //create page echo "<!doctype html><html><head><title>page title</title></head><body style='margin:0;padding:0;'>"; //c

android - TypeError: Cannot read property 'udp' of undefined -

i need write ionic app sends , recieves udp packets. i'm using plugin android: https://github.com/mobilechromeapps/cordova-plugin-chrome-apps-sockets-udp this code in app.js: $scope.connect = function() { var socketid; // handle "onreceive" event. var onreceive = function(info) { if (info.socketid !== socketid) return; console.log(info.data); }; // create socket chrome.sockets.udp.create({}, function(socketinfo) { socketid = socketinfo.socketid; // setup event handler , bind socket. chrome.sockets.udp.onreceive.addlistener(onreceive); chrome.sockets.udp.bind(socketid, "0.0.0.0", 55555, function(result) { if (result < 0) { console.log("error binding socket."); return; } var arraybuffer = new arraybuffer(20); var dv = new dataview(arraybuffer,0); dv.setuint16(0,0); dv.setuint16(1,12); dv.setuint16(2,0); dv.setuint16(3,0);

elasticsearch - How to make synchronous call in ES java API -

i using elasticsearch 2.3 (both server , client) . i added indexes using below mention code: private transportclient txclient; // client connection code indexresponse response = txclient.prepareindex(some_values).setsource(some_value) .execute().actionget(); assert response.getid() != null; immediately after addition , searched index using searchrequestbuilder . searchresponse response = txclient.preparesearch(some_values).settypes(some_value) .execute().actionget(); i did not got newly added indexes. all want wait until indexes added. how can achieve that? edit : after adding .setrefresh(true) prepareindex() method, problem solved. far understand, it's not performance. i did not want refresh immediately, want wait till indexes created in normal way. you should use setwaitforyellowstatus() method. example: clusterhealthrequestbuilder healthrequest = txclient.admin().cluster().preparehealth();

Initialize automtatically selectInput in R Shiny -

so have selectinput ask user variables want keep dataframe. problem want specific variable pre-selected or @ least added select list after made choice. for example ask variables want keep : "color","length","name","price","website" let's chose "name" , "price" want variable "website" in select, how can add list after choice ? and if choose "name" , "website" took variable need, how do program doesn't add "website" twice! thanks in advance, fellow r user discovered today rshiny ! have day edit : alright i'm dumb, tried option selected, didn't work it's because put @ wrong selectinput so yeah, using option selected, sorry

java - In jQuery, how many braces are needed for .css? -

does jquery method .css need div.css({"color":"red"}); or div.css("color":red"); ? if there's specific use both of them, please tell me. thanks. you need format: div.css('color','red'); if there 1 setting. however, perform multiple settings in 1 instruction, must use object: div.css({'color':'red','background':'yellow'}); or, if prefer format: div.css({ 'color':'red', 'background':'yellow' }); note: in first example, comma separates css selector setting. in object, comma separates each pair, , colon separates selector setting.

swift iOS - UICollectionView images mixed up after fast scroll -

i new swift , ios programming, have been able build stable starting interface application in xcode. collectionview grabs image , text array of dictionaries created csv file on home network server. cvs file contains data in following format (note, urls have been changed protect licensed images): csv file csv file @ url https://myserver.com/csv.txt , contains following title";"seriesimageurl title1";"https://licensedimage.com/url1 title2";"https://licensedimage.com/url2 ... title1000";"https://licensedimage.com/url1000 the problem when scrolling through collectionview, cell grab incorrect image. noticeably, if slow or medium scroll, different image show before correct image rendered correct cell (the label text cells correct, image ever off). after mismatch of images proper cell label occurs, other cells in collectionview have incorrect images displayed. e.g. cell 1-9 show title1-9 correct image1-9 when scrolling slowly, cells 19-27 sh

php - Getting records where pivot [Laravel] -

how can records relation. i have this: return conversation::with('messages') ->get(); so need return convrsation in pivot table have user_id 1 it ideal if there function this: ->wherepivot('user_conversation.user_id',1) any solution this? assuming conversation has belongstomany relationship setup user , can use wherehas() method constrain conversation query user relationship. $id = 1; return converstaion::with('messages')->wherehas('users', function ($userquery) use ($id) { $userquery->where('id', $id); }) ->get(); this return conversations related user id of 1. can read more wherehas() , other useful methods under querying relationships . another option, if have user loaded, return user's conversations: $user = user::find(1); return $user->conversations()->with('messages')->get();

php - I install Laravel on window 7 and I got error message -

i install laravel when run demo file gave me error message. error message that:- class 'illuminate\foundation\testing\testcase' not found in d:\xampp\htdocs\laravel\tests\testcase.php on line 4 for solving issues tried run phpunit app/tests/ command on command prompt nothing happend. , composer.json file :-- { "name": "laravel/laravel", "description": "the laravel framework.", "keywords": ["framework", "laravel"], "license": "mit", "type": "project", "require": { "php": ">=5.5.9", "laravel/framework": "5.2.*" }, "require-dev": { "fzaninotto/faker": "~1.4", "mockery/mockery": "0.9.*", "phpunit/phpunit": "~4.0", "symfony/css-selector": "2.8.*|3.0.*", "symfony/dom

html - Viewstate on asp.net -

i little confused how viewstate server controlls store data , retrieve in next postback, think small example or contoller should ok. by way, html elements can't use viewstate? read documentation, e.g. taking bite out of asp.net viewstate

Access a method from a DLL from C# program -

i have c program , have created dll file. using windows vista, , visual c++. now need access method dll, main() method of c# code. steps of doing so? so far have added dll file reference, thereafter should do? this example: int main1( void ) { prinf("hello world"); } please note class makes of other .lib functions, able create dll out of it. (i don't know if relevant) now need access method c# main(); [stathread] static void main() { // need call main1() method here application.enablevisualstyles(); application.setcompatibletextrenderingdefault(false); application.run(new form1()); } see using class defined in c++ dll in c# code has great accepted answer. , hans passant wrote in comments, cannot add native dll reference c# project. when refer 1 of own native dlls, either add dependency between c# project , project generates native dll, or add dll linked content file in c# project, so: right-click on project , choose add > exi

javascript - Response In A Separate Window (HTML/Java/Jquery/etc) -

i'm trying build "achievement system" via html, don't know keywords google or study produce have in mind unfortunately: it requires 2 windows/pages in 1 host macros (triggers) buttons , other window display event. user activate buttons , other users can see action. mock gif here i know how build on 1 page. can't figure out how send triggers make seperate page echo action.

.htaccess - redirect to http to https for multiple domain -

we have server having 2 domains 1) exmaple.co 2) exmaple.com.au if user hits first domain "example.co" http://www.exmaple.co or http://exmaple.co should redirect https://exmaple.co if user hits second domain "example.com.au" http://www.exmaple.com.au or http://exmaple.com.au should redirect https://exmaple.com.au we have purchase ssl. we have use framework codeigniter set coding in htaccess. rewritecond %{http_host} ^exmaple.co [nc] rewriterule ^(.*)$ http://exmaple.co/$1 [l,r=301] rewritecond %{http_host} ^exmaple.com.au [nc] rewriterule ^(.*)$ http://www.exmaple.com.au/$1 [l,r=301] if use above code it's goes on redirect loop. you getting infinite redirect loop because not preventing redirect happen @ all. to achieve trying do: rewritecond %{https} off rewritecond %{http_host} ^(www\.)?example\.co$ rewriterule ^(.*)$ https://example.co/$1 [l] rewritecond %{https} off rewritecond %{http_host} ^(www\.)?example\.

How to ADD javascript files and css to a contentpage of a master page in asp.net -

how can add javascript files , css contentpage of master page in asp.net. tried include datetime picker contentpage. bur works on masterpage . when try put same in contentpage doesn't work. this content page code: <%@ page title="" language="c#" masterpagefile="~/testmasterpage.master" autoeventwireup="true" codefile="datetime.aspx.cs" inherits="datetime" %> <asp:content id="content1" contentplaceholderid="head" runat="server"> <link href="css/ui-lightness/jquery-ui-1.8.19.custom.css" rel="stylesheet" type="text/css" /> <script src="js/jquery-1.7.2.min.js" type="text/javascript"></script> <script src="js/jquery-ui-1.8.19.custom.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { $(&

Symfony cloning entity persist old entity -

i've form 2 submit buttons, "save , overwrite" , "save copy". so here problem, when i'm creating copy next code, old entity still being updated: public function editaction($id, request $request) { $auth_checker = $this->get('security.authorization_checker'); $token = $this->get('security.token_storage')->gettoken(); // our user token $user = $token->getuser(); $em = $this->getdoctrine()->getmanager(); $checklist = $em->getrepository('appbundle:checklist')->find($id); if (!$checklist) { throw $this->createnotfoundexception('checklist not found... ' . $id); } $originalgroups = new arraycollection(); $originaltasks = new arraycollection(); $originalcorrectives = new arraycollection(); /** @var checklistgroup $group */ foreach ($checklist->getgroups() $group) { $originalgroups->add($group); /** @var checklist

javascript - Dynamically changing Angular directive based on attribute -

i want change template/templateurl whenever specific attribute changes. have following, load initial image correctly, doesn't change on update. .directive('parkingimage', ['$compile', function($compile) { return { restrict: 'e', scope: { image: '=' }, link: function(scope,element,attrs) { scope.contenturl = 'img/parking/'+attrs.templateurl+'.svg'; attrs.$observe("template-url", function(v){ scope.contenturl = 'img/parking/'+v+'.svg'; }); }, template: '<div ng-include="contenturl"></div>' } }]); and in html <parking-image id="parking-image" template-url="area_2"></parking-image> i took @ angular.js directive dynamic templateurl , doesn't seem work properly. the correct approach observe on templateurl rather

c - snprintf not working as expected with avr-gcc -

Image
during debugging session, found out snprintf not working expected when comiling code avr-gcc. example code should convert floating point value 3999.9f character representation. here minimal test case: int testsnprintf(void) { const float inputvalue = 3999.9f; /* print fixed width of 6 characters (5 numbers , 1 dot). buffer must have length of 7, because snprintf appends '\0' @ end. */ char buf[7u] = {0, 0, 0, 0, 0, 0, 0}; const uint8_t buffersize = 7u; if(6 != snprintf(buf, buffersize, "%06.1f", inputvalue)) { return -1; } if( buf[0] != '3' || buf[1] != '9' || buf[2] != '9' || buf[3] != '9' || buf[4] != '.' || buf[5] != '9' || buf[6] != '\0') { return -2; } return 0; } int main(void) { int retval = testsnprintf

javascript - How to pass LIST to view as JSON in MVC asp.net -

Image
i need pass list view: but in format: { "data": [ { "first_name": "robert", "last_name": "meczybula", "id": 12421 ... }, ... ]} basically want transform list desired data contract. linq this: var transform = new { data = data.select(x => new { x.first_name, x.last_name, ... }), ... }; then serialize , return transform object.

Shell string processing using regex and extract words based on delimiters -

i have asked question using regex string last colon. have received answers though don't quite know how integrate rest of program. have command line return output in form of st:st:st:st1-st2-st3-st4-...stn , want strip out st1, st2, st3...stn , write them in text file st1 \n "st2 \n...."stn \n . i know can use while ifs:- extract strings want how rid of string before last colon? how rid of string before last colon? use prefix removal: $ str='st:st:st:st1-st2-st3-st4-...stn' $ echo "${str##*:}" st1-st2-st3-st4-...stn ${str##*:} returns string $str after having removed longest match starts beginning , ends : . documentation from man bash : ${parameter#word} ${parameter##word} remove matching prefix pattern. word expanded produce pattern in pathname expansion. if pattern matches beginning of value of parameter, result of expansion expanded value of parameter shortest matching

GSON: Illegal Argument exception when converting a json string to a Java object -

i'm working youtube api. can convert java object json string. when try reverse (json string java object) throws exception: can not set com.google.api.services.youtube.model.commentthreadsnippet field com.google.api.services.youtube.model.commentthread.snippet java.util.linkedhashmap . why error , how fix it? this works: commentthread commentthread = getitsomehow() gson gson = new gson(); string jsonstr = gson.tojson( commentthread ); reverse throws exception: commentthread fromjson = gson.fromjson( jsonstr, commentthread.class ); here commentthread class: @suppresswarnings("javadoc") public final class commentthread extends com.google.api.client.json.genericjson { /** * etag of resource. * value may {@code null}. */ @com.google.api.client.util.key private java.lang.string etag; /** * id youtube uses uniquely identify comment thread. * value may {@code null}. */ @com.google.api.client.util.key private java.lang.str

javascript - Typescript + Angular2 test fails because of a JS library dependency -

i use jsfeat javascript library in angular2 project. i put @ beginning of .ts , .spec.ts files: declare var jsfeat: any; i included jsfeat.js in index.html. now want run angular2 tests, get: referenceerror: jsfeat not defined the test code is: describe('myobj instance', function () { it('should instantiate myobj', () => { expect(new myobj()).tobedefined('whoopie!'); }); }); 1) install jsfeat npm (optional): npm install -g jsfeat 2) edit karma.conf.js: config.set({ [...] files: [ // system.js module loading 'node_modules/systemjs/dist/system.src.js', // polyfills 'node_modules/core-js/client/shim.js', // reflect , zone.js 'node_modules/reflect-metadata/reflect.js', 'node_modules/zone.js/dist/zone.js', 'node_modules/zone.js/dist/jasmine-patch.js', 'node_modules/zone.js/dist/async-test.js', 'node_modules/zone.js/dist/fake-async-test.js',

ios - Add sound for each button -

i'm making app name user , choose thumbnail (and it'll play sound). problem couldn't play different sounds each button. plays last 1 keyed value in (in case, avengers). started swift last week , don't know language. google of time. here's code. in advance. import uikit import avfoundation class imagesviewcontroller: uiviewcontroller, avaudioplayerdelegate { var audioplayer: avaudioplayer? @ibaction func antman(sender: anyobject) { audioplayer!.play() } @ibaction func avengers(sender: anyobject) { audioplayer!.play() } func selectsound(alertsound: string, sound: string) { var alertsound: nsurl = nsurl (fileurlwithpath: nsbundle.mainbundle().pathforresource(sound, oftype: "mp3")!) var error: nserror? { audioplayer = try avaudioplayer(contentsofurl: alertsound) } catch var error1 nserror { error = error1 audioplayer = nil }

Loading data from existing connector table in JPA -

i'm beginner in jpa mapping. have simple entity (essentially 2d matrix) specifying value every product group/cost group combination. @entity public class costdistribution { @id @generatedvalue(strategy=generationtype.auto) private long id; @notnull @onetoone private productgroup productgroup; @notnull @onetoone private costgroup costgroup; private long value; } now i'd read-only access relevant column of matrix when productgroup loaded (i.e. load costdistribution records product_group_id equals id of current product group). cannot figure out how this. tried: @elementcollection @collectiontable(name="cost_distribution", joincolumns=@joincolumn(name="product_group_id")) but exception: same physical table name [cost_distribution] references several logical table names: [costdistribution], [cost_distribution] what misunderstanding here? @entity public class productgroup { @id @generatedvalue(stra

Solr Search text with underscore (_) -

Image
how search text containing underscore(_) in solr . eg: this_is_for_testing". want search "testing". you can use solr.worddelimiterfilterfactory job. <fieldtype name="text_general" class="solr.textfield" positionincrementgap="100" multivalued="true"> <analyzer type="index"> <tokenizer class="solr.whitespacetokenizerfactory" /> <filter class="solr.worddelimiterfilterfactory" generatewordparts="1" catenatewords="1" generatenumberparts="1" catenatenumbers="0" splitonnumerics="1" catenateall="0" splitoncasechange="1" stemenglishpossessive="1" preserveoriginal="1" /> <filter class="solr.lowercasefilterfactory"/> </analyzer> <analyzer type="query"> <tokenizer

javascript - Change only the label text in Google gantt chart -

Image
i'm using google's gantt chart , wish change text of label (not the tooltip). example, 1 of labels says "this long label test width of label on google gantt chart" , wish on label "this ...". on tooltip, display full text. if make change in when adding row data.addrows([ ['research', 'this long label test width of label on google gantt chart' it changes both label , tooltip. change label. please see jfiddle , image below. how can done?

angularjs - Dynamic parameters with ui-router -

i'm developing search app angular using ui-router . requirements: the search form has many fields , have optional. users should share users url display page result list. (so need use querystring) so have urls path/to/url/list?p=123&v=876 path/to/url/list?c=yes&a=true&p=123 path/to/url/list?z=yes&c=yes&a=true&p=123 path/to/url/list?z=yes&v=876&a=true&p=123 and endless combinations. know can use $location.search() params in json format. great! question how can define url state ui-router ? define explicitly params in url not option. have read many post didn't find concrete answers. if you're getting parameters $location don't need define them in state explicitly.

angular - How can i implement vaadin date-picker in my angular2 forms -

hello guys have implemented vaadin date-picker in 1 of pages.i want assign formcontrol vaadin datepicker directive showing error original exception: no value accessor '' and have built form in way <form [formgroup]="myform"> <div> <label for="skuinput">sku</label> <vaadin-date-picker label="pick date" [formcontrol]="sku"></vaadin-date-picker> </div> <button (click)="onsubmit(myform.value)">submit</button> </form> and included datepicker directive this directives: [form_directives, reactive_form_directives,date,polymerelement('vaadin-date-picker')], what correct way use vaadin datepicker in angular2 forms? thanks data binding between polymer elements (like vaadin-date-picker) don't work out of box. might work using angular-polymer adapter .

javascript - How to share a data-uri image on Pinterest? -

i want share data-uri image on pinterest. i've come following markup: <a target="_blank" href="https://www.pinterest.com/pin/create/button/"> <img class="pin-image" src="data:image/png;base64,…"> </a> at end of body including js: <script type="text/javascript" async defer src="//assets.pinterest.com/js/pinit.js" ></script> usually, pinit.js should pick src of img tag inside link, when open link don't see image want share. i've tried share without pinit.js adding parameters url, data-uri long. my researches haven't given me helpful advices on sharing generated images on pinterest, on of guys has answer me :-) you can update anchor tag proper url , avoid loading of pinit.js script.. the basic method trick... i wrote function you. need pass img selector , find occurrences , apply logic. demo: https://jsfiddle.net/zmgyc0bd/ function pinteres