Posts

Showing posts from April, 2014

sql - update with jquery -

i making small site, can put in number in form field. number saved in mysql database, , value return in div id "show". have here made jquery number shown immediately, working fine. i have made div tag id "showhot". here see numbers between 1 - 100 have been put in times. working fine sql string, jquery in not working. if update page, numbers moving , down, if specific number has been put in more times. have tried make jquery it, wrong. is there has clue how that? hope question understandable, otherwise reformulate it. best regards mads html: <div id="show"> <div class="numberheader"> <p>tal</p> </div> <ul class="latestnumbers" style="list-style:none;padding-top: 60px;"> <?php include('response.php');?> </ul> </div> <div class="content"> <p>number</p> <div class=...

java - Asynchronous classes and its features -

newbie in programming, trying understand asynchronous classes , benefits. features can included in class supports such operations? example too the main benefit program multiple things @ same time, instead of waiting 1 thing finish before doing next. simple example: want show information twitter , facebook. getting information typically takes quite time. instead of waiting twitter , waiting facebook, can query both @ same time , alerted when information available. halves time user has wait.

java - JetBrains' @Contract annotation -

how org.jetbrains.annotations.contract annotation work? how intellij idea support it? first off, should annotation idea use check possible errors. java compiler ignore entirely (it'll in compiled artifact have no effect). having said that... the goal of annotation describe contract method obey, helps idea catch problems in methods may call method. contract in question set of semi-colon separated clauses, each of describes input , output guaranteed happen. cause , effect separated -> , , describe case when provide x method, y always result. input described comma-separated list, describing case of multiple inputs. possible inputs _ (any value), null , !null (not-null), false , true , , possible outputs adds fail list. so example, null -> false means that, provided null input, false boolean result. null -> false; !null -> true expands on null always return false , non- null value always return true, etc. finally, null -> fail means me...

Jenkins Jobs are not loading while starting it from CLI -

i have setup lot of jobs while jenkins running windows service.when try start jenkins command line , none of jobs showing up. can 1 let me know how make sure jobs loaded when start jenkins cli on windows machine. make sure have same jenkins home directory when run cli. you can use jenkins_home variable control that: set jenkins_home=c:/myjenkins java -jar jenkins.war

javascript - Access first datum in Firebase snapshot -

i attempting access attributes of first datum in firebase snapshot consists of 10 urls. no matter try, however, getting whole snapshot. code looks like: mydataref.limittolast(10).on("child_added", function(snapshot) { var newimg = snapshot.child("url"); console.log(newimg); }); is there way specify [0] or on whole snapshot i'll first datum? it's tricky sure without seeing data structure, think you're looking for: mydataref.limittolast(10).on("child_added", function(snapshot) { var newimg; snapshot.foreach(function(urlsnapshot) { if (!newimg) { newimg = urlsnapshot.val(); } }); console.log(newimg); }); the foreach() loops on child keys of snapshot , invokes inner callback datasnapshot of each of them. the newimg = urlsnapshot.val(); value of child. may have modify bit based on data structure.

php 5.3 - PHP Fatal error: Can't use method return value in write context -

this question has answer here: reference - error mean in php? 29 answers if (isset( $xml->xpath('/lfm/artist/image[@size="extralarge"]')[0])) { php version 5.3 in use (was 5.7 until server dude switched 5.3). on line @ top we're getting error: php fatal error: can't use method return value in write context i've read few articles nothing obvious springs mind - might case of not seeing wood through trees. any advice on how rid of error other switching 5.7? for compatibility php < 5.4, update code follows: $elements = $xml->xpath('/lfm/artist/image[@size="extralarge"]'); if (isset($elements[0])) { take @ https://wiki.php.net/rfc/functionarraydereferencing if you're interested in learning more.

java - Repeated column in mapping for entity, oneToMany relationship -

i trying one-to-many relationship between 2 tables. have table called users has many user_history entries. defined these tables in mysql , generated entities intellij hibrernate support. problem when want insert in databse receiving following error repeated column in mapping entity: com.userhistoryentity user: <?xml version='1.0' encoding='utf-8'?> <!doctype hibernate-mapping public "-//hibernate/hibernate mapping dtd 3.0//en" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="com.usersentity" table="users" schema="" catalog="protein_tracker"> <id name="id"> <column name="id" sql-type="int" not-null="true"/> </id> <property name="name"> <column name="name" sql-type="varchar" length=...

php - Sorting records starting with upper and lower case in Laravel view -

when sorting records in blade template records beginning lower case letter appear @ bottom. how force sortby list records alphabetically? @foreach ($registrations->sortby('profile_last_name') $registration) record list @endforeach you can use natcasesort @foreach (natcasesort($registration->last_name) $last_name) record list @endforeach

javascript - Change the transformz property -

i need change transformz of element using jquery. have div css: .bottom_face { -webkit-transform: rotatex(-90deg) rotate(180deg) translatez(487px); -moz-transform: rotatex(-90deg) rotate(180deg) translatez(347px); } when user changes property on form change translatez value add amount enter: $('.bottom_face ').css('-webkit-transform') ?? how access translatez property of above without overwriting rotatex , rotate properties ? thanks here code tried strip down bare minimum: $("#add").click(function() { var z = $("#z").val(); $(".bottom-face").each(function() { var $c = $(this); var css; if (css = $c.css("-webkit-transform")) { // assignment $c.css("-webkit-transform", $c.css("-webkit-transform") + " translatez(" + z + "px)" ); //console.log( $c.css("-webkit-transform")...

junit - Java Mockito when-return on Object creation -

i'm trying test class calculates age. method calculates age looks this: public static int getage(localdate birthdate) { localdate today = new localdate(); period period = new period(birthdate, today, periodtype.yearmonthday()); return period.getyears(); } since want junit time-independent want today variable january 1, 2016. tried going mockito.when route running trouble. i first had this: public class calculatortest { @before public void setup() throws exception { localdate today = new localdate(2016,1,1); mockito.when(new localdate()).thenreturn(today); } } but got error: org.mockito.exceptions.misusing.missingmethodinvocationexception: when() requires argument has 'a method call on mock'. example: when(mock.getarticles()).thenreturn(articles); also, error might show because: 1. stub either of: final/private/equals()/hashcode() methods. methods *cannot* stubbed/verified. mocking methods declared on no...

postgresql - Using Convert on an ELSE CASE SQL query -

i performing sql query in postgres, selects numeric field. need display string value result of select, using case statement this: select case numeric_field when 100 'some string' when 200 'some other string' the problem if numeric field has other value (like 300 example), need display value (as string of course). try put convert on else this ... else convert(varchar(10),numeric_field) but didn't work. how do this? select case numeric_field when 100 'some string' when 200 'some other string' else numeric_field::text end result your statement incomplete, end missing. read manual here. to output numeric field text, cast text: numeric_field::text , postgres specific short form of sql standard call: cast (numeric_field text)

java - Iterate through array for two elements -

i'm trying make quite simple thing. loop through array , 2 elements in 1 iteration instead of one. here code, maybe point mistakes :) for(int = 0; < temporary.size(); = + 2) { layoutinflater inflater; inflater = (layoutinflater) activity.getparent().getsystemservice(context.layout_inflater_service); view v = inflater.inflate(r.layout.smartuilinear , null); button ls1, ls2; ls1 = (button) v.findviewbyid(r.id.ls1); ls2 = (button) v.findviewbyid(r.id.ls2); ls1.settext("i= "+i+ "info " + temporary.get(i).tostring()); int j = + 1; ls2.settext("i= "+j+ "info " + temporary.get(j).tostring()); linear.addview(v); } edit: problem when size odd number. not wish loose last element. decrementing value if size odd. well guess question not clear en...

java - Creating multiple SQLite databases containing the same schema for a Flashcard program, bad practice? -

i trying come way can import/export sets of data. need share deck of flashcards. each flashcard includes: front text string , reverse text string , efactor float / real , interval integer , count integer the idea want users create deck of flashcards , have ability share deck. concept similar of decks / .anki files in anki . @ moment using sqlite3 store flaschard data. had considered using xml felt sql more logical approach. my initial plan allow users create multiple sqlite db files because felt there key advantages approach. 1) easier share db file rather having export table sqlite database , end sharing file anyway. 2) if user wishes delete deck, simple deleting db file. as negatives though: can understand maybe seen waste of resources or 'messy' create multiple sqlite fb files. is method feasible or considered bad programming practice? i'm open different approaches problem. i think having separate .db file per deck acceptable. mentione...

javascript - onclick() parameter becomes object Object -

i have following function: 'countyofflinenote': function (county) { console.log(county); console.log('logged county'); var = ''; = '...more logic...'; var message = '...some logic...'; var title = 'create offline county note ' + county.county; $('body').appmodal({ appliedto: '', title: title, type: '', message: 'please enter note current county status', submessage: '', template: 'simple', contents: message, cancel: "<input type='button' value='cancel' class='button action left cancel' onclick='$ep.modules.appmodal.cancel(\"" + county "\");' />", icon: 'info', callback: '' }); $('#support-question').focus(); } the issue having input html. when pass county cancel() function,...

Python: How to print my simple poem -

i know how print out sentences using triplet poem program. program randomly picks list of nouns use. my program: import random def nouns(): nounpersons = ["cow","crowd","hound","clown"]; nounplace = ["town","pound","battleground","playground"]; rhymes = ["crowned","round","gowned","found","drowned"]; nounpersons2 = ["dog","frog","hog"]; nounplace2 = ["fog","prague","smog"]; rhymes2 = ["log","eggnog","hotdog"]; nounlist1 = [nounpersons,nounplace,rhymes] nounlist2 = [nounpersons2,nounplace2,rhymes2] nounslist = [nounlist1, nounlist2] randompick = random.choice(nounslist) return(randompick) verbs = ["walked","ran","rolled","biked","crawled"]; nouns() for example, hav...

Earth Orbitting the Sun simulation Object Array not printing correctly java -

i'm trying simulate earths orbit around sun making print out current position. i'm new java , unable print "newp" array correctly within loop. @ moment i'm using- system.out.println(arrays.deeptostring(newp)); i've tried: system.out.println(arrays.tostring(newp)); to no avail. i've imported java util array well, i'm not sure why not working. no other errors appearing in code either. loop of code below: do{ physicsvector[] y = new physicsvector[gravfield.length]; y=copyarray(gravfield); for(int i=0; i<planets.length;i++){ newp[i] = planets[i].updateposition(position[i], velocity[i], timestep, gravfield[i]); } for(int j=0; j<gravityobject.length; j++){ for(int l=0;l<gravityobject.length;l++){ if(j!=l){ newgrav[j].increaseby(gravityobject[j].aduetogravity(planetmass[l], newp[l], newp[j])); } } ...

Outlook AddIn (NetOffice) - Context Menu -

i'm using netoffice developing ms outlook addin, , want add custom context menu item in calendar, allow users add new custom appointment selected time range. so written in article define additional item in ribbonui.xml following way: <customui xmlns="http://schemas.microsoft.com/office/2006/01/customui" onload="onloadribonui"> <ribbon> <tabs> <tab idmso="tabappointment"> <group id="group0" label="addin" insertbeforemso="groupshow"> <button id="convertbutton" label="convert" getimage="convertimage" size="large" onaction="convertbutton_click" /> </group> </tab> <tab idmso="tabcalendar"> <group id="group1" label="addin" insertbeforemso="groupgoto"> <button id="aboutbutton" label="ne...

Azure SQL DW CTAS of over 102,400 rows to one distribution doesn't automatically compress -

i thought way columnstores worked if bulk load on 102,400 rows 1 distribution of columnstore, automatically compress it. i'm not observing in azure sql dw. i'm doing following ctas statement: create table columnstoredemoctas (clustered columnstore index, distribution=hash(column1)) select top 102401 cast(1 int) column1, f.* factinternetsales f cross join sys.objects o1 cross join sys.objects o2 now check status of columnstore row groups: select t.name ,ni.distribution_id ,csrowgroups.state_description ,csrowgroups.total_rows ,csrowgroups.deleted_rows sys.tables t join sys.indexes on t.object_id = i.object_id join sys.pdw_index_mappings indexmap on i.object_id = indexmap.object_id , i.index_id = indexmap.index_id join sys.pdw_nodes_indexes ni on indexmap.physical_name = ni.name , indexmap.index_id = ni.index_id left join sys.pdw_nodes_column_store_row_groups csrowgroups on csrowgroups.object_id = ni.object_id , csrowgroups.pdw_node_id = n...

c# - Getting constant error indications instead of Intellisense help in LINQ query -

Image
i'm not new visual studio, i'm new vs2012 , linq. try build query, instead of getting useful intellisense table field names, look-ahead , errors indicated on next lines of code. let's have 2 lines of code. when try insert line in between, vs doing red underlines on new line 3, because line 2 still incomplete i'm typing out. this simple console app i'm working on learn stuff. have "using system.linq" in file. notice in example screenshot how "where", "foreach" underlined in red i'm typing out. when type period after c, i'm expecting list of field names pop up. i'm spoiled resharper, visual studio isn't giving me same behavior, here couple of tips may help: make sure have using system.linq; statement. isn't obvious because feels where keyword , shouldn't rely on specific package, due way linq relies on extension methods, necessary. try putting semicolon after linq statement: var test...

How to Monitor the Setting of new Properties on Javascript Objects -

how callback whenever new properties set on javascript object..? i.e. don't know properties going set, want callback properties that set. what want is var obj = {}; obj.a = "something"; // triggers callback function function callback(obj,key,val) { console.log(key + " set " + val + " on ", obj); } is possible? you can use new defineproperty : function onchange(propertyname, newvalue){ ... } var o = {}; object.defineproperty(o, "propertyname", { get: function() {return pvalue; }, set: function(newvalue) { onchange("propertyname",newvalue); pvalue = newvalue;}}); but depends on browser version need support. edit: added snippet on jsfiddle, works in ie10. http://jsfiddle.net/r2wbr/

sql - How do I find the oldest date in Group -

i have table need oldest date group , able return rows. i'm finding difficult since need return system_id field. assignedprofshistory matterid effectivedate 1 33434-3344 08/22/2005 2 33434-3344 07/12/2004 3 33434-3344 07/12/2004 4 21122-323 12/05/2007 5 43332-986 10/18/2014 6 43332-986 03/23/2013 so in example, rows systemid 2 & 3 should return because tied earliest date. row systemid 4 should return , systemid 6 should returned. this have far. because need include systemid(assignedprofhistory) i'm not getting results need. select aph.assignedprofshistory, m.matterid, min(aph.effectivedate) 'effectivedate' assignedprofshistory aph inner join matters m on aph.matters = m.matters aph.assignedtype = 'originating' group m.matters,m.ma...

python - Force integers of a given size with bin? -

i'm playing around bitwise operators more comfortable using them. the problem i'm having since python has infinite width integers, it's difficult see actual results of operations. >>> bin(0b00000001 & 0b11110111) 0b1 i'd see 0b00000001 instead. is there way experiment these operators fixed-size integers in python? use format() function: print(format(0b00000001 & 0b11110111, '#010b')) output 0b00000001 the string parameter format() function specifies format of output. # makes output include 0b prefix, , 10 indicates entire output should 10 characters. 0 preceding 10 enforces 0 left-padding in 10 output characters. can remove hash if want remove 0b prefix.

join - MySQL, using a joined table twice in the same query -

i'm trying write mysql query joins 2 columns in same table table. have looked through many examples , tried great many things, of them error 1 reason or another. i have teams table: id | team 1 | team 1 2 | team 2 3 | team 3 4 | team 4 i have games table: id | team_1 | team_2 1 | 1 | 2 2 | 2 | 3 3 | 3 | 4 4 | 4 | 1 i have following query: select pio.games.id , team.name `team-1` , team.name `team-2` games left join team on games.team_1 = team.id left join team t2 on games.team_2 = team.id i need list games , show team names, expect: game_id team-1 team-2 1 | team 1 | team 2 2 | team 2 | team 3 3 | team 3 | team 4 4 | team 4 | team 1 but i'm getting first team twice: game_id | team-1 | team-2 1 | team 1 | team 1 2 | team 2 | team 2 3 | team 3 | team 3 4 | team 4 | team 4 i'...

ios - Host Android OS on a server -

i unable use right terminology search else if answered not have posted. pls comment if silly question , take off. not vote down pls. :( rookie i trying setup server can host android environment , let users test apps. cloud ?. wanna see if can host various flavors of android can test machine. possible? use. may run few independent simulators on server ? yes, lots of companies things run own build server. there many services allow such things on servers (i.e. circleci). google around , find lot of stuff.

node.js - Why use different debug modules depending on production/development status? -

so express best practices page, among others, states 1 should use debug module debugging , winston logging app activity in production. why 1 not use winston all? ...and if using both how 1 decide goes in winston debug vs debug's debug? express best practices / debug module / winston module it's not big deal library use log/debug, many express applications use neither winston nor debug. debug has convenience features makes easier use on using winston debugging. use winston, , write own wrapper around debug() method in order replicate exact functionality of debug module. if use both, use debug module log messages used strictly developing , diagnosing bugs, , use winston log messages file/database/service while application in production.

function - C Linked List - understending, how to delete the same element on list -

can tell my, how it's possible, function working ? structure : struct el{ int key; struct el *next; }; typedef struct el ellisty; typedef ellisty *list; and function: void delete(list *l, int zm) { list p, *k; k = l; while ((*k)) { if ((*k)->key == zm) { p = *k; *k = (*k)->next; free(p); } else { k = &(*k)->n; } } } if can illustrate it, awesome. i didn't tried it, i'm happy you. let's take look. other users suggest, double typedef annoying; code isn't clear @ , it's more complex understand code do. struct composition key, label, , pointer next struct. function delete() comparing int zm , takes argument, node of linked list. second argument linked list root pointer, or start pointer. about function: in words, function reading value (key) of linked list , comparing int zm. if key different, (*k) next pointer. met...

python 2.7 - how to draw multigraph in networkx using matplotlib or graphviz -

Image
when pass multigraph numpy adjacency matrix networkx (using from_numpy_matrix function) , try draw graph using matplotlib, ignores multiple edges. how can make draw multiple edges ? graphviz job drawing parallel edges. can use networkx writing dot file , processing graphviz (e.g. neato layout below). you'll need pydot or pygraphviz in addition networkx in [1]: import networkx nx in [2]: g=nx.multigraph() in [3]: g.add_edge(1,2) in [4]: g.add_edge(1,2) in [5]: nx.write_dot(g,'multi.dot') in [6]: !neato -t png multi.dot > multi.png on networkx 1.11 , newer, nx.write_dot doesn't work per issue on networkx github . workaround call write_dot using from networkx.drawing.nx_pydot import write_dot or from networkx.drawing.nx_agraph import write_dot

Matlab: How can i stop a the whole function in matlab? -

i have function in matlab calculating something. within function open function calculate it. in second function have case want stop if condition true (so want end both functions) i don't want error message or anything; there command that? if type in error notice in red message such as: error: invalid call error. correct usage is: -- built-in function: error (template, ...) -- built-in function: error (id, template, ...) error: called from: error: /usr/share/octave/3.8.1/m/help/print_usage.m @ line 89, column 5 >>>error: /home/john/wpq.m @ line 75, column 4 error: /home/john/test.m @ line 23, column 21 if write error('blabla') still get: >>>error: blabla error: called from: error: /home/john/wpq.m @ line 75, column 4 error: /home/john/test.m @ line 23, column 21 i no output because can write 1 line above disp('the test on number failed') . you try placing try/catch block in main function expect condition und...

django - d3js returning "[object%20Object]" and "Uncaught TypeError: Cannot read property: nodes of undefined" -

i new javascript , django. have animate svg file d3js, practice , understand how works decided add the miserables widget local django website. have simple view: def miserable(request): return render_to_response('index.html') the url is: url(r'^moremiser/$','more_miserable') and copied both index.html , miserable.json template folder. when go url supposed display widget blank screen. doing wrong? person set local website installed tinymce , compressor, causing problem? here code index.html , miserables.json. both in templates folder: #index.html <!doctype html> <meta charset="utf-8"> <style> .node { stroke: #fff; stroke-width: 1.5px; } .link { stroke: #999; stroke-opacity: .6; } </style> <body> <script src="http://d3js.org/d3.v3.min.js"></script> <script> var width = 960, height = 500; var c...

objective c - Setting TCP_NODELAY for NSOutputStream in Swift -

this answer , this answer both show how set tcp_nodelay nsoutputstream in objective-c . need on getting work in swift , , believe it's mistake i'm making api . this objective-c solution supposedly works: cfdataref nativesocket = cfwritestreamcopyproperty(`mywritestream`, kcfstreampropertysocketnativehandle); cfsocketnativehandle *sock = (cfsocketnativehandle *)cfdatagetbyteptr(nativesocket); setsockopt(*sock, ipproto_tcp, tcp_nodelay, &(int){ 1 }, sizeof(int)); cfrelease(nativesocket); this attempt @ translating swift : let nativesocket: cfdataref = cfwritestreamcopyproperty(mywritestream, kcfstreampropertysocketnativehandle).data let sock = cfsocketnativehandle(cfdatagetbyteptr(nativesocket).memory) var 1 = int(1) setsockopt(sock, ipproto_tcp, tcp_nodelay, &one, uint32(sizeofvalue(one))) the real issue getting cfdataref mywritestream (an nsoutputstream ), , getting cfsocketnativehandle that. in swift code above, crashes on first line while tryin...

regex - Match string with escape characters or backslashes -

the following perl script , testdata simulate situation can find 2 instead of 4 expected. (to match support.tier.1 backslash in between). how can modify perl regex here? thanks my @testdata( "support.tier.1", "support.tier.2", qw("support\.tier\.1"), "support\.tier\.2", quotemeta("support.tier.1\@example.com"), "support.tier.2\@example.com", "support\.tier\.1\@example\.com", "support\.tier\.2\@example\.com", "sales\@example\.com" ); here code changed: my $count = 0; foreach $tier(@testdata){ if($tier =~ m/support.tier.1/){ print "$count: $tier\n"; } $count++; } i 2 matches while expected 4: 0: support.tier.1 6: support.tier.1@example.com update since seems may indeed getting strings containing backslashes, suggest use string::unescape remove backslashes before testing strings. have install isn't core ...

javascript - Return variable from a reader.onload event -

i reading array via javascript , saving size of array in reader.onload event. think reader.onload function called when file has finished uploading. event.target.result stores array. array saved variable used in other functions but, tried initializing empty array , using slice function but, didn't work. console returns undefined value. here code <!doctype html> <html> <head> <title> home page </title> </head> <body> <input type="file" id="file" name="files[]" multiple/> <output id="list"></output> <p id="demo"></p> <script> function handlefileselect(evt) { // grab file uploaded type file. // evt event triggered // evt.target returns element triggered event // evt.target.files[0] returns file uploaded, type file var file = evt.target.files[0]; var myarra...

jquery - How do i select every last child of a specific class in a list -

i have div contains list of other div messages, want select every last child of div has same class. here code: <p>the first paragraph.</p> <p class="q">the second paragraph.</p> <p>the third paragraph.</p> <p class="q">the fourth paragraph.</p> <p class="q">the fifth paragraph.</p> <p class="q">the sixth paragraph.</p> <p>the seventh paragraph.</p> <p>the seventh paragraph.</p> <p class="q">the fifth paragraph.</p> <p class="q">the sixth paragraph.</p> <p class="q">the sixth paragraph.</p> <p class="q">the sixth paragraph.</p> all want select every last child of class "q" . like this: <p>the first paragraph.</p> <p class="q">the second paragraph.</p> - selected <p>the third paragraph.</p> <p cl...

Import Facebook SDK to Android -

after import facebook sdk dependencies as: compile 'com.facebook.android:facebook-android-sdk:4.7.0' and set of facebook requisites on manifest. started crash on build. on gradle console shows: * went wrong: execution failed task ':app:dexdebug'. > com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command '/library/java/javavirtualmachines/jdk1.7.0_80.jdk/contents/home/bin/java'' finished non-zero exit value 2 after hours looking solutions added bolts library solution didn't work. and worst, when rebuild project on android studio build success if run project device fails. any tips?

REGEX match string include content inside optional delimiter -

i trying match string using regex , close having working way want. lets have string 5a(test1),4b,3c(test2) the first thing break string apart on commas, end 3 strings in array 5a(test1) 4b 3c(test2) now want pull following information out; digit, letter , content in parentheses. parentheses optional. here pattern ([1-9][0-9]*)([aabbcciiffppss]+)(\(.*\))? this works except includes parentheses. get 5 (test1) when want is 5 test1 ive tried ([1-9][0-9]*)([aabbcciiffppss]+)\(([^)]*)\)? doesn't match on strings without parentheses so 5a(test1) , 3c(test2) match 4b not. any assistance appreciated. change regex bit: ([1-9][0-9]*)([aabbcciiffppss]+)(\((.*)\))? the content inside () in capturing group 4. if language supports non-capturing group (?:pattern) : ([1-9][0-9]*)([aabbcciiffppss]+)(?:\((.*)\))? this prevent unnecessary capturing (saves memory), , content inside () in capturing group 3.

objective c - iPad crashes when showing photos or taking photo--nil source view -

the follow code crashes when run on ipad error message: (<uipopoverpresentationcontroller: 0x1377a19e0>) should have non-nil sourceview or barbuttonitem set before presentation occurs.' however, in code have following, , checked breakpoints , console prinouts ensure sourceview , barbutton not nil. need avoid this? error appears on ipad. here method causes trouble: - (void)showchooseimageoptions { uialertcontroller *alertcontroller = [uialertcontroller alertcontrollerwithtitle:nil message:nil preferredstyle:uialertcontrollerstyleactionsheet]; uialertaction *chooseaction = [uialertaction actionwithtitle:@"choose photos" style:uialertactionstyledestructive handler:^(uialertaction *action) { [self showlibrary]; }]; uialertaction *takeaction = [uialertaction actionwithtitle:@"take photo" style:uialertactionstyledestructive handler:^(uialertaction *action) { [self showcamera]; }]; self.directionstextview.text=@""; [alertcontr...

Inserting string in another string at specific index c++/Qt -

i have qstring (it may not matter since convet std::string anyway) contains full unix path file. e.g. /home/user/folder/name.of.another_file.txt . i want append string file name right before extension name. e.g. pass function "positive", here call vector_name , @ end want /home/user/folder/name.of.another_file_positive.txt (note last underscore should added function itself. here code not compile, unfortunately!! qstring temp(mpath); //copy value of member variable doesnt change??? std::string fullpath = temp.tostdstring(); std::size_t lastindex = std::string::find_last_of(fullpath, "."); std::string::insert(lastindex, fullpath.append("_" + vector_name.tostdstring())); std::cout << fullpath; i following errors: error: cannot call member function 'std::basic_string<_chart, _traits, _alloc>::size_type std::basic_string<_chart, _traits, _alloc>::find_last_of(const std::basic_string<_chart, _traits, _alloc>&, s...

php - Working with encrypted files in Laravel (how to download decrypted file) -

in webapp, users can upload files. before being saved , stored, contents of file encrypted using this: crypt::encrypt(file_get_contents($file->getrealpath())); i use file system comes laravel move file storage::put($filepath, $encryptedfile); i have table store information each file columns such as: id file_path file_name original_name (includes extension) now want user able download encrypted file. however, i'm having trouble decrypting file , returning user. in file downloads response section of laravel documentation, suggests this: return response()->download($pathtofile, $name, $headers); it wants file path fine, @ point can decrypt file contents readable? i seem able this: $encryptedcontents = storage::get($filerecord->file_path); $decryptedcontents = crypt::decrypt($encryptedcontents); ... don't know how return download specified file name. you manually create response so: $encryptedcontents = storage::get($filerecord-...

react-router redux how can i update state on load of page for authentication -

i using https://github.com/davezuko/react-redux-starter-kit starter kit , trying introduce authentication starter app. i have authentication working, sets state.auth on login success, have onenter on protected routes calls isauthenticated() check if user authenticated. this lost , not sure how check both state.auth.user , localstorage.token make sure things set. the way see it, need account 2 cases the user logged in, refreshed page. means token still in localstorage state wiped, i'd need reload state decoding token , reinjecting state.auth.user the user isn't logged in, redirect them route /auth/login (this part have working). my problem using starter kit not know how properly state/store within routes file can check state.auth.user property.. or if thats right way (maybe should using action instead)? redux/modules/auth.js import { createaction, handleactions } 'redux-actions'; import { pushpath } 'redux-simple-router' // ---------...

java - How To Add JLabel to Already Existing Jframe? -

lol dont know if worded right i new programmer , code main class: package culminatingnew; import java.awt.borderlayout; import java.awt.color; import java.awt.container; import java.awt.dimension; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.joptionpane; import javax.swing.jtextfield; public class culminatingnew { public static void main(string[] args) { container container = null; jframe jframe = new jframe("math adventure"); jframe.setdefaultcloseoperation(jframe.exit_on_close); jframe.setlocationrelativeto(null); jframe.setbounds (150, 0, 1000, 1000); jframe.setbackground(color.blue); jframe.setvisible(true); jlabel labeltext = new jlabel("welcome!"); jframe.getcontentpane().add(new characterchoose());// jframe.setvisible(true); jframe.getcontentpane().add(labeltext); jframe.setvisible(true); so basically, i'm making game. in class in assignment package characterchoose, user greeted picture ...