Posts

Showing posts from August, 2011

java - Getting the Object Calling a Method -

in java, how can object calling method, within method calling, if method in class? have looked on internet , no solution. please help? the way can think of pass this method, static void somemethod(object o) { system.out.println(o); } void testit() { somemethod(this); // <-- pass current instance method. }

scala - build.sbt defining project dependency between modules -

i have project in playframework. has 1 main project without code/logic. , have few submodules: main: admin common shop modules: admin , shop base on common module (classes like: user, role, permission), have configure way: lazy val shop = project.in(file("modules/shop")) .dependson(cirs) .dependson(common) .dependson(admin) lazy val admin = project.in(file("modules/admin")) .dependson(cirs) .dependson(common) .dependson(shop) but in module common have view wonna display links (a href...) other submodules. have use reverse routing classes, wich controllers in submodules: shop , admin. have use that: <a href="@controllers.shop.routes.index.index">shop</a> <a href="@controllers.admin.routes.index.index">admin</a> wich mean have add .dependson(shop).dependson(admin) common module. but cause cyclic dependencies, wich incorrect! please me. how can deal it?

java - Serve static resources from within a compressed file using Spring -

is possible serve static resources within compressed file using spring mvc? this . i have data packaged individual json files (e.g. 123.json, 1634.json, etc.) , and serving them via <mvc:resources mapping="/resources/**" location="/resources/" /> the files under .../resources/datafiles/ . user can go http://mywebsite.com/resources/datafiles/123.json retrieve data entity 123. however, have ~10,000 json files. great if compress them under 1 file ( .../resources/datafiles/entities.zip ) , tell spring serve individual json files within compressed file. so user still go http://mywebsite.com/resources/datafiles/123.json file under .../resources/datafiles/ entities.zip. i'm using tomcat 7.0 if question outside scope of mvc framework. i'm not sure if there's spring out-of-the-box component that, can create independent servlet handle incoming requests static resources, servlet parse file name, , dynamically read zipped file corre

python - How to dynamically add items to jinja variable in Flask? -

i'm building website using flask jinja2 templating engine , i'm dynamically building menu ( as described here ): {% set navigation_bar = [ ('/', 'index', 'home'), ('/aboutus/', 'aboutus', 'about us'), ('/faq/', 'faq', 'faq') ] %} {% set active_page = active_page|default('index') -%} <ul> {% href, id, title in navigation_bar %} <li{% if id == active_page %} class="active"{% endif %}> <a href="{{ href|e }}">{{ title|e }}</a> </li> {% endfor %} </ul> now if user logged in want show additional things. @ runtime want add items navigation_bar variable. tried this: {% if g.user.is_authenticated() %} {% navigation_bar.append(('/someotherpage', 'someotherpage', 'someotherpage')) -%} {% endif %} but unfortunately results in following error: templatesyntaxerror: en

asp.net - How to Upload .aspx websites onto APACHE Tomcat -

i have created website has extension of .aspx using microsoft expression web 4 , need upload onto out apache tomcat server. there can guide me how this? i host websites on windows web hosting. click on link below , click on link mono-project see if you. http://www.c-sharpcorner.com/forums/thread/167026/how-to-deploy-asp-net-app-on-tomcat-apache.aspx

jquery - JavaScript to detect bottom of page does the reverse on Chrome -

i'm trying infinite scrolling page, condition test if we're @ bottom of page not behaving correctly on chrome. on chrome alert seems trigger @ top of page rather when hitting bottom. works correctly on ie11 though. on chrome $(document).height() equals 0. have <!doctype html> html @ top of page if matters. oddly took example worked within jsfiddle on chrome: http://jsfiddle.net/nick_craver/gwd66/ $(window).scroll(function () { if ($(window).scrolltop() + $(window).height() == $(document).height()) { alert("test"); } } } what kind of css applied page, more body element? padding or margin making $(document).height() equal more combination of $(window).scrolltop() , $(window).height(). following code determine if ever meeting if() criteria. what version of jquery using? $(window).scroll(function() { var scrollposition = $(window).scrolltop() + $(window).height(); var bodyheight = $(document).heigh

Convert for loop/print output to string? Python -

def reveal(): guessright = 0 letter in secretword: if letter == usertry: guessright = guessright + 1 print usertry, else: print "_", return guessright reveal() when using reveal() _ _ _ _ _ printed loop- there way of converting prints string, or getting function return 2 outputs, integer guessright, , stuff printed while reveal() running? sure, there lots of ways -- simplest use list hold data (appending new data rather printing) , ''.join @ end: def reveal(): text = [] guessright = 0 letter in secretword: if letter == usertry: guessright = guessright + 1 text.append(usertry) else: text.append('_') return guessright, ''.join(text) reveal() here return tuple python's way of returning multiple values. can unpack tuple in assignment if wish: guessright, text = reveal()

sql - Join rows from two different queries -

i have table sales_table id,date , sales fields. no          date          sales ---------------------------------------------------- 1          1-jan          10,000 2          3-jan          12,500 3          4-jan          8,000 4          5-jan          12,000 5          8-jan          10,000 "          "          " "          "          " "          "          " "          "          " "          "          " "          "          " "          "          " "          "          " "          "          " 100          13-mar          4000 the date unique not in series. no unique , in series incremented no of each higher date. i looking difference between sales of current , previous date. like no               date               sales               diff               -------------------------

java - When to use hash table? -

i have general question when should use hash table instead of avl trees. remembered lecturer saying if data size 2 10 or 2 20 , avl tree acceptable, because using hash table generate hashing operations etc. so wonder in practice, there general rule regarding data size tell when should choose hash table on avl trees? hash table first choice when dealing data size larger 2 20 ? hash tables 'wasteful' memory wise backing table larger number of entries. trees don't have problem have problem lookups (and other operations) log(n) operation. yes correct small data sets tree may better - depending on how care memory efficiency. there's no general rule data regarding data size - depends on specifics of implementations comparing , want optimize (memory or cpu). javadocs provide insight performance of implementations provided java: http://docs.oracle.com/javase/7/docs/api/java/util/treemap.html http://docs.oracle.com/javase/7/docs/api/java/util/hashmap.html

javascript - Echo after header -

this part of code. code moving location, echo below not working. sure header affecting somehow else { header('location: index.php'); echo '<script> document.getelementbyid("nick").value = "invalid email"; document.getelementbyid("nick").classname = "invalidemail"; </script>'; if read header in php functions, came know nothing gets printed after header giving instructions redirect on index.php however achieve same, can use session variables. so, on page redirecting index.php: $_session['error']=true; header('location: index.php'); on index.php, check if session variable true: if($_session['error']== true) { echo '<script type="text/javascript"> document.getelementbyid("nick").value = "invalid email&q

php - Does rewrite url affect the url in jquery? -

i trying use filename in jquery i'm facing problem file not found because of rewrite file?when tried using full url worked fine.. i tried did not work $.ajax({ type: 'post', url: 'inentry.php', data: $("#myform").serialize(), success:function(data) { } }); i tried , work $.ajax({ type: 'post', url: 'http://localhost/mgosoft/admin/inentry.php', data: $("#myform").serialize(), success:function(data) { } }); why i'm not able access file directly ? there problem htaccess file? .htaccess rewriteengine on rewritebase /mgosoft/admin/ rewritecond %{th

Difference between Amazon ec2 and AWS Elastic Beanstalk -

can please explain difference between ec2 , beanstalk. want know regarding saas, paas , iaas. to deploy web application in wordpress need scalable hosting service. if there better purpose, please let me know well. just inform, want host&deploy multiple wordpress , drupal sites. i not want give more time server , focus on development. cloud hosting needs auto scalable. first off, ec2 , elastic compute cloud same thing. next, aws encompasses range of web services includes ec2 , elastic beanstalk. includes many others such s3, rds, dynamodb, , the others . ec2 ec2 amazon's service allows create server (aws calls these instances ) in aws cloud. pay hour , use. can whatever want instance launch n number of instances. elastic beanstalk elastic beanstalk 1 layer of abstraction away ec2 layer. elastic beanstalk setup "environment" can contain number of ec2 instances, optional database, few other aws components such elastic load balancer, auto-s

php - Regex involving nested delimiters/quotes -

i have string enclosed either apostrophes or double-quotes. within string, other ('non-enclosing') character may appear. i'd extract contents of string using regex. example: string = "isn't"; , want extract isn't . using /[\'"]([^\'"]*)[\'"]/ doesn't work because doesn't impose constraint string opened , closed same character. using /([\'"])([^\'"]*)(?1)/ fixes that, disallows 'other' character occurring within string. need /([\'"])(!(?1)*)(?1)/ how write that? as bonus, can avoid capturing opening character ?1 contains string contents? group index 1 contains characters present within double quotes or single quotes. (?|"([^"]*)"|'([^']*)') demo or you use below regex also, ([\'"])((?:(?!\1).)++)\1 demo pattern explanation: ([\'"]) captures starting single or double quotes. ((?:(?!\1).)+) capture

Why OpenCL doesn't have matrix data type? -

considering opencl kernels executed on same units shaders seem logical me opencl have same data types glsl, yet looking here: http://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/datatypes.html don't see matrix type. why that? also, mean if want multiply 4x4 matrices slower when using opencl glsl? actually, if @ link more closely there matrix data types in category of reserved datatypes: floatnxm, doublenxm. quite there implementation types in future releases of standard. have no idea why haven't done already. at point can use either array or image2d_t represent matrices. want take @ article what comes speed. doesn't mean opencl slower, quite likely. if manage write perfect matrix multiplication code 1 platform opencl, in other platform performance can quite poor. in opengl, manufacturers writing own matrix multiplication code should quite optimal each platform.

android - How to convert an existing Angular1 web app to a Cordova app? -

i've found lot of tutorials on internet telling how build new cordova app angularjs, , that's good. but if have angularjs web app alive , kicking, , make mobile app (android/ios) it? possible / feasible / advisable? if is, can give advise, or point existing resource documenting task? as dmahapatro said best bet angularjs app packaged mobile use ionic framework. migration simple. ionic includes ui framework, isn't @ required, web coding work because app being run in chrome frame. ionic command line tool of magic. i start spinning standard ionic app using command ionic start appname . can put app appname/www directory. edit index.html , add script tag in head. <script src="cordova.js"></script> that required app built mobile. can test on android running ionic platform add android install dependencies android , run ionic run android (have android plugged in drivers installed or emulator running genymotion ). if want build ios

How to get proper diff of merge commit in tig -

if got tig main view, nice graph of commits , merges. i'd prefer @ merge commits trunk unlike normal commits tig tig shows full diff file contents, on merge commits shows list of changed files in diff view. how tig display file contents diff on merge commits? commit fb56223ec50cf659a308b3c9979c912881147689 refs: [master], {origin/master}, {origin/head}, juju-1.21-alpha1-229-gfb56223 merge: 7e7c95d a017b5a author: juju bot authordate: mon sep 22 01:22:03 2014 +0100 commit: juju bot commitdate: mon sep 22 01:22:03 2014 +0100 merge pull request #803 mjs/check-ssh-api-methods-are-allowed-during-upgrade cmd/juju: ensure api calls used "juju ssh" allowed during upgrades had regression api call required "juju ssh" wasn

ios - How to draw an image in a specific shape -

Image
i ordinary image designer every new network call. design image must in shape this: how can that? on android use path create such shape , use shader draw image in shape. don't find on ios? thanks krivoblotsky. can use piece of code mask image: - (uiimage*) _maskimage:(uiimage *) image withmask:(uiimage *) mask { cgimageref imagereference = image.cgimage; cgimageref maskreference = mask.cgimage; cgimageref imagemask = cgimagemaskcreate(cgimagegetwidth(maskreference), cgimagegetheight(maskreference), cgimagegetbitspercomponent(maskreference), cgimagegetbitsperpixel(maskreference), cgimagegetbytesperrow(maskreference), cgimagegetdataprovider(maskreference), null, yes ); cgimageref maskedreference = cgimagecreatewithmask(imagereference, imagemask); cgimagerelease(imagemask); uiimage *maskedimage = [uiimage imagewithcgimage:maskedreference]; cgimagerel

python - BeautifulSoup extract XPATH or CSS Path of node -

i want extract data html , able highlight extracted elements on client side without modifying source html. , xpath or css path looks great this. is possible extract xpath or css path directly beautifulsoup? right use marking of target element , lxml lib extract xpath, bad performance. know bsxpath.py -- it's not work bs4. solution rewriting use native lxml lib not acceptable due complexity. import bs4 import cstringio import random lxml import etree def get_xpath(soup, element): _id = random.getrandbits(32) e in soup(): if e == element: e['data-xpath'] = _id break else: raise lookuperror('cannot find {} in {}'.format(element, soup)) content = unicode(soup) doc = etree.parse(cstringio.stringio(content), etree.htmlparser()) element = doc.xpath('//*[@data-xpath="{}"]'.format(_id)) assert len(element) == 1 element = element[0] xpath = doc.getpath(element) return xpath soup = bs4.beautifulsoup('<

mysql - Php Pagination while passing Query String -

in php,while passing query string page page how pagination.the following code used works fine pagination without query string while passing value page page(query string) dint work. please give me suggestions. <?php include("connect.php"); $adjacents = 3; $id = $_request["id"]; $query = "select count(*) num data"; $total_pages = mysql_fetch_array(mysql_query($query)); $total_pages = $total_pages[num]; $targetpage = "pagetest.php"; $limit = 10; $page = $_get['page']; if($page) $start = ($page - 1) * $limit; else $start = 0; $sql = "select name,email,dateins data name='$id' limit $start, $limit"; $result = mysql_query($sql); $cnt=0; if($result) while($rs=mysql_fetch_assoc($result)) { $cnt=$cnt+1; $cssrow="class='gridrow'"; if(($cnt%2)==1) {

Please help me with android debug error -

i have import project android studio , debug it. show erro: **error:execution failed task ':app:processdebugmanifest'. manifest merger failed : uses-sdk:minsdkversion 8 cannot smaller version l declared in library com.android.support:support-v4:21.0.0-rc1** who have more experiences please newbie android. you using incorrect version of api sounds of it. try changing down (as writing this, @darkie commented, saying '19') should work you.

ruby on rails - Querying sidekiq for models queued -

i have gallery photos, on processing photos through sidekiq. when gallery has photos processing or in queue, i'd write in page. one option mark each photo processing when added queue, , let sidekiq worker remove when finished. downside need check if @ least 1 photo processing, meaning check photos... is there way query sidekiq directly? you can use sidekiq-status gem track jobs. can use code sidekiq::status::working? job_id check if specific job running.

Python *.exe file from *.py -

i've python project split in 3 files : main.py, file1.py , file2.py files i've generated *.exe file (main.exe) when start executable file receive error : traceback (most recent call last): file "main.py", line 11, in <module> file "win32com\client\gencache.pyc", line 649, in rebuild file "win32com\client\gencache.pyc", line 65, in _savedicts file "win32com\client\gencache.pyc", line 141, in getgeneratepath ioerror: [errno 2] no such file or directory: 'd:\\dir1\\python\\dir2\\test\\version\\dist\\library.zip\\ win32com\\gen_py\\__init__.py' in main.py i've : import win32com.client if win32com.client.gencache.is_readonly == true: win32com.client.gencache.is_readonly = false win32com.client.gencache.rebuild() but these rows of code i'm not able solve problem. suggestion? thanks

ios - How to get correct value for CurrentCulture? -

on iphone, user can choose display language , region used formatting. display language equivalent .net's thread.currentuiculture , i.e. language of ui. formatting region equivalent .net's thread.currentculture , i.e culture settings used formatting numbers, dates etc. assume following settings: language: english region: germany in ios6, nslocale.currentlocale return "de_de" , transform cultureinfo object. however, since then, things have changed. example, on ios8, "en_de" invalid value cultureinfo . so, preferred way make sure xamarin.ios application takes account settings chosen user, i.e. how correct value thread.currentculture ? i think answered own question: changing region germany doesn't change formatting long user didn't explicitly switch off "automatic" in regions advanced settings , changed language german, too. in case, formatting different ui language. based on that, using code now: private static

url - Python creating dynamic button -

this question has answer here: why button parameter “command” executed when declared? [duplicate] 2 answers i have array, holds urls. i want create button, within tk, opens url in browser. so far, i've got button create, however, when run .py file, seems function open page being hit - not prepared button. import tkinter tk import webbrowser web urls = [[1, 'http://www.google.co.uk','google'],[2, 'http://www.bbc.co.uk','bbc']]; def urlopen(target): web.open(target) window = tk.tk() window.overrideredirect(1) window.update_idletasks() url in urls: urltarget = url[0] labelurl = tk.button(window, text=url[2], height = 2, command = urlopen(url[1]), width = 10) labelurl.grid(row = url[0] + 1 , column = 1) close = tk.button(window, text = 'quit', command = window.destroy, width = 10) close.grid(row =

Decode 2d data matrix barcode in HTML/JavaScript (Android) -

context: need scan data matrix barcode camera of android mobile phone. access camera on html5 , got picture canvas element. approach: can't find javascript library scanning picture decode 2d data matrix code. call zxing app , copy , go backt etc. i'm not happy laborious solution. question: knows javascript library decoding 2d data matrix codes? or maybe easy solution using app zxing / goggles , result of scan automatically in js?! i'd appreciate input.

pyqt4 - python - cannot import name from file generated with pyuic4 -

i have following 2 scripts, first of generated using pyuic4 windows, , not modified. textedit.py: # -*- coding: utf-8 -*- # form implementation generated reading ui file 'mytextedit.ui' # # created: mon sep 22 14:47:34 2014 # by: pyqt4 ui code generator 4.11.2 # # warning! changes made in file lost! pyqt4 import qtcore, qtgui try: _fromutf8 = qtcore.qstring.fromutf8 except attributeerror: def _fromutf8(s): return s try: _encoding = qtgui.qapplication.unicodeutf8 def _translate(context, text, disambig): return qtgui.qapplication.translate(context, text, disambig, _encoding) except attributeerror: def _translate(context, text, disambig): return qtgui.qapplication.translate(context, text, disambig) class ui_notepad(object): def setupui(self, notepad): notepad.setobjectname(_fromutf8("notepad")) notepad.resize(763, 638) self.centralwidget = qtgui.qwidget(notepad) self.central

php - 1045 PHPMyAdmin error using GAE -

summary: when attempting log phpmyadmin, running on gae, continuously receive mysql 1045 error. suspected issue: believe don't have phpmyadmin environment connected cloudsql correctly, i'm not sure how fix it. files: app.yaml - original version used in tutorial didn't work, found allows me load page. here's working one. application: appname version: phpmyadmin runtime: php api_version: 1 handlers: - url: /phpmyadmin/(.*\.(ico$|jpg$|png$|gif$)) static_files: phpmyadmin/\1 upload: phpmyadmin/(.*\.(ico$|jpg$|png$|gif$)) application_readable: true - url: /phpmyadmin/(.*\.(htm$|html$|css$|js$)) static_files: phpmyadmin/\1 upload: phpmyadmin/(.*\.(htm$|html$|css$|js$)) application_readable: true - url: /(.*\.(ico$|jpg$|png$|gif$)) static_files: phpmyadmin/\1 upload: phpmyadmin/(.*\.(ico$|jpg$|png$|gif$)) application_readable: true - url: /(.*\.(htm$|html$|css$|js$)) static_files: phpmyadmin/\1 upload: phpmyadmin/(.*\.(htm$|html$|cs

java - unit testing for proprietary ide -

i add sort of unit testing ide known "ibs integrator". how ide works: write "java-ish" code in .itr files. when press run button these files compiled .class , .java files. have no idea happens next. does have advise on how make unit testing work in setup this? hopping framework phpunit or rspec. know different langagues similar tool java nice. i'm not sure (if anything) can interact .class/.java files. i prefer open-source if possible. since ibs integrator compiles .class files, should able write junit tests in java against classes, , run them you'd run junit tests (kick off ant or maven, open eclipse , run them there, etc.). , can't think of reason use technology (phpunit, rspec, etc.) writing tests of java code; junit seems clear winner here.

c# - Join 2 tables that has different ID records in entity framework -

so happen have 2 tables this: id time loc 01 10:00 02 8:00 b 03 8:00 c 04 8:00 b and id time loc netval indivalue 05 10:00 4 3 06 8:00 b 7 5 07 8:00 c 1 2 how join them have like: id time loc netval indivalue 01 10:00 02 8:00 b 03 8:00 c 04 8:00 b 05 10:00 4 3 06 8:00 b 7 5 07 8:00 c 1 2 i using entity framework 5.0 work oracle 11g... please guys edit: here have: var last = qu.concat<object>(sm_list); give me error: system.argumentexception: dbunionallexpression requires arguments compatible collection resulttypes note qu , sm_list not s

rest - Why can't I remove the Shipping address from this IPP QBO v3 API Customer object -

i'm using intuit partner platform v3 qbo api try update a customer object . sole objective purpose of post remove shipping address. here's original object, queried before change: { "domain": "qbo", "familyname": "last", "displayname": "my display name", "title": "mr.", "preferreddeliverymethod": "print", "givenname": "first", "fullyqualifiedname": "my display name", "billwithparent": false, "job": false, "balancewithjobs": 0, "taxable": true, "metadata": { "createtime": "2014-09-22t18:49:43-07:00", "lastupdatedtime": "2014-09-22t18:49:44-07:00" }, "billaddr": { "city": "city 1", "country": "usa"

cordova - Process message failed in Javascript pushnotification -

i'm trying gcm regid via ( https://github.com/phonegap-build/pushplugin ). getting following error in logcat. 09-23 10:20:07.640: i/web console(31679): processmessage failed: message: jjavascript:onnotification({"regid":"apa91bhdlg9bzl-eicx3ts-mjvgy-mcufmbrc-epcukzb9b_tpddg125jyxy-ohvr5vul6az-ej2nz0peiovpqp2kjclauwaktbqx5gsilui0jsgirpcvnqdubtkubxnnh0dh94rhugpju29xhts5cl8qigh1mljhw","event":"registered"}) @ file:///android_asset/www/cordova.js:1046. i refered question ( cordova processmessage failed: stack: undefined (and) error: illegal access ), can't find answer.

nsnumber - NSObject to Int (Swift) -

is possible convert nsobject int? , how can implement this? i've apple reference guide can't seem understand how use intvalue under nsobject reference. var intvalue: int32 { } i receive nsobject class highestscore saved. want compare highestscore current score , if current score larger highestscore send current score saved. have except i'm not able compare nsobject (highest score) int (current score) here how retrieve highestscore: func retrivehighscore() -> nsobject { var datatoretrive = highscore() documentdirectories = nssearchpathfordirectoriesindomains(.documentdirectory, .userdomainmask, true) documentdirectory = documentdirectories.objectatindex(0) string path = documentdirectory.stringbyappendingpathcomponent("highscore.archive") if let datatoretrive2 = nskeyedunarchiver.unarchiveobjectwithfile(path) as? highscore { datatoretrive = datatoretrive2 } return(datatoretrive) } and here how in class calling

c# - Selenium - Modal dialog present - how to accept information? -

Image
i have following problem. after submit date on page have modal dialog on picture: i want click "enter" go through modal not work. have following code: driver.findelement(by.cssselector("input.submit")).click(); actions action = new actions(driver); action.sendkeys(openqa.selenium.keys.enter); after click on continue manually test go next page. must go through modal continue test. ideas how solve problem? i found solution following code: ialert alert = driver.switchto().alert(); alert.accept(); it works me.

windows - Batch File to get most recent file where filename contains a substring -

i'm trying write batch file open recent session log logs file. i have bash script want on linux, listing contents of logs folder in time order, grep lines starting session , taking recent one. after append onto file path , open it. code bash script follows: mostrecentlogfile=~/my/logs/folder/$(ls -t ~/my/logs/folder | grep ^session | head -1) displayfunction="gedit" echo "opening $mostrecentlogfile ..." $displayfunction $mostrecentlogfile however need convert script batch file same thing on windows. i can go far opening recent file in logs folder, there other types of log files , need recent 1 begins string "session" code doesn't open correct file: cd my\logs\folder /f %%i in ('dir *.* /b /o:-d') notepad.exe %%i any suggestions on how edit code filter filenames ones containing substring appreciated. this isn't best approach, seems work for /f %%i in ('dir *.* /b /o:d') echo %%i |>nul findstr /b &quo

ios - Preparing assets for iphone 6 spritekit games -

i'm making game in spritekit, , positioning cards code. size of card texture needs different based on screensize or layout screwed. same background images of course, or other layout. how iphone6 share same @2x assets lower-res screens? makes no sense. i've heard design 6, , let older phones down scale. doesnt seem happening. cut off when checking on 5s. assets 6+ fine, of course uses own set of 3x images. display scale factor doesn't tell might want choosing assets , laying out screen — e.g. if have @2x assets, they're used on both iphone (4 , newer) , ipad (3 , newer) though ipad , iphone have different screen sizes. spritekit's image loading falls uikit's, automatically picks right scale factor device not right dimensions. so, how you have own heavy lifting choose different images iphone 4/4s vs iphone 5/5s , you'll need @ screen size pick images and/or layout calculations on 3.5", 4", , 4.7" displays. (actually, can ui

c++ - Is a local scoped variable initialized to an undetermined value, or un-initialized? -

pedantically speaking, x initialized in following code or not? int main() { int x; } there paragraphs in 8.5 initializers [dcl.init] (for c++11) not backed examples. it formally default-initialized , means int s, no initialization performed. [dcl.init]/12 (n3797) if no initializer specified object, object default-initialized; if no initialization performed, object automatic or dynamic storage duration has indeterminate value [dcl.init]/7 to default-initialize object of type t means: if t (possibly cv-qualified) class type, default constructor t called [...]; if t array type, each element default-initialized; otherwise, no initialization performed .

bash - getops 1 option to receive 2 arguments -

i've searched around found out getops receives 0 or 1 argument only, need make work, i need make script run this: ./script.sh -a string integer what write string , integer text file. i tried code: while getopts a:d opt case "$opt" in a) na1=$optarg eval "na2=${optind}" shift 2 ;; d) ./views.sh;; esac done if [ $isdef -eq 0 ] echo "$na1;$na2" >>pbdb.txt fi i can write string part text file integer keeps resulting "3". sample: ./script.sh -a power 0000 result inside textfile: power;3 any suggestions? just started learning bash scripting assuming bash tag accurate (you're not using /bin/sh), change eval "na2=${optind}" to use "indirect variable" na2=${!optind} with eval, you'd need eval na2=\$$optind that's uglier

ios - Application with private framework "could not inspect application package" in Xcode 6. Missing framework info.plist -

my application built , ran fine in xcode 5. upgraded xcode 6 yesterday , application builds, not run on device or in simulator. i'm getting error "could not inspect application package" when trying run. i checked device logs (xcode > windows > devices) , after trying run application, following error in log: sep 23 10:32:46 xxxxxx's-iphone streaming_zip_conduit[5476] : __dispatch_source_read_socket_block_invoke:203: failed install application @ file:///var/mobile/media/publicstaging/activatemachines.app/ : error domain=launchserviceserror code=0 "the operation couldn’t completed. (launchserviceserror error 0.)" userinfo=0x1355075a0 {error=packageinspectionfailed, errordescription=failed load info.plist bundle @ path /private/var/mobile/library/caches/com.apple.mobile.installd.staging/temp.5lz5ts/extracted/activatemachines.app/frameworks/gelosdk.framework} i've checked gelosdk.framework have resources/info.plist file.

node.js - Looking to use Gulp to create individual distributions of standalone HTML files -

basically i'm looking gulp plugin turn directory this: /app - htmlfile1.html - htmlfile2.html - htmlfile3.html - /css -cssmain.css -/js -global.js and turn this: /dist -/htmlfile1 - htmlfile1.html - /css -cssmain.css -/js -global.js - /htmlfile2 - htmlfile2.html - /css -cssmain.css -/js -global.js - /htmlfile3 - htmlfile3.html - /css -cssmain.css -/js -global.js any thoughts on how accomplish build system this? the code allows common files added every page distribution unique dependencies defined array in pages object. the following gulp file relies on gulp-foreach , parse-filepath , , event-stream : npm install gulp gulp-foreach parse-filepath event-stream --save-dev gulpfile.js : // command: // npm install gulp gulp

python - Apparently fine http request results malformed when sent over socket -

i'm working socket operations , have coded basic interception proxy in python. works fine, hosts return 400 bad request responses. these requests not malformed though. here's one: get http://www.baltour.it/ http/1.1 host: www.baltour.it user-agent: mozilla/5.0 (x11; ubuntu; linux x86_64; rv:28.0) gecko/20100101 firefox/28.0 accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 accept-language: en-us,en;q=0.5 accept-encoding: gzip, deflate connection: keep-alive same request, raw: get http://www.baltour.it/ http/1.1\r\nhost: www.baltour.it\r\nuser-agent: mozilla/5.0 (x11; ubuntu; linux x86_64; rv:28.0) gecko/20100101 firefox/28.0\r\naccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\naccept-language: en-us,en;q=0.5\r\naccept-encoding: gzip, deflate\r\nconnection: keep-alive\r\n\r\n the code use send request basic socket operation (though don't think problem lies there, works fine hosts) socket_client.send(request_raw)

mysql - How to make this JDBC code more portable? -

i have following piece of code: list<list<object>> batch = db.executeinsert("insert batches (batch_date,source,log_file,status) values (?, ?, ?, ?)", now, importzip.getabsolutepath(), logfile.getabsolutepath(), batchstatus.importing.tostring()) and returned data when run on mysql returns integer representing inserted id expected. when run under oracle returns non portable rowid object. have identity column, converted sequence represents id. however, there's not can rowid . i've checked code , i'm calling statement.getgeneratedkeys() thought whole point of making portable code. how can write in portable fashion without executing things select table rowid=? not portable. as found out, oracle returns rowid can - example - obtain id querying row. some databases return last generated id (which might not belong table, eg mysql afaik), databases return id column first column in resultset , others return all colum

php - Need to get field value and if it doesnt end in '.jpg' or '.png' it gets deleted or store its id -

i moving data db another, i've ended column supposedly hosting image links of invalid urls doesn't lead image. need run query fetch value field , data , compare if ends in '.jpg' or '.png' or '.gif' , if not delete or else store it's id later deletion. been reading using php strpos my current query fetching fields data in value field below: $query = "select id kosmos_module_articles_item_fielddefs fielddef_id='29' , value not null"; thanks, iain assuming you're using mysql, compare last 4 characters of value list of extensions want allow: delete kosmos_module_articles_item_fielddefs substring(value, -4) not in ('.png', '.gif', '.jpg');

mysql - My SQL query order so that no same value from the column come together -

i m fetching data multiple tables , want sort result no 2 values come together. for example query returns following data. 23 25 26 26 22 22 19 i want result ordered no 2 values come consuctivley. 23 25 26 22 26 22 19 you cannot guarantee no 2 values come (for instance, values might same). can distribute them. here method using subquery , variables: select t.* (select q.*, (@rn := if(@v = col, @rn + 1, if(@v := col, 1, 1) ) ) rn (query) q cross join (select @v := -1, @rn := 0) vars order col ) t order rn, col;

Versioning of ActiveX COM DLL with Semantic Versioning but GUID per MAJOR.MINOR? -

long story short, i'm maintainer of visualbasic 6 project products activex com dll used internally ~50 other software packages have internal uses in organization. for last couple years have been following semantic versioning "major.minor.patch" each dll released , have been assigning unique guid per release. i.e. 1.1.1 , 1.1.2 have separate guids. it has worked ok, causes each of software packages require new release -- when none needed -- can reference new guid , recompile. wastes few dozen man hours due internal processes releases. my question is, "bad practice" maintain guid each minor release 1.1.1, 1.1.2, , 1.1.99 have same guid? better guid per major release instead? this cause references change when new major or minor release made reducing number of changes required software packages depend on it. lastly, if helps response, dlls named as: myactivexdll_vmajor.minor.patch.dll. with guid per minor switch myactivexdll_vmajor.minor.dll

sqlite - Using existing database in Android Wear -

i'm try build wear-app existing app. have sqlite database in handheld-app, want try use them in wear app. is possibility send database wear or can access database on handheld wear app? my current idea transfer items via wearable.dataapi , that's sounds not best solution. for example, don't believe google keep transfer notes separately. anyone idea? i've found quick solution transfering whole database phone smartwatch. first create helper class converts database content json-string, can send smartwatch using wearable.dataapi : databasetojson.java: public class databasetojson { databasehandler dbhandler; public databasetojson(context context) { dbhandler = new databasehandler(context); } public jsonobject getjson() throws jsonexception{ item[] item = null; jsonobject pl = new jsonobject(); item = dbhandler.getitems(); dbhandler.close(); jsonarray jsonarray = new jsonarray(); for(int i=0;i<item.length;i++){