Posts

Showing posts from January, 2013

arrays - Concatenate two consecutive foreach iterations in PHP? -

Image
i have $result variable. has following structure: i trying array structured this: masculine => 1 , feminine => 2 . i stuck here: foreach ($result $row) { foreach ($row $column => $value) { echo $column . ' order ' . $value . '<br/>'; } } the output of attempt is: i tried using next() function , apply $row variabile, each iteration got 1(2) => false . i'd appreciate help! you can use php builtin function array_column job. array_column — return values single column in input array (php 5 >= 5.5.0, php 7) syntax - array array_column ( array $input , mixed $column_key [, mixed $index_key = null ] ) and script - <?php $result = array( array( 'gender_value' => 'masculine', 'gender_preffered_order' => 1 ), array( 'gender_value' => 'feminine', 'gender_preffered_order' => 2 ...

computer vision - Matching features of images using PCA-SIFT -

i want match features in 2 images detect copy-move forgery. used pca-sift code detect image features. but, having trouble in matching pca-sift features. according several papers, similar matching process used pca-sift used in sift. have used following code snippet match features. %des1 , des2 pca-sift descriptors obtained 2 images % precompute matrix transpose des2t = des2'; matchtable = zeros(1,size(des1,1)); cnt=0; %no. of matches %ration of ditances distratio = 0.5; %normalising features m1=max(max(des1)); m2=max(max(des2)); m=max(m1,m2); des1=des1./m; des2=des2./m; = 1 : size(des1,1) %finding eucledian distance of vector in 1 image features in second image a=des1(i,:); d = des2-repmat(a,size(des2,1),1); [vals,indx] = sort((sum(d.^2,2)).^(1/2)); %sort distances % check if nearest neighbor has angle less distratio times 2nd. if (vals(1) < distratio * vals(2)) matchtable(i) = indx(1); cnt=cnt+1; else matchtabl...

html5 - How do I get my footer and columns and forms within the footer to be responsive properly -

how footer responsive? problems: when screen shrinks down below 1200px column on right side (footer-right) starts getting cut off , middle columns form input field shrinks down small. when gets approx 750px middle , left column form under first column on left, supposed middle forms input field 1px wide; , right form offset far left instead of in middle. first column on left responsiveness working not other 2 (middle , far right) the appreciated! <footer class="footer-distributed"> <div class="row"> <div class="footer-left col-sm-3 col-xs-12"> <h3>text</h3> <p class="footer-links"> <a href="index.html">home</a> · <a href="about.html">about us</a> · <a href="products.html">products</a> · <a href="support.html">support</a> · <a href="contact.html...

Android Picker Style (theme) -

Image
i'm facing situation , can't find solution, i've alloy app, , i've created 'input' it's own options, in ios shows popup ui.picker, , in android shows ui.picker dropdown, problem background dark , text white, i've tried add theme tiapp.xml , add properties it, nothing changed yet; want apply in alert dialogs, tiapp.xml file: <android xmlns:android="http://schemas.android.com/apk/res/android"> <tool-api-level>14</tool-api-level> <manifest> <application android:debuggable="true" android:largeheap="true" android:theme="@style/theme.mytheme"> <activity ... ></activity> </application> <supports-screens android:anydensity="true"/> </manifest> </android> this app/platform/android/res/values/style.xml: <?xml ...

SQL Server 2012 In-Place3 Upgrade and Timing of Database Version Change -

we updating several sql server 2008r2 instances sql server 2012 sp3 cu2. know database versions changed 100 110 during process (e.g. once finished, databases can no longer moved 2008r2 instance). does change databases occur during upgrade or first time databases brought online when server restarts? sql server keeps track of version in 2 ways. first, sql server instance has version (for example sql server 2008 r2 10, followed decimals keep track of patches). your databases separate version, known compatibility level . if upgrade instance, databases not upgraded until choose so. not mean there not impact, mean databases can remain in old version. example of 100 , 110 both compatibility level. please see changing compatibility on msdn here: https://msdn.microsoft.com/en-us/library/bb510680.aspx

javascript - Testing react-bootstrap with mocha and ES6/babel -

