Posts

Showing posts from July, 2013

How to insert data using spring mvc and angularJS -

i want insert data database using angularjs , spring mvc, according tutorial did failed insert data database. controller : @requestmapping(value = "/add", method = requestmethod.post) public @responsebody string addemployee(@modelattribute(value="employee")employeeentity employee, bindingresult result) { employeemanager.addemployee(employee); return "redirect:/"; } jscode : $scope.insertdata = function(){ $http.post("http://localhost:9090/crudoperations/add", {"firstname":$scope.firstname}) .success(function(data,status,header,config) { console.log("inserted"); }); } jsp: <form:form class="form-horizontal" role="form" method="post" commandname="employee"> <div class="form-group col-lg-7" > <label for="email" class="control-label">first name...

javascript - Hexadecimal colors do not work on target style backgroundColor -

i posted previous question , responded code: html: <table class="bingo"> <tr> <td id="square0"></td> <td id="square1"></td> <td id="square2"></td> </tr> <tr> <td id="square3"></td> <td id="square4"></td> <td id="square5"></td> </tr> <tr> <td id="square6"></td> <td id="square7"></td> <td id="square8"></td> </tr> </table> js: var togglehighlight = function (e) { var bg = e.target.style.backgroundcolor; if (bg == 'red') { e.target.style.backgroundcolor = ''; } else { e.target.style.backgroundcolor = 'red'; } } var preparetable = function () { var cells = d...

regex - regular expression for a serial number -

i have long payload , need return serial number has many serial numbers , want return serial number after tag. here payload: usb: usb 2.0 superspeed bus: host controller location: building internal card reader: product id: 0x8406 serial number: 000000000820 //i dont want building: yes usb 2.0 bus: pci id: 0x8c31 iphone: vendor id: 0x05ac (skyway inc.) version: 7.02 serial number: wea0aa752ada7722ac92575e98z2e89c691f4282 //i want speed: 492 mb/sec rec id: 0x11100000 / 1 skyway internal keyboard / trackpad: product id: 0x0162 recog id: 0x05ac (skyway inc.) location id: 0x14c00000 / 3 current available (ma): 500 built-in: yes how can build regular expression return me following: wea0aa752ada7722ac92575e98z2e89c691f4282 i tried doing following return expressions start serial number: serial number: [0-9] i want serial number shows after iphone title. \\biphon...

parsing - How do I replace a string between a set of delimiter strings including the second delimiter with sed? -

how replace string between set of delimiter strings sed? first delimiter string not replaced while; second delimiter single char needs replaced part of replacement. i.e. first_delem="getval(" second_delem=”,” example string: abc = param.getval((m_astringtoreplace, xml_somedata, stringparameter(l"")); the string replace or remove = (m_astringtoreplace, this following sed command parse out string, not replace it. sed -e 's/.*getval(\(.*\),.*/\1/' how use sed replace string using these complex delimiters ? with input: $ cat file abc = param.getval((m_astringtoreplace, xml_somedata, stringparameter(l"")); this performs replacement of string starts following getval( , ends first comma: $ sed -re 's/(getval[(])[^,]*,/\1replacement/' file abc = param.getval(replacement xml_somedata, stringparameter(l"")); the regex (getval[(]) captures first delimiter group 1. [^,]*, matches follows , including firs...

How to dynamically split a string using JavaScript/jQuery after so many occurences of a character -

i'm looking way split string in javascript dynamically , keep contents after many occurrences of particular character. i've tried searching on solve this, though not had success. here's example of format i'll using: var s = "17:44, 22 july 2015 foo connected chat address 127.0.0.1"; in above example, want rest of contents of line after 2015, though @ same time don't want use 2015 or of start of string hardcoded way split because users can call that, mess way of splitting, have go years too. in nutshell want split string after 4th space dynamically, , keep whatever after without splitting rest too. do matching instead of splitting. > var s = "17:44, 22 july 2015 foo connected chat address 127.0.0.1"; > s.match(/^((?:\s+\s+){3}\s+)\s+(.+)/) [ '17:44, 22 july 2015 foo connected chat address 127.0.0.1', '17:44, 22 july 2015', 'foo connected chat address 127.0.0.1', index: 0, input: '17:44...

ruby - Rails - multiple association unknown attribute -

i'm making api in rails, , has model called match has 2 association user model defined as belongs_to :user_a, class_name: 'user', foreign_key: 'user_a' belongs_to :user_b, class_name: 'user', foreign_key: 'user_b' in user model: has_many :matches in match controller spec, i'm doing following: before(:each) user = factorygirl.create :user api_authorization_header user.auth_token @match_attribs = factorygirl.attributes_for :match post :create, { match: @match_attribs } end and tests fails "unknown attribute: user_id" if make change post: post :create, { user_a: user.id, user_b: user.id, match: @match_attribs } then still giving me unknown attribute. edit: scheme matches: create_table "matches", force: true |t| t.integer "user_a" t.integer "user_b" t.datetime "created_at" t.datetime "updated_at" end add_index "matches", ...

java - How to move particles independently from particle emitter in andengine -

i have working particle emitter attached entit. have when drag (move) entity emitter created partcles move well. emitter creates particles should move upwards, when idrag emitter right particles moved right well. understand because of attachment entity. achieve when particle shows independent emitter, can drag emitter , particle stays on original course. thanks. try attaching particle system scene , updating position (or emitter position) when sprite moves (in onmanagedupdate function). you can try adding own iparticlemodifier , override onupdateparticle calculate proper position during update , set velocity/acceleration each particle. (see andengine cookbook)

bash - Passing unescaped equals sign to GNU parallel in args -

i invoked gnu parallel (on os x yosemite, installed using macports, shell bash 3.2.57) this: parallel mycommand -o a=5 -o ::: y=1 y=2 with intent run following commands, in parallel: mycommand -o a=5 -o y=1 mycommand -o a=5 -o y=2 but runs this: mycommand -o a=5 -o y\=1 mycommand -o a=5 -o y\=2 the backslash causes mycommand not recognize argument. problem. , after scanning man page , reading section of tutorial on quoting , can't figure out way parallel run commands without backslash getting in there. i've tried putting y= options in file, i've tried single , double quotes various levels of nesting, output of parallel --dry-run shows y\= . there way can backslash out? this should trick: parallel eval mycommand -o a=5 -o ::: y=1 y=2

python - Set instance variable as default parameter to class function -

i have class function takes 4 arguments, class member variables in practice. 1 of these arguments modified @ time , rest of time would-be defaults (current values of class member variables) passed function/written out though aren't changing. i thought best make these class member variables defaults, i'm having hard time getting best syntax. following code produces behavior desire - using class member variable default parameter function. it's ugly: class test: def __init__(self, a, b): self.a = self.b = b def testfunc(self, param = none): if not param: param = self.a print(param) if __name__ == '__main__': a1 = test(1, 3) a1.testfunc() a2 = test(5, 5) a2.testfunc() #(prints 1 , 5 when called) i use following: def testfunc(self, param = self.a): print(param) but gives error: nameerror: name 'self' not defined what's better way this? your first a...

flash - ActionScript 2.0 and swc -

i have project in actionscript 2.0.it having classes act interface native.these classes intrinsic. trying make set of classes swc. followed approach mentioned in how include swc in as2 flash project? but, swf throwing compilation error - not able access intrinsic classes. limitation ? from have read on link : http://help.adobe.com/en_us/as2lcr/flash_10.0/help.html?content=00001911.html not seem limitation, there may rules followed. doc says: " the source code may contain intrinsic class definitions contain no function bodies , provided purely type checking. " hope helps

Restrict login email with Google (HWIOAuthBundle) to specific Domain in Symfony -

how can restrict logging google specific domain hwioauthbundle in symfony2 ( hd parameter). ¿where can write it? documentation thanks you may write inside options parameter resource owners. e.g.: # config.yml resource_owners: google: type: google client_id: "%google_client_id%" client_secret: "%google_client_secret%" scope: "email profile" options: hd: "yourdomain.com" access_type: offline as referenced issue: https://github.com/hwi/hwioauthbundle/issues/216

listview - Dynamic ImageView in list item android -

i developing twitter based app , showing tweets item in recycler view. have imageview in item layout, shown if tweet have image associated it. i'm doing setting imageview visibility gone in xml , if image url present, set imageview visibility visible in onbindview. i want imageview height dynamic, set height wrap content. when list shown, looks images appear out of , on scrolling othe issues appear when scrolling speed fast imageview showing other image replaced correct image after time , change quite noticeable. so, right i'm using fixed height on imageview scale down image, in short not filling imageview. problem this, if image height less specified height in xml, lot of whitespace above , below imageview appears .i want image appearing in list item big possible without issues mentioned. how can that. also, i'm using glide load images. as requested here code: item_layout <linearlayout xmlns:android="http://schemas.android.com/apk/res/android...

ruby on rails - ActionMailer and Gmail:: Very Slow to send email from application -

i've been using this tutorial build contact form application (rails 4.2, ruby 2.1). email address being used gmail one. i'm not sure how influence have on problem, tutorial indicates using devise (and project, have use scratch build log in system not devise) the code works (as in, confirmation email has been sent appears , no errors recorded in development log) email never comes through. i've tested in development far. my colleague working on similar project has said took awhile (as in, few hours day) application form send out. i've checked other stackoverflow questions same problem it's far not been useful. this set in config/development.rb part (minus log in details of course) config.action_mailer.raise_delivery_errors = true config.action_mailer.default_url_options = { :host => 'localhost:3000' } config.action_mailer.delivery_method = :test config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { address:...

.net - Alternating row color for Listbox using MahApps.Metro -

i'm trying create alternating row color listbox in wpf while using mahapps.metro project. when add style , triggers, background of items still white: <style targettype="listbox"> <setter property="alternationcount" value="2" /> <style.triggers> <trigger property="itemscontrol.alternationindex" value="1"> <setter property="background" value="blue" /> </trigger> </style.triggers> </style> apply style on listboxitem instead of listbox , this: <listbox alternationcount="2"> <listbox.resources> <style targettype="listboxitem"> <style.triggers> <trigger property="itemscontrol.alternationindex" value="1"> <setter propert...

php - cakephp 3.0 session not supported in safari browser -

we have created application using cakephp 3.0 application runs in iframe. now problem not able session value in safari browser . we have tried solution added header ('p3p: cp="cao psa our"') --->it works fine in ie browser anyone please, session value in safari browser

mysql - How do I validate a PHP integer within a variable? -

i have integrated yelp reviews directory site each venue has yelp id returning number of reviews , overall score. following successful mysql query venue details, output results of database formatted user. yelp element is: while ($searchresults = mysql_fetch_array($sql_result)) { if ($yelpid = $searchresults['yelpid']) { require('yelp.php'); if ( $numreviews > 0 ) { $yelp = '<img src="'.$ratingimg.'" border="0" /> read <a href="'.$url.'" target="_blank">'.$numreviews.' reviews</a> on <a href="http://www.tkqlhce.com/click-7842347-10756740-1314724701000" target="_blank"><img src="graphics/yelp_logo_50x25.png" border="0" /></a><br />'; } else { $yelp = ''; } } //end if ($yelpid = $searchresults['yelpid']) { } //end while ($searchresult...

linux - Sorting by self column in perf report -

Image
how sort self column in perf report output? $ perf --version perf version 4.0.8-300.fc22.x86_64 $ uname -a linux marko-desktop 4.0.8-300.fc22.x86_64 #1 smp fri jul 10 21:04:56 utc 2015 x86_64 x86_64 x86_64 gnu/linux data callected with $ perf record -g -p $(pidof node) by default, perf receives --children parameter creates "children overhead view". consequence, can switch "self overhead" view specifying --no-children switch perf report --no-children there discussion on topic in man page man perf-report

javascript - AngularJS, get scope with object-id -

is possible specific scope of object accesing through id? i use angular ui tree navigation menu. after add subitem , save navigation mysql database, node subitem not expanded. after push, see menu expands, after saving in database , rerendering navigation menu, node not expanded. have solution? json-object of menu. [ { "id": 35, "title": "foo", "items": [] }, { "id": 34, "title": "bar", "items": [ { "id": 123, "title": "foobar", "items": [] }, ] }, { "id": 46, "title": "barfoo", "items": [] }, ] this structure saved following code function setmenu(nodeid) { $http.post("...", { "menujson" : $scope.menu }).success(function (data, status, headers, config) { if (status =...

How do I validate XML document using RELAX NG schema in C# wiht validator Nu of the w3c? -

this error found in code: invalid datatype found namespace 'http://whattf.org/datatype-draft' , local name 'string'. here code snippet: relaxngpattern g = compile("c:\\nu\\validator-master\\validator-master\\schema\\html5\\xhtml5.rnc"); xmltextreader xml_memori = new xmltextreader(memstream); relaxngvalidatingreader r= new relaxngvalidatingreader(xml_memori,g); try { while (!r.eof) r.read(); } { r.close(); } relaxngpattern compile(string file) { using (streamreader sr = new streamreader(file)) { return compile(sr, file); } } relaxngpattern compile(textreader reader) { retu...

imagemagick - PHP Imagick produces black png from multi page pdf -

i need uploaded pdf converted 1 long png image. simple images (e.g. jpg) works fine , pdf if convert last page (default). when try convert pages of pdf 1 png produces long black image or long black image white strip. if ($file === null || !($file instanceof uploadedfile)) { throw new \logicexception('no uploadable file found'); } $tmpfile = $file->getrealpath(); try { $im = new \imagick(); $im->pingimage($tmpfile); $im->setresolution(140, 140); $im->readimage($tmpfile); switch ($file->getmimetype()) { case 'application/pdf': $im->resetiterator(); $ima = $im->appendimages(true); $ima->setimageformat('png'); $ima->writeimage(); $ima->clear(); $ima->destroy(); break; default: break; //return new respon...

android - Enabling Proguard fail with Can't process class [org/fmod/FMODAudioDevice.class] -

i have classes.jar unity3d included in libs folder of project in android studio. if enable proguard, not build it. minifyenabled true my build.grade got dependencies dependencies { compile 'com.google.android.gms:play-services:+' compile files('libs/classes.jar') } proguard-rules file has -dontwarn org.fmod.** -keep class com.unity3d.** { *; } -keep class org.fmod.** { *; } -keepclassmembers class com.unity3d.player.** { *; } -keepclassmembers class org.fmod.** { *; } -libraryjars !libs/classes.jar(!org/fmod/fmodaudiodevice.class) check proguard website have -libraryjars !. did not well. following build error. error:execution failed task ':android:proguardrelease'. java.io.ioexception: can't read [/users/me/after_android_studio/src/libs/classes.jar(;;;;;;!meta-inf/manifest.mf)] (can't process class [org/fmo...

Can't flatten JSON array to prepare for CSV conversion using Ruby 2.1.4 -

i have array of nested json "hash" objects need flatten ports on csv cleanly, not nested , "multidimensional" json typically is. but flatten method (used here ! bang) not working (it creates file no error file empty). in ruby file below leave working example of commented out code isjust doing conversion without .flatten method. since json array (at highest level) - separated commas , enclosed in square brackets, shouldn't take .flatten method, takes .each in working commented out block? (this docs seems indicate!) require 'csv' require 'json' # csv.open('false-hotels-merged.csv', 'w') |csv| # json.parse(file.open('monfri-false-hotels-merged.json').read).each |hash| # csv << hash.values # end # end csv.open('wed-all-false-hotels.csv', 'w') |csv| json.parse(file.open('monfri-false-hotels-merged.json').read).flatten! |f| csv << f.values end end example json dat...

git - How to find which commits removed a line that contain a specific string? -

i have file no longer referenced anywhere in code. looking find commits removed reference file. (i have no idea files used reference it). i know git log -s find commits either added or removed string. looking ability limit search lines removed. possible? i see easier solution. shell-scripting like: for id in $(git log -sstring --pretty=%h) if [ "$(git show $id | grep "+.*string")" != "" ] echo $id fi done

javascript - Angularjs error validation for dropdown/select redirect with ng-href -

i'm using angularjs's ng-href , select html element ng-model using ng-href link "selecteditem" (from ng-model). unable validate or provide error when nothing chosen , wondering how this. ng-href works, think doesn't have same functionality on plunker. heres html code: <form name="linkform" ng-controller="mainctrl"> <select name="link" ng-model="selecteditem" ng-options="item item.name item in items"></select> <option value=""></option> <span class="error" ng-show="linkform.link.$dirty && linkform.link.$invalid">please select website</span> <a ng-href="{{selecteditem.id}}">let's go</a> </form> heres angularjs code var app = angular.module('angularjs-starter', []); app.controller('mainctrl', function($scope) { $scope.items = [ { id: 'http://w...

Using Raphael.js in Confluence! Workaround for the conflict? -

i want use raphael.js in confluence pages. however, when it's injected page it's (by html ) breaking confluence's raphael segment, ie. page tree not displayed etc. dig little browser console inspection , confluence directory , found-out raphael.spinner instance. what work-around? thanks. i found dirtiest way think : modified raphael.js occurences of raphael raphaelmodified. (then have to replace raphael entires within other libraries depending raphael, raphaelmodified). when injected them pages worked. appreciate more permanent , elegant way though..

php - The user has not authorized this application to perform the action in facebook post -

i trying post on facebook wall mysite using hybrid auth api in php exception/error "the user has not authorized application perform action in facebook post". any guess ?? thanks in advance. make sure gather publish_actions permission during facebook login. also, permission subject login review, meaning if didn't receive permission yet, you'll able use app's admins/testers/developers.

node.js - node-inspector not working from generator-angular-fullstack app -

i'm pretty new grunt, , created new app using generator-angular-fullstack , yeoman. i'm trying figure out how debug. when run grunt serve:debug, chrome window http://localhost:8080/debug?port=5858 i open application @ http://localhost:9000 in chrome tab. two issues though: if set break point, debugger never hits it i can set breakpoints in client side js, not server side thanks help

c++ - Shows an error if the pointer variable being displayed is changed -

Image
i high school student learning c++.so while doing pointers came across problem, when try display value @ y,it shows : the value of x displayed properly,but after write *y *(x+1),it works fine can 1 please explain why getting segmentation fault? despite screenshots show,all code compiled perfectly. y points unallocated memory, dereferencing undefined behaviour. need point @ valid memory, either allocating dynamically, or taking address of valid variable, did x .

authentication - authenticate of django doesnt work -

i working on password reset django, whatever try reset doesn't work. checked form handled on data knew had true. still didn't work. alst tried authenticate in django shell. , happened. shell: in [11]: user = user.objects.first() in [12]: password = "bier" in [13]: user.set_password(password) in [14]: = authenticate(username=user.username, password=password) in [15]: i returns none someone clue causing this? you should save user object, user.save() according docs, user object not saved: "sets user’s password given raw string, taking care of password hashing. doesn’t save user object." https://docs.djangoproject.com/en/1.8/ref/contrib/auth/#django.contrib.auth.models.user.set_password

jquery - How can i post a variable equal to the only "style = 'display: block'" dropdown menu? -

so have 6 dropdown menus in class called .receiver , 1 visible based on selection of #type1 dropdown menu. depending on current value of #type menu, appropriate .receiver displayed. want post value of .receiver dropdown menu display set "block". there selector can use this? tried program glitch work creating user_receiver variable , assigning value of program glitch menu on change doesn't work. here script: $(document).ready(function() { var user_receiver; $("#type1").change(function() { $('#it1').css('display', 'none'); $('#operations1').css('display', 'none'); $('#logistics1').css('display', 'none'); $('#customerservice1').css('display', 'none'); $('#buyers1').css('display', 'none'); var type = $("#type1").val(); if (type == 'program glitch') { $('#it...

javascript - why undefined in the function of addEventListener? -

this question has answer here: javascript closure inside loops – simple practical example 31 answers i'm trying add mouseenter event listener elements change childnodes' opacity. use for add listener, , can output childnodes properly, in function it's "undefined". have no idea why. html: <article class="index-image-article rel"> <section class="index-image-info"> // elements </section> <div class="index-image-excerpt mask table"> // elements </div> </article> javascript: var indeximagearticle = document.queryselectorall(".index-image-article"); var indeximageinfo = document.queryselectorall(".index-image-info"); var indeximageexcerpt = document.queryselectorall(".index-image-excerpt"); for(var = 0; < i...

php - Moving records to a new table updating original id accordingly -

i need create new table data table update original table id of newly inserted record new table. so: new_table ---------------- id -- other data -- original_table ---------------- id new_table_id -- other data -- however, added records new_table grouped rid of duplicates. so, won't 1-to-1 insert. query needs update matching records, not copied record. can in 1 query? i've tried doing separate update on original_table it's not working. any suggestions? you going doing 3 seperate queries see it. $db = new pdo("..."); $stmt = $db->prepare("select * table"); $stmt->execute(); $results = $stmt->fetchall();just iterate o foreach ($results $result) { $stmt = "insert new_table (...) values (...)"; $stmt = $pdo->prepare($stmt); $data = $stmt->execute(); $insert_id = $pdo->lastinsertid(); // update first table $stmt = "update table set id=:last id=:id"; $stmt = $pdo->pr...

google maps - Android: editText should automatically get the GeoLocations as suggestions -

Image
i want edittext show locations googlemaps suggestions whenever type in name of location.

Infinite loop in Python cannot stop -

i tried loop keeps giving me infinite loop can me ? difficulty = int (input ( '"1" easy \n"2" medium \n"3" hard\n')) while difficulty <= 0 or difficulty >= 4 : print ('invalid choice. try again!') you printing while difficulty within range. problem difficulty variable set once, before loop. try moving inside loop.

java - removing invalid characters (("\\/:*?\"<>|") ) from a string to use it as a FileName -

how remove invalid characters string , can used file name ? invalid characters include ("\\/:*?\"<>|") . you can try this, string filename = "\\/:*aaaaa?\"<>|3*7.pdf"; string invalidcharremoved = filename.replaceall("[\\\\/:*?\"<>|]", ""); system.out.println(invalidcharremoved); output aaaaa37.pdf

javascript - Set default url parameter value when none is specified -

i found answer getting url arguments javascript on internet: function geturlparameter(name) { return decodeuricomponent((new regexp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null } i wondering if there way modify this, when no url arguments specified, preset value become argument value. eg. index.html?value=1 return 1, if set default value 2, , types index.html variable value 2. add argument specify default value if key missing: function geturlparameter(name, _default) { var value = decodeuricomponent((new regexp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20')) || null return value !=null ? value : _default; } (fyi implementation treats ; delimiter: k=a;b return a , bit odd.)

Inno Setup hide a Log entry -

i want able hide particular entry displaying in inno setup log file (i.e. not want particular command visible in log file). there way of selectively telling particular command in [run] section not logged? no. logging hardcoded in inno setup no explicit way skip entries @ time. can read here in source code (notice, there's no condition nor parameter passed log function able skip entry logged later on).

sql server - SQL command to get highscore position with similar scores -

please guide me write optimize sql command real position(ranking) of users id order similar scores. i have written below select command can't distinguish names similar scores , if use "and" specify gamer's name shows number 1 row number not want ! fields : id , name , score select count(id) num hscore (score>= @scorenumber) thanks i think query you're looking for: select [rank] , id , name , score ( select dense_rank() on (order id desc) [rank] , id , name , score hscore (score>=@scorenumber) ) resultset name = 'milad' order score desc i'm assuming you're using sql server, since you're using standard notation variable, @ before variable name.

excel - Conditional formatting not displaying cell highlights on coworkers computer -

Image
my boss has spreadsheet uses macros , conditional formatting rearrange data , whatnot; running @ least office 2010. when coworker opens it, however, not show cell fill colors; running 2007. shows on mine , running 2010. i pretty excel savy has me stumped. in excel 2007, if coworker wants conditional formatting work sheet, going need create named range. follow link , scroll down little "conditional formatting workaround earlier versions" section: http://blog.contextures.com/archives/2010/09/03/conditional-formatting-from-different-sheet/

ios - AVCaptureSession App Crash stopRunning -

i've got fake camera app. practically user thinks camera real , it's not. in view call live camera so: - (void)viewdidappear:(bool)animated { [super viewdidappear:animated]; nsstring *path = [nsstring stringwithformat:@"%@/photoshutter.mp3", [[nsbundle mainbundle] resourcepath]]; nsurl *soundurl = [nsurl fileurlwithpath:path]; _player = [[avaudioplayer alloc] initwithcontentsofurl:soundurl error:nil]; //----- show live camera preview ----- avcapturesession *session = [[avcapturesession alloc] init]; session.sessionpreset = avcapturesessionpresetlow; calayer *viewlayer = self.vimagepreview.layer; nslog(@"viewlayer = %@", viewlayer); avcapturevideopreviewlayer *capturevideopreviewlayer = [[avcapturevideopreviewlayer alloc] initwithsession:session]; capturevideopreviewlayer.frame = self.vimagepreview.bounds; [self.vimagep...

ios - Weird overflow on UITableView with an iAd banner -

Image
i added iad banner banner view (which table view). but, unfortunately, there weird blank space @ end of table view when banner loads (everything until banner loaded , displayed). here's capture showing blank space : to displays banner, added self.candisplaybannerads = true in viewdidload() method any ideas on how fix ? since gap appears same size ad banner, (without seeing code) guess tableview's constraint not set properly. can check bottom constraint set to? if ad banner hidden behind tabbar control , slides up, can set bottom constraint of tableview top of ad banner value of 0. way tableview resize ad banner slides up. without knowing setup can't sure, reply layout constraints , can tackle :)

python - How to check a variable for certain strings? -

i apologize if i'm not following formatting requirements. first time asking question here , first programming language. topic says, i'd check variable strings. i've tried few options , have researched bit, have still failed find working option. just give background, i'm trying create word game similar zorg (i think called). i'm doing part of learn python hard way [exercise 35 practice]. anyways, here code. thank time , help! #first room, allows 3 options def firstroom(): print "you have begun test." print "for sake %s, hope pass." % name print "------------------------------------" print "you enter new room , see 3 paths." print "the middle path illuminated eery blue light." print "the left path illuminated dangerous red light." print "the right path illuminated soft green glow." next = raw_input("what path take?" ) if next in ("left...

Not able to Search on Solr Field Type="text_general_maxlength"? -

i new solr field type="text_general_maxlength" on not able search. tried using <copyfield> mention field type "string" didn't work. giving schema.xml. please let me know doing wrong or have make question more specific. in advance <schema name="hadoop-logs-schema" version="1.5"> <fields> <field name="msg" type="string" indexed="true" stored="false" multivalued="true"/> <field name="id" type="string" indexed="true" stored="true" required="true" multivalued="false" /> <field name="cluster" type="string" multivalued="false" docvalues="true"/> <field name="rowtype" type="string" multivalued="false" docvalues="true"/> <field name="level" type="string" docvalues="t...

What is the difference between Rspec have_css, have_selector, and have_field? -

i have html.erb rails form: <h1 class=new_vendor_header>new vendor form</h1> <%= form_for(@vendor) |f| %> <%= f.label :name %> <%= f.text_field :name, placeholder: "ex: jeff" %> <%= f.submit "submit" %> <% end %> this passes: expect(page).to have_selector('input[placeholder="ex: jeff"]') but not: expect(page).to have_field('input[placeholder="ex: jeff"]') and not: expect(page).to have_selector('input[placeholder="ex: jeff"]') selector refers html selector right refers html elements? have_css thought looked css seems more. here example cheat sheet: response.body.should have_css("input", :count => 3) #true if there 3 input tags in response and seems input html selectors. so difference , why other 2 fail in example? from docs here have_css call has_selector css param, has_selector can handle css , xpath , ... def...

c++ - what is the result of pointer of a type & valiable -

i trying understand code. not understand last line? result of *(uint8_t*)&b[8]= ? typedef uint8_t a; uint8_t *b = new uint8_t[100]; rpc_flags_t c; c=0u; *((a*)&(b[8]))=c; it obfuscation of b[8] = c; &(b[8]) b + 8 (or address of b[8] ) (a*)&(b[8]) cast a* uint8_t* type of b + 8 , equivalent &(b[8]) *((a*)&(b[8])) *&(b[8]) b[8] .

Relative paths of css and images in htacces nice url -

trying nice urls. when have url this: http://nove.illusions-media.cz/nase-sluzby everythink ok. when url http://nove.illusions-media.cz/nase-sluzby/tvorba-webu css , images not work. can me? how .htaccess looks like: rewriteengine on rewritebase / rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^([^/]+)/?$ ?stranka=$1 [l,qsa] rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewritecond %{request_uri} !\.(css|js|jpe?g|gif|png)$ [nc] rewriterule ^([^/]+)/([^/]+)?/?$ ?stranka=$1&podstranka=$2 [l,qsa]

(500) Backend Error on update style id by Google Fusion Table REST API -

i updating fusiontable style rest api. but got error (500) backend error message. on same time got successful message in fusiontable insert/update row rest api. how can debug/resolve issue. here code: $columnname = self::getstylecolumnprefix($style_id); $strokeopacity = '1'; $fillopacity = '1'; $kind = 'fusiontables#fromcolumn'; $tableid = $this->table; $styleid = $style_id; $fillcolorstyler = new \google_service_fusiontables_stylefunction(); $fillcolorstyler->setcolumnname($columnname); $fillcolorstyler->setkind($kind); $polygonoptions = new \google_service_fusiontables_polygonstyle(); $polygonoptions->setfillcolorstyler($fillcolorstyler); $polygonoptions->setstrokeopacity($strokeopacity); $polygonoptions->setfillopacity($fillopacity); $postbody = new \google_service_fusiontables_stylesetting(); $postbody->setpolygonoptions($polygonoptions); // $this->service = new \google_service_fusiontables_style_resource(); $results ...

forms - background-color applies only to part of a div in bootstrap , when it should apply to the whole div -

Image
i have form in website building following html using bootstrap <div class="hotel-search side-menu blue-background "> <h2>search</h2> <hr/> <br/> <form class="hotel-search-form"> <div class="form-group col-md-12"> <label for='nationanlity'>nationality</label> <select class="chosen form-control" name="nationanlity" placeholder="please select nationality"> <option value="">select nationality</option> <option value="...">...</option> </select> </div> <div class="form-group col-sm-6"> <select class="chosen form-control" id="country" name="country" placeholder="please select country"> <option value=...

java - LibGdx - Scaling Sprites, Camera and Viewports -

hell & reading, i started working on 2d android/desktop project , have become stuck trying display sprites in way want. i have background sprite 144(w) 160(h) want able position other sprites onto screen relative points on background sprite. i think understand if create camera/viewport 144 x 160 able position sprites on background sprite using co-ordinates based on 144 x 160 of background sprite. work across different screen resolutions found on mobile devices stretch background sprite despite experimenting different viewport types (fillviewport, fitviewport etc..). what want achieve have background sprite maintain ratio across different screen resolutions , able place other sprites on background sprite. placing of sprite need work across different resolutions. apologies if explanation confusing or makes no sense. add image explain reputation add post. think tltr question "what correct way display sprites on multiple screen resolutions while keeping correct ratio...