Posts

Showing posts from May, 2013

cordova - ios-sim stopped working "NSCFString containsString" error -

i'm using ionic build hybrid mobile app. i've had no trouble launching emulator via "ionic emulate ios" command. of sudden command started throwing errors. i've tried removing adding ios platform, uninstalling re-installing ios-sim, still same error message below. appreciated, thanks 2015-06-13 14:06:20.198 ios-sim[12997:507] -[__nscfstring containsstring:]: unrecognized selector sent instance 0x7f98e06006e0 2015-06-13 14:06:20.200 ios-sim[12997:507] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[__nscfstring containsstring:]: unrecognized selector sent instance 0x7f98e06006e0' *** first throw call stack: ( 0 corefoundation 0x00007fff9303925c __exceptionpreprocess + 172 1 libobjc.a.dylib 0x00007fff9058ee75 objc_exception_throw + 43 2 corefoundation 0x00007fff9303c12d -[nsobject(nsobject) doesnotrecognizeselector:] + 205 3...

gd - PHP imagecolorallocate not working -

Image
i running site off of bluehost, php 5.4 , , gd version bundled (2.0.34 compatible) - high enough gd use imagecreatetruecolor() i cropping image, , cropped image not entirely fill output thumb. imagecreatetruecolor() leaves black background wherever resampled image isn't covering output thumb, shown below but white, or transparent background. php: $tci = imagecreatetruecolor($w, $h); $color = imagecolorallocate($tci, 255, 255, 255); imagefill($tci, 0, 0, $color); imagecopyresampled($tci, $img, 0, 0, $x, $y, $w, $h, $wor, $hor); imagejpeg($tci, $preview, $qual); i not having issue resampling image, or using imagecreatetruecolor() , whatever reason, cannot background color white. thank in advance. edit if comment out line imagecopyresampled(...) then gives correct background color set in imagecolorallocate , image fill . it's imagecopyresampled that's causing problem.

python - Django - beginner tips for test writing? -

i django beginner , need learn how write functional , unit tests. going start documentation, maybe knows tutorials or has tips share? should use "selenium" functional tests or considered bad practise? also wondering percentage of code should cover tests? thanks answers in advance. as resources, right after finish docs go straight book, it'll cover writing tests in django, simple complex tests: http://www.obeythetestinggoat.com/ now code coverage, 1 basic thing you'll learn in book above test everything, quoting page 1 of book: obey testing goat! nothing until have test one great tool find useful while testing coverage of tests coverage.py , tell how of code covered tests, here's django docs it: https://docs.djangoproject.com/en/dev/topics/testing/advanced/#integration-with-coverage-py hope helps!

c - How is `dup2` actually working? -

i try figure out how dup2 works. goal duplicate standard input , display on standard output (like parrot :) ) i made basic test file: #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main (void){ file* fp= fopen("test.txt", "w"); int fildes = fileno(fp); dup2(fildes, 1); printf("test\n"); close(fildes); fclose(fp); return exit_success; } edit the text doesn't appear in shell, file stays empty. this working, made mistake. my idea realize entry duplication this: #include <stdio.h> #include <unistd.h> typedef struct { int read; int write; } pipe_t; int main (void){ pipe_t my_pipe; int pid; if (( pipe((int *)&my_pipe)== -1) || ( (pid = fork()) == -1)) return 1; if(pid > 0){ close(my_pipe.read); dup2(my_pipe.write, 0); int c; do{ read(my_pipe.write, &c, 1); write(my_pipe.write, &c, 1); fflush(stdin); }whil...

mysql - Setting "Server" programatically with a TFDConnection -

tfdconnection.params.server not valid published property in delphi xe7. how can set server location programatically? have 2 mysql servers (test , production) @ different ip's , based on doing in application, want switch , forth between 2 servers. please read documentation, tells how define firedac connection mysql: working connections (firedac) connect mysql server (firedac) you specify db server part of connection definition : defining connection (firedac) connection definitions can defined in external .ini file, can reference in tfdmanager.connectiondeffilename property, or load dynamically using tfdmanager.loadconnectiondeffile() method. [mysql_connection_1] driverid=mysql server=192.168.1.100 ... [mysql_connection_2] driverid=mysql server=192.168.1.101 ... or dynamically using tfdmanager.connectiondefs property: var odef: ifdstanconnectiondef; begin odef := fdmanager.connectiondefs.addconnectiondef; odef.name := 'mysql_connection_1...

