Posts

Showing posts from August, 2013

php - mpdf page numbering {PAGENO} with smarty template engine -

i want use pagenumbering in mpdf tags how described in mpdf manual: http://mpdf1.com/manual/index.php?tid=109 problem have used smarty template engine , there can not use mpdf tag {pageno} in header/footer direct in html template, because think smarty expected in {} parentheses variables. ( example {$test} ) so when define {pageno}, smarty syntax error: unrecognized tag 'pageno' ... also have tried call metod, it's not working->when generate pdf, in generated pdf nothing regarding page numbering: // set simple footer including page number $mpdf->setfooter('{pageno}'); have idea, how use mpdf page numbering smarty template engine? thx just use {literal} in html template: {literal}{pageno}{/literal}

amazon ec2 - Tagging EC2 machines in Pipeline's EMR Cluster (ImportCluster in the S3->DynamoDB example) -

i'm trying run s3->dynamodb example , having problems running emr cluster created myimportjob activity. we configured our iam accounts such every user can create ec2 machines specific 'team_id' tag (of team). helps control resources, prevent mistakes , monitor usage. when pipeline tries launch emr cluster, (probably) without tags , therefore fails terminated errors: user account not authorized call ec2 . tried find configuration in emrcluster resource couldn't find me set that. i'm pretty sure fails because of tags policy. any idea how can overcome this? if if create cloudformation template that? have more control there? (i'm going create pipeline part of application template anyway, wanted experience product before). thanks! i not find solution how add tags emr(and how set visible users) have created python script run bootstrap action. if still relevant can find here

objective c - How to populate an array from detailViewController and return to masterViewController in iOS? -

i have tableview navigate 'viewcontroller' ie passengerinfoviewcontroller in have form.i fill form , make dictionary out of , add nsmutablearray . so when going tableview' pass array , reload the tableview` filled array. so here's doing : - //navigate form - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { passengerinfoviewcontroller *pivc = [self.storyboard instantiateviewcontrollerwithidentifier:@"passengerinfoviewcontroller"]; [self.navigationcontroller pushviewcontroller:pivc animated:yes]; } //after filling form -(void)gobacktopassengerdetails:(uibutton*)sender{ nsstring *title = self.titletextfield.text; nsstring *fname = self.firstnametextfield.text; nsstring *lname =self.lastnametextfield.text; nsstring *agestr = self.agetextfield.text; nsmutabledictionary *dict = [[nsmutabledictionary alloc]init]; [dict setvalue:title forkey:@"title"]; [dict setvalu...

Watching local storage using angularjs -

