Posts

Showing posts from September, 2015

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

xcode6 - xcodebuild setting parameter equivalent in Xcode GUI build? -

i have xcode workspace. workspace has multiple projects. each project has @ least 1 target. the command xcodebuild allows add setting parameters on command line. these settings passed targets. for example, can build in workspace doing this: xcodebuild -scheme kitchensink build bob=newhart and setting bob=newhart passed every project. what equivalent of when choosing product | build xcode menu bar (pressing command+b)? some points: i prefer not edit every project. i created xcconfig file named "global", how xcode build process use targets? the build section when editing scheme not contain way attach xcconfig files. when select global.xcconfig in navigator pane, , @ file inspector in utilities pane, not see way add file targets. the xcconfig file part of workspace. not part of 1 project. i'm not use of xcconfig files how accomplish want; i'm explaining i've tried.

c# - LINQ many to many relationship - get a list of grouped objects -

i have bit of complicated 1 (for me anyway): i have 2 entities in many many relationship. projects {project_id, projectname} users {user_id, username} projects-users {id, project_id, user_id} a project can assigned more users. now want retrieve list of projects (listed once) project_id, name, listofassignedusers: id projectname users 1 project1 u1, u2, u3 2 project2 3 project3 u1 i can in sql, can't figure out how in linq! it's linq entity - framework(db first): classes this: public partial class projects { public projects() { this.users = new hashset(); } public int project_id { get; set; } public string name { get; set; } public virtual icollection<users> users { get; set; } } public partial class users { public users() { this.projects = new hashset(); } public int user_id { get; set; } public string user

python - Read binary file which has different datatypes -

attempting read binary file produced in fortran python, has integers, reals , logicals. @ moment read first few numbers correctly with: x = np.fromfile(filein, dtype=np.int32, count=-1) firstint= x[1] ... (np numpy). next item logical. , later on ints again , after reals. how can it? typically, when you're reading in values such this, they're in regular pattern (e.g. array of c-like structs). another common case short header of various values followed bunch of homogenously typed data. let's deal first case first. reading in regular patterns of data types for example, might have like: float, float, int, int, bool, float, float, int, int, bool, ... if that's case, can define dtype match pattern of types. in case above, might like: dtype=[('a', float), ('b', float), ('c', int), ('d', int), ('e', bool)] (note: there many different ways define dtype. example, write np.dtype('f8,f8,i8,i8,?') .

Reading and printing speciffic lines in Python -

i doing gcse computer science python programming i've come against bit of problem, , cannot seem find answer. i have piece of code read file , print part of file. code can seen below: #welcome message print("hello , welcome client activity recorder. \nhere able see , asign exercise levels clients.") #open file reading. client_file_read = open("clientintensity.txt","r") print_content = client_file_read.read() print(print_content) #client selection print("please type client id of person wish check relevant activities apply:") client_id = input() if client_id == ("nequa"): open("exerciseactivities.txt") f: print("for supplied client id following activities available: \n") x in range (6): line = f.readline() print(line) f.close elif client_id == ("roden"): open("exerciseactivities.txt") f: print("for supplied client

servlet 3.0 - Spring web fragments and java config -

i created simple spring-mvc web app (one controller), , simple spring jar (containing 1 controller). i utilized servlet 3 spec using web fragments, came across that, if using spring xml configuration (as per example spring-mvc project created in sts), controller in jar not being called or hit when entered url , if used java config worked fine. and java config did import xml , set scanning... i'm curious why was, got ideas? java config: @enablewebmvc @configuration @componentscan(basepackages = { "com.webapp.test" }) @importresource({"classpath:webapp-context.xml"}) public class testconfig extends webmvcconfigureradapter { } webapp-context.xml <?xml version="1.0" encoding="utf-8"?> <beans:beans xmlns="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:context=&qu

c# - published reports don't work - Database logon failed Error -

i developing simple web app has 3 reports created on vs 2013, reason reports run fine developer mode, when publish website give me "database logon failed" error. causing this? vs installed on same server publishing reports. have created local admin user same info odbc connection logon user iis authentication, still no luck. below code: public partial class openwoswebform : system.web.ui.page { connectioninfo epakconnectioninfo = new connectioninfo(); protected void setconnectioninfo() { epakconnectioninfo.servername = configurationmanager.appsettings["epak_server_name"]; epakconnectioninfo.userid = configurationmanager.appsettings["epak_user_name"]; epakconnectioninfo.password = configurationmanager.appsettings["epak_password"]; } private void page_init(object sender, eventargs e) { reportdocument report = new reportdocument();

ios - How does UILabel vertically center its text? -

Image
there has been lot of confusion trying achieve. please let me reword question. simple as: how apple center text inside uilabel 's -drawtextinrect: ? here's context on why looking apple's approach center text: i not happy how center text inside method i have own algorithm job way want however, there places can't inject algorithm into, not method swizzling. getting know exact algorithm use (or equivalent of that) solve personal problem. here's demo project can experiment with. in case you're interested problem apple's implementation is, @ left side (base uilabel): text jumps , down increase font size using slider, instead of gradually moving downwards. again, looking implementation of -drawtextinrect: same base uilabel -- without calling super . - (void)drawtextinrect:(cgrect)rect { cgrect const centeredrect = ...; [self.attributedtext drawinrect:centeredrect]; } i don't have answer, did little research , t

opencv - CascadeClassifier::detectMultiScale doesn't work with C++ -

i'm using opencv , cascadeclassifier::detectmultiscale facial detection. problem seems cause memory corruption on output vector<rect> . vector correctly filled rects, causes crash when vector deallocated. this occurs when compiling debug build. error message debug assertion failed, makes me wonder if there problem occurs in release build, , assert isn't checked. could bug opencv? or i'm doing wrong how handle vectors? the following code snippet shows example code reproduce bug: #include <opencv2/opencv.hpp> using namespace cv; int main(array<system::string ^> ^args) { videocapture video(0); mat frame; cascadeclassifier classifier("haarcascade_frontalface_default.xml"); while (waitkey(1000 / 30) != 'q') { video >> frame; vector<rect> faces; classifier.detectmultiscale(frame, faces); (int = 0; < faces.size(); i++) rectangle(frame, faces[i], scalar

sql - How to get records missed after join on two tables -

table aa id name email traid stusyid ----------------------------------------- 1 ketan ketan@test.com 1 2 pankaj pankaj@test.com pl1 5 3 adil adil@test.com as1 1 4 lalit lalit@test.com 7 5 adil adil@test.com as1 2 6 adil adil@test.com as1 3 table ab id name email traid stusyid ----------------------------------------- 1 pankaj pankaj@test.com pl1 5 2 lalit lalit@test.com 7 3 milind milind@test.com 8 4 akhi akhi@test.com 8 5 milind milind@test.com 8 6 pa pankaj@test.com pl1 8 7 adil1 adil@test.com as1 1 8 adil2 adil@test.com as1 2 i want detail table below: ((select * aa join ab b on a.email = b.email , a.traid null) union (select * aa join ab b on a.traid = b.tarid , a.traid not null) after getting above results want remaining results table ab not availabe in above result set , want merge/union entire result set (i want fetch entire result exectuting

angularjs - Resetting form controls after action in Angular -

need bit of this . trying angular reset value of input box after add control invoked. kind of important when comes drop down select boxes. want able clear user has selected after option pushed collection. i seems have issue user.fname updating whatever added users array it's related above. also can see doing wrong ng-show ? html <div ng-controller="usercontroller" name="form"> <div ng-show="form.fname.$touched">hello {{ user.fname }}</div> <input type="text" name="fname" ng-model="user.fname"> <a ng-click="adduser(user)">add</a> <br> <div ng-repeat="user in users">{{ user }}</div> </div> javascript function usercontroller($scope) { //$scope.user = { // fname: "joe", // lname: "doe" //}; $scope.users = []; $scope.adduser = function (user) { if($scope.users.indexof(user) ===

ios - How to change attribute type in xcdatamodel? -

Image
i'm newbie assigned gigantic project. have found minor bug needs fixing don't know how. ok here is. issuenumber attribute in xcode's core data model set integer 64 . need change string , bug fixed, when change attribute type integer 64 string , app crashes gigantic output starts this: coredata: error: -addpersistentstorewithtype:sqlite configuration:(null) url:file:///users/apple/library/developer/coresimulator/devices/67d17d00-2af8-4bc4-abb7-091c95d02f35/data/containers/data/application/b94b1310-4a63-4f91-ae7b-5f625697b3e2/library/imagdocument.sqlite options:{ nsinfermappingmodelautomaticallyoption = 1; nsmigratepersistentstoresautomaticallyoption = 1; nssqlitepragmasoption = { synchronous = off; }; } ... returned error error domain=nscocoaerrordomain code=134130 "the operation couldn’t completed. (cocoa error 134130.)" userinfo=0x7f405ef0 {url=file:///users/apple/library/developer