Posts

Showing posts from February, 2013

scala - How to perform calculation given multiple types of numbers? -

i have numbers list go through it, , doing simple calculation 2 numbers: i have numbera , numberb, , calculation im doing is: val res = (numbera/numberb) * 100 now, dont know type number, know float (with 2 nums after dot) or integer... so want know syntax in scala calculate it? currently have: val num1 = (vatreclaimed.toint/vatpaid.toint) * 100 but dont work, , cannot use toint guess since dont know type... whats important me res hold right answer, if 2.3 * 4 res hold 9.2 thanksss! when not know type only, number, have work numeric . numeric can convert numeric value double, float, int or long . precision recommend double : def calc[a : numeric, b : numeric](a: a, b: b): double = (a.todouble / b.todouble) * 100

javascript - Error when using datatables callback -

i have datatables table set call json server. able format rows based on data in each row this: https://datatables.net/examples/advanced_init/row_callback.html so using code in link code so: <script> $(document).ready(function() { testtable = $('#mylist').datatable({ // current proprerties , ajax stuff "createdrow": function ( row, data, index ) { if (my own conditional) { $('td', row).eq(5).addclass('highlight'); } } }) however when run error: uncaught typeerror: cannot read property 'replace' of undefined i new jquery , datatables i'm not of start this. has come across before?

Java Matrix using Arrays -

i'm struggling find answer problem below. user inputs rows , columns. example below given 4 x 4 matrix. 1 8 9 16 2 7 10 15 3 6 11 14 4 5 12 13 i cannot find how relate numbers when printing array. obvious relation how goes downwards , upwards. perspective looks hard. i'm beginner. not quite sure if there point post code, it's basic lines: public static void main(string[] args) { scanner scanner = new scanner(system.in); system.out.println("please enter array rows: "); int rows = scanner.nextint(); system.out.println("please enter array columns: "); int columns = scanner.nextint(); int[][] array = new int[rows][columns]; int counter = 0; (int j = 0; j < columns; j++){ (int = 0; < rows; i++) { counter++; array[i][j]=...(stuck @ beginning); } probably i'd need use several loops , not above-mentioned or totally wrong ... thank in advance! i think

reactjs - Flux architecture for a login or basically most forms processing -

i trying understand bit more flux architecture , designing simple login component. suppose when login (post ajax) , error comes back. how information flow in flux? i think logincomponent should work on handlesubmit function. after ajax call comes error , message should component create action such "updateloginstatus payload {message: "no e-mail found"}. trigger loginstore or save status message , emit event such "loginstatusmessagechanged". another totally different component called loginstatusmessage register listen events on loginstore. notified of event , proceede update it's own state message. go out loginstore , fetch message , display user via render. i believe example covere question quite well: https://github.com/przeor/react-router-flux-starter-kit/

jquery - Firefox simple extension to post data -

i've created simple extension firefox. i've tried send user selected text. on mozilla web site can not find document sending rest data via post or example httpclient. want send selected text server , via server parse it. var req = request({ url: 'http://localhost:9989/put', content: btoa(json.stringify(res)), overridemimetype: "text/plain; charset=latin1", oncomplete: function (response) { pendingreports -= 1; if (onfinish && pendingreports === 0) { onfinish(); } } }); req.post();

javascript - How do I access a certain string variable in a json API? -

i using weatherunderground api, , access forecast today. use parsed_json[][] until variable need, in case there array. here code: function findweather() { jquery(document).ready(function($) { $.ajax({ url : "http://api.wunderground.com/api/c531e176f43b999d/forecast/q/ct/old_greenwich.json", datatype : "jsonp", success : function(parsed_json) { var forecasts = parsed_json['forecast']['txt_forecast']['forecastday: 0']['fcttext']; var forecaststring = "the weather is" + forecasts + "." speak(" test" + forecaststring); } }); }); } function speak(x) { var msg = new speechsynthesisutterance(x); window.speechsynthesis.speak(msg); } if go url, see entire sheet , info trying access. i've been trying solve few hours, , can't find google. try this: parsed_json['forecast']['txt_forecast']['forecastday'][0]['fcttext']; don

javascript - $(this).toggleClass not working -