i trying write unit test of react , react-bootstrap components using mocha. all of javascript written in es6, , using babel transpile es5. the files using below. after running npm install , run npm test . fails following output: $ npm test > @ test /users/tda0106/test/npm > mocha --compilers jsx:babel-register simple-test.jsx simple test 1) "before all" hook: render , locate element 0 passing (34ms) 1 failing 1) simple test "before all" hook: render , locate element: assertionerror: expected null exist @ context.<anonymous> (simple-test.jsx:21:9) npm err! test failed. see above more details. testutils.renderintodocument returning null no reason can see. testutil docs indicate window , document must defined before importing react , point of test-dom.jsx . i test-dom.jsx loaded before react, because before added line setting global.navigator , react throwing error deep in code trying access variabl...

Perl Grep Exclusion -

i'm grepping values list of legitimate file names there file name matches i'm trying exclude. can't quite figure out exclusions. list = ( "filea", "makefile.am.cppcheck", "makefile.am.cpplint", "readme-autotools.md", "readme-metrics.md", "readme.md", "autogen.sh", "configure.ac", "test.pl", ) @files = grep(/(?!readme|makefile)([a-z]\.[a-z])/i,@list); the grep works fine without exclusion missing exclude items matching (readme|makefile) or other patterns? edit: filenames must include period (such test.pl), hence reason exclusions opposed weeding out unwanted names alone. it's "magic regex" again, that's expected move earth in single pattern it's hard tell question result want, looks want file has dot in name doesn't start readme or makefile so write that. after all, that's how .gitignore works: it's list...

java - eclipse error of "Error occurred during initialization of VM " -

Image
i have eclipse project, got following error message after running the "classpath" setting in "run configurations" shown follows the "build path" setting shown follows: it seems me you're using system jre instead of jdk. from "libraries" tab, select "jre system library [javase-1.7] > choose edit > popup window > execution environment choose jdk environment, eg javase-1.6 (jdk1.6.0_32)

ios - Is there a way to convert special characters to normal characters in Swift? -

this question has answer here: how remove diacritics string in swift? 2 answers suppose have string value special accents : éáüîāṁṇār̥ is there universal/dynamic way convert/strip these types of characters down basic formatting ?.. eauiamnar use stringbyfoldingwithoptions , pass .diacriticinsensitivesearch let s = "éáüîāṁṇār̥" let r = s.stringbyfoldingwithoptions(.diacriticinsensitivesearch, locale: nil) print(r) // prints eauiamnar

Sending corrupted csv line over the socket in Python 3 -

i build sensor unit data gathered @ 1 raspberry pi , send another's on network. first pi creates line multiple readings different sensors. supposed create server , send clients. client pis needs receive sentence, further processing or visualisation. to test solutions want read data txt file, build in experiment. problem data corrupted, has different format depending on sensor , rows can different different set-ups. i have build function suppose change input line bytes. (i tried different methods clunky function closest results). not convert on network import struct message = ['first sensor', 'second data', 'third',1, '19.04.2016', 0.1] def packerfornet(message): pattern = '' newmessage = [] cell in message: if isinstance( cell, int ): pattern += ('i') newmessage.append(cell) elif isinstance( cell, float ): pattern += ('d') newmessage.appe...

php - Put in array the result from arsort array with fatser method -