i using module called ngstorage handling local storage operations.( https://github.com/gsklee/ngstorage ). lets set object in local storage $localstorage.something = true; how watch object find out if still available in local storage? i'v tried : $scope.$watch($localstorage.something,function(newval,oldval){ if(oldval!==newval && newval === undefined){ console.log('it undefined'); } }); basically trying watch when user removes object local storage manually through chrome's console.is possible?? you can try: $scope.$watch(function () { return $localstorage.something; },function(newval,oldval){ if(oldval!==newval && newval === undefined){ console.log('it undefined'); } })

unity3d - ios/unity how to open app with attachment -

i have "simple-example" code showing "how share ios". never had ios in hands... ;/ what want: open other app attachment (e.g. mail, pinterest, twitter etc.) i found how @ android: androidjavaclass androidintentcl = new androidjavaclass ("android.content.intent"); androidjavaobject androidintentobj = new androidjavaobject ("android.content.intent"); androidintentobj.call<androidjavaobject> ("setaction", androidintentcl.getstatic<string> ("action_send")); androidjavaclass uriclass = new androidjavaclass ("android.net.uri"); androidjavaobject uriobject = uriclass.callstatic<androidjavaobject> ("parse", "file://" + photoaddress); androidintentobj.call<androidjavaobject> ("putextra", androidintentcl.getstatic<string> ("extra_stream"), uriobject); androidintentobj.call<androidjavaobject> (...

assembly - What is the advantage of using segment registers (today)? -

i trying quite while learn segment registers purpose is? ready know comes past (8086) there 1 mbyte of physical memory. cpu's had 16 bit wide address registers. these 16 address bits address 64k byte. 1mbyte address-space had separated segments each of 64k size. this seems me requirement past engineers hat work around of somehow limited memory space , such. question advantage of segment registers today? how or use them registers in useful way? if need clarification comment. arguably, x86-64 long mode technology of "today". there classical segmentation part nonexistent, fs , gs being used practical purposes. fs typically used various thread-local , system data in user mode, while gs used kernel mode. latter use supported swapgs instruction.

ruby on rails - Can't use methods in the application helper for cancan ability.rb -

i'm using devise , cancancan. in application helper have - def is_part_of_team?(book) on_team = false book.contributions.each |contribution| if contribution.user == current_user on_team = true end end if book.user == current_user on_team = true end return on_team end and in ability.rb have - include applicationhelper ... can :update, book |book| is_part_of_team?(book) end ... throws error - undefined local variable or method `current_user' #<ability... there better ways of doing this, wondered why cancan not current_user within application helper. why this? use function views , it's dandy. my approach bad altogether. instead of code in helper, hadn't understood use - book.contributions.where(user_id: user.id).any? ...to same result. means in ability.rb can have - can :update, book |book| (book.try(:user) == user) || book.contributions.where(user_id: user.id).any? en...

bash - finding the tty of a logged in user -

i'm trying find tty number of person logging in using loops. code far is: if [ "$#" -ne 1 ] echo "usage: mon user" exit 1 fi user="$1" # until | grep "^$user " > /dev/null tty=$(who | cut -c 9-13) sleep 60 done echo "$user has logged onto $tty" how go cutting out characters between 9-13 in first row? secondly, did correctly? can't test without having person work with. you can reduce code lot loops not required seach extract user , tty for example if [ "$#" -ne 1 ] echo "usage: mon user" exit 1 fi tty=$(who | grep "$user" | awk '{print $2}') echo "$user has logged onto $tty" what does? who lists logged in users grep "$user" searches lines containing $user awk '{print $2}' awk prints second column in output you can use cut instead of awk in program. instead of using -c option selects characters use -f option ...

javascript - Lose the focus of the textboxes in gridview -

i have grid view in updatepanel : <asp:updatepanel id="updatepanel3" runat="server"> <contenttemplate> <asp:panel id="pnl_lect" runat="server"> <asp:gridview id="gv_ques" runat="server" cssclass="formtable cr_center" autogeneratecolumns="false" showfooter="true" onrowdatabound="gv_ques_rowdatabound"> <columns> <asp:templatefield headertext="عناصر التقييم"> <itemtemplate> <asp:label id="lbl_ques" runat="server" text='<%# bind("que_desc") %>'></asp:label> </itemtemplate> <footertemplate> <asp:label id="label1...

php - trigger event on selected option -

this question has answer here: what difference between client-side , server-side programming? 4 answers is possible trigger event on selected option without submitting form? <h3 id="center" align="center">our site can provide info mantioned countries</h3> <select style="padding:10px;margin-left: 550px;margin-top: 20px;"> <option name="india">india</option> <option name="pakistan">pakistan</option> <option name="us">united state</option> <option name="uk">united kingdom</option> </select> you can't php (since it's server side language). use js/jquery that. $(document).ready(function() { $("#dropdown").change(function() { alert("selection: " + $("option:...

string - sed - search and replace between 2 marks -

i want search string , modify it i build string that: |bor.team1-fcteam2| but also: |fcteam2-bor.team1| or pattern |text–text| i want change name of team1, can have different names eg: bor.team1 b.team1 bteam091 ... i want everytime same name -> b.team1 team everytime in different diction! i play arround sed 's/\bbor.team1\b/b.team1/g' , must find , know every different diction. that shoudl need: echo $string | sed -e 's/[a-za-z\.]\+team\([0-9]\+\)/b.team\1/g' it searches alphabetic characters , dot ( . ) followed word team , followed number ( [0-9] ). replaced whatever want. in example it's b.team followed found number ( \1 ).

line 45: syntax error: unexpected end of file -

when try running script, gettin error line 45: syntax error: unexpected end of file. relatively new scripting. please me resolve it. #!/bin/ksh set -xv export home=/home/mine . $home/.env.ksh bis_spool=/tmp/bis_table_mine.spl bis_report_mine=/tmp/bis_table_report_mine.txt touch $bis_spool rm $bis_spool touch $bis_spool exec 5< $bis_report_mine while read -u5 rec_mine tblename=`echo "$rec_mine" | awk '{print $3}' | tr '[:upper:]' '[:lower:]'` sqlplus -s ${user_id}/${user_pass}@${oracle_sid} <<- eof set feedback off set hea on set pagesize 9999 set linesize 9999 set trimspool on set termout off spool $bis_spool append column c1 heading 'job name' format a30 column c2 heading 'table name' format a30 select job_name c1, t...

Extract PHP array value in for loop and pass to JQuery -

*edited format i found php code calendar online , attempting create on click event set date user chooses variable (which later used in database query). as of want isolate specific day , return value, far can return entire array (1 2 3 4, 5, etc). there way pass particular $list_day value of day selected? the particular loop in question: for($list_day = 1; $list_day <= $days_in_month; $list_day++): $calendar.= '<td class="calendar-day">'; /* add in day number */ $calendar.= '<div class="day-number">'.$list_day.'</div>'; full program code: <!doctype html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("div").click(function(){ alert($('.calendar-day').t...

c# - How to change an endpoint address with XML Transformation in web.config? -

i need change address of configuration in web.config: <client> <endpoint address="old_address" binding="basichttpbinding" contract="service.iservice" name="basichttpbinding_iservice" /> </client> to this: <client> <endpoint address="new_address" binding="basichttpbinding" contract="service.iservice" name="basichttpbinding_iservice" /> </client> in xml-transformation file (it's working, changes add key value ) have this: <configuration xmlns:xdt="http://schemas.microsoft.com/xml-document-transform"> <client> <endpoint name="basichttpbinding_iservice" address="new_address" xdt:transform="setattributes" xdt:locator="match(name)"/> </client> but doesn't work. don't understand why doesn't change, if locate name. help/tip preciated....

python - Cherrypy issue on updating list -

i have script use cherrypy. script working , html page ok. on html page i'm showing content of 1 list (is exercise learning). working if try put background color based on values in list, starts problem! class helloworld(object): @cherrypy.expose def index(self): in range(0, len(li)): status_bkg[i]=color_status(li) color status little function return 'green' if li[i]==1 'red' if 0. send 2 lists html file in way: template = loader.load('index.html') title = "exerc 2" ctx = context(title=title, li=li, status=bkg=status_bkg) return template.generate(ctx).render('html', doctype='html') now html file have kind of structure: ... <tr py:for="i in len(li)"> <td class="${status_bkg[i]}">${li[i]}</td> <tr> the 2 classes "green" , "red" ok. firs...

php - List o paths to hierarchical array -

i have serialized data list of filepaths each 1 or without 1 or more files inside. array 0 => 'config.ini' 1 => 'folder/file1.php' 2 => 'folder/folder2/file2.php' 3 => 'folder/folder2/folder3/file3.php' 4 => 'folder/folder2/folder3/file4.php' the first 1 in root folder, outside subdirectory and convert array multidimensional hierarchical array, being folder3 sub-array of folder2 , sub-array of folder1 . with this answer succeeded. problem is, because created different purpose, array files (wit extensions) being considered more dimensions, instead of being appended values of last entry. e.g: file3.php , file4.php should values of folder3 , not indexes. i tried modify myself reference 1 of few features don't understand in php. if worth mention, i'm converting structure build treeview.

curl - Forward everything over SSL in an Express.js App -

can't seem of these forward through ssl. ideally, done without wildcard certificate. http://baredomain.com https://baredomain.com http://www.baredomain.com https://www.baredomain.com ideally of above if typed browser or curled send traffic on https://www.baredomain.com or https://baredomain.com (just one, not both). i've tried combo of a-records, cname records , node.js redirecting code. can't seem working. i've tried lots of different configurations , gotten close @ best. i'm trying ideal setup node.js apps. i've been working on many , in order people able them without trouble routes listed above need work. update : hmm... seems there's called san (subject alternative name) well. you have 2 individual certs each of names. if goal lower cost, san cert baredomain.com www.baredomain.com san dnsname work fine. that plus simple redirect code like app.get('*', function(req, res, next) { if (/^www\./.test(req.headers.host...

java - Create process that survives creator process -

is there way create process java application, can can survive creator process? i use processbuilder create child processes in application, can't see way configure process survive shutdown of "main" application. if you're running binary, processes started using exec created in separate process: runtime.getruntime().exec("yourprogram");

rest - Restful Service Jersey 2x charset ISO-8859-9 is not working -

i m trying create restful webservice using jersey 2.13 api + tomcat 7. aim show directories , files on computer response. everything works fine except turkish encoding. html response includes turkish chars. did (added ;charset=iso-8859-9 annotation, added meta stuff charset,added charset response header, added language response header etc.) still page full of unknown chars instead of turkish ones. i couldnt post image showing problem because of low rep. :s instead here link server's response <a href="http://localhost:8080/tezwebserver/rest/servis/klasor?ad=c://**görüntü Ä°Ã…leme genel">klasor:görüntü Ä°Ã…leme genel**</a> this 1 should as <a href="http://localhost:8080/tezwebserver/rest/servis/klasor?ad=c://**gÖrÃœntÃœ Ä°Åžleme genel">klasor:gÖrÃœntÃœ Ä°Åžleme genel</a> the same code working using jersey 1x think bug :s @get @path("klasor") @produces(mediatype.text_html+";charset=iso-8859-9") public respon...

Ruby: replacing a matching element in a multidimensional array? -

could tell me how can achieve replacing element in 2d array? tried each, include , replace , wasn't able figure out going wrong. thank in advance help. class lotto def initialize @lotto_slip = array.new(5) {array(6.times.map{rand(1..60)})} end def current_pick @number = rand(1..60).to_s puts "the number #{@number}." end def has_number #prints out initial slip @lotto_slip.each {|x| p x} #prints slip "x" replacing number if on slip #ex: @number equals 4th number on slip --> 1, 2, 3, x, 5, 6 @lotto_slip.each |z| if z.include?(@number) z = "x" p @lotto_slip else z = z p @lotto_slip end end end end test = lotto.new test.current_pick test.has_number let me know if works out (tried reduce variations 1 10 in order able test easier): class lotto def initialize @lotto_slip = array.new(5) {array(6.times.map{rand(1..10...

php - Unsure of what code Error is -

i have been working on code change someone's password in database (such if forgot code) using variables database such secret code. whenever attempt run function error: parse error: syntax error, unexpected end of file in c:\xampp\htdocs\physicsproject\resetpasswordconnection.php on line 70. here code causing error: <?php include ('inc/header.php'); $userusername1 = $_post['userusername']; $userchangepassword = md5($_post['userchangepassword']); $userchangepasswordconfirm = md5($_post['userchangepasswordconfirm']); $usersecretcode = md5($_post['usersecretcode']); $sql4 = "select * userinformation user_username = '" . $userusername1 . "'"; $data2 = mysql_query($sql4, $cn) or die (mysql_error($cn)); $rowpw = mysql_num_rows($data2); $row1214 = mysql_fetch_assoc($data2); $dbuname = $row1214['user_username']; $dbcode = $row1214['user_code']; if ($userusername1 == $dbuname){ if ...

adb - Can debug on Android tablet with one user account but not another -

i'm developing android app in-app billing , following these instructions . described under adding in-app billing test accounts, i've added second account nexus 7 tablet. can debug using original account fine, new account doesn't work. when try run adb –d install /path/to/release/apkfile.apk in terminal window on mac, get, "error: device unauthorized. please check confirmation dialog on device." when check device running adb devices it shows unauthorized when i'm using new account. i've seen suggestions in other posts disable debugging , kill , restart adb server, test account doesn't have developer options enabled , i'm not able enable them reason. suggestions? popups such usb debugging rsa fingerprint acceptance dialog appear on main account. try opening second account plugging tablet usb port on computer without unplugging usb port, go primary account accept rsa fingerprint dialog switch second account at point, dev...

html5 - Add button to ionic footer in specific controller -

i want add command button in 2 side of ionic footer in many of controller. example in firstcontroller want add , edit button , in secondcontroller want remove , send button. i add main layout static: <div class="bar bar-footer bar-balanced"> <div class="title">my program</div> <button class="button button-outline button-light" ng-click="add()"><i class="ion-arrow-left-c"></i></button> <button class="button button-outline button-light" ng-click="edit()"><i class="ion-arrow-right-c"></i></button> </div> please guide me how in ionic framework , angular. thanks attention my approach : move code add , edit buttons, , remove , send button different service [1st , 2nd service]. create middle man service, containing references both of services declared above [3rd service]. this service contain 2 gener...

objective c - iOS Bluetooth Dilemma. CoreLocation vs. CoreBluetooth -

i'm creating ios app triggers server call whenever come bluetooth proximity of iphone running app. each ios device should have unique bluetooth advertisement identifier (e.g major/minor combo) appropriate server/db call can made. my first plan use standard ibeacon api (corebluetooth + corelocation). worked charm hit standstill when realized can't advertise bluetooth while app in background using method. method 1 //create nsuuid object nsuuid *uuid = [[nsuuid alloc] initwithuuidstring:@"6ca7d72e-824e-45d1-99e9-02bd33599a81"]; //initialize beacon region self.mybeaconregion = [[clbeaconregion alloc] initwithproximityuuid:uuid major:1 minor:1 identifier:@"com.emjoseph.test"]; //get beacon data advertise self.mybeacondata = [self.mybeaconregion peripheraldatawithmeasuredpower:nil]; //start peripheral manager self.peripheralmanager = [[cbperipheralmanager alloc] initwithdelegate:self queue:nil options:nil]; -(void)peripheralmanagerdidupdatestate:(cbpe...

ruby on rails - Adding a record to a has_many_and_belongs_to association? -

i have 2 rails models of form: class user < activerecord::base has_many_and_belongs_to :tags end class tag < activerecord::base has_many_and_belongs_to :users end i have migration creates tags_users table. how add record tags_users table? (tags , users unique) i've trying doing users.tag_ids << new_tag but not seem work. pointers welcome there various ways achieve that, e.g: u = user.first t = tag.create(name: 't') u.tag_ids << t.id # or: u = user.first t = tag.new(name: 't') u.tags << t you can't call collection_singular_ids ( tag_ids in case) on collection. worth noting having habtm association, not have access join model explicitly (e.g taguser ).

java - Response been writen twice in custom servlet forwarding -

i need forward servlet been dynamically loaded jar custom class loader main servlet using external configuration file. servlet not mapped in web.xml. have been able load servlet , construct new instance using reflection , casting: object o = loadedclass.newinstance() ; httpservlet loadedservlet = (httpservlet) o ; i have initialized servlet as: loadedservlet.init(getservletconfig()) ; and implemented every do... method in main servlet as: loadedservlet.service(request, response) ; everything works expected exception of response getting output twice: hello, world!hello, world! is not issue of loaded servlet: protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { printwriter printwriter = response.getwriter() ; printwriter.write("hello, world!") ; } protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { doget(request, ...

html - Javascript function content in bootstrap popover area -

i want have function content bootstrap popover area. how that? adding 1 jsfiddle : http://jsfiddle.net/zc1xj3sn/2/ inserting image done. want function inserted. another code tried : <!doctype html> <html> <body> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <script src="http://code.jquery.com/jquery-2.0.0.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap-theme.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> <script language="javascript" type=...

search - SharePoint 2013 KQL each query with xrank on multi value taxonomy field -

in search query query items have multi value taxonomy field. the publishing page running query has same multi value tax field (for example "color"). example: list items (have color column) - item 1: red, blue - item 2: yellow, red, white - item 3: red, blue, green - item 4: black publishing page (has color column) - defined colors are: red, green all items match "red", "item 3" best match, has both red , green. need return items. not want filter , want rank items. first attempt: following query returns items. not each single value out of multi value field boosted whole value altogether. contenttypeid:0x010600c0deb45360cf4e9eb452aefe3a238a1ca1* xrank(cb=100) mycolormanagedproperty:{page.mycolorcolumn} problem: example item 4 have same ranking item 1 , 2. boost of 100 apply item 3 (which has red , green). need solution item 1 , 2 treated higher item 4 @ least contain "red". update 1: (in previous version used multi value...

visual studio 2008 - VS2008 c++/cli project adds unnecessary office.dll to output folder -

i have created project (that behaves differently on 2 different computers, although files same. the project compiles managed dll. part of solution (let's 'solution a') has 4 projects. project references project of solution , various managed dlls of solution b. on computer 1, did development, compiles expected , it's working fine. on computer 2, using files, compiles , it's working fine, too. during compilation, there 2 files added output folder although not referenced anywhere: 1>kopieren von "c:\program files\microsoft visual studio 9.0\visual studio tools office\pia\office12\office.dll" in das zielverzeichnis... 1>kopieren von "c:\program files\microsoft visual studio 9.0\visual studio tools office\pia\office12\microsoft.office.interop.outlook.dll" in das zielverzeichnis... i not using files nor referencing them or functions of them @ place in code. why copied? doesn't hurt though, know if there's going wrong. ...

python - How to use Panda3d and Pygame together -

i new game development , trying develop game panda3d. can directly use pygame modules along panda3d ones? yes. both panda3d , pygame python modules can used in (compatible) python installation. there (at least awareness) nothing either library prevents importing other python modules. depending on you're trying do, though, answer may more tricky. instance, presumably both pygame , panda3d have own main game loops, , using them require making 1 game loop run part of other library's game loop. sharing resources or graphics contexts tricky, both libraries manage own graphics state. lot more tricky (but not impossible) if question included, example, drawing pygame elements panda3d window or vice versa.

c++ - qt-updating ui by thread -

hi have problem updating ui thread. code works correctly problem when want move window know in moment ui thread stop updating. , thread sends values stopped thread causes error. don't know how fix this. here thread code header: #ifndef readerthread_h #define readerthread_h #include <qtserialport/qserialport> #include <qtserialport/qserialportinfo> #include <qthread> class readerthread : public qthread { q_object public: explicit readerthread(qobject *parent = 0); void run(); bool stop = false; qbytearray port_input; qbytearray payload; quint8 starter_symbol = 0; quint8 message_length = 0; quint8 message_id = 0; readerthread *thread; signals: void updated(qbytearray , quint8); private: qserialport *serial; }; #endif // readerthread_h my thread .cpp: #include "readerthread.h" #include <qtcore> readerthread::readerthread(qobject *parent) : qthread(parent) { serial = new qserial...

doctrine2 - How to get number of rows in group after GROUP BY select in MySQL? -

let mysql table example id | grp | title 1 | 1 | item1 2 | 1 | item2 3 | 2 | item3 after sql select * table group grp have result: id | grp | title 1 | 1 | item1 3 | 2 | item3 how can number of rows in group? this: id | grp | title | grp_count 1 | 1 | item1 | 2 3 | 2 | item3 | 1 and if possible, want doctrine2 if selecting id , title not matter in other words select of id , title while doing group can use following select id, grp, title, count(*) grp_count table group grp

django - Adding django_content_type and permission without model -

i want have permissions on few contents, not models , 'name' in following table: mysql> select * my_contents; +----+---------------------+ | id | name | +----+---------------------+ | 1 | content1 | | 2 | content2 | i understand django's permission model requires contenttype instance. so, inserted these 2 entries in django_content_type table arbitrary app_label , model . like: | 20 | content1 | some_label | content1 | | 21 | content2 | some_label | content2 | now, thinking on running syncdb permissions these 2 new contents created automatically in auth_permission , instead, get: the following content types stale , need deleted: some_label | content1 some_label | content2 how update permissions these 2 contents (without model) ? what attempting sounds per object permissions. each object within model want set permissions on it. django not support django-guardian does. if @ link provides...

network programming - Busy Wait Avoidance -

the operating system can avoid busy wait of process putting sleep , restoring in case of event. restoring operating system needs check on event occurance, means operating system or part of struck in busy wait ? possible have interrupt driven i/o in software context? between i/o , process not between processes. for restoring operating system needs check on event occurance, means operating system or part of struck in busy wait? no. is possible have interrupt driven i/o in software context? yes. only between i/o , process not between processes. yes. computers haven't used busy-wait i/o since 1957.

regex - How to convert LineFeed delimited file to one line using repl.bat -

for example: i have set of strings: aaaa~ bbbb~ expected: aaaa~bbbb~ im using repl.bat find , replace tool impelemented in batch file follows: for /f "tokens=2,3" %%a in ('type c:\user\delim.txt') ( copy "c:\user\linefeed\%%a" "c:\user\linefeed\%%a.in.tmp" /f "tokens=1,*" %%s in (findnreplace.txt) ( type "c:\user\linefeed\%%a.in.tmp" | c:\user\bat\repl.bat "%%s" "%%t" x > "c:\user\linefeed\%%a.out.tmp" move /y "c:\user\linefeed\%%a.out.tmp" "c:\user\linefeed\%%a.in.tmp" ) move "c:\user\linefeed\%%a.in.tmp" "c:\user\clientout\%%a" ) example contents of delim.txt ^(aaaaa.{5}).{4}(.*)$ $17777$2 ^(aaaaa.{5}).{4}(.*)$ - find pattern starts aaaaa followed 5 chars , 4 succeeding characters $17777$2 - match value replaced 7777 what equivalent value in regex in order convert line f...

ios - UITextField adjustsFontSizeToFitWidth not working -

on ios 7, textfield.adjustsfontsizetofitwidth = yes has no effect. minimumfontsize set. expect font size reduced if text long fit in textfield's frame. but, happens text gets clipped , "..." gets appended on end. i tried: setting width constraint textfield setting font textfield in places other init method of containing view any ideas? edit: code bit convoluted, here is: self.captionview = [[captionview alloc] initwithframe:cgrectmake(0, 0, self.width, 50)]; self.captionview.textfield.font = [self.captionview.textfield.font fontwithsize:20.f]; self.captionview.textfield.leftpadding = 2.f; self.captionview.textfield.rightpadding = 2.f; self.captionview.textfield.adjustsfontsizetofitwidth = yes; self.captionview.textfield.minimumfontsize = 2.f; self.captionview.captionviewdelegate = self; [self addsubview:self.captionview]; captionview has property textfield, subclass of uitextfield . this subclass overrides methods: - (void)drawrect:(cgrect)rec...

php - Need to change from get ByID to ClassName (Javascript) -

it working when getelementbyid. when change classname, doesn't work. the reason why going class name because there many looping (php) ticket in page ordered ticket number. , when "view" clicked specif ticket, show full message on it. of course, can't multiple duplicate "id" here. , need change class name only. help, please. <div id="menutiket"> <span style="padding:10px; background:yellow; float:right;"> <a href = "javascript:void(0)" onclick ="document.getelementsbyclassname('light').style.display='block'; document.getelementsbyclassname('fade').style.display='block'; ">tiket baru</a></span></div> <!--black overlay--> <d...

Is WAV needed for html5 audio fully cross-browser? -

an audio web cross-browser needs different formats work on browsers. commonly see people use mp4 , ogg . want sure. therefore added webm , wav . needed? wav files heavy. question should thought thinking performance responsive site. this html example: <audio controls="controls" data-music="1"> <source src="http://example.webm" type="audio/webm" /> <source src="http://example.mp4" type="audio/mpeg" /> <source src="http://example.ogg" type="audio/ogg" /> <source src="http://example.wav" type="audio/wav" /> </audio> will downloaded , affect global performance? additionally, order matter of type of formats?

Scala filter tuples (x, y) == (y, x) -

i have list of tuples, example: (0,2) (0,5) (2,0) (2,5) (3,4) (4,3) (5,0) (5,2) there tuples (x, y) == (y, x) , example (5, 0) , (0, 5). want leave 1 of them, example first one. how can it? using foldleft var ts = list((0,2), (0,5), (2,0), (2,5), (3,4), (4,3), (5,0), (5,2)) ts.foldleft(list[(int,int)]()) {(acc, el) => if ((acc contains el) || (acc contains el.swap)) acc else el::acc} // list[(int, int)] = list((3,4), (2,5), (0,5), (0,2)) or, sets o(n) version (assuming set lookup , additions o(1)) ts.foldleft(set[(int,int)]()){(acc, el) => if (acc(el.swap)) acc else acc + el} if doesn't matter if re-order ones swapped tuple not present (i'm guessing doesn't don't specify of ones have swapped tuple should kept): ts.map{t => if (t._1 < t._2) t else t.swap}.distinct // list[(int, int)] = list((0,2), (0,5), (2,5), (3,4))

sql server - Keep inserted rows in Temp table - after a rollback -

i want run updates on hard table within transaction, , insert rows temp table based on newly updated hard table, don't want lose temp table after transaction rolled back...is possible? i feel there obvious answer here, , i'm not seeing it. thanks laurence!! you can use table variable, don't participate in rollback. --laurence this test prove it: declare @test table (test int) begin tran insert @test select 1 rollback select * @test worked perfect. thanks! expand on this

how to use a proxy connection with android studio -

i'm trying run "hello world" application in android studio. connection via proxy. when try run "hello world app", android studio show me next error: error running prueba: gradle project sync failed. please fix project , try again. if configure in: "file/setting -> http proxy" , next put proxy configuration, error next: error:could not ' http://jcenter.bintray.com/com/android/tools/build/gradle/0.12.2/gradle-0.12.2.pom '. received status code 407 server: proxy authentication required ( isa server requires authorization fulfill request. access web proxy filter denied. ) <a href="toggle.offline.mode">enable gradle 'offline mode' , sync project</a> how can fix error? there error indicates proxy authentication needed. authenticate proxy server go file->setting->http proxy, check box proxy authentication , enter credentials there. also, click check connection button test connect...

Surface Normals OpenGL -

so, working on opengl es 2.0 terrain rendering program still. have weird drawing happening @ tops of ridges. guessing due surface normals not being applied. so, have calculated normals. know in other versions of opengl can activate normal array , used culling. use normals in opengl es can activate normals or have use lighting algorithm within shader? thanks opengl doesn't use normals culling. culls based on whether projected triangle has vertices arranged clockwise or anticlockwise. specific decision based on (i) way around said considered front-facing via glfrontface ; (ii) of front-facing and/or back-facing triangles asked culled via glcullface ; , (iii) whether culling enabled @ via glenable / gldisable . culling identical in both es 1.x , 2.x. it's fixed hardware feature. it's external programmable pipeline (and, indeed, hard reproduce within es 2.x programmable pipeline because there's no shader per-triangle oversight). if don't have cullin...

javascript - "'null' is not an object (evaluating 'apiData.original_release_date.split')"; -

i'm making app pulls giantbomb's api display catalog of games depending on query searched. want display picture of game, title, , date added. basically problem having api displays date game created in illogical way (e.g "1983-12-31 00:00:00") last characters being 00:00:00. (which totally redundant) i'm using .split() , .join() remove , replace blank string. while of results populate , see results, i greeted big error screen giving me error cannot make sort of sense since of objects have dates , being replaced accordingly: [error] : script error { [error] : backtrace = "#0 () @ :0"; [error] : line = 54; [error] : message = "'null' not object (evaluating 'apidata.original_release_date.split')"; [error] : name = typeerror; ; [error] : } this randomly halt many other rows populating no apparent reason. have own dates well. this global object...: var nameobject = { name : "...

database - Pagination, LIMIT do not work. PHP/MySqli -

this code: <?php $sqlpages = 'select count(id) newsvid approved=1'; $querypages = mysqli_query($con, $sqlpages); $row = mysqli_fetch_row($querypages); // here have total row count $rows = $row[0]; // number of results want displayed per page $page_rows = 1; // tells page number of our last page $last = ceil($rows/$page_rows); // makes sure $last cannot less 1 if($last < 1){ $last = 1; } // establish $pagenum variable $pagenum = 1; // pagenum url vars if present, else = 1 if(isset($_get['pn'])){ $pagenum = preg_replace('#[^0-9]#', '', $_get['pn']); } // makes sure page number isn't below 1, or more our $last page if ($pagenum < 1) { $pagenum = 1; } else if ($pagenum > $last) { $pagenum = $last; } // sets range of rows query chosen $pagenum $limit = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows; // query again, grabbing 1 page worth of rows applying $limit $querymain ="select ...

php - How to add field or html in Joomla login form -

i'm creating joomla plugin in want add iframe in login forms. first have created component adding custom field used add xml in plugin using "oncontentprepareform". want know best practice of doing without change core joomla files. myplugin.php public function oncontentprepareform($form, $data) { $app = jfactory::getapplication(); $option = $app->input->get('option'); switch($option) { case 'com_users': jform::addformpath(__dir__ . '/forms'); $form->loadfile('iframe', false); return true; } return true; } com_myfield class jformfieldiframe extends jformfield { protected $type = 'iframe'; // getlabel() left out public function getinput() { // generate , empty object $plgparams = new jregistry(); // p...

jquery - how to open a .php?id link in a div -

i'm having problems trying link open inside leftpan div. the index page has auto load function opens page in leftpan without problem, , menu works jquery way without problems. but open php page menu /content/ , inside page if click on link needs open page called moreinfo.php connected database id linked image click on, far good, problem i'm having doesn't open page inside leftpan, instead opens in new window , putting target leftpan results in page still opens own tab/window... this doing without success: echo "<a href='moreinfo.php?id=".$row['id']."'> <img src=\"content/uploads/" . $row['filename'] . "\" alt=\"\" height=\"219\" width=\"350\" target=\"leftpan\"/></a> <br />" . "<br />"; attribute target should inside <a> tag, not inside <img>

Inconsistent image orientation correction in php for android 4.1.2 -

when trying fix image orientation in php after uploading image android using popular code: http://snipplr.com/view/76539/ : function image_fix_orientation($path){ $image = imagecreatefromjpeg($path); $exif = exif_read_data($path); if (!empty($exif['orientation'])) { switch ($exif['orientation']) { case 3: $image = imagerotate($image, 180, 0); break; case 6: $image = imagerotate($image, -90, 0); break; case 8: $image = imagerotate($image, 90, 0); break; } imagejpeg($image, $path); } } and works android 2 . we have inconsistent behaviour android 4.1.2. code not correct images taken android 4.1.2. . but code does: function image_fix_orientation($path){ $image = imagecreatefromjpeg($path); //$exif = exif_read_data($path); //if (!empty($exif['orientation'])) { // switch ($exif['orientation']) { // case 3: // $ima...

spring - Jetty startup delay due to scanning -

context , setup information: jetty 9 eclipse jetty plugin spring 4.1.1.release spring security 3.2.3 spring java configuration (no web.xml) problem description starting jetty 9 slow in project spring's javaconfig used boot spring context instead of using web.xml . jetty seems doing nothing during considerate amount of time. occurs after line: info:oejs.server:main: jetty-9.2.3.v20140905 jetty start eventually, takes long start compared regular tomcat 7 distribution. additional resources public class dispatcherservletinitializer extends abstractannotationconfigdispatcherservletinitializer { //implementation } this due fact jetty 9 scans jars in web-inf folder annotations in order start web context. if you've attempted find solution problem, discovered fact. tried several such answers, never found correct solution among them. in order eliminate such scanning as possible, can define pattern tells jetty sources scan , not scan. don...