so i'm busy creating mini webshop, , i'm using google's front-end ( mdl ) template what wanted in webshop is, when user clicks on x product want toggle class, i'm using closures inside loops detect clicks on product. my issue is, class won't toggle. tried using addclass work not convenient because want toggle class (from selected product not selected) checkout snippet & understand, see detect clicks properly. toggling classes doesn't work. $(document).ready(function() { console.log("document ready"); (var = 1; < $(".products").length; i++) { (function(index){ $(".products").click( function(e){ console.log("click successfull!"); console.log(this); $(this).css("border", "1px solid #1976d2"); $(this).toggleclass("mdl-shadow--16dp"); }); })(i); } $("#card").keyup(function(event){

php - Hide mysql AI UID's, unique and not unique results, always same length -

i need convert mysql auto-increment bigint uid's (1-20 digit) strings of same length public displaying , url's (hiding real uid). i need create 3 variants, 1 creates same encrypted string each time per id (these must same length (10-50 alphanumeric)), 1 creates different/random string each time id displayed never same can still retrieved (these must same length (10-50 alphanumeric)). last short id (for user id's), displaying least amount of characters (compressed string), alphanumeric, same per id (always same length, short possible); 1 created once per session can take longer or use more resources create. // method 1 $id = '1'; displayed: 64359b7192746a14740a (same each time, id's displayed @ same length) // method 2 $id = '1000000000000000000'; displayed: 746a14740ad4bb7afe4eht36nh 146a7492719b3564094eyu8o0p fe7abbd40a7416fd90012fvd3e (different each time, id's displayed @ same length) // method 3 $userid = '2

ruby - How to really set up a Rails 4.2 application in a subdirectory? Using nginx and puma -

first have tried hard long time. have application that's in /home/deploy/app/myapp , want deploy accessed in http://myurl.com/myapp because want have many others on same domain name. the problem rails default configuration not working should. should put configuration in application.rb or in production.rb or environment variable (rails_relative_url_root) [ http://edgeguides.rubyonrails.org/configuring.html#deploy-to-a-subdirectory-relative-url-root ]. keep getting 404. way worked when put in routes.rb: rails.application.routes.draw scope '/myapp' || '/' root 'home#index' end end it fells wrong. "config.relative_url_root" should work. don't it? and thing assets still wrong. can't them right. should do? my nginx config is: upstream myapp { server unix:///home/deploy/apps/myapp/shared/tmp/sockets/puma.sock; } server { listen 80; server_name myapp; keepalive_timeout 5; access_log /home/deploy/apps/myapp/current/l

actionscript 3 - Cannot push past 1 element to basic AS3 Array -

i new , hoping it's should have been obvious. when run code below, array newhole , newarray both return 1 on trace. code built newhole array, created newarray in hopes of troubleshooting. did not help. class bullethole contains no code didn't post that. thank you. import flash.display.*; import flash.events.*; import flash.ui.mouse; mouse.hide(); var myreticle:movieclip; var holearray:array = new array(); var randomhole:number = randomnumber(1, 5); var newhole:bullethole = new bullethole(); var newarray:array = new array(); stage.addeventlistener(mouseevent.mouse_move, followreticle); stage.addeventlistener(mouseevent.click, myfire); stage.addeventlistener(mouseevent.click, checkcount); function followreticle(event:mouseevent):void { myreticle.x = mousex; myreticle.y = mousey; } function myfire(int):void { stage.addchild(newhole); newhole.x = myreticle.x; newhole.y = myreticle.y; //holearray.push(newhole); newhole.gotoandstop(randomhol

node.js - Herkoku "must sleep 6 hours in a 24 hour period", showing custom text? -

heroku says (free) must sleep 6 hours in 24 hour period ok, that´s fine. but can influence message or text shown user like: "hello user, unfurtunately the website needs rest, please try again 6 a.m 2 a.m ". i can influence uptime, because of sending ping every 20 min. i found this : ... free dynos allowed 18 hours awake per 24 hour period, , on next few weeks begin notify users of apps exceed limit ... if you're using cdn create scheduled task replaces root page static page @ time of day, make sure cdn updates page, , spin down app 6 hours. the docs cloudflare might place start learning how cdn works , how set (see: cloudflare support > getting started ). of course use different content delivery network (cdn) service.

java - Dependency Injection: Difference between loose coupling mechanisms based on interface and class? -

suppose, have 2 configurations. first one: interface { ... } class implements { ... } class b implements { ... } class component { i; component (i i) { this.i = i; } } second one: class c { ... } class extends c { ... } class b extends c { ... } class component { c c; component (c c) { this.c = c; } } what in difference between 2 configurations using 2 different loose coupling mechanisms (based on interface , based on class)? why should need use interface on class? an object can implements multiple interfaces can extends 1 class, user of loose coupled library may not able extends class. when extends, incorporate code of superclass yours, there no code incorporate implements better suited. finally not same paradigm, when write "b extends a" "i a, same things, can make other things". when write "b implements a" "i b, can treat me a". long st

python - Selenium - cant get text from span element -

i'm confused getting text using selenium. there span tags text inside them. when search them using driver.find_element_by_... , works fine. but problem text can't got it. the span tag found because can't use .get_attribute('outerhtml') command , can see this: <span class="branding">thrivinghealthy</span> but if change .get_attribute('outerhtml') .text returns empty text not correct can see above. here example (outputs pieces of dictionary): display_site = element.find_element_by_css_selector('span.branding').get_attribute('outerhtml') 'display_site': u'<span class="branding">thrivinghealthy</span>' display_site = element.find_element_by_css_selector('span.branding').text 'display_site': u'' as can see, there text not finds it. wrong? edit: i've found kind of workaround. i've changed .text .get_attribute('in

java - How can i make that in the timer my program will do something every second? -

in top of mainactivity.java added: private handler customhandler = new handler(); long timeswapbuff = 0l; then inside oncreate did: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); starttime = systemclock.uptimemillis(); customhandler.postdelayed(updatetimerthread,0); timervalue = (textview) findviewbyid(r.id.timervalue); startbutton = (button) findviewbyid(r.id.startbutton); startbutton.setonclicklistener(new view.onclicklistener() { public void onclick(view view) { starttime = systemclock.uptimemillis(); customhandler.postdelayed(updatetimerthread, 0); } }); pausebutton = (button) findviewbyid(r.id.pausebutton); pausebutton.setonclicklistener(new view.onclicklistener() { public void onclick(view view) { customhandler

swift - Textured NSWindow Background Gradient -

Image
i trying generate own textured nswindow appears different gradient default metallic appearing one. so far i've subclassed nswindow no success below. import cocoa class pswindow: nswindow { override init(contentrect: nsrect, stylemask astyle: int, backing bufferingtype: nsbackingstoretype, defer flag: bool) { super.init(contentrect: contentrect, stylemask: astyle, backing: bufferingtype, defer: flag) let gradient: nsgradient = nsgradient(startingcolor: nscolor(red: 48 / 255, green: 35 / 255, blue: 174 / 255, alpha: 1), endingcolor: nscolor(red: 200 / 255, green: 109 / 255, blue: 215 / 255, alpha: 1)) gradient.drawinrect(contentrect, angle: 45) } } am going correct way? nswindow subclass of nsresponder , shouldn't drawing within it. solutions: you should override "contentview" variable (custom window subclass) , set layer cagradientlayer create in set method of "contentview" create custom subclass of

swift - How would I limit the amount of items in a tableview and automatically load more? -

again real quick helped me out. the last thing i'm dealing follows. i have search functionality in application , looks through parse keyword , matches accordingly. works fine now, list gets bigger, i'm assuming load times might little much. instantly shows 200 text results , i'm wondering if it'll crash or lag when showing 2,000. the following important parts of search class. func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { return searchresults.count } func tableview(tableview: uitableview, heightforrowatindexpath indexpath: nsindexpath) -> cgfloat { return uitableviewautomaticdimension } func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let mycell = tableview.dequeuereusablecellwithidentifier("mycell", forindexpath: indexpath) as! uitableviewcell //mycell.backgroundview = uiimageview(image: uiimage(named: "goodbg"))

javascript - angular-tags: Reset the tags input value -

index.html <div class="modal-header" > <button type="button" class="close" ng-click = "submit(information.add, information.subject, information.emailcontent); close()">×</button> <h3>compose email</h3> </div> <div class="modal-body"> <form name = "form.email"> <tags options="{addable: true}" typeahead-options="typeaheadopts" data-model="information.add" data-src="toperson toperson toperson in to"></tags> <input type="text" placeholder="subject" style="width:95%;" data-ng-model = "information.subject"><br /> <textarea style="width:95%;" rows="10" data-ng-model = "information.emailcontent"></textarea>

sql server - c# Local Database insert into doesn't work -

i tried many times insertion doesn't work! please me.. codes: sqlconnection conn = new sqlconnection(@"data source=(localdb)\v11.0;attachdbfilename=|datadirectory|\database1.mdf;integrated security=true"); conn.open(); sqlcommand cmd = new sqlcommand("insert mytbl(id, nav) values('yek','du')", conn); //yek , du examples //following command doesn't work, //"insert mytbl(id, nav) values('"+tb.text+"','"+tb2.text+"')" cmd.executenonquery(); conn.close(); the whole user instance , attachdbfilename= approach flawed - @ best! when running app in visual studio, copying around .mdf file (from app_data directory output directory - typically .\bin\debug - app runs) , most likely , insert works fine - you're looking @ wrong .mdf file in end! if want stick approach, try putting breakpoint on myconnection.close() call - , inspect .mdf file sql server mgmt studio express - i'm

python 3.x - Key Pressing System PyGame -

i'm making basic pong game , want make system button press makes paddle goes or down. i'm new pygame , here's code far. import pygame, sys pygame.locals import* def pong(): pygame.init() display=pygame.display.set_mode((600,400),0,32) pygame.display.set_caption("pong") black=(0,0,0) white=(255,255,255) red=(255,0,0) display.fill(black) while true: def p(b): pygame.draw.rect(display,white,(50,b,50,10)) xx=150 p(xx) event in pygame.event.get(): if event.type==keyup , event.key==k_w: p(xx+10) xx=xx+10 pygame.display.update() elif event.type==quit: pygame.quit() sys.exit() please read tutorials and/or docs . basic , if don't right bite later. anyway, here's how look: import pygame pygame.init() display = pygame.display.set_mode((600,400)) paddle = pygame.rect(0, 0, 10, 50) paddle.midleft = display.get_rect().midleft speed = 10 clock = pygame.time.clock() while true: event in pygame.event

actionscript 3 - Java heap space,AIR 18 -

i working on ios application, using flashdevelop , air sdk version 18. got java heap space error while compiling project. here have tried: modify jvm.config - have not tried this, because there not such file in air sdk. modify adt.bat file -xms1024 -xmx1024 - tried not working modify mxmlc.bat, adt.bat - not working any solution? i'll grateful ideas! please keep in mind cannot divide resources , code - must pack them together. ran across problem today , wanted let people know can caused programmer error... i had set simple parallax background game. worked fine when player moved short distance needed test long distance. in game player moves right automatically until encounters enemy him walk long distance had move enemy further away. set enemy x 999999, compiled... , got java heap space error. have no idea why cause me run out of memory (i don't understand how display objects work) restoring enemy's position , restarting flashdevelop fixed proble

java - Printing first 3 decimal places without rounding -

okay, know there question quite similar already, didn't quite answer question. please let me know if i'm doing wrong though. i have written program gets temperature in fahrenheit user , converts celcius. looks this: import java.util.scanner; public class fahrenheittocelcius { public static void main(string[] args) { double fahrenheit; scanner sc = new scanner(system.in); system.out.print("please enter temperature in fahrenheit: "); fahrenheit = sc.nextdouble(); double celcius = (fahrenheit - 32) * 5 / 9; string num = string.format("%.3f", celcius); system.out.println(" "); system.out.println(fahrenheit + "f" + " " + num + "c"); } } when prints answer out, want first 3 decimal places printed, not rounded. example, if input 100f , want 37.777c printed, not 37.778c . i have tried using decimalformat , string.format (like abov

In a java developed REST based app java architecture, should I split an implementation for requests/validations and one for domain? -

in past lets have domain model of bike , i'd make interface called bike , , in past i'd create implementation of that. , in implementation, i'd cram validation, json rules, database mapping annotations, etc. seems make system ugly , brittle. many gyrations map , display , transform. i'm wondering (as experiment) if should create 1 implementation takes inputs , validates data, , creates instance of model use deeper inside code after transformations. so: (type)bike -> bikeweb, bikemodel however when seems lose whole point of json transformations, , add complexity interface hell. because see happening is (type)bike -> (types) bikeweb, bikemodel -> bikewebimpl, bikemodelimpl ...times 1000 i'm asking design pattern i'm describing 1 typical debate on way go, actual pattern should using, or i'm out of gourd. it seems every rest solution in java world has dilemma me, maybe should using solution, i'm open well. to honest i'

php - Use one iPhone to call a method on another iPhone -

my app uses objective c , afnetworking, j son, , php let users register, login, take, , upload photos uiscrollview jpeg thumbs. in app referenced , stored either programmatically or in database i.e. usernames, user ids, , photo ids. app uses 5 php functions (register, login, upload, logout, stream) called using following command part of class subclasses afhttpclient in afnetworking. -(void)commandwithparams:(nsmutabledictionary*)params oncompletion:(jsonresponseblock)completionblock; when photo tapped stream command called show user fullscreen version of thumbnail. segue takes user new viewcontroller. my goal take picture on iphone uploaded picture tapped scaling existing api. how do this? edit update in progress...

robotics - what sensors, cameras, image algorithms should be used for tracking a path laid out in white tape -

my question on sensors, camera (image algorithms). looking field of robotics , wanting construct track (path) machine of sorts traverse along. have simulated goal potential , obstacles in program. same physical "robot" , road path laid out in white tape or similar. tape simulate boundary must not crossed. my question sensors should invest in in order to track white tape or similar? use camera , image algorithms? if can point me in right direction on hardware (sensors) , software (which algorithms can applied)? many thanks i think more suited electrical engineering or robotics sites ... anyway answer depends on level of hw , programming skills. control unit i recommend start mcu gpio,pwm,dac,adc,sram @ disposal , no need many supporting parts. choice atmel at32uc3l064 . not need crystal has 64kb of sram use , have many features ... datasheet says runs on max 66mhz computing power more enough. can programmed isp use of rs232 serial port +

asp.net - Button Inside Gridview Inside Update Panel Not Working -

i'm starting use update panels in solutions, i'm getting familiar them. have gridview has delete button associated each row displayed. when click on delete button, it's onclick event should displays panel acts semi-modal confirmation box (done lightbox) delete record associated relevant row. however, when click button, panel doesn't show because of in update panel. works fine without update panel any ideas? here's stripped down version of code: <script runat="server"> protected sub linkbuttondelete_click(byval sender object, byval e eventargs) panelconfirmmessage.visible = true panelconfirmlightbox.visible = true end sub '.... note there other code handles delete ... </script> <html> <head"></head> <body> <form id="form1" runat="server"> <asp:updatepanel id="updatepanel1" runat="server"> <contenttemplate> <a

Visual Studio Extensibility: Get the Git repository's path from Team Explorer's Git Commit Details page -

i adding git integration visual studio extension diff files , allows diffing (i.e. comparing) files in team explorer window previous version. have working git changes page (in team explorer), since when the microsoft.teamfoundation.git.controls.extensibility.ichangesext service files in it's includedchanges property contain full file path on disk. however, when working git commit details page the microsoft.teamfoundation.git.controls.extensibility.icommitdetailsext service , changes property contains file paths relative git branch. i'm using the libgit2sharp library interact git repository, , in able access git repository libgit2sharp requires path file in repository. since icommitdetailsext changes property contains file paths relative git repo, don't know how path git repo (so can retrieve previous versions of file compare against). at first thought access path solution file using dte object, realized it's possible view pending changes , previous commits g

mysql - CodeIgniter PHPExcel export to excel for 16 digit varchar data type error -

i trying export table mysql excel in codeigniter using phpexcel. column varchar datatype [16 digits], result in excel become a,be+15. example 3374142005140004 in mysql, in excel export became 3,37414e+15 or 3374142005140000, lost last digit value 4. best file type export opendocumentspreadsheet (.ods) [tried manually xampp export file]. phpexcel doesn't have oocalc writer yet. , don't know how integrate phpmyadmin export in codeigniter app. so, if have solution problem, please please share solution. in advance help/suggestion. if string value longer php integer, you'll need save string using setcellvalueexplicit() instead of setcellvalue() phpexcel allow write openofficexml files using opendocument writer

AppleScript: remove last character in text string -

i need remove last character in text string applescript. it's proving more difficult problem thought. can explain how done? try this set t "this string" text 1 thru -2 of t output: "this strin"

How to create Django Models based on DTD file/XML -

i new xml , dtd files. need on how create models in order upload xml file in it. files have work can found under these 2 links: xml fomat: https://webgate.ec.europa.eu/europeaid/fsd/fsf/public/files/dtdfullsanctionslist/content?token=dg9rzw4tmjaxnw dtd format: https://webgate.ec.europa.eu/europeaid/fsd/fsf/public/files/dtdfullsanctionslistschema/content?token=dg9rzw4tmjaxnw the dtd file looks this: <?xml version="1.0" encoding="utf-8"?> <!element whole (entity+)> <!attlist whole date cdata #required > <!element entity (name+, address*, birth*, passport*, citizen*)> <!attlist entity id cdata #required type (e | p) #required legal_basis cdata #implied reg_date cdata #implied pdf_link cdata #implied programme cdata #implied remark cdata #implied > <!element name (lastname?, firstname?, middlename?, wholename?, gender?, title?, function?, language?)> <!attlist name id cdata #requir

haskell - Yesod not routing to handler -

i scaffolded yesod ( yesod 1.4.1.5 ) application using stack tool. cannot new route work. # config/routes /static staticr static appstatic /auth authr auth getauth /favicon.ico faviconr /robots.txt robotsr /trails trailsr / homer post then defined following module: -- handler/trails.hs module handler.trails import import --import yesod.form.bootstrap3 (bootstrapformlayout (..), renderbootstrap3, -- withsmallinput) gettrailsr :: handler html gettrailsr = defaultlayout $ settitle "welcome yesod!" $(widgetfile "trails") i made trails template file: -- templates/trails.hamlet <h1>all trails a-z <ul> <li>hi i did not create .julius or .lucius files. matter? and made sure put module in application.hs : -- import relevant handler modules here. -- don't forget add new modules cabal file! import handler.common import handler.home import handler.trails and made sure regi

angularjs - Test if function has been called inside $scope.$watch -

i'm trying figure out how test karma jasmine if function executed inside $watch conditions need. here in controller. $watch contains couple of condition. $scope.$watch('player', function (newval, oldval) { if (oldval && newval != undefined && newval != oldval) { if (newval.email == oldval.email && newval.emwallet == oldval.emwallet) $scope.savesettings(); } }, true) this part of test it('when player property changed savesettings calls', function () { var sspy = spyon(scope, "savesettings"); expect(scope.player.email).toequal(''); expect(scope.player.emwallet).toequal(''); expect(scope.player.balance).toequal(10.0000); //change player balance scope.player.balance = 10.0304; scope.$apply(); expect(scope.player.email).toequal(''); expect(scope.player.emwallet).toequal(''); expect(sspy).tohavebeencalled(); }); in test

ios - can't set to "UIBarPositionTopAttached" on navigationBar -

Image
i made uiviewcontroller have navigationcontroller parent (connected in storyboard), , want apply picture of navigationbar statusbar background. but seems statusbar can't state "translucent", i tried set - (void)viewwillappear:(bool)animated { [self.navigationcontroller.navigationbar setbackgroundimage:[uiimage imagenamed:@"bartop.png"] forbarposition:uibarpositiontopattached barmetrics:uibarmetricsdefault]; [self setneedsstatusbarappearanceupdate]; .... } - (uistatusbarstyle)preferredstatusbarstyle { return uistatusbarstylelightcontent; } in uiviewcontroller . but backgrounds of navigation , status bar have been separated. i try both make plist file "view controller-based status bar appearance" yes , no. still can't configure statusbar viewcontroller. couldn't find same problem in bulletin board . does knows solution??or how debug? thank reading. (9/3 added: want make backgrounds navigationbar , statusba

mysql where string ends with numbers -

my table column contains values like: id | item ------------- 1 | aaaa11a112 2 | aa1112aa2a 3 | aa11aa1a11 4 | aaa2a222aa i want select rows value of item ends numbers. there this? select * table item '%number' you can use regexp , character class select * table item regexp '[[:digit:]]$' demo explanation: [[:digit:]] >> match digit characters $ >> match @ end of string within bracket expression (written using [ , ]), [:character_class:] represents character class matches characters belonging class. sidenote: other helpful mysql character classes use regexp , taken documentation : character class name meaning alnum alphanumeric characters alpha alphabetic characters blank whitespace characters cntrl control characters digit digit characters graph graphic characters lower lowercase

ios - Insets to UIImageView? -

i'd achieve : scale fill mode of image view insets uiimageview image not meet edges of uiimageview bottomline: want increase touch area of uiimageview without stretching image beyond size. is possible through storyboard ? if not can tell how programmatically ? i can achieve similar functionality through uibutton , setting image inset through storyboard cant find such thing uiimageview . using method given here : uiimage *image= [myutil imagewithimage:[uiimage imagenamed:@"myimage"] scaledtosize:cgsizemake(80, 80)]; uiimageview* imgview = [[uiimageview alloc] initwithframe:cgrectmake(0, 0, 100, 100)]; imgview.contentmode = uiviewcontentmodecenter; [imgview setimage:image]; now insets become 100-80 i.e. 20 . this workaround provide insets uiimageview. better answers welcomed.

c# - How can I cancel from Device.StartTimer? -

when use system.threading.timer can stop timer , start again: protected override void onscrollchanged(int l, int t, int oldl, int oldt) { if (timer == null) { system.threading.timercallback tcb = onscrollfinished; timer = new system.threading.timer(tcb, null, 700, system.threading.timeout.infinite); } else { timer.change(system.threading.timeout.infinite, system.threading.timeout.infinite); timer.change(700, system.threading.timeout.infinite); } } what best way stop device.starttimer , start again? i guessing referring device.starttime in xamarinforms. way stop or continue recurring task determined second argument returns: // run task in 2 minutes device.starttimer(timespan.fromminutes(2), () => { if (needstorecur) { // returning true fire task again in 2 minutes. return true; } // no longer need recur. stops firing task return false; }); if want temporarily stop timer,

javascript - Retriving values and passing values between HTML and extjs View -

is there way retriving values , passing values between html , extjs view? an example in html <input id="text" type="text" value="book" style="width:80%" /><br /> in view var win = ext.create('ext.window.window', { items: { // created windows need codes call html passing values, , after retrieve data html , getting values id: text; } } the flow want change input value book newbook. view code , return values html again. possible? in advance! sure that's possible. can take @ ext.select , shorthand of ext.dom.element.select . selector creates composite element , can data etc. var els = ext.select("#some-el div.some-class", true); // or select directly existing element var el = ext.get('some-el'); el.select('div.some-class', true); els.setwidth(100); // elements become 100 width els.hide(true); // elements fade out , hide // or els.setwidth(100).hide(tr

broadcastreceiver - SMS_Sending Blackberry 10 Android runtime? -

i tried repackage android app blackberry 10. worked pretty well, app unable send sms. my android code: private void sendsms(string phonenumber, string message) { string sent = "sms_sent"; string delivered = "sms_delivered"; pendingintent sentpi = pendingintent.getbroadcast(getbasecontext(), 0, new intent(sent), 0); pendingintent deliveredpi = pendingintent.getbroadcast(getbasecontext(), 0, new intent(delivered), 0); //---when sms has been sent--- registerreceiver(new broadcastreceiver() { @override public void onreceive(context arg0, intent arg1) { switch (getresultcode()) { case activity.result_ok: toast.maketext(getbasecontext(), "sms sent", toast.length_short).show(); break; case smsmanager.result_err

ios - TableView Collapse/Expand with sections -

Image
question related uitableview collapse , expand mode dynamic sections. got requirement of showing number of cells has collapse , expand option , once user expand cell having list of sections , cells. more info attaching screenshot, , please suggest me best approach. there plenty of libraries available , many more other requirements,check out cocoacontrols

I can't handle php mysql login page -

i trying make change password users. cant manage it. whatever tried, returns me problem alert wrote. can suggest anything? trying fix hours. the below form code; <form action="change_s_pwd.php" method="post" class='form-horizontal form-validate' id="bb"> <div class="control-group"> kullanıcı adı : <div class="controls"> <input type="text" name="user" placeholder="your login id" data-rule-required="true" data-rule-minlength="4"/> </p> </div> <div class="control-group"> <p>secure id :

python - Django: How to handle Settings Keys in database -

i came across requirement need save settings key, value in database. created model key, value fields. want access these values. first thing came in mind should value database. here example. class settings(models.model): key = models.charfield(max_length=50) value = models.charfield(max_length=100) @classmethod def get_key_value(cls, key): obj = cls.objects.filter(key==key) if obj.count() > 0: return obj.first().value; return none class meta: db_table = u'app_settings' i think not idea hit database every time. want save list in global variable or session. how can store data in global? i dont know approach? please suggest me better way it. why need save when can access data in settings.py directly? from django.conf import settings print settings.some_value so there no need save believe

image processing - Why are non-gray colors used when rendering gray letters? -

Image
why left of these better right? called something? see why anti-aliasing in black characters use colors other gray-scale? on graphicdesign site. words "anti-aliasing" , "sub-pixel rendering" : [subpixel rendering] takes advantage of fact each pixel on colour lcd composed of individual red, green, , blue or other color subpixels anti-alias text greater detail or increase resolution of image types on layouts designed compatible subpixel rendering.

java - spring apache phoenix integration on Hbase steps -

i new apache phoenix .how use apache phoenix spring.what steps connect spring , apache phoenix.how configure jdbc template phoenix connection details. 1) first of add specific apache phoenix dependency pom.xml file 2) create data source object this: <bean id="datasource" class="org.apache.commons.dbcp.basicdatasource"> <property name="driverclassname" value="org.apache.phoenix.jdbc.phoenixdriver" /> <property name="url" value="jdbc:phoenix:localhost" /> </bean> 3) inject datasource dao class <bean id="somedao" class="com.stackoverlow.somedao"> <property name="datasource" ref="datasource" /> </bean> 4) implement dao public class somedao extends namedparameterjdbcdaosupport { @override public void insert(final someentity someentity) { string sql = "upsert someentities(id, fiel

How do I customize <title> of SilverStripe pages -

how customize <title> of silverstripe pages? right it's <title><% if $metatitle %>$metatitle<% else %>$title<% end_if %> &raquo; $siteconfig.title</title> your current page template page <title> tag is: <title> <% if $metatitle %>$metatitle<% else %>$title<% end_if %> &raquo; $siteconfig.title </title> you can change use variable or content like. your current template code checks if page has $metatitle defined. if use this. otherwise use page $title . the last part adds site title $siteconfig.title end. field can found in cms on settings tab. the metatitle variable removed core silverstripe code in 3.1. if add functionality in can installing silverstripe metatitle module or adding variable , input page class yourself. here code add metatitle variable page class: class page extends sitetree { private static $db = array( 'metatitle' =>

curl - How to send the client id and secret id of OAuth2 using AngularJs? -

i have rest api oauth2 developed using spring boot resource server , authorization server. fetch token using curl, postman rest client , request granted service using token provided oauth. now, need know how pass oauth2 client_id, secret_id using angularjs , know what's usage of -vu in following curl request, curl -x post -vu clientapp:123456 http://localhost:8080/oauth/token -h "accept: application/json" -d "password=spring&username=roy&grant_type=password&scope=read%20write&client_secret=123456&client_id=clientapp". please me know , provide me samples work on angularjs ? tia.., here's example jhipster: https://github.com/jhipster/jhipster-sample-app-oauth2/blob/master/src/main/webapp/scripts/components/auth/provider/auth.oauth2.service.js note: i'd use blank client secret (both in angularjs , spring) since secret isn't secret in js anyway. see https://stackoverflow.com/a/32062458/1098564 , below:

Unable to connect bluetooth mouse and android phone -

how connect bluetooth mouse , android phone using bluetooth . want connect phone bluetooth device can mouse . if mouse scan , , paired how connect device. bluetooth mouse name. not using bluetooth related services or anything. mouse , receiver works on particular frequency can't connect frequency using bluetooth . as per example can't connect else mouse receiver. frequency matters. :) hope understand. luck

java - How to count records of particular id in spring boot and hibernate -

i working on project using spring boot , hibernate. want count records against id in table. can count records of table unable count records against foreign key. here controller code @requestmapping("/rating/{id}") @responsebody public long getratinginfo(@pathvariable("id") long id, httpservletrequest req, httpservletresponse res) throws exception { long postobj = mydao.count(); return postobj; } here passing id in url there no method of count pass id find records. and here dao interface @transactional public interface mydaointerface extends crudrepository<rating, long>{ } add dao: @query(countbypostid) integer countbypostid(long post_id); final string countbypostid= "select count(ra) rating ra ra.post_id = ?1" and call likewise: @requestmapping("/rating/{id}") @responsebody public long getratinginfo(@pathvariable("id") long id, httpservletrequest req, httpservletresponse res) throws exception {

scheduler - How to know Workload Automation Agent's FTP site -

Image
i ftp put csv.file workload automation agent provisioned bluemix. regarding following bluemix doc, think can ftp put files agent following command. https://www.ng.bluemix.net/docs/services/workloadscheduler/index.html to upload , download files , workload automation agent, can use curl command line. curl -t data.dat ftp://myftpsite.com/dat/ --user myname:mypassword but there no information how know ftp site. think vcap_services values of workload scheduler service connection service instance, not agent. tried ftp access url of vcap_services, got connectionn error. does bluemix doc mean workload automation agent ftp client(no1), not ftp server(no2) ? the documentation referring own ftp server, , "myftpsite.com" example/placeholder. ftp server/account example: - own ftp server - ftp service account registered on shared hosting and on. then can replace myftpsite.com ftp service (using hostname or ip), myname , mypassword service account related data.

java - How to inherit parent's inner class in this code? -

below parent class dblylinklist package javacollections.list; import java.util.iterator; import java.util.nosuchelementexception; public class dblylinklist<t> implements iterable<t>{ class dlistnode<t> { private t item; private dlistnode<t> prev; private dlistnode<t> next; dlistnode(t item, dlistnode<t> p, dlistnode<t> n) { this.item = item; this.prev = p; this.next = n; } } ..... } below derived class lockablelist , package javacollections.list; import javacollections.list.dblylinklist.dlistnode; public class lockablelist<t> extends dblylinklist<t> { class lockablenode<t> extends dblylinklist<t>.dlistnode<t> { /** * lock node during creation of node. */ private boolean lock; lockablenode(t item, dblylinklist<t>.dlistnode<t