how can put in array result arsort array faster method ? i have : array ( [a] => 32389 [o] => 25534 ) i : array ( [1] => array ([0] => 'a', [1] => '32389') [2] => array ([0] => 'o', [1] => '25534') ) i : $words = []; foreach($words $key=>$value) { $words[] = [$k, $v]; } it works, after arsort, if (foreach($words $key => $value) better/faster method execute task or if there other method/function php ? easy do:- <?php $data = array ( 'a' => 32389, 'o' => 25534 ); $new_data = array(); foreach ($data $key=>$value){ // iterate through original array $new_data[] = array($key,$value); // assign key , value array new array } echo "<pre/>";print_r($new_data); // print new array ?> output:- https://eval.in/556504 based on question best solution (every 1 else use same things). there no m...

excel - Python Modify data of existing .xlsx file -

i have code here in python created .xlsx file using openpyxl. however, when tried modify file, new data register file previous data gone. heard of using deepcopy or (.copy.copy) copy data of file how can paste data copied plus current edits .xlsx file? (*some code missing here program gui, code juz far long) ##############creating###################### try: wb_id = load_workbook('list.xlsx') ws_id = wb_id.active pass except environmenterror e: # oserror or ioerror... filenotfounderror exist in python 3.x version print(os.strerror(e.errno)) #use operating system error define filenotfounderrorerror openpyxl import workbook #import workbook function create new xlsx (excel) file wb_id = workbook() ws_id = wb_id.active ws_id['a1'] = "ic" ws_id.merge_cells('b1:e1') ws_id['b1'] = "name" ws_id.merge_cells('f1:k1') ws_id['l1'] = "email" ws_id['m...

SyntaxError: invalid syntax when coding in python -

the code have is >>> string import ascii_lowercase >>> collections import counter >>> open('example.txt') f: print counter(letter line in f letter in line.lower() if letter in ascii_lowercase) however, i'm getting syntaxerror: invalid syntax highlights counter on line print counter... , don't know why in python3, print function . therefore, need surround arguments parentheses when call it: % python python 3.4.3 (default, oct 14 2015, 20:28:29) [gcc 4.8.4] on linux type "help", "copyright", "credits" or "license" more information. >>> print 1 file "<stdin>", line 1 print 1 ^ syntaxerror: missing parentheses in call 'print' >>> print(1) 1

python - Can/ Why can't I read a text file into my Kivy app? -

im making game app involves, reading text file. app doesn't seem work when this. erased code read text file , simulated snippet of information text file have , app worked fine. here code want use textfile = open('symbols.txt', 'r') symbols = textfile.read() textfile.close() symbols = symbols.split('\n') where symbols list of words wish use

autocomplete - Is the unpublished Google Suggest Queries API VALID for use -

does know if it's legal use google suggestqueries in commercial product ? as i'm using open stream of ajax jsonp request https://suggestqueries.google.com/complete/search?callb .... in searchengine based product. no - can't legally used , search team changes endpoint every , apps can't abuse , there wrapper services emulate / gather data endpoints through own means - http://keywordtool.io/api example of that

How do I make macro pull data from different sheets within a workbook. Excel VBA -

i'm having issue macro used pull information 1 worksheet another. cant figure out how make macro @ different worksheet within "currentschedule" workbook. when go through macro 1st (a line) worksheet runs smoothly, when try run through 2nd sheet (b line) times out. gets stuck @ line " order = range("w1").offset(count, 0).value " saporder = inputbox("enter sap order number:") prodline = inputbox("enter sheet# of currentschedule has sap order number. example: line = 1; b = 2") end select count = 0 'count row in designated column flag = true while flag workbooks("currentschedule.xlsx").worksheets(prodline).activate order = range("w1").offset(count, 0).value if order = saporder nme = range("b1").offset(count, 0).value throw away stupid .activate method learn how work this sheets("sheetname").range("rangename/rangerange")[optional].cells("cellrow",...

javascript - Issue with changing label color -

i not web developer trying fix in code, please excuse me if overlooking something. i trying disable checkbox , label when checkbox checked. this how html looks like: <dl id="someparent"> <dd><input type="checkbox" name="checkbox1" id="checkbox1"/> <label for="checkbox1" data-localize="sometext.name1" class="checkbox1"> </label> </dd><dd> <input type="checkbox" name="checkbox2" id="checkbox2"/> <label for="checkbox2" data-localize="sometext.name2" class="checkbox2"> </label> </dd><div class="clear"></div></dl> js: $('#checkbox1').click(function() { if( $("#checkbox1").is(':checked') ){ $('#checkbox2').attr("disabled", true); $('label[data-localize="sometext.name2"]').css("colo...

javascript - how to zoom content in iframe to fit my page size -

i need place iframe inside page, need zoom (to smaller) the original page http://palweather.ps/temps/days/forecast/120 i tried following code (i added #zoom=75 after link didn't work) <iframe border="0" frameborder="0" height="1300" name="map" src="http://palweather.ps/temps/days/forecast/120#zoom=75" style="width: 100%;" >your browser not support inline frames or configured not display inline frames.</iframe>

excel - Google sheets: Case statement or ifelse formula to modify a cell's value based on the value of another cell? -

Image
based on validation, if a1 = 20, b1 = 5. based on formula, b2 = b1. except, want b2 = b1 + d1, if c1 = true. my question is: how make formula 1 cell (b2) equals sum of 2 cells (b1,d1) in event third cell (c1) has true value? if false, want (b2) equal sum of 1 cell (b1). so in b2: =b1+if(c1="true",d1,0) if c1 true can shortened to: =b1+if(c1,d1,0)

Hide icon of three dots in option menu android -

i need put 2 icons on action bar , hide 3 dots of default menu option when press options button of phone should show items , how can ? here menu overflow button style: <style name="widget.holo.actionbutton.overflow"> <item name="android:src">@android:drawable/ic_menu_moreoverflow_holo_dark</item> <item name="android:background">?android:attr/actionbaritembackground</item> <item name="android:contentdescription">@string/action_menu_overflow_description</item> see more attributes android sdk installation, in platforms/android-xx/data/res/values/style.xml and here officially documentation telling how customize action bar most: customizing actionbar

javascript - getting a number using regular expressions -

this question has answer here: regular expression extracting number 4 answers i have following string: pr-1333|testtt i want number 1333 using regular expressions in javascript. how can that? this numbers in text. var text = "pr-1333|testtt"; var number = text.match(/\d+/g); // returns array of found. console.log(number[0]); // 1333

ios - RoboVM - libGDX resizing & FitViewport bug -

i use fitviewport in libgdx game. works on android & desktop, can't right on ios. the pink box contains game screen & black parts black that this how initialize important elements camera = new orthographiccamera(menuscreen.virtual_width, menuscreen.virtual_height); viewport = new fitviewport(menuscreen.virtual_width, menuscreen.virtual_height, camera); viewport.apply(); camera.position.set(camera.viewportwidth / 2, camera.viewportheight / 2, 0); b = new spritebatch(); b.setprojectionmatrix(camera.combined); menuscreen.virtual_width & height 480 & 800 and resize method: @override public void resize(int width, int height) { renderer.getviewport().update(width, height); renderer.camera.position.set(renderer.camera.viewportwidth / 2, renderer.camera.viewportheight / 2, 0); renderer.getb().setprojectionmatrix(renderer.getcamera().combined); } and sort of stressed license ex...

mysql - join elements from three unrelated tables -

sql newbie here. have following schema. i provide list of active primary super charged domains belonging foobar association. as far know, 3 tables (sites, domain, , name) cannot joined together. how can done? this example of joining 3 tables select * companies join sites on sites.company = companies.id join domains on domains.site = sites.id sites.is_supercharged = 1 , sites.is_deleted = 0 , domains.is_primary = 1 , domains.is_deleted = 0 it based on schema (i hope field names correct, text quite small) when joining table query, need specify matching fields reference in on part. , can add condition in where part.

python - How can I have a button in Kivy that when pressed, creates a label? -

i make button when pressed, label appears. simply define function creates label , assign button's on_press event. consider following code: from kivy.uix.label import label kivy.uix.button import button kivy.uix.gridlayout import gridlayout kivy.app import app layout = gridlayout(cols = 1) mybtn = button(on_press = myfunction) layout.add_widget(mybtn) def myfunction(): mylabel = label(text = "this label") layout.add_widget(mylabel) class myapp(app): def build(self): return mylayout if __name__ == '__main__': myapp().run() all of this, however, covered in kivy documentation, comprehensive , has examples. before anything, should hang of reading , trying out examples yourself.

osx - Can't find MySQL on MAC -

i installed mysql on mac , can't find usr/local/mysql on machine. cd home directory when type in cd usr can't see , unable determine if mysql installed. how can find installation? terminal window: cd /usr to view hidden folders in finder: open terminal found in finder > applications > utilities in terminal , paste following: defaults write com.apple.finder appleshowallfiles yes press return. hold option/alt key, then right click on finder icon in dock , select relaunch

How to stop a for loop in R and keep the data -

i have code running in loop on dates. code takes while run, , there couple of days left, urgently need whatever results there are. there way of breaking code/for loop, keep whatever data has been produced now. yes. can press "escape", examine results , restart loop. for(iii in 1:100000000) force(iii) # press esc iii # in case 1121673 # use value restart loop later: for(iii in 1121674:100000000) force(iii)

groovy - Override gradle project.ext params from command line -

i have gradle build, use properties gradle file: build.gradle apply from: "props.gradle" the props.gradle set of properties in file groovy syntax: ext { jdbcjarfile = "/jdbc/lib/ojdbc6.jar" system_oracle_driver = "oracle.jdbc.driver.oracledriver" system_db_admin_user = "system" } later in build can access properties this: project.property("jdbcjarfile") what need way override of property defined in props.gradle command line. e.g. gradle build -pjdbcjarfile=new/path but when try this, still value declared in props.gradle . i need able override every property, , have dozens of them in file. checking manually every property not option here. how can solve this? gradle version 2.12. think have change props.gradle check property, , set ext.jdbcjarfile if isn't set on command line, ie: if(!hasproperty('jdbcjarfile')) { ext.jdbcjarfile = "/jdbc/lib/ojdbc6.jar" } ...

Null Reference Exception when writing to an array. c# -

this question has answer here: what nullreferenceexception, , how fix it? 33 answers i trying write months array in order. string january = "january"; string february = "february"; string march = "march"; string april = "april"; string may = "may"; string june = "june"; string july = "july"; string august = "august"; string september = "september"; string october = "october"; string november = "november"; ...

php - wordpress WPML advanced fields relationship -

i'm making multilanguage website uses advanced custom fields relationship plugin. i'm reading out employers , if read em out in site's native language have 0 problems, when try read them out in language empty array. of guys know can do? <?php $field = get_post_meta( get_the_id() ); $posts = get_field('field_81'); echo '<!--'; echo 'test '; var_dump( $field ); var_dump( $posts ); echo '-->'; ?> <?php if (icl_language_code == 'en'): ?> <?php $fields = $field['medewerkers']; ?> <?php $posts = $fields; ?> <?php endif; ?> <?php if ($posts): ?> <?php if (icl_language_code == 'nl'): ?> <h3 class="titelmedewerkers">medewerkers</h3> <?php elseif (icl_language_code == 'en'): ?> <h3 class="titelme...

jsf - Issue with rowSelector in ice faces -

i have ice faces jspx page following structure <ice:datatable..> <ice:columns> <ice:rowselector .../> <f:facet name="header"> <ice:outputtext ..../> </f:facet> <ice:outputtext ...../> </ice:columns> </ice:datatable..> on load of page following exception thrown saying datatable not parent of rowselector . have verified data table parent component of rowselector . has faced similar issue ? not find issue, has solution. java.lang.runtimeexception: rowselectorrenderer: decode. not find ice:datatable parent componenent @ com.icesoft.faces.component.ext.rowselector.getparentdatatable(rowselector.java:505) @ com.icesoft.faces.component.ext.rowselector.updatecurrentselection(rowselector.java:131) @ com.icesoft.faces.component.ext.rowselector.setvalue(rowselector.java:125) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect...

c# - Unable to make asynchronous call using Windows Phone Background Task -

i have background task windows phone silverlight 8.1 app. the background task runs fine, when put call asynchronous method in it, freezes @ stage. using debugger, stops. cannot step through code or anything. below code: public sealed class bgtask : ibackgroundtask { public async void run(ibackgroundtaskinstance taskinstance) { backgroundtaskdeferral _deferral = taskinstance.getdeferral(); datetime timenow = datetime.now; timespan minus28 = new timespan(0, 28, 0); datetime timegone = timenow.subtract(minus28); int resultscount = await getcount(); toasttemplatetype toasttemplate = toasttemplatetype.toasttext02; xmldocument toastxml = toastnotificationmanager.gettemplatecontent(toasttemplate); xmlnodelist textelements = toastxml.getelementsbytagname("text"); textelements[0].appendchild(toastxml.createtextnode("new pictures!")); ...

android - Need to center ImageButton src, not stretch it to match the button size -

Image
i learning develop android user interfaces. want create imagebutton set of drawables indicate different button states. created 2 pictures each button: 133 dp normal state , scaled copy (126 dp) create pushed button effect. i painted second picture indicate image selector mechanism works @ least. here initial state of application when push button changes color not size expected. both images fitted same size activity layout xml: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom=...

php - How to post tweets to multiple twitter accounts through "thujohn/twitter" library in Laravel? -

how use thujohn/twitter library in laravel framework post tweets multiple accounts manage on twitter.com ? i have faced same problem when i've tried publish on multiple twitter accounts before , i've solved this: first: need create twitter app each twitter account manage, , each app need these data: api key (consumer key) api secret (consumer secret) access token access token secret and here how going use them: // set twitter app data of twitter account going publish to.. if (some_condition) { $consumer_key = "account_consumer_key"; $consumer_secret = "account_consumer_secret"; $access_token = "account_access_token"; $access_token_secret = "account_access_token_secret"; } else if (some_other_condition) { $consumer_key = "account_consumer_key"; $consumer_secret = "account_consumer_secret"; $access_token = "account_access_token"; $access_token_secre...

javascript - Java Script, Need help finding my error -

<script type="text/javascript"> var score = prompt("enter score. grade must between 100-0."); if ( score>==90 ) { document.write ( "your grade a." ) } else if ( score <89>==80 ) { document.write ( "your grade b." ) } else if ( score <79>==70 ) { document.write ( "your grade c.") } else if ( score <69>==60 ) { document.write ( "your grade d.") } else if ( score <59>==0 ) { document.write ( "your grade f") } }//end if </script> should if ( score>==90 ) { document.write ( "your grade a." ) } else if ( score >==80 ) { document.write ( "your grade b." ) } else if ( score >==70 ) { document.write ( "your grade c.") } else if ( score >==60 ) { document.write ( "your grade d.") } else if ( score >==0 ) { doc...

ios - Delegation between two ViewControllers without segues -

i learning concept of delegation , stuck in project. believe solution simple, new me have no idea wrong. project concept simple: there 2 views in application. in first view press button "change color" , result second view appears. in second view there 3 text fields user puts numbers respectively r g , b values in rgb color. when button tapped, second view disappears , first view's background should changed color based on user's input. assume user put correct numbers, therefore @ moment use forced unwrapping values. @ moment views appear correctly, background color of first view not change , have no idea why. beneath code 2 view controllers. appreciate hints. first vc: viewcontroller.swift class viewcontroller: uiviewcontroller, colorchangedelegate { let secondstoryboard = uistoryboard(name: "second", bundle: nil).instantiateviewcontrollerwithidentifier("secondviewcontroller") uiviewcontroller var secondvc = secondviewcontroller() @...

32-bit x86 Assembly- Reversing Order of Array through Rotates/Shifts -

i googled question past 2 hours , couldn't find what's needed figured i'd ask help. so.. we have 2 arrays. both have length of 10. first 1 stores student/teacher/work id number prefix of 0. example: 0,1,2,3,4,5,6,7,8,9 the goal of program reverse order using shifts , rotates , store them in second array.for example: 9,8,7,6,5,4,3,2,1,0 i can't seem figure out algorithm; i've been staring @ screen long. the other requirements sum 2 values each array , show memory locations, think won't cause me trouble. precise constraints: draft program adds 2 bcd numbers (10-digits each) first bcd number stored in array1 , reversed order stored in array2. use shifts/rotates using array1 fill array2 display contents of memory locations in question add both values using bcd arithmetic store sum in variable named result those requirements. no other information given. thank you

jquery - Javascript Module Usage -

i'm getting started javascript modules , want make sure i'm doing correctly. below example of methodology i'm following, based on "loose augmentation pattern" read here //myapp.js var myapp = {}; //somemodule1.js (function (ma) { ma.somemodule1.dostuff = function () { alert("hi"); }; return ma; }(myapp || {})); //somemodule2.js (function (ma) { ma.somemodule2.domorestuff = function () { alert("ho"); }; return ma; }(myapp || {})); //somemodule3.js myapp.somemodule1.dostuff(); myapp.somemodule2.domorestuff(); the myapp variable within myapp.js variable that's globally exposed, of other modules , functions being accessible via variable. somemodule3.js isn't module, arbitrary javascript wanting access properties of myapp object (after appropriate modules have been defined). the part in particular i'm no...

sql server - T-SQL XQuery Node Value Path not Matching -

while works retrieving local-name(.) node names demonstrated here can't table resume first name , resume last name each job candidate. use adventureworks2012; xmlnamespaces( 'http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/resume' ns) select t.rows.value('(ns:name.first)[1]', 'nvarchar(100)') firstname, t.rows.value('(ns:name.last)[1]', 'nvarchar(100)') lastname humanresources.jobcandidate cross apply resume.nodes('//ns:name/*') t(rows); the error message lists nodes in context, including appears targeted node. xquery [humanresources.jobcandidate.resume.value()]: there no element named "{ http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/resume }: name.first " in type "element(ns{ http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/resume }:name.prefix,xs:string) | element(ns{ h...

jquery - How do I make a JAVASCRIPT variable equal to an HTML attribute? -

i trying have number displayed starts @ 0 , goes randomly every time press button. need variable equal current number(which stored within h1 tag). how do that? when try check if worked alerting page, [object htmlheadingelement] here javascript, css, , html code, respectively: function myrandom() { var headnumber = document.getelementbyid('headnum'); alert(headnumber) //the alert check if '0' comes up' } h1 { text-align: center; font-size: 30px; color: blue; font-family: verdana; } button { margin-left: 640px; border: solid blue 5px; font-size: 14px; font-family: verdana; font-weight: bold; background-color: cyan; border-radius: 6px; } <h1 id='headnum'>3</h1> <button onclick="myrandom()">button</button> you html content using innerhtml. see below, function myrandom() { var headnumber = document.getelementbyid('headnum').innerht...

laravel 5 advance eloquent multiple selection -

i have table containing multiple artist. while creating event (updating event table) need select artists want perform @ event , need add ids in event_artist (transitive) table (that contains event_id & artist_id). how shall proceed? you define many many relationship . in artist model class: public function events() { $this->belongstomany(event::class); } in event model class: public function artists() { $this->belongstomany(artist::class); } this assumes pivot table named artist_event (the other 2 table names combined in alphabetical order). otherwise can pass pivot table name second argument belongstomany: belongstomany(event::class, 'event_artist') . then can attach artist event using $event->artists()->attach($artist); . or detach $event->artists()->detach($artist); . can sync collection of artists: $event->artists()->sync($artists); . can attach, detach or sync events artists. 3 methods accept either eloquent mo...

data structures - Linked list in C with fgets() -

i'm having issues code skipping first question in second data structure. i'm pretty sure it's because gets(), not sure. think tried fgets(), still giving me issues. why? #include <stdio.h> #include <stdlib.h> #include <string.h> #define numberofactresses 5 typedef struct actress { char *name, *placeofbirth, *haircolor; int age; float networth; struct actress *next; } actress; void populatestruct(actress *node) { node->name = (char *) malloc(sizeof(char) * 50); node->placeofbirth = (char *) malloc(sizeof(char) * 50); node->haircolor = (char *) malloc(sizeof(char) * 50); printf("please enter name of actress/actor: "); gets(node->name); printf("please enter actress/actor place of birth: "); gets(node->placeofbirth); printf("please enter actress/actor hair color: "); gets(node->haircolor); printf("please enter actress/actor age: "); scanf("%d", &node->age); printf("pleas...

regex how to match all the strings which character x repeated for 5n times -

how write regex each following case: match string character x repeated 0 or 5 times,e.g. abc or abcxxxxx pass; match strings character x repeated 5n times, example: xxxxx,xxxxxxxxxx,xxxxxxxxxxxxxxx... pass thank remarkable answers!! sorry obscurity of previous question, point how use iteration of regex, say, if want character x repeated 5^n times i guess want this: /(?:x{5})*/ example