Posts

Showing posts from September, 2015

javascript - Trigger mouseenter when an animated element touches mouse -

i'm new web development , i'm building game in object avoid touching animated circles pointer. set mouseenter event (full jsfiddle below): $("#"+circlename).mouseenter(function(){ $(this).attr("class", "redcircle"); }); this turns circles red when user moves pointer them. however, when mouse stationary, circles can pass through safely. there better way this? by changing mouseenter event hover event, event triggered when animated circle touches stationary mouse. however, there seems delay. know why might be? this sounds it's related issue found here, means may have related browser bug: getting mouseenter event still mouse entering animated element fiddle: http://jsfiddle.net/nbsteuv/6yok3s56/4/ i store last mouse position , whenever circle moves, check whether has intersected mouse position. var mousex, mousey; $( "#container-element-id" ).mousemove(function( event ) { mousex = event.pagex; mouse...

javascript - When is a DOM element "ready"? -

this might sound silly question, , tend use: $(document).ready(function() { }); but basic question. let's have list of elements this: <body> <p>paragraph</p> <div>div</div> <div id="helloworld">hello, world</div> <script> var hw = $('#helloworld'); $(document).ready(function() { // hw available me here }); </script> <p>another paragraph</p> </body> it seems div available, , don't run errors, there technically wrong this? not talking organized code, curious technical question @ hand. so suppose question is: is dom element considered complete , available browser reads it, regardless if rest of elements have loaded yet? it seems div available, , don't run errors, there technically wrong this? no . long script isn't run until after element exists, can access it. script in script tag that's after markup element refers...

javascript - Superfish dropdown with Bootstrap? -

how possible combine nav-pills of bootstrap , sf-menu of superfish ? i tried use them both. <ul class="nav nav-pills" id="example"> <li class="sf-menu current"> menu item </li> </ul> .. surely conbtradicted each other in css styles , output wasn't useable. looking easy way, combine both, without rewriting css of either of them. (i beginner in front end programming)

java - Using Spring @Transactional with a combination of readOnly and write, when does this entity get committed? -