oracle - SQL Join with one column in the joining table -

q: there 2 tables emp , dept having 1 column each i.e id column tables as emp table dept table id id 1 1 1 1 2 2 and join query select * emp e,dept d e.id = d.id? and result of above join : id id 1 1 1 1 1 1 1 1 2 2 but not able understand how comes. can 1 explain me this? a join repeats each row in right hand table each row in left hand table, limited on clause. so each row id = 1 repeated twice, resulting in 4 rows id = 1 . if you'd add row id = 1 both tables, you'd 3 x 3 = 9 rows id = 1 in result.

android - Receiver doesn't work after restart -

after restart or turn on device receivers don't working. when don't restart or turn on device working... manifest: <receiver android:name=".alarmreceiver"> <intent-filter> <action android:name="android.intent.action.boot_completed" /> </intent-filter> </receiver> <receiver android:name=".actionreceiver"> <intent-filter> <action android:name="android.intent.action.boot_completed" /> </intent-filter> </receiver> broadcastreceiver: public void onreceive(context context, intent intent) { string msg=intent.getstringextra("msg"); string note=intent.getstringextra("note"); intent startintent = new intent(context, alarmdialog.class); startintent.putextra("msg",msg); startintent.putextra("note",note); ...

html - Responsive resizing image-height to fit text-div next to it -

im creating 2 colum website, having fit pictures next text-boxes. images have resize according text-divs, @ time cover 50% width each, , height defined div containing text. (eg. imagine pulling window lesser width, text fill more in height, , image have fill same height, , still centered in container , keep aspect-ratio.) possible using html , css, , if so, how? you combine table solution background-size: cover; solution. demo: https://jsfiddle.net/64gzjah4/2/ css: td { border: 1px solid red; width: 50%; } td:first-child { background-image: url('http://placekitten.com/g/200/300'); background-repeat: no-repeat; background-size: cover; /* make image cover td */ background-position: 50% /* center image inside td */ } html: <table> <tr> <td> </td> <td> text goes here </td> </tr> </table> what browser support need? ie8 not support backg...

android - Nested CardView registration form. How to dynamically size form? -

here picture of current layout i have been asked create form big square button @ bottom of page. at point need teach me lesson layouts , me make dynamically sized form. want field cards , text dynamically size , fill screen big blue bar @ bottom. can without orientation qualifiers , stuff? the design trying meet extends zip code down depending on screensize , stops @ blue bar. while settle anchoring button , using zip code field dynamic filler, ideally have dynamic form. help! p.s. there scrollview somehow use small screens can scroll through fields down button. <?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fillviewport=...

Elasticsearch - location of fragments in a document -

i executing phrase query 1 below. returns me highlighted fragments ordered relevance. naturally, want user click on fragment , i'd scroll document corresponding location. however, don't see way in elasticsearch find out fragments in original document. ideas? get documents/doc/_search { "query": { "match_phrase": { "text": { "query": "hello world", "slop": 10 } } }, "highlight" : { "order" : "score", "fields" : { "text" : {"fragment_size" : 100, "number_of_fragments" : 10} } } } in meantime couldn't find proper solution , ended following hack (works us): before indexing annotate each word in text "[index]", " some text index " becomes " some[00] text[01] to[02] index[03] ". use c...

c - Different Answers by removing a printf statement -

this link question on uva online judge. https://uva.onlinejudge.org/index.php?option=com_onlinejudge&itemid=8&category=29&page=show_problem&problem=1078 my c code #include <stdio.h> double avg(double * arr,int students) { int i; double average=0; for(i=0;i<students;i++){ average=average+(*(arr+i)); } average=average/students; int temp=average*100; average=temp/100.0; return average; } double mon(double * arr,int students,double average) { int i; double count=0; for(i=0;i<students;i++){ if(*(arr+i)<average){ double temp=average-*(arr+i); int a=temp*100; temp=a/100.0; count=count+temp; } } return count; } int main(void) { // code goes here int students; scanf("%d",&students); while(students!=0){ double arr[students]; int i; for(i=0;i<students;i++){ ...

mysql - Aggregate and Group By in Apache Phoenix -

i trying execute query in apache phoenix using aggregate , groupby function. have executed same query in mysql , works in phoenix tried query based on mysql query failed. please see mysql query , phoenix query below. mysql: select id3, id4, name, descr, status, min(date) table1 status = "inactive" group id3, id4, name, descr, status result: id3 id4 name descr status min(date) 17773 8001300701101 name1 descr1 inactive 20121202 17785 9100000161822 name3 descr3 inactive 20121201 phoenix query: there no difference in query between mysql , phoenix. select id3, id4, name, descr, status, min ( date ) table1 status = 'inactive' group id3, id4, name, descr, status; but getting below error can 1 explain please? error: error 1018 (42y27): aggregate may not contain columns not in group by. els_name (state=42y27,code=1018) java.sql.sqlexception: error 1018 (42y27): aggregate may not contain columns no...

How do I access inserted document's _id within a transaction in ArangoDB -

i don't see examples of accessing inserted/updated documents key's when in transaction. var collections = {write: ['foo','bar']}; var action = string(function () { var doc = params['doc']; var relateddoc = params['relateddoc']; var db = require('internal').db; db.foo.save(doc); // how access _id, key etc of newly inserted doc? relateddoc.foos.push(doc._id); // _id not exist yet db.bar.save(relateddoc); return {success: true}; }); var params = { doc: doc, relateddoc: relateddoc }; db.transaction(collections, action, params, function (err, result) { if (err) { return dfd.reject(err); } return dfd.resolve(result); }); the collection.save() method return meta-data saved document: _rev : document revision id (auto-generated server) _key : document key (either specified user in _key attribute or auto-generated server if not) _id : same key, including collection name ...

memory management - In linux every process is given a 4GB of virtual address space considering a 32-bit architecture -

hi new linux kernel development. want clearity following statement. *> in memory, every process given 4gb of virtual address space considering 32-bit architecture. lower 3gb virtual addresses accessible user space portion of process , upper 1gb accessible kernel space portion.* does mean each process in linux allocated memory space 1gb+3gb? if yes there hundreds of process in linux , 100*4gb space system gets of memory space? what has relation kernel stack , user stack ? does every process in linux has kernel , user stack ? intro linux, modern operating systems, uses virtual pages provided modern architectures, including x86 family. in system virtual memory, physical memory (actual ram resource) abstract process running on system. address space numbers memory could be. paging memory can mapped (put @ address) in pages architecture dependent size of memory chunk. if want put memory @ address process can use it, you'd have pick page aligne...

parse.com - how to implement the likes post pattern in parse -

given standard use case of user able post. and using parse example var user = parse.user.current(); var relation = user.relation("likes"); relation.add(post); user.save(); what's best way keep count of total likes per post? should i: increment total likes counter on post object beforesave cloud code hook on user looks obj.isdirty("likes") , figures out object added somehow (i'm not sure find post added in case) create separate likes object in parse , count queries against (probably not because parse recommends against doing count queries) increment likes counter on product client-side @ same time user adding post users relation (security issue , synchronization issue?) its good, thoughtful question. looking @ ideas: seems natural put likes counter on post, , natural maintain on beforesave of user. you're right dirty info (as far know) doesn't tell enough to-many side of relation new. i'd exclude otherwise fine idea...

javascript - Standard responses for restful API -

i creating rest server hybrid mobile app consume , webserver based on sails. implementing various authentication calls using passport , wondering if there standard way output calls login, signup, logout etc. i found few public apis on web output can mimicked me wondering if more standard public api output can used me.

java - Advancing text in a text file using user input -

so in first year of college christmas project needed make basic game using if statements, chose text adventure me being novice chose write out every print out: system.out.println("you approach 2 cupboards 1 on right , 1 on left.\nwhich 1 inspect?"); system.out.println("please press 1 inspect right cupboard or 2 press left cupboard."); int action1 = 0; while(action1 !=1 && action1!=2){//checking make sure no 1 puts in number thats not 1 or 2 action1 = in.nextint();//start of player choice if( action1 == 1) { system.out.println("in right cupboard find note.\nupon reading note says:"); system.out.println("hello" + " " + name + " " + "you're wondering why woke in kitchen whith driend blood on shirt unable rememeber anything.\npretty understandable. however, you're part of game , expect play rules. i'm waiting ...

html - image height fix even in responsive without image stretching -

i want image height fix exact 300px in responsive screen without image stretching. while try object-fit: cover; and work want compatible latest browsers. please avoid stupid answers. .container { width:100%; height:300px; } .container img { width:100%; height:300px; } <div class="container"> <img src="images/bnr1.jpg" /> </div> i'd go for: img{ max-width: 100%; height: auto; } or max-height: 300px if expect (portrait) pictures run on size. if want sure nothing crosses on boundaries of container, can following: .container{ height: 300px; overflow: hidden; }

php - XPath 1.0 - Make selection based on value of text spread over multiple nodes -

<root> <div> <p>this text</p> <p><span>fo</span><span>ob</span><span>ar</span></p> </div> <div> <p>this text</p> <p><span>fo</span><span>b</span><span>ar</span></p> </div> <div> <p>this text</p> <p><span>fooba</span><span>r</span></p> </div> <div> <p><span>foo</span>this text<span>bar</span></p> </div> <div> <p><span>foo</span><img/><span>bar</span></p> </div> <div> <p><span>foo</span><span>bar</span><span>baz</span></p> </div> <div> <p>foobar</p> </div> </root> given above xml xpath 1.0 query select <div> s base...

javascript - Greasemonkey iframe content access jQuery -

i had wrong impression using greasemonkey allow me unrestricted access iframe's elements jquery selectors.. the html page example: <html> <body> <div id='content'> //here first iframe <iframe src='bla.php'> <html> <body> <div id='content2'> //here iframe inserted <iframe src='bla2.php'> //here simple elements <div id="goal"> password secret </div> </iframe> </div> </body> <html> </iframe> <...

sql server - SQL Compute Default Value Column -

i have 5 column in table transaction debit, credit, rate, companydebit, companycredit the question : how add default value companydebit & companycredit using following formula: companydebit = debit * rate companycredit = credit * rate

When do I have to cast to byte when initialize a byte array in java? -

here code: import java.io.*; public class bed { private string bedfn; private int bytes_snp; private int nindiv; private long bedsize; private int nsnp; private byte[] magicbytes; public bed(string bedfn, int bytes_snp, int nindiv) { this.bedfn = bedfn; this.bytes_snp = bytes_snp; this.nindiv = nindiv; bedsize = (new file(bedfn)).length(); nsnp = (int) ((bedsize - 3) / bytes_snp); /////////////////////////////////////// magicbytes = new byte[] {0x6c, 0x1b, 0x01}; } //... public outputstream writebytes(outputstream filestream, byte[] bytes) { try{ filestream.write(bytes); } catch (ioexception e) { e.printstacktrace(); } return filestream; } public outputstream writebytes(outputstream filestream) { return writebytes(filestream, magicbytes); } public outputstream writebytes(string filename, byte[] bytes)...

asp.net mvc - Autofac not working after update -

i have updated autofac.mvc version 3.2.1 3.3.0, updated other packages including ef, mvc, webactivatorex etc , after update giving error on controller no parameterless constructor defined object i put breakpoint in initialization class , found not hitting breakpoint. i've separate dependency resolution layer in project , code initialization class [assembly: webactivatorex.preapplicationstartmethod(typeof(iocconfig), "registerdependencies")] namespace myapp.bootstrapper { public class iocconfig { public static void registerdependencies() { var builder = new containerbuilder(); const string nameorconnectionstring = "name=appcontext"; builder.registercontrollers(typeof(mvcapplication).assembly); builder.registermodule<autofacwebtypesmodule>(); builder.registergeneric(typeof(entityrepository<>)).as(typeof(irepository<>)).instanceperhttprequest(); ...

html - how to change get php info in htmlB -

i trying make product page various products on site. far don't have php backend. my html <div id ="itemsgohere> //getname() getimageurl() //getname() getimageurl() //getname() getimageurl() </div> the variables need call var productinfostring = {"images/product1.png" , "thisproducttitle", "$50"} can make php file store information , when user clicks on product1 it'll load productinfostring product1?? yes need ajax call on click of product , send it's id , return productinfostring value of product.

Shiny R reactivevalues memory leak -

i'm trying understand why cycling use of shiny's reactivevalues causes use more memory. context user interface option automate given strategy. example below based on st. petersburg paradox. appreciate may better practice place entire automation process in seperate function file understand why reactive object increases in size , if there more immediate work around. the example below print out amount of memory values using on disk. there no increase in size list saved it. library(shiny) library(pryr) server=shinyserver(function(input, output) { values=reactivevalues(win=0, total=1000, gamble=0, stick=0, outcome=0, auto.counter=0 ) ############################################# # update action buttons observe({ if(!is.null(input$stick)){ isolate({ values$stick=values$stick+1 }) } }) obse...

ios - UICollectionView with data source fetched from Photos - slow updates with big amount of photos -

i making the app detecting screenshots in photos library using old alaseetlibrary framework — please use new photos framework if can. problem is, when user has big photo library takes lot of time find screenshots. updating data source every time app opened. here's code scanning photo library: alassetslibrarygroupsenumerationresultsblock savedphotosblock = ^(alassetsgroup *group, bool *stop) { if (group) { [group enumerateassetsusingblock:^(alasset *result, nsuinteger index, bool *stop) { if(result) { alassetrepresentation *original = [result defaultrepresentation]; cgsize dimensions = [original dimensions]; after work finished calling reloaddata() . how can update data on go possible interact uicollectionview while data source updating? you should use performbatchupdate method. create array new indexpath added. call insertitemsatindexpaths: instead of reloaddata

javascript - Hide checkboxes if they do not match input text -

basically have list of check boxes so <label style='padding-right:30px;' > <input type='checkbox' name='tag[]' value='1'> bob ; <input type='checkbox' name='tag[]' value='2'> john ; <input type='checkbox' name='tag[]' value='3'> mary ; </label> i have input box user type checkbox show <input type="text" name="filter" placeholder="filter tag name" id="filter" > what want when user types bob, check boxes without text value of bob hidden. i have java script matching value of checkbox not text of it js follows <script src="js/jquery.min.js"></script> <script type="text/javascript"> $('#filter').on('keyup', function() { var query = this.value; $('[name^="tag[]"]').each(function(i, elem) { if (elem.value.tolowercase().indexo...

First row error with @rownum mysql -

i trying generate rownum mysql query. code. select @rownum:=@rownum+1 rowno, (`plgap_nos`.`no_id` - 1) `no_id` `plgap_nos`, (select @rownum:=0) r limit 0, 10 while works fine, rownum of first row shoes 1621 , not 0. it tried differnt code below. still same error persists. select coalesce(@rownum:=@rownum+1,0) rank, (`cnxnifty_plgap_nos`.`no_id` - 1) `no_id` `money_database`.`cnxnifty_plgap_nos`, (select @rownum:=0) r limit 0, 10 it seems committing silly error not being able figure. can help. additional info- how data looks- rank     no_id 1621     0 1           7 2           18 3           21 4           33 5           37 6...

MySql select data from multiple tables - several sub records expected -

i have feeling might have got table structure wrong, appreciated. i have, say, 3 tables tbl_a (has class , section association) id classid sectionid tbl_b (has subject , class association) id classid subjectid tbl_c (has examination , class association) id classid examid i need display records in following format class | section (s) | subject (s) | examination (s) --------------------------------------------------- grade 1 | a, b, c, d | english, maths, drawing... | assessment 1, assessment 2... sql script select distinct t1.classid, t1.sectionid, t2.subjectid, t3.examid `tbl_a` t1 join `tbl_b` t2 on t1.classid = t2.classid join `tbl_c` t3 on t1.classid = t3.classid can above in achieve 1 sql query (with join etc) or need create separate sql recordsets loop through (for example, grade 1 have multiple subjects etc) thanks heaps in advance! select t1.classid, group_concat(t1.sectionid order t1.sectionid...

python - List of lists changes reflected across sublists unexpectedly -

i needed create list of lists in python, typed following: mylist = [[1] * 4] * 3 the list looked this: [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]] then changed 1 of innermost values: mylist[0][0] = 5 now list looks this: [[5, 1, 1, 1], [5, 1, 1, 1], [5, 1, 1, 1]] which not wanted or expected. can please explain what's going on, , how around it? when write [x]*3 get, essentially, list [x, x, x] . is, list 3 references same x . when modify single x visible via 3 references it. to fix it, need make sure create new list @ each position. 1 way is [[1]*4 n in range(3)] the multiplication operator * operates on objects, without seeing expressions. when use * multiply [[1] * 4] 3, * sees 1-element list [[1] * 4] evaluates to, not [[1] * 4 expression text. * has no idea how make copies of element, no idea how reevaluate [[1] * 4] , , no idea want copies, , in general, there might not way copy element. the option * has make new referenc...

css - How to block scrolling without "jumping" -

well know overflow-y: hidden , dont site "jumps" right side 20px every time use overflow-y: hidden . is possoble block scrolling without "jumping"? here example http://jsfiddle.net/wjyb8tzw/6/ just give margin or padding of 20px @ right side. padding-right:20px;

ios - Xcode 7 beta 1 view doesn't fit -

in previous versions of xcode, storyboard app fine, since updating xcode 7 beta, running on simulator , on device (ios 9) view size seems distorted. similar app hasn't been optimised iphone 6/6 plus, height shortened. any reasons why happening? thanks i resolved issue adding correctly sized launch image iphone 6 in assets folder. makes view fit perfectly.

spring statemachine - problems running state machine examples -

congratulations on spring state machine, found yesterday , have been trying out, turnstile example running in sts. found easy , intuitive build fsm. because spring shell doesn't work in sts tracked down instructions run examples command line in reference doc, "java -jar spring-statemachine-samples-turnstile-1.0.0.build-snapshot.jar" , running got error "no main manifest attribute, in spring-statemachine-samples-turnstile-1.0.0.build-snapshot.jar". although not novice in using gradle, tried fixing adding line build.gradle in jar section "manifest.attributes['main-class'] = 'demo.turnstile.application'" (which doesn't handle various sub-projects know) got error "noclassdeffounderror: org/springframework/shell/bootstrap". if possible run samples gradle, include them in reference document? tried running samples using gradle run there no interaction shell...

python - Remove boilerplate content from HTML page -

i use justext implementation found here https://github.com/miso-belica/justext clean content out of html page. works this: import requests import justext response = requests.get("http://planet.python.org/") paragraphs = justext.justext(response.content, justext.get_stoplist("english")) paragraph in paragraphs: if not paragraph.is_boilerplate: print paragraph.text i have downloaded pages parse using tool (some of them no longer available online), , extract html content out of them. since justext appears working on output of request (which response type object), wondering if there custom way set content of response object contain html text parse. response.content of <type 'str'> >>> requests import >>> r = get("http://www.google.com/") >>> type(r.content) <type 'str'> so call: justext.justext(my_html_string, justext.get_stoplist("english"))

How to improve the performance of Haskell IO? -

it seems haskell's io relatively slow. for example, comparing haskell python #io.py import sys s=sys.stdin.read() sys.stdout.write(s) , -- io.hs main = s <- getcontents putstr s their performance (gen.py writes 512k data stdout): the python version: $ time python gen.py | python io.py > /dev/null real 0m0.203s user 0m0.015s sys 0m0.000s the haskell version: $ time python gen.py | runhaskell io.hs > /dev/null real 0m0.562s user 0m0.015s sys 0m0.000s it seems haskell 1 far lower. there problem test? or inherent problem of haskell? thanks. your example slow because uses lazy io string -s. both have own overheads. in particular, string linked list of char -s, therefore has 2 words of space overhead each character (one word constructor tag , 1 forward pointer), , each character takes @ least 1 word (one word cached low characters, 3 words uncached characters). strict io byte or unicode array input faster. try...

jsp - Servlet path is not included in <c:url> -

i have simple java webapp (eg. test ) containing 2 different springmvc application. my web.xml maps them as: <servlet-mapping> <servlet-name>web</servlet-name> <url-pattern>/web/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>restful</servlet-name> <url-pattern>/restful/*</url-pattern> </servlet-mapping> inside web part i'm using "classic" libraries, such jstl core. i don't understand how avoid jstl c:url tag ignoring url pattern. if write <c:url value="/browse/"/> the link rendered /test/browse , not /test/web/browse . what i'm missing? thank you the <c:url> indeed not take servlet path account. that's own responsibility. <c:url> takes httpservletrequest#getcontextpath() account. either hardcode yourself: <c:url value="/web/browse" /> or...

ios - Can I check any value in Xcode debugger? -

i use xcode 6.x wonder if there way check(see) variable value(including local, global) writing name @ debug break point. thank reply! i use po in console window or use expression window po variablename

php - Laravel 5 route same urls login or not -

i updating site laravel 4 5. in l4 had set up: if(sentry::check()){ route::get('/', array('as' => 'school.home.index', 'uses' => 'school\authschoolcontroller@index')); else{ route::get('/', 'school\schoolcontroller@index'); } note same url different controllers depending on login or not. with l5 cannot use middleware tried this: route::get('/', 'schoolcontroller@index'); route::group(['middleware' => 'auth'], function() { route::get('/', array('as' => 'school.home.index', 'uses' => 'authschoolcontroller@index')); }); but passes on first , goes group, gets redirected login page , admin if logged in. so think need if/else equivalent in route based on login auth::user() doesn't seem work: if(auth::check()){ route::get('/', array('as' => 'school.home.index', 'uses' => 'au...

image - Google App Engine : Wrong Serving Url -

i have created google app engine project it's possible upload photos. uploading part working fine , photos uploaded in proper size. when try getting images.get_serving_url , returns me serving_url appended lh3.googleusercontent.com according googleappengine documentation must return serving_url lh3.gghpt.com . also, problem comes photos on serving_url 4-6 times smaller uploaded ones , when view in googleappengine console, photos have same size uploaded ones. don't know why googleappengine not returning actual sized images. try specifying size=0 in images.get_serving_url method call. eg. images.get_serving_url(blob_key, size=0)

jquery - How to upload images from its src using generic handler -

i using code upload images using generic handler <script type="text/javascript"> $(function () { $('#btnupload').click(function () { var fileupload = $("#fileupload1").get(0); var files = fileupload.files; var test = new formdata(); (var = 0; < files.length; i++) { test.append(files[i].name, files[i]); } $.ajax({ url: "uploadhandler.ashx", type: "post", contenttype: false, processdata: false, data: test, // datatype: "json", success: function (result) { alert(result); }, error: function (err) { alert(err.statustext); } }); }); }) </script> this code works file upload control want upload image sending image src generic handler like this var src = 'images/shaiwal.png'; $.ajax({ url: "uploadhandler.ashx", type: "post", contenttype: false, processdata: false, data: src, // datatype: "json", success: function (result) { alert(result); }, error: function (err) { alert(er...

javascript - How to consistently crash IE 10&11? Reproducing "Internet Explorer to close and reopen the tab" -

this stupid question. is there way consistently produce error in internet explorer 10&11 javascript, css or html? a problem webpage caused internet explorer close , reopen tab. this not malicious webpage, need test plugin , simulate situation ie crashes. are there known issue in versions of ie cause show error?

Laravel 5 : multi-model middleware "Owner" -

i want create middleware check if authenticated user owner of item. single model, code easy , : <?php namespace app\http\middleware; use closure; class owner { public function handle($request, closure $next) { $id = $request->segments()[1]; //get id parameter $model = model::find($id); // find model db if(!$item) return 'not found'; //if item not found //check if authenticated user owner if($item->user_id == \auth::id()){ return $next($request); }else{ return 'not allowed'; } } } now let's have multiple models (modelx, modely, modelz) , don't want rewrite middleware handle function several times. how 1 inject referenced model in middleware make accomodate multiple models app? you use middleware parameters route/model binding. lets assume have post resource. you def...

Android Drag and Drop, Click, and Scroll in a Listview -

Image
so have layout such: i using listview right , each row has imageview , 2 textviews. i want able 3 things on page: clicking on row (or clicking on imageview in row works me too) brings me fragment. you can drag image in each listview row. uses dragshadowbuilder , therefore can detect if drop darker gray zone in bottom. you can scroll , down in listview other items overflowing right now. as can imagine, these 3 cases difficult capture because hard differentiate between 3 (bc of overlaps in functionality). i prefer not use onitemlongclicklistener drag , drop bc users don't think hold fingers down long time start drag , drop. any suggestions on how implement capture 3 use cases? actually, can thought of 2 use cases because if dropped image original container, count click me. complex part make somehow work scrolling , down listview... thanks in advance! p.s. entire view rendered in fragment , clicking on view or dropping 1 gray area opens separate fragment. ...

audio - Giving large no of samples to KissFFT -

i wanted find 4096 point dft of audio signal of duration 10 seconds sampling rate 44100 hz. hence there 441000 input samples. kissfft takes 4096 input size. how go finding fft of such large signal? the power spectrum of real-world audio signals (speech, music, etc) time-varying, typically calculate series of short-term ffts using overlapping windows, produce sequence of power spectra, aka spectrogram . i suggest starting 50% overlap, first fft samples 0..4095, second 2048..6143, etc.

c# - How to use existing camera app(not create one using MediaCapture) and take picture in windows phone 8.1(WinRT)? -

i know how implement camera capture using mediacapture in windows phone 8.1. question can't launch existing camera app using launchuriasync() , path of file or file in form of argument? example: when try using import , choose photos app have option take image. can't use existing camera app this? should have implement our own media capture resolution etc? thanks. the app needs use mediacapture api. windows phone runtime apps cannot directly launch camera app capture , return image. there no analogous api cameracapturetask (windows phone silverlight) or cameracaptureui (windows store apps). can't launch existing camera app using launchuriasync() , path of file or file in form of argument? in windows 10 possible write camera app service provides this, not in 8.1. see build session app-to-app communication: building web of apps should have implement our own media capture resolution etc? http://wpdev.uservoice.com place request featur...

Where I can find MariaDB protocol document that different from MySQL -

mysql support gtid @ 5.6, mariadb support @ 10.0.2, mariadb mysql 5.5.5 compatible. so, gtid replication protocol different mysql's replication. here can find out gtid format different mysql: uuid set 3e11fa47-71ca-11e1-9e33-c80aa9429562:23 server_uuid:interval gtid set uuid_set[, uuid_set] ... | '' mariadb 0-3306-123 domainid-serverid-sequence how start gtid replication mysql use com_binlog_dump_gtid mariadb set @mariadb_slave_capability = 4;-- gtid capability set @slave_connect_state = '0-3311-90';-- gtid send register_slave but response packet still not same.so, there document these different ? reference mysql replication global transaction identifiers com_binlog_dump_gtid mariadb global transaction id mariadb 1- gtid explain enabling gtids server replication in mariadb 10.0 finally, find document in code , described how. thanks @zedfoxus, found issue mdev-26 described internal. according above, ...

c++ - QML module not installed error: running Qt app on Embedded Linux -

i trying launch cross-compiled gui qt application on ti board. use command launch application: qt_debug_plugins=1 qt_plugin_path=/root/qt-5.2.1-install/plugins ld_library_path=/root/qt-5.2.1-install/lib/ ./simple_qml_ui -platform linuxfb unfortunately error occurs: qfactoryloader::qfactoryloader() checking directory path "/root/qt_app/styles" ... qfactoryloader::qfactoryloader() checking directory path "/root/qt-5.2.1-install/plugins/styles" ... qqmlapplicationengine failed load component qrc:/main.qml:3 module "qtquick.window" not installed qrc:/main.qml:1 module "qtquick" not installed qrc:/main.qml:2 module "qtquick.controls" not installed qrc:/main.qml:4 module "qtquick.dialogs" not installed qrc:/main.qml:3 module "qtquick.window" not installed qrc:/main.qml:1 module "qtquick" not installed qrc:/main.qml:2 module "qtquick.controls" not installed qrc:/main.qml:4 module "qtqui...

c++ - what to delete after assignment? -

if have: template<> char *tobytes<uint64_t>(uint64_t src) { char *data = new char[8]; //...stuff return data; } template<> void write<uint64_t>(char *dst, uint64_t src) { char *srcbytes = tobytes(src); (int = 0; < 8; ++i) { *(dst++) = *(srcbytes++); //am leaking here? } } that gets called like: char *keyptr = new char[27]; //...stuff write(keyptr, 1234ull); //...write 27 if delete[] keyptr; have deleted srcbytes? think question is, on line asking if i'm leaking, doing copy , result deleting keyptr leaves srcbytes still deleted? still learning c++ , it's not clear me when copy constructor called vs assignment operator. edit 1 : fixed delete per @steephen's answer edit 2 add tobytes per @whozcraig's comment you have memory leak. no, delete [] -ing keyptr has nothing srcbytes , independent allocation. 2 addressed buffers unrelated (except content due copy-code). apart obvious (using std::vecto...

javascript - Can I embed a chrome extension app as part of my main AngularJS app? -

i have been doing lot of reading , studying figure out. i want main angularjs application run, include embedded chrome extension app - in case, have regularly scheduled alarms (using chrome.alarm api). i want users of angularjs app have automatic access chrome extension app, embedded in main clientside 1 lots of other angular features. it seems have manually enable chrome app in developer mode on browser , drag chrome app location in chrome browser. don't understand how end users can automatically use chrome app then. i need add here have never used jquery, angularjs angularjs extensively. angularjs app frontend, backend provided rails. some advice helpful. hope not downvoted strange how questions downvoted , not sure why...i don't know else go question. edit: ok code demonstrate: myangularapp.controller('myappcontroller', function($scope, $http) { var delayvar = 5; chrome.alarms.create("arandomalarm", {delay: delayvar}); }; this doe...