Posts

xslt - Substring before throwing error -

i've below xml <?xml version="1.0" encoding="utf-8"?> <body> <p>industrial drawing: creative composition</p> <p>industrial drawing: creative<fn> <fnn>4</fnn> <fnt> <p>ftn1"</p> </fnt> </fn> composition </p> </body> and below xsl. <xsl:template match="p"> <xsl:choose> <xsl:when test="contains(substring-before(./text(),' '),'article')"> <xsl:text>sect3</xsl:text> <xsl:value-of select="./text()"/> </xsl:when> <xsl:when test="contains(substring-before(./b/text(),' '),'section')"> <xsl:text> sect 2</xsl:text> <xsl:value-of select="./text()"/> </xsl:when> <xsl:w...

c# - Call C++ Native DLL in Managed Code -

this question has answer here: c++/cli mixed mode dll creation 6 answers i have native c++ dll, header file , lib file. want create managed wrapper of it. not have source code of dll. how can call/used in c# or c++ managed code. here header file thanks, adil if you've got dll's header, can use dllimport (you can use without have been more complicated) this allow specify method you'll able call in managed code match 1 of in dll. you'll have little work though, have tell c# compiler type use match c++ ones

Google Cloud Bigtable Durability/Availability Guarantees -

i google provide guidelines on durability , availability guarantees provided cloud bigtable service. here understanding far: the fact minimum cluster requires 3 nodes suggests that, @ least within zone, data highly durable , replicated 3 nodes. however, this answer googler states "cloud bigtable doesn’t replicate data" — directly contradicting quote on cloud bigtable homepage claims "is built replicated storage strategy". it? replicated or not? , if so, how many copies kept? the fact clusters can set within particular zone suggests availability of cluster tied directly availability of zone. if want have highly available bigtable-based data storage, best practice set independent clusters across multiple zones , handle synchronisation of writes across clusters myself? there no information on whether bigtable clusters across zones independent or not. if set clusters across multiple zones, , 1 zone goes down, expect clusters in other zones carry on work...

ldap - PHP Warning: ldap_mod_replace(): Modify: Server is unwilling to perform in -

below code getting error as: php warning: ldap_mod_replace(): modify: server unwilling perform in here code: $ip = "10.60.0.12"; $ldaps_url = "ldaps://$ip"; $port = 636; $ad = ldap_connect($ldaps_url, $port) $ad->set_option(ldap_opt_protocol_version, 3); $ad->set_option(ldap_opt_referrals, 0); $b = $ad->bind($config['ad']['binddn'], $config['ad']['bindpassword']); $newpassword = "fssfgds^^&&"; $userdata["unicodepwd"] = $newpassword; $userdata["pwdlastset"] = - 1; $userdata["useraccountcontrol"] = 512; $result = $ad->mod_replace($dn, $userdata); not sure went wrong in above code, please , tell me how fix issue? server unwilling perform means you're not binding user sufficient rights perform action. it's credentials/access control issue ldap not code.

c# - Changing Rows to Columns in LINQ -

Image
i have list displays recorded shown view using linq want record display shown view b. also, using angularjs binding script using ng-repeat table display record. i have included sample of code below. view a: view b: code: public iqueryable<paygrossentitlement> getpayrollbyid(int payrollid, int schoolbranchid, int schoolid) { var query = x in _context.db.tbl_paygrossentitlement x.schoolid == schoolid && x.schoolbranchid == schoolbranchid && x.payrollid == payrollid && x.salarycomponentid !=6 select new paygrossentitlement() { schoolid = x.schoolid, schoolbranchid = x.schoolbranchid, salarycomponentid = x.salarycomponentid, salarycomponentname = x.tbl_salarycomponent.salarycomponentname, s...

How to convert image from double to uint8 in matlab? -

i have image i of type double . want convert image double uint8 . have tried using both: i=uint8(i) i=im2uint8(i) . when use imshow(i) command, black image , nothing else. doing wrong? the im2uint8 function assumes double image scaled range [0,1] . if image has values larger 1 or smaller 0 , these values clipped. see following example: im2uint8([-1 0 0.5 1 2]) ans = 0 0 128 255 255 the solution scale input image [0,1] subtracting minimum value , dividing total range: i = (i - min(i(:))) / (max(i(:)) - min(i(:))); = im2uint8(i); imshow(i);

Android M doze mode and "native" posix socket freezing up -

do not know if considering android m floating around since not much. experiencing strange behaviour app. using native posix tcp client sockets make connections. these sockets working until "doze" or "app standby" modes not activate...cause once either phone reset can not allow app work once again. solution clear app data or reinstall app on phone. still have not investigated errno of subsequent connections, after doze mode, sure sound strange complete app reinstall necessary in order fix posix tcp connections work once again. tomorrow able post few more details regarding issue. has encountered similar problem on android m after doze had prevented network access? thank you!

ios - Push notification showing before background refresh finished (using Push with background refresh) -

i trying set app when push received first fetches new messages before showing push notification. in push notification have content-available = 1 set , switches enabled in plist. have implemented: - (void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo fetchcompletionhandler:(void (^)(uibackgroundfetchresult result))handler { if([[userinfo objectforkey:@"aps"] objectforkey:@"content-available"]){ nslog(@"doing background refresh"); uinavigationcontroller *navigationcontroller=(uinavigationcontroller *)[[[uiapplication sharedapplication] keywindow] rootviewcontroller]; myviewcontroller *myviewcontroller = (myviewcontroller *)[[navigationcontroller viewcontrollers] objectatindex:1]; [myviewcontroller.currentuser refreshmessagesarraywithcompletionhandler:^(bool successful, bool newmiaos) { nslog(@"messages refreshed array has %lu messages",(unsig...

Angularjs ui-grid sorting table according to a given column name -

i using ui-grid version v3.0.0-rc.21-1d9f81f - 2015-05-01 , trying sort given grid according given column name. cannot sort externally (from javascript code), defining , clicking on grid's headers. is possible in version sort grid's data according grid's column name via javascript code? if want sort based on column/field before grid loaded, can using angular orderby filter whenever data retrieved server. $filter('orderby')(array, expression, reverse) or if wanted sort grid @ initial state, can define in columndef sort property { field: 'gender', sort: { direction: uigridconstants.asc, priority: 0, } } take @ plnkr http://plnkr.co/edit/4qqgi76rqpyxbrgbcbyx?p=preview

javascript - Image slider performance -

i testing image sliders written javascript , thought use them instead of coding scratch. if comes big amount of images (400) horrible slow. did testing firefox developer tools , network monitor shows e.g. 5 images loading within 10-15 ms , others 300 - 600ms. totally random. images same size. overall taken on minute load 80mb. tested in local environment. any ideas without seeing code?

Benchmarking mysql on windows -

mysql on linux has useful pager command allows run command , see results of processing query , not displaying results in console. pager cat > /dev/null 251903 rows in set (49.25 sec) mysql on windows missing pager command. running command on windows including output takes 1 min 17.28 seconds (most of time spent outputting command prompt). how can time how long takes perform command in windows. (i suppose write simple python program!) try changing following performance comparisons: select count(*) ......

sublimetext3 - Shortcut key to show unsaved changes in Sublime Text 3 -

how can set shortcut key right key -> show unsaved changes in sublime text 3? i have tried { "keys": ["alt+f10"], "command": "show_unsaved_change" }, but not work. you have wrong command name, correct command name diff_changes : { "keys": ["ctrl+alt+d"], "command": "diff_changes" }

javascript - Close other menus on page before new one opens -

$(function () { var pull_1 = $('#pull-main-menu'); var menu_1 = $('#mobile-menu'); pull_1.on('click', function (e) { e.preventdeenter code herefault() `enter code here`; menu_1.slidetoggle(); }); }); $(function () { var pull_2 = $('#pull-first-menu'); var menu_2 = $('#first-menu-top-left'); pull_2.on('click', function (e) { e.preventdefault(); menu_2.slidetoggle(); }); }); $(function () { var pull_3 = $('#pull-second-menu'); var menu_3 = $('#welcome'); pull_3.on('click', function (e) { e.preventdefault(); menu_3.slidetoggle(); }); }); html: <a href="#" id="pull-main-menu"></a> <div id="mobile-menu"> <ul> <li><a href=""></a></li> <li><a href=""></a>...

sql - How do I pass the same parameter to multiple Command statements in Crystal Reports XI? -

my db not have tables need, have create custom sql queries (commands in crystal terminology), embed results in subreport, , fill report subreports. here's want happen: report asks user date that date gets passed subreports the date passed subreports gets used in query. user has enter date once, else happens behind scenes here's happens: user asked date subreport 1 user asked date subreport 2 etc etc user gets frustrated , report unsuccessful. i know can link parameter fields between reports, understand it, cannot same commands. how can rectify this? right-click on subreport object , choose change subreport links, select how parameter used subreport. courtesy: @martw

android - Notification disappears then reappears when clicked on? -

hi have notifcation set go off on specific day , time. here code - private void createpushtimer() { // todo auto-generated method stub calendar calendar = calendar.getinstance(); intent intent = new intent(mainactivity.this, drawing.class); pendingintent pendingintent = pendingintent.getbroadcast(mainactivity.this, 2, intent, 0); alarmmanager = (alarmmanager)getsystemservice(alarm_service); int day = calendar.get(calendar.day_of_week); if (day == 4) { //5 thurs calendar.set(calendar.hour_of_day, 9); calendar.set(calendar.minute, 48); calendar.set(calendar.second, 0); am.setrepeating(alarmmanager.rtc_wakeup, calendar.gettimeinmillis(), alarmmanager.interval_day*7, pendingintent); } //am.setrepeating(alarmmanager.rtc_wakeup, 10000, alarmmanager.interval_day, pendingintent); } here receiving class notification - public void shownotification(context context) { intent intent = new intent(context, mainactivit...

fortran90 - How does automatic typecasting (type conversion) work in Fortran? -

i using gfortran compiler. tell me if gfortran uses other fortran standard while performing automatic typecasting (type conversion). assignment defined fortran 2008 section 7.2. of note cl. 7.2.1.3 paragraph 8: for intrinsic assignment statement variable of numeric type, expr may have different numeric type or kind type parameter, in case value of expr converted type , kind type parameter of variable according rules of table 7.9. table 7.9: numeric conversion , assignment statement type of variable value assigned integer int(expr , kind = kind (variable)) real real(expr , kind = kind (variable)) complex cmplx(expr , kind = kind (variable)) this means expression ( expr ) implicitly converted type , kind of variable being assigned to. character types, derived types , else, please see standard. also note fortran performs conversions during assignment , initialization not contexts procedure calls. example, ...

memory - Heap - How free bytes are tracked? -

i reading heap , stack usage , have question heap , dynamically allocated memory. how/where heap memory used application known used or availabe? what see in explanation of dynamic allocation : int *p; p = (int*)malloc(sizeof(int));/* space in heap allocated store int*/ p = (int*)malloc(sizeof(int));/* p points space in heap ; first allocated space lost, causing memory leak*/ i understand /* comments */ wrote in code don't understand first space "lost" came 2 ideas: everytime there dynamic allocation, "something" must keep track of space reserved in memory (address of first byte , size of space allocated) : list updated @ each dynamic allocation. or there sort of flag each byte saying free or used application. in way, call free function would, first idea, update list removing address of bytes or second 1 change flags. thank time.

git - How does initializing a repository with a README help in letting you immediately clone the repository to your computer? -

Image
how connected in way? git can clone empty repository. but in case, end-up repo no branch , can unsettling git beginners. that means that, when create own commit in empty cloned repo, need setup upstream branch on first push, git push -u origin master . again, bit of hassle when discover git. see " why need explicitly push new branch? " hence recommendation creating @ least 1 file, meaning @ least 1 commit in master branch. plus, cloned repo has local master branch upstream branch already setup : when new commits done locally, simple git push enough send them github repo. those 2 points (local repo master branch, and remote tracking branch origin/master ) make easier experience. if importing existing repo, on other hand, want empty repo begin with.

datatable - jQuery daterangepicker throwing invalid function error -

i trying using daterangepicker. what trying using server side datatable, have bound server call on each input field. using date , date to, datatable not able take value of both date , date to. it returns value of 1 @ time , on same key. so went daterangepicker, 1 component. table.columns().every(function() { var = this; $("input", this.header()).on('keyup change', function() { that.search(this.value).draw(); }); $('select', this.header()).on('keyup change', function() { that.search(this.value).draw(); }); }); what should doing accepting start date , end date. jquery code: $('#reportrange').daterangepicker({ format : 'dd/mm/yyyy' }); html markup: <input type="text" style="width: 200px" name="reportrange" id="reportrange" class="form-control" /> bu...

php - Post a blob using Guzzle -

is possible post blob using guzzle? methods i've been able find using @filename upload local file. file stored blob in mysql database , upload api post field without redundancy of saving blob disk (and permissions/path issues come it), uploading @filename, , unlinking file. here code have working blob. need 'file' field save data blob. $data = array( 'first_name' => $fname, 'last_name' => $lname, 'email' => $email, 'partner_key' => 'qwerty', 'secret_key' => 'qwerty', 'file' => $fileblob ); $curl = new \guzzlehttp\client(); return $curl->post('https://www.api.com',['verify'=>false,'body'=>$data]) the goal being replace existing curl code using guzzle: 'file' => "@".$localfile.";type=".mime_content_type($localfile) i found solution. helps others in future: $data = array( 'fi...