given class callingclass { @autowired someservice someservice; doit() { someservice.readonlycall(); } } @transactional(readonly = true) class someservice { @autowired anotherservice anotherservice; readonlycall() { // logic may do... anotherservice.writecall(); } } class anotherservice { @transactional // not readonly writecall() { // save entity } } will entity committed database when writecall method exits or when readonlycall method exits? and how can modify commits after writecall method? the entity not committed database in both method exits. because your someservice class has read-only (which have specify). set flushmode.never prevent commit transaction your someservice class , anotherservice class has required propagation type(which default , have not specify other type both class). create new transaction if doesn't exist use current transaction if there is. in case someservice class begin transaction read-only , an...

ios - How to selectively choose compatible devices with Xcode 7.5 beta -

i developing xcode 7.5 betas , swift 2. have chosen project run on iphones. however, not want run on iphone 4s screen size small. there anyway can have run on iphone 5 - 6s only? you can limit iphones can run app using information property list (info.plist) file. "the uirequireddevicecapabilities key lets declare hardware or specific capabilities app needs in order run" however, based on handset capabilities not characteristics. won't let limit applicability screen size can similar result finding common capabilities in targeted handsets aren't shared hardware want rule out. use device compatibility matrix linked below. although i'm not sure how can rule out 4s, without ruling out 4, there couple options ruling out iphones prior 5s. good luck! https://developer.apple.com/library/prerelease/ios/documentation/deviceinformation/reference/iosdevicecompatibility/devicecompatibilitymatrix/devicecompatibilitymatrix.html#//apple_ref/doc/uid/tp40013599-ch...

Why is my WAMP Stack not working? -

my wamp stack doesn't seem working , can't figure out why. i have windows 7 (32-bit) installed on laptop. i downloaded wamp server , installed it's default options. however, noticed apache not work (while mysql work!). i tried install via apache -> service -> install service , got message saying port 80 taken skype. turned off skype, , apache started work. how can avoid conflict , allow wamp , skype work simultaneously ? should configure apache work other port ? where? thanks. option a you have change port number of wamp server. wamp server defaults port 80 upon installation. set in httpd.conf file. change port number avoid skype conflict. c:\wamp\bin\apache\apache2.2.22\conf option b the second method change port number of skype application. in skype: tools -> options -> advanced -> connection uncheck box "use port 80 , 443 alternative". option c quit skype before run wamp server, , can open skype witho...

java - Resizing JButton causes it to disappear -

Image
i want of buttons same size. 1 text "open save" widest, want use 1 metric resizing other buttons. however, when have line of code in program, button won't display: newbutton.setpreferredsize (opensavebutton.getsize ()); here's full program far: public class project1 implements actionlistener { // frames private jframe mainmenu = new jframe("main menu"); private jpanel mainpanel = new jpanel(); private jframe game = new jframe("game"); private jpanel gamepanel = new jpanel(); // controls private jbutton newbutton = new jbutton("new"); private jbutton opensavebutton = new jbutton("open save"); private jbutton exitbutton = new jbutton("exit"); private jtextarea textarea = new jtextarea(); public static void main(string[] args) { new project1(); } // constructors public project1() { mainpanel.setlayout(new gridbaglayout()); additem(ma...

javascript - Uber OAuth Redirect URI error -

i'm trying develop web application on uber's api using javascript , node.js, , when trying authenticate user oauth 2.0, i'm getting error given url not allowed application configuration: 1 or more of given urls not allowed app's settings. must match website url or canvas url, or domain must subdomain of 1 of app's domains. this occurs after snippet of code, display login page specified uber: app.get('/home', function(req, res){ var loginurl = "https://login.uber.com/oauth/authorize?response_type=code&client_id=" + client_id + "&redirect_uri=https://localhost:3000/login"; request(loginurl, function (error, response, body) { if (!error && response.statuscode == 200) { res.send(body) // show html google homepage. } }); }); in uber account, have added of following redirect url section under authorization: http://localhost http://localhost:3000/login https://localhost:3000 https://localhost:300...

ios - Sticking with Swift 1 and making app for IOS7 and above -

i have few questions considering while making app. app supports ios7 , above. being written in swift 1.2 , came across few articles it's better switch code swift 2. problem frameworks being used not support swift 2 yet. 1) possible stick swift 1.2 , continue deploying ios 7 , above? 2) once xcode 7 official, need update code swift 2 or can continue swift 1.2 time until frameworks upgraded swift 2. thank you 1) don't have switch swift 2 immediately, have stick xcode 6 , there's inconvenience such not being able test on ios9. 2) it's easy upgrade swift 1.2 code swift 2, opinion wait until frameworks support swift 2. good luck!

html - Double background -

i trying achieve similar display highlighted part in picture yellow , black background. 3 boxes displaying half in yellow , half in black bg. can me deal in css bootstrap. thanks in advance. http://i.stack.imgur.com/ypj0w.png the 3 boxes positioned absolutely on background image. see this- #bgbox { background-color: black; border-left: 50px solid yellow; width:50px; height:100px; } #top { position:absolute; top:40px; left:40px; width:30px; height:30px; background-color:blue; } <div id="bgbox"> </div> <div id="top"> </div>

windows - Shell says find: missing argument to `-exec' and no alternatives working -

a backup program used made duplicates of whole bunch of files throughout computer because of setting i've since changed. when backup program made copy, renamed old 1 original1.thefilename.extension . i'm trying automatically delete of these unnecessary files simple shell command. find -type f -name 'original1*' -exec rm {} \; however, when try run get find: missing argument `-exec' i've looked on web solution. i've found suggestions should try exec rm + , -exec rm {} + , -exec rm {} \; , -exec rm + etc. none of them work. using windows 8.1 i appreciate help! in windows command shell, don't need escape semicolon. find -type f -name 'original1*' -exec rm {} ; your version of command should work in bash shell (like cygwin). it's interesting gnu find execute, because on windows 8.1 machine, microsoft's find .

asp.net - Can i change alignment style of a particular column in asp grid that already has a default css style where columns where alligned left -

<asp:gridview id="reports" runat="server" autogeneratecolumns="false" cssclass="datatable" enableviewstate ="true" llowpaging="true" allowsorting="true" cellpadding="0" cellspacing="0" borderwidth="0" gridlines="none" sortedascendingheaderstyle-cssclass="sortasc" sorteddescendingheaderstyle-cssclass="sortdesc" sortedascendingcellstyle-cssclass="sortasc" sorteddescendingcellstyle-cssclass="sortdesc" pagesize="10" onpageindexchanging="gvreports_pageindexchanging"> yes, can change alignment of templatecolumn in asp.net grid. see following code template column properties. <asp:templatecolumn headertext="sr. no." itemstyle-width="4%" itemstyle-verticalalign="top" itemstyle-h...

php - How to compare mysql timestamp with jquery timestamp? -

i have timestamp value return mysql table. need compare jquery timestamp check whether time , date expired or not. from stackoverflow answer get: difference between jquery timestamp , php timestamp? timestamps in jquery (as returned $.now, defers date.prototype.gettime) javascript expressed in milliseconds. in php, (using time et al) in seconds. so, can write like: $time_php = strtotime(2015-08-29 00:00:00); $time_js = 13898736000 * 1000; if($time_php > $time_js) { echo"php time greater"; } else{ echo"js time greater";}

updating - merge design of mysql between localhost and server? -

i'm kinda new kind of problem. i'm developing web-app , changing db design trying improve , add new tables. since had not published app since days ago, dump tables in server , import local version we've passed version 1 , users starting use it. can't dump server, still need update design of server db when want publish new version. best practices here? i know how can manage differences between local , server in mysql? i need preserve data in server , change design, data on local db test. before other apps small , change single table or column can't keep track of changes now, since might revert many of them later , managing team members on impossible. assuming not using framework provides migration tool database, need keep track of changes manually. create folder sql_upgrades (or whatever name name) in code repository whenever team member updates sql schema, creates file in folder corresponding alter statements, , possibly update , create ta...

listview - Android - Horizontal scroll with "Show more" -

Image
i have create view - there 3 items shown show more option on click of show more list grow 10 items scrollable . what optimal way implement kind of view ? use horizontalscrollview on first population of scrollview detect click on 4th position , on 4th item click reload data , call adapter.notifydatasetchanged()

android - Send sms after call rejection - being sent multiple times -

i want send sms after reject incoming call. app sending sms problem is sending twice. unable figure out problem is. below code used. public class callbarring extends broadcastreceiver { private string number; @override public void onreceive(context context, intent intent) { // if, received action not type of "phone_state", ignore if (!intent.getaction().equals("android.intent.action.phone_state")) return; // else, try action else { // fetch number of incoming call number = intent.getstringextra(telephonymanager.extra_incoming_number); // check, whether member of "black listed" phone numbers stored in database if(mainactivity.blocklist.contains(new blacklist(number))) { // if yes, invoke method disconnectphoneitelephony(context); sendsms(context); ...

Spring 4 and Hibernate 5 EhCache no hit L2C -

i have problem ehcache spring , hibernate my applicationcontext.xml ............... ............... <prop key="hibernate.generate_statistics">true</prop> <!--configuration second level cache using ehcache --> <prop key="hibernate.cache.use_second_level_cache">true</prop> <prop key="hibernate.cache.use_query_cache">true</prop> <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.ehcacheregionfactory</prop> <prop key="org.hibernate.cache.ehcache.configurationresourcename">/ehcache.xml</prop> .............. .............. my ehcache.xml under src/main/resources <?xml version="1.0" encoding="utf-8"?> <ehcache> <diskstore path="java.io.tmpdir" /> <cache name="org.hibernate.cache.internal.standardquerycache" maxelementsinmemory="...

How to extract the upper triangular matrix w or w/o diagonal in Chapel -

the best stories start matrix a . var a: [{1..4,1..4}] real = ( (4, -30, 60, -35), (-30, 300, -675, 420), (60, -675, 1620, -1050), (-35, 420, -1050, 700) ); i recall somewhere can upper triangle, can't find in chapel docs can set in/exclude diagonal? using linearalgebra library: use linearalgebra; var a: [{1..4,1..4}] real = ( (4, -30, 60, -35), (-30, 300, -675, 420), (60, -675, 1620, -1050), (-35, 420, -1050, 700) ); var uppertriangle = triu(a); // confirm worked writeln(istriu(uppertriangle));

jquery - How to check whether session exists from javascript? -

i have app frontend in javascript (using angularjs , jquery) , backend in java. app has many pages ( ng-view ). i need know whether session in backend active or invalidated. based on need decide whether show logout button on page or not. although have learnt session maintained in browser using session cookies , this , this , concluded have manually set variable values in cookie object create in javascript. is there way session cookie used communicate server? getting cookie, can perhaps see whether session active or not. please let me know if interpratation wrong. you can't check session expire or not in java script using session because if write code this: if (isset($_session["phpsessid"])) {} that write on document working can not change value call of javascript. if reload page update session value.

filter - Nested Aggregation Elasticsearch -

i'm trying build nested aggregation in elasticsearch keeps giving errors. says "cannot find agg type tags". how can fix it. thank helps.btw don't have nested documents have 1 document having 180 fields. can apply aggregation? here code: { "aggs": { "comments": { "nested": { "path": "comments" }, "aggs" : { "red_products": { "filter": { "not": { "terms": { "text": [ "06melihgokcek", "t.co","??","????","???" ] } } }, "aggs": { "top_docs": { "terms": { "field": "text", "size": 50 } }, "aggs" : { "tags" : { ...

Swift dynamicType does not work with generic function -

say have protocol: protocol vehiclemodel {...} it implemented number of different structs. (e.g. carmodel, truckmodel, etc.) have generic method vehicle's 'model identifier'. func modelidentifierforvehicle<v: vehiclemodel>(vehicletype: v.type) -> string { return "\(vehicletype)" } if call modelidentifierforvehicle(carmodel.self) returns "car" fine. if have polymorphic collections of vehiclemodel's , try call modelidentifierforvehicle(model.dynamictype) on each of them, xcode says "cannot invoke 'modelidentifierforvehicle' argument list of type (vehiclemodel.type)" why this? , how can work around it? since you're converting vehicletype string in modelidentifierforvehicle , argue why need use constrain v vehiclemodel , or use generics @ all: func typeidentifier(t: any.type) -> string { return "\(t)" } let vehicles: [vehiclemodel.type] = [carmodel.self, truckmodel.self] typei...

akka patterns.ask implementation details -

we have use case have set following: master type of actor , worker type of actor. the master receives work request input , uses workers orchestrate , generate result. there plan create java class named client.java. creates new instance of master , sends work it. client uses - patterns.ask future pointers , later blocks on until results arrived. patterns.ask(master, initialmessage, t); await.result message the internal documentation of patterns.ask says temporary actor created. but, when invoke , try print hashcode of sender inside master, seemed same actor every time. i have following concerns: how concurrent invocations of patterns.ask managed? can happen thread after calling, ask gets future pointer wrong data put in it? how guarantee future pointers filled relevant responses , not mixed responses others? ex: futurex = future expecting x message futurey = future expecting y message can ever happen futurex y , futurey gets x? i haven't read...

ios - Merging main and private contexts with Core Data -

i'm creating temportary contexts in private queue asynchronously update data persist core data : nsmanagedobjectcontext *privatecontext = [[nsmanagedobjectcontext alloc] initwithconcurrencytype:nsprivatequeueconcurrencytype]; appdelegate *appdelegate = [[uiapplication sharedapplication] delegate]; privatecontext.persistentstorecoordinator = appdelegate.persistentstorecoordinator; [privatecontext performblock: ^{ // parse files and/or call services , parse // responses dispatch_async(dispatch_get_main_queue(), ^{ // notify update user }); }]; then, once i've got new data, need merge changes main context. know common scenario, i'm not sure how should proceed... apple's core data documentation section talks setting merge policy , don't understand way handle that. on other hand, found link , scenario described in "stack #2" section , says looks simpler, , doesn't talk merge policies @ all... which correct or appropriat...

javascript - ng repeat list not getting updated when menu and content is in different template (Ionic Framework) -

i working on 1 ionic framework project. where stuck of list not getting updated. once menu item clicked list should updated accordingly. as both things in different controller don't have idea how can scope.apply below mine code. menu.html <ion-side-menus enable-menu-with-back-views="true"> <ion-side-menu-content> <ion-nav-bar class="bar-assertive"> <ion-nav-back-button class="button-clear button-icon ion-ios-arrow-back"> </ion-nav-back-button> <ion-nav-buttons side="left"> <button class="button button-icon button-clear ion-navicon" menu-toggle="left"> </button> </ion-nav-buttons> </ion-nav-bar> <ion-nav-view name="maincontent"></ion-nav-view> </ion-side-menu-content> <ion-side-menu side="left"> <ion-header-bar class="bar-assertive"...

javascript - Apply gradient or solid color on dynamic element -

i'm trying apply gradient or solid color element jquery. why jquery? because site has several different color combo's generating css classes work. let's have list generated json call <div class="colours"> <ul> <li class="black white"></li> <li class="green"></li> </ul> </div> as can see need 1 list element gradient (black/white) , 1 solid (green) element. so question how set either gradient when list class has 2 colors in or solid color when 1 color needed?? with code below gives me "producthtml not function" or [object object] when try apply colors. $.each(data.product.custom, function(i, custom) { var productshtml = []; $.each(custom.values, function(index, value){ var color = (value.title).tolowercase(); var colorclean = color.replace(/\s?\/\s?/," "); var colors = colorclean.split(/\s+/); if (co...

xml - how to get the text between two nodes using XPath -

i not know how values when nodes have same text. here xml data. <dict> <key>value1</key> <dict> <key>us</key> <string>zubehör</string> <key>fr</key> <string>accessories</string> </dict> <key>value2</key> <dict> <key>us</key> <string>test2</string> <key>fr</key> <string>test</string> </dict> </dict> how value value1 searching text accessories ? real list larger. text given accessories . , need find parent's sibling text --> value1 this 1 possible way, given such description , tiny sample xml : //dict[dict/string = 'accessories']/key we can't sure enough though, work correctly actual xml since sample xml posted contains only target element. update : to respond updated xml sample, can try way : //di...

javascript - Iterating over DOM element -

i iterating dom elements using loop, using 2 syntax , in both getting different results. the javascript method 1 for (var sortable in document.getelementsbyclassname('test')) { console.log("---- " + sortable) sortable.setattribute('class', ''); } th output gives error undefined not function for sortable.setattribute('class', ''); line. and using javascript 2 method var elements = document.getelementsbyclassname("test"); (var i=0; i< elements.length;i++) { elements[i].setattribute("class", ""); } i appropriate result. my html code <span class="test" id="test1">test1 </span> <span class="test" id="test2">test2 </span> <span class="test" id="test3">test3 </span> i don't know why don't dom elements in var sor...

database - Why do I get a "#08S01Bad handshake error" while connecting to remote db using Net::MySQL? -

i able connect remote db using "mysql -h -u'root' option. remote db has no password root. when use net::mysql throws _#08s01bad handshake error_ . my $mysql = net::mysql->new( hostname => '<ip>', database => '<db>', user => 'root', password => '' ); the sql version of local machine 5.5.44. able connect same remote db(mysql ver 5.0.45) using same code different machine(mysql ver 5.0.24).

Remove countdown from Growl Notification with angular -

i using growl.success feature pop message in website. does know how remove display of countdown visible in corner showing how time left pop fade away? you can use time live countdown feature: app.config(['growlprovider', function(growlprovider) { growlprovider.globaldisablecountdown(true); }]); to read more go to: http://janstevens.github.io/angular-growl-2/#time-to-live-countdown

javascript - Adding Theme and Auto complete option to Tinymce -

http://www.avoid.org/codemirror-for-tinymce4/ here example tinymce , codemirror. i want implement autocomplete , add theme codemirror here, didn't work tinymce.init({ selector: '#html', plugins: 'codemirror', toolbar: 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | code', codemirror: { indentoninit: true, // whether or not indent code on init. path: 'codemirror', // path codemirror distribution extrakeys: { 'ctrl-space': 'autocomplete' // auto complete didn't working }, config: { linenumbers: true, theme: "abcdef", //theme didn't work } } });

access modifiers - What are the differences between final class and sealed class in Scala? -

there 2 types of modifiers in scala: final , sealed what differences between them? when should use 1 on other? a final class cannot extended, period. a sealed trait can extended in same source file it's declared. useful creating adts (algebraic data types). adt defined sum of derived types. e.g.: an option[a] defined some[a] + none . a list[a] defined :: + nil . sealed trait option[+a] final case class some[+a] extends option[a] object none extends option[nothing] because option[a] sealed, cannot extended other developers - doing alter meaning . some[a] final because cannot extended, period. as added bonus, if trait sealed, compiler can warn if pattern matches not exhaustive enough because knows option limited some , none . opt match { case some(a) => "hello" } warning: match may not exhaustive. fail on following input: none

linux - Setting path to shared library inside a makefile for compile -

i want compile program using makefile linked against zlib shared libraries different 1 installed on system. don't want them permanently added library pool of system. the path of custom zlib /usr/work/libxlsxwriter-master/zlib-1.2.8 i have tried use like: zlibdir=/usr/work/libxlsxwriter-master/zlib-1.2.8 # static library. $(libxlsxwriter_a) : $(objs) export ld_library_path=$(zlibdir):$(dependencies); \ $(q)$(ar) $(arflags) $@ $(minizip_dir)/ioapi.o $(minizip_dir)/zip.o $^ # dynamic library. $(libxlsxwriter_so) : $(sobjs) export ld_library_path=$(zlibdir):$(dependencies); \ $(q)$(cc) $(soflags) -o $@ $(minizip_dir)/ioapi.so $(minizip_dir)/zip.so $^ -lz # targets object files. %.o : %.c $(hdrs) $(q)$(cc) -i$(inc_dir) $(cflags) $(cxxflags) -c $< %.so : %.c $(hdrs) $(q)$(cc) -fpic -i$(inc_dir) $(cflags) $(cxxflags) -c $< -o $@ %.to : %.c $(hdrs) $(q)$(cc) -g -o0 -dtesting -i$(inc_dir) $(cflags) $(cxxflags) -c $< -o $@...

python - Django one line datetime if null -

i'd this: class ventegroupee(models.model): date_v_debut = models.datetimefield( default=datetime.now, editable=true ) date_v_fin = models.datetimefield( default=none, null=true, editable=true, blank=true ) def __str__(self): return "{0} - ({1} -> {2})".format( self.id, dateformat(self.date_v_debut).format('js f y h:i') if self.date_v_debut else 'infinity', dateformat(self.date_v_fin).format('js f y h:i') if self.date_v_fin else 'infinity' ) but 2 last lines ugly ( date_v_debut , date_v_fin may null need check). there nice "pythonic"/"djangostic" way of doing this? you create helper function format date. def format_date(value) return dateformat(value).format('js f y h:i') if value else 'infinity' then __str__ method simplifies to def __str__(self): ...

c# - Can't deploy asp.net web api debug mode on azure -

i have asp.net web api application. works well. deployed on azure web app (with right click -> publish...). can token url xxxxxx.azurewebsites.net/token when call url xxxx.azurewebsites.net/api/xxxx, returns error 500. wanted remote debug application, tried deploy "configuration : debug" when it, have error : error 5 web deployment task failed. (création d'une application qui n'est pas prise en charge par cet environnement serveur. pour en savoir plus : http://go.microsoft.com/fwlink/?linkid=221672#error_not_supported.) 0 0 api sorry, it's french error (translation : creation of application not supported server environment. see more :). is there knows how deploy in debug ? thank you. salut! i'm not sure specific error remote debugging requires attaching debugger. take @ microsoft article describing how set visual studio remote debugging azure web sites. https://azure.microsoft.com/blog/2014/05/06/introduction-to-remote...

php - Laravel 5 - How to setlocale Carbon time to German -

i using carbon, , don't know how change output german time format. should make change in controller or in view? now want dayname germanstring. that's default output: {{ $game->start_at }} when change in view {{ $game->start_at->format('l') }} i dayname not in german. your answer here think. remember check documentation when in trouble :d http://carbon.nesbot.com/docs/#api-localization setlocale(lc_time, 'german'); $dt = carbon::now(); echo $dt->formatlocalized('%a %d %b %y');

ios - How to get substring of String in Swift? -

this question has answer here: how use string.substringwithrange? (or, how ranges work in swift?) 32 answers if want value nsstring "😃hello world😃" , should use? the return value want "hello world" . the smileys can string. need regexp this. there's more 1 way it. first: string in swift 1.2 bridged nsstring answer : how substring of nsstring? second: answer deal emoticon characters too. var s = "😃hello world😃" let index = advance(s.startindex, 1) // index string.index 2nd glyph, “h” let endindex = advance(s.startindex, 12) let substring=s[index..<endindex] // here got "hello world" if let emojirange = s[index...s.endindex].rangeofstring("😃") { let substring2 = s[index..<emojirange.startindex] // here "hello world" }

php - Codeigniter Calendar within a div and changing month -

i trying use codeigniter calendar event calendar part of social network similar facebook. in codeigniter manual calendar class, gets call echo $this->calendar->generate() method within controller. wish appear within div tag on tab on page. ok use echo within view in way? secondly next_prev_url uses url load next or previous month. use url information user such id. when try use calendar @ moment, takes user_id month or year parameter, giving me view april in year 186 or that. how load next or previous month without using url? first question: it's ok, it's style. separate logic more view, can assign calendar variable. $data['calendar'] = $this->calendar->generate(); $this->load->view('myview', $data); second: don't know why user id inside calendar(maybe unclosed quotes somewhere), there's no need jquery plugin. wrote similar long time ago. //my-calendar-button inside calendar template jquery(document).on('click...

encryption - What is the Difference between Decode and Decrypt? -

this question has answer here: difference between encoding , encryption 9 answers this decrypt , decode word used of people. whenever asked them "what difference between decode , decrypt?" no 1 able answer way wanted hear. can clear this? encrypting , decrypting used hide (a secret message), while encoding , decoding used bring information specific form (e.g. send on internet connection). so encryption part of cryptography , relies on secret key. key 1 can decrypt message read original message. an example encoding url open web page. in url characters have special meaning ?& characters. if want pass characters parameter have encode them, browser doesn't interpret them. urlencode() function place more information. another example encoding utf-8 standard. surely know ascii table, can represent 265 characters 1 byte. utf-8 encoding a...

javascript - Why does the Kendo TreeView delete nodes after drag and drop? -

i have kendo treeview bound datasource connected crud api via transport object. i want re-order nodes in tree using drag , drop , save these changes db. i calling .sync() on datasource in dragend event handler of treeview. var commandstreeview = $("#commandgroups-treeview").kendotreeview({ datasource: mydatasource, draganddrop: true, dragend: function(e) { // sync changes db mydatasource.sync(); } }); however create 2 ajax calls: put updates delete on node has been dragged , dropped. in api react on changes in put request , re-organize object relations in tha database object gets deleted afterwards. this bad in database there bunch of other tables have foreign keys on object , deleted on cascade, well. this confusing me. why dragged object deleted? how can prevent happening? edit: here's workaround gather information need service calling service manually remember nodes expanded cancel changes kendo sto...

avr - how to set fuse bit code for 16mhz oscillator -

currently trying figure out correct fuse settings atmega16 are. want use external crystal oscillator frequency 16 mhz.on point must focus on much? didnt got knowledge articles. said working on fuse bit difficult, there chance of damaging ic. to change external oscillator should write 0xee in low fuse, check clock system clock section in atmega16 datasheet or read description edit lfuse using avrdude sudo avrdude -c usbtiny -p m16 -u lfuse:w:0xee:m remove usbtiny , specify programmes it said working on fuse bit difficult, there chance of damaging ic. of course there chance damage ic, there no learn without try!

export to excel - Extract text word by word from .pdf file using pdfbox -

my object extract text .pdf file , write excel file without losing text formatting. @ moment, have been success extract text word word font, size, , coordinates in array of 2 dimensions have little problem: distinct words in same row have been combined 1 word. for example: 020 | 0542 | cd45 it extracted in same word : 0200542cd45 i can not find error. need help. this code: public class printtextlocations extends pdftextstripper { public static stringbuilder tword = new stringbuilder(); public static string[][] coordtab; public static int p = 0; public static string seek; public static string[] seeka; public static list<string> wordlist = new arraylist(); public static boolean is1stchar = true; public static boolean linematch; public static int pageno = 1; public static double lastyval; public printtextlocations() throws ioexception { super.setsortbyposition(true); } public static void main(string[] arg...

javascript - angular js - unable to access objects pushed to array in controller -

here controller angular.module("app").controller('mycontroller', ['$scope', '$filter','$rootscope','contentservice','$location','$anchorscroll', function ($scope, $filter,$rootscope,contentservice,$location,$anchorscroll) { $scope.searchcontents = [] ; var filterlist = function (list, keyword) { return $filter('filter')(list, keyword); }; var addtosearchcontents = function (list,type){ _.each(list,function(item){ item.type = type; $scope.searchcontents.push(item); }); }; $scope.init = function(){ var str = $location.absurl(); $scope.searchkeyword = str.substring(str.indexof("=") + 1,str.length); !_.isempty($scope.searchkeyword) { // songs contentservice.getallsongs().then(function (result) { var filteredsongs = filterlist(result.data.songs, $scope.searchkeyword); addtosearchcontents(filteredsongs,"so...

javascript - Bootstrap datetimepicker zone issue -

Image
i have bootstrap datetimepicker installed on website, plugin: https://eonasdan.github.io/bootstrap-datetimepicker/ the problem experience whenever user has different timezone, time in datetimepicker changes aswell. (the value coming database , solid date) so example, timezone does: whenever change timezone, reverts this: make 1 timezone default. either in 'connect.php' or in 'head.php'. fix it, wherever feel suitable. date_default_timezone_set("asia/bangkok"); now, according bangkok, user's time set. fix code in page, included in each , every page. that's reason prefer in 'connect.php' or 'header.php'.

validation - ANSI Message format validator -

we know ansi 1 of standard , format transfer financial , billing information between organisation, in our terms application, ie integration purpose, while developing ansi format integrations need message format validator software helpful identify segments required fields , match segments , values between templates , actual message constructing. i have 1 validator hl7 message 7edit, have ansi message validator integrate ansi, ub04 message elements. thanks in advance. your best bet might use open-source java libraries , create small app yourself. here libraries: edireader http://berryworkssoftware.net/index.php?option=com_content&task=view&id=13&itemid=27 bots http://bots.sourceforge.net/en/index.shtml smooks http://www.smooks.org/

php - Query inside query loop with both query outputs required -

on website, want make navigation bar this , categories (here 2012) , articles (here may - october). i've got mysql-database categories (infocat_id, name) , 1 articles (title, body, category, infopost_id). i thought code php follows: <ul> <?php $query1 = $db->prepare("select infocat_id, name info_category"); $query1->execute(); $query1->bind_result($infocat_id, $name); while($query1->fetch()): ?> <li> <?php echo $name; ?> <ul> <?php $query2 = $db->prepare("select title, infopost_id info_posts category = $infocat_id"); $query2->execute(); $query2->bind_result($title, $infopost_id); while($query2->fetch()): ?> <li><?php echo $title; ?></li> <?php endwhile; ?> </ul> </li> <?php endwhile; ?> </ul> sadly, wouldn't work got fi...

java - How do I retrieve resource name from imagespan drawable? -

i have array of imagespan type contains icons added textedit. called: imagespan[] itemspans; when want know icon typed in edittext field - loop through array for (int x = 0; x < itemspans.length; x++) { string icon=""; if (itemspans[x].getdrawable().equals(mywinkiconimageview.getdrawable())) { icon = ":-)"; } } mywinkiconimageview variable linked imageview control points resource, eg: r.drawable.myicon this how how it. if bit wrong. the thing is: want drawable's resource name itemspans[x].getdrawable() instead of pointing imageview control, meaning want know itemspans[x] drawn in edittext rather check imageview. i wish that: if (itemspans[x].getdrawable().equals(r.drawable.smiley) { icon=":-)"; } if (itemspans[x].getdrawable().equals(r.drawable.sad) { icon=":-("; } and on... again, itemspans[x].getdrawable() array contain image resources (icons r.drawable.xxxx ) exist in edittext after u...

c++ - Understanding std::forward -

why compiler not able deduce template parameter std::forward ? i mean: #include <memory> #include <iostream> struct x{}; struct a{ a( const x& ) { std::cout << "cpy ctor\n"; } a( x&& ) { std::cout << "move ctor\n"; } }; x foo() { return {}; } template<typename t,typename arg> t* factory( arg&& ) { return new t(std::forward(a)); // ----------^^^^^^^^^^^^^^^ error: can't deduce template parameter } int main() { factory<a>(foo()); } i know design choice (due std::remove_reference in definition of std::forward ) avoid user forget specify type. can't is: why way it's implemented works prevent deduction? why compiler not deducing forward 's template parameter arg . std::forward declared so: template< class t > t&& forward( typename std::remove_reference<t>::type& t ); typename std::remove_reference<t>::type non-deduced co...

javascript - Access property in div in jquery -

i want access transform in div <div id="slideshow3" class="slideshow" style="width: 490px; height: 490px; margin-top: 10px; margin-left: 10px; transform: rotate(-10.9956rad);"> , it's there instead of inside css because value edited template. i have tried $('#slideshow3').attr('transform'); doesn't work. same problem when try z-index li <li style="z-index: 100;"> <img width="100%" alt="fish" src="/media/cache/95/2d/952d083ec4919a006ad6666680ea322c.jpg" style="transform: rotate(-32.9867rad);"> </li> you can't use .attr because it's not attribute. style attribute. try accessing css method style want. this: $('#slideshow3').css('transform'); $('#slideshow3').css('z-index'); and if need set css can add second parameter css function this $('#slideshow3').css('z-index', 10); ...

regex - Read content of a set of file and check existence of a file in Ant -

i'm new ant , can't quite figure out how following (if possible @ all): have basic code: <copy todir="${mydir}"> <fileset dir="${mydir2}" includes="**/*.html" /> <filterchain> <replaceregex pattern="bla" replace="pla"/> <!-- regex1 --> <replaceregex pattern="doh" replace="dah"/> <!-- regex2 --> <filterchain> </copy> in folder recursed fileset task, have bunch of html files, contain link existing file, contain link non-existing file. now i'm trying to: read each file of fileset extract specific link contain. see if link points existing file. if does, apply regex1. if doesn't, apply regex2 remove dead link. so there's bit of everything: conditions, retrieval of data files ant use in other tasks, , seems impossible do! thanks help. use filterchain tokenfilter replaceregex ,...

SAS: create list of strings in quotation marks as macro variable for input filtration -

Image
i'd use following syntax data new; set old (where=(mystring in ('string1','string2',...,'string500'))); run; in order filter large input data set. 500 strings @ first contained numeric values in variable "bbb" in dataset "aux". far have created macro variable contains required list of 500 strings following way: proc sql noprint; select bbb :stringlist1 separated "',' " work.aux; quit; data _null_; call symputx('stringlist2',compress("'&stringlist1'")); run; data new; set old (where=(mystring in (&stringlist2))); run; ... seems work. there warning telling me that the quoted string being processed has become more 262 characters long. might have unbalanced quotation marks. results still seem plausible. should worried 1 day results might become wrong? more importantly: try find way avoid using compress function setting separated "',' ...

php - How to setup zend 2 routing to expect certain get variables to be passed? -

my app expected handle url sent 3rd party app variables ie: 'www.example.com/user/login?idusuario=500'. configured route way: 'usuario' => array( 'type' => 'segment', 'options' => array( 'route' => '/usuario[/:login][?:idusuario]', 'constraints' => array( 'login' => '[a-za-z][a-za-z0-9_-]*', 'idusuario' => '[a-za-z][a-za-z0-9_-]*' ), 'defaults' => array( 'controller' => 'administrativo\controller\usuario', 'action' => 'index' ) ), ), now, problem app not 'seeing' variables passed through url. when try go params using: $this->getevent()->getroutematch()->getparams(); string like: array(3...

Chrome rendering html/css differently on webserver vs locally -

Image
i have strange problem chrome rendering simple menu written in css , html. when check website on localhost works on web server there bug. here link test website http://slitest.me.pn/menu_bug/ (saving locally removes bug) i care chrome here. have discovered problem caused float: left; in .menu li span but funny, in chrome page inspector manually disabled , enabled parameter , started working fine, after refreshing page wrong again... no idea happening. here's results i'm getting (localhost assume correct): try use margin-left instead of float:left

c - Why does printf(i) give 0 as output in this program? -

#include <stdio.h> int main() { int i=-1; !i; printf(i); } output: 0 why output zero ? in code, printf(i); is invalid , because printf() expects const char * first argument, , you're passing int . invokes undefined behaviour . turn compiler warnings. basic level of warning turned on, should message along line warning: passing argument 1 of ‘printf’ makes pointer integer without cast solution: believe, wanted is printf("%d\n", i);

javascript - Moving the axes in d3.js -

i have 2 axes in graph right now, stuck @ left , bottom of graph. want make axes line (0,0) coordinate, or in other words want axes @ x=0 , y=0 here's axes code: //setup x var xaxis = d3.svg.axis() .scale(xrange) .ticksize(5) .ticksubdivide(true), //setup y yaxis = d3.svg.axis() .scale(yrange) .ticksize(5) .orient("left") .ticksubdivide(true); i thinking way might make smaller svg underneath 1 have, starts @ zero, , put axes there, , remove them 1 have right now. here's full code: http://jsfiddle.net/v92q26l8/ the key part of code bit attach axes vis.append("svg:g") .attr("class", "x axis") .attr("transform", "translate(0," + (height - margins.bottom) + ")") .call(xaxis); vis.append("svg:g") .attr("class", "y axis") .attr("transform", "translate(" + (margins.left) + ",0)...