Posts

Showing posts from April, 2014

c - Why is the parent process not executing at all? -

following program shared memory implementation parent , child processes use shared memory printing next alphabet given parent. there shared memory , both processes attaching obtain required result. in code, parent process not execute @ all. #include<stdio.h> #include<stdlib.h> #include<unistd.h> #include<string.h> #include<sys/ipc.h> #include<sys/shm.h> #include<sys/types.h> int main(int argc,char *argv[]) { int smid; pid_t x; char *sm; smid=shmget(ipc_private,(size_t)sizeof(char),ipc_creat); x=fork(); if(x>0) { sm=(char *)shmat(smid,null,0); sprintf(sm,"%s",argv[1]); printf("parent wrote:\n"); puts(sm); sleep(4); printf("parent got:\n"); puts(sm); shmdt(sm); shmctl(smid,ipc_rmid,null); } else if(x==0) { sleep(2); sm=(char *)shmat(smid,null,0); printf("child read:\n"); puts(sm); sm[0]++; } retur...

lisp - Clojure: iterate over map of sets -

this pretty follow-up last question ( clojure idiomatic way update multiple values of map ), not quite same. (keep in mind i'm new clojure , functional languages alike) suppose have following data structure, defined map of sets: (def m1 {:1 #{2} :2 #{1 3} :3 #{1}}) and map of maps such: (def m2 {:1 {:1 0 :2 12 :3 23} :2 {:1 23 :2 0 :3 4} :3 {:1 2 :2 4 :3 0}}) what want update registries of m2 have correspondence in m1 value. let's value want x . resulting m2 this: {:1 {:1 0 :2 x :3 23} :2 {:1 x :2 0 :3 x} :3 {:1 x :2 4 :3 0}} assuming v contains every possible key map, y first attempt, (that failed miserably) this: (assume x=1 (for [i v] reduce (fn [m j] (assoc-in m [i j] 1)) d (i m1))) needless failure. so, how idiomatic way this? as understand requirements want to produce number of key-sequences m1 . in m2 associate each of key-sequences particular constant value. the first step simple transformation of m1 . want produce 0 or more ke...

validation - Javascript to validate only Numeric after predefined text in a textbox -

i'm trying use javascript make textbox contains read-only text @ beginning of text box , allows editing following read-only text. need allow 10 digit numeric after readonly text , need validate numeric digits. following javascript code having readonly in textbox var readonlylength = $('#field').val().length; $('#output').text(readonlylength);enter code here $('#field').on('keypress, keydown', function(event) { var $field = $(this); $('#output').text(event.which + '-' + this.selectionstart); if ((event.which != 37 && (event.which != 39)) && ((this.selectionstart < readonlylength) || ((this.selectionstart == readonlylength) && (event.which == 8)))) { return false; } }); if looking solution script here plain js , regexp : var fixedtext = function(textbox, label) { var num = textbox.value.replace(/\d/g, ''); //non numeric num = num.substr(0, 10); //max 10 di...

php - Limit custom taxonomy dropdown by custom post type -

i have 2 custom post types connected same custom taxonomy. on particular page needed filter 1 particular post type using filter created custom taxonomy. able dropdown of custom taxonomy using <?php wp_dropdown_categories( $args ); ?> noticed listed terms atleast 1 of 2 custom post types had post linked it. here's example of i'm trying do: 1. have 2 custom post types: cars , bikes 2. have custom taxonomy (location) 3. on specific page, need filter post type cars using dropdown created taxonomy 4. problem i'm facing dropdown taxonomy location, lists locations posts bikes post type connected to. example, if have posts cars post type connected usa, uk, australia , post bikes post type connected brazil, dropdown custom taxonomy lists 'brazil' term though none of cars posts linked it. is possible restrict dropdown taxonomies 1 custom post type? i asked same question on wordpress stackexchange site , got answer. linking in case else interested i...

sql server - Sql JOIN Performance on Big tables -

Image
i have query following line. select /**/ #customers fia inner join [fia_cmmn_fin_account] fca with(nolock) on (fca.report_oid=fia.oid , fca.status='1') inner join [fia_cmmn_rpt_parameter] pr with(nolock) on (pr.report_oid =fia.oid , pr.status='1') (fca.original_1+fca.original_2+fca.original_3+fca.original_4)!= 0 second table "pr" has 28.000.000 rows , query progressing 2 minutes. how can optimize query.

javascript - Remove checked property through jquery .model value not updated in knockout js -

i used jquery remove checked property of checkbox.the ui value updated.however, model value not updated. same old value there in model. if manually check unchecked checkbox model value updated. have scenario 1 checkbox click other checkbox should unchecked.the required functionality done through below code. need updated value in model. answerclick: function (data, event) { var element = event.target; $(element).parents('.primarycasemain').find("div#" + valuetohide).find('input[type=checkbox]:checked').removeattr('checked'); } here html code <input type="checkbox" data-bind="attr:{id: $data.id , qid: $parent.id , qref: $data.questionrefsetstrings , uid: $data.uid , rel: $data.mutuallyexclusive ? 'true' : 'false'} ,checked: $data.selected, click: $root.answerclick , if: $root.appendqrefquestion($data.questionrefsetstrings, $data.noappendrequiredqref)"> you should use knockout implemented ...

java - JOptionPane: texts message and buttons in the same line -

as title says want achieve pop option message using joptionpane such question , buttons placed on same line. i'm reading following tutorials seems quite difficult: how make dialogs how make dialogs java the definitive guide java swing in sense idea have following confirmation message layout: the products going removed database. are sure want perform it? |yes| |no| where yes , no should buttons. (the text not real one, it's give flavor of message). any comments or hints welcomed. thanks lot in advance. try this joptionpane.showconfirmdialog(null, getcustompanel(), // return panel design on own "joptionpane example : ", joptionpane.ok_cancel_option, joptionpane.plain_message); //and custom panel private jpanel getcustompanel() { jpanel panel = new jpanel(); jlabel label = new jlabel("text message:"); ...

beautifulsoup - missing links from soup object -

this code extract amazon links. there 1 link on page (may more one) not showing in results. http://www.amazon.com/gp/product/b00a0gta00/ref=pd_lpo_sbs_dp_ss_3?pf_rd_p=1944687522&pf_rd_s=lpo-top-stripe-1&pf_rd_t=201&pf_rd_i=b001u2eqkc&pf_rd_m=atvpdkikx0der&pf_rd_r=1pzmrm5x5fr2zw2e8egz myurl='http://www.apartmenttherapy.com/11-everyday-items-under-25-everyone-needs-at-home-223494?utm_source=rss&utm_medium=feed&utm_campaign=category%2fchannel%3a+main' import urllib2 import beautifulsoup request = urllib2.request(myurl) response = urllib2.urlopen(request) soup = beautifulsoup.beautifulsoup(response) in soup.findall('a'): if 'amazon' in a['href']: print a['href'] how make sure amazon links displayed?

rx java - Sequential Observable Web Service and Database Query Call -

how implement sequential web service , database query call using rxjava observable? first call database query (cache) display result (onnext or oncompleted) , after network call display (replace) current result (cache). i'm using volley listener display data. sequential actions can implemented using concat . because 2 concatenated observables can of different types ignoreelements , cast can useful: databasequeryobservable .doonnext(displayresult) .dooncomplete(something) .ignoreelements() .cast(object.class) .concatwith( networkcall .doonnext(displaynetworkcallresult) .dooncomplete(somethingelse) .ignoreelements() .cast(object.class) ).subscribe(onnextaction, onerroraction, oncompletedaction);

spreadsheet - Using Query command to extract, compare and list data -

i run music festival , data given ticketing provider extremely poorly laid out, in spreadsheet format vertical merges. data, use google sheets extract camping tickets other festival ticket types , allocate camping tent numbers. proposed solution is: 1: extract camping tickets using query commmand: =query(ticketdata!a1:s50000, "select c,d,e, f, g,n, s contains 'season shared camping - 10 man tent'order c"). but query command must also: 2: compare results static sheet of existing allocations 3: display entries not in static existing allocations sheet. thus query command shows new, unallocated camping ticket purchases need actioned. once placed in static sheet, entry automatically removed query sheet exists in both sheets. unique identifier column c, , column contains text string identifies if camping ticket column s. thank you i imagine have downvote due not being excel question, being tagged so. either way think have solution. writing co...

awk - Match 2 columns in same file and exit zero if matching else proceed Unix -

i have requirement file 1 has employee details, below empid,empname,empdaddress,empsupervisor 1234,xxx,street1,6666 2345,yyy,street2,6666 3456,uuu,street3,2345 4567,ppp,street4,9999 9999,kkk,street5,7777 now, have match empsupervisor column value empid, know if details of empsupervisor present in file1. in file sample, 2345 empsupervisor , details present in file. same 9999. 6666 emp details not present in file. i have check if details present in file 1 check record, else exit 0 on complete searching. new unix scripting. suggestion highly appreciated. thanks i've tried awk 'fnr==nr {h[$1] = $11; next} ($1 in h) { print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$15,'u' }' file2 file1 >newfile this should work emp filename. comm -23 <(cut -d, -f4 emp | sort -u) <(cut -d, -f1 emp | sort -u) will give you 6666 7777 it's not clear want result , other file. above code can rewritten using function. p () { cut -d...

javascript - AngularJS slider number binding not working -

i relatively new angularjs, , having trouble getting slider , number element work correctly. when change number value, updates slider. however, when change slider value number becomes invalid. html <div id="radius" ng-controller="radiuscontroller"> <input type="range" ng-model="radius" ng-change="radiuschanged(radius)" ng-value="{{ radius }}" min="0" max="100" /> <input type="number" ng-model="radius" ng-change="radiuschanged(radius)" ng-value="{{ radius | number }}" min="0" max="100" step="1" /> radius: <label>{{ radius }} km</label> </div> controller angular.module("app").controller("radiuscontroller", ["$scope","radiusservice", function ($scope, radiusservice) { $scope.radius = radiusservice.getradius(); $scope.radi...

java - Global filter in WebSphere -

i want add filter adds new parameter header of each request on websphere. found global filter web applications , configuring global filter in websphere 8.5 , tried create global context listener adds filter. however, attempts end exception says cannot add filter programmatically added listener. [9/21/15 9:39:29:646 cest] 00000000 containerhelp e wsvr0501e: error creating component com.ibm.ws.runtime.component.compositionunitmgrimpl@a344950a com.ibm.ws.exception.runtimewarning: com.ibm.ws.webcontainer.exception.webappnotloadedexception: failed load webapp: failed load webapp: srve8011e: operation cannot executed programmatically added listener. @ com.ibm.ws.webcontainer.component.webcontainerimpl.install(webcontainerimpl.java:428) @ com.ibm.ws.webcontainer.component.webcontainerimpl.start(webcontainerimpl.java:714) @ com.ibm.ws.runtime.component.applicationmgrimpl.start(applicationmgrimpl.java:1165) @ com.ibm.ws.runtime.component.deployedapplicationimpl.firede...

java - random start in drools -

currently drl file looks 100+ rules. rule "check 0" when ..... .......... end rule "check 1" when ..... .......... end rule "check 2" when ..... .......... end . . . . rule "check 100" when ..... .......... end and have set sessionobject.fireallrules(1); so iterate through rules rule 'check 0' rule 'check 100' , returns when ever falls under rule. is way can start @ random rule instead of starting rule 'check 0' every time. i looking this. start rule 'check 34' iterate till rule 'check 100' , iterate rule 'check 0' rule 'check 33' . the idea of testing condition , executing action if true old computers. likewise, concept of ordering actions old. both have been implemented in various versions of known "procedural programming". the requirements describe meet, , met by, "procedural programming" head-on. of course, drools ca...

laravel - FatalErrorException in Model.php line 750: Class not found Laravel5 -

i'm in process of upgrading laravel 4.2 project 5.0 i've been making reasonable progress until particular error: fatalerrorexception in model.php line 750: class 'sapproduct' not found. my sapproduct class called product class hasone relationship , can't work out why laravel can't find it. sapproduct.php namespace app\models; use eloquent; class sapproduct extends eloquent { public function brand() { return $this->belongsto('app\models\brand', 'u_brand', 'name'); } } product.php namespace app\models; use eloquent; class product extends eloquent { ... public function sapproduct() { $relationship = $this->hasone('app\models\sapproduct', 'itemcode', 'itemcode'); } ... } model.php (lines 746-755) public function hasone($related, $foreignkey = null, $localkey = null) { $foreignkey = $foreignkey ?: $this->getforeignkey(); $instance ...

cross hair on chart in c# -

Image
i created cross hair or chart , , working, want change position of y-axis form left right (i fixed form chart properties-> series(collection)->y-axis type change primary secondary )then show x-axis line, want y-asix, how can fix it, code below.. //for x axis line chart1.chartareas[0].cursorx.linewidth = 1; chart1.chartareas[0].cursorx.linedashstyle = chartdashstyle.solid; chart1.chartareas[0].cursorx.linecolor = color.red; //chart1.chartareas[0].cursorx.selectioncolor = color.yellow; //for y axis line chart1.chartareas[0].cursory.linewidth = 1; chart1.chartareas[0].cursory.linedashstyle = chartdashstyle.solid; chart1.chartareas[0].cursory.linecolor = color.darkslateblue; chart1.chartareas[0].cursorx.interval = 0; chart1.chartareas[0].cursory.interval = 0; chart1.chartareas[0].cursorx.setcursorpixelposition(mousepoint, true); ...

python - Scpiy: strange behavior of scipy.optimize.minimize -

i'm doing minization using scipy.optimize.minimize . in looking proper argument x0 target function f(x0) , x0 has sudden change, , value turns nan , minimize method stopped. here x0 , result series before strange behaviro: [ 0.1329492 0.13074885 -9.92951618 -1.15521653 5.74419133 4.11687514 0.19983624 -9.95148156 -1.18517543 5.69420641 3.91303028 0.19983624 -7.34387457 -5.30116147 4.90141309 5.06593156 0.18205401] 267.765197762 [ 0.1329492 0.13074885 -9.92951618 -1.15521653 5.74419133 4.11687514 0.19983624 -9.95148156 -1.18517543 5.69420641 3.91303028 0.19983624 -7.34387457 -5.30116149 4.9014131 5.06593156 0.18205401] 267.76519813 [ 0.1329492 0.13074885 -9.92951618 -1.15521653 5.74419133 4.11687514 0.19983624 -9.95148156 -1.18517543 5.69420641 3.91303028 0.19983624 -7.34387457 -5.30116149 4.90141309 5.06593157 0.18205401] 267.765196949 [ 0.1329492 0.13074885 -9.92951618 -1.15521653 5.74419133 4.11687514 0.19983624 -9.9514...

c# - LINQ to SQL Failing to Insert to the Database -

i learning linq , trying insert using linq sql having challenges when inserting showing me incorrect string format when debug no pointing on specific line. can please me made mistake. save button list<legal_member> _legalmemberlist = _dc.legal_members.where(a => a.idnumber == txtidnumber.text.tostring()).tolist(); if (rbtnareyouemployed.items[0].selected == true) { viewstate["areyouemployed"] = true; } else { viewstate["areyouemployed"] = false; } if (rbtnissacitizen.items[0].selected == true) { viewstate["issacitizen"] = true; } else { viewstate["issacitizen"] = false; } if (_legalmemberlist != null) { if (_legalmemberlist.count() == 0) { ...

android - Xamarin Fail to initialize device -

Image
im freshman of xamarin. pls help. followed guideline of xamarin https://developer.xamarin.com/guides/android/getting_started/hello,android/hello,android_quickstart/ until step of 31 finally, can test our application deploying android emulator. if have not yet configured emulator, please see xamarin android player setup instructions. in example, have installed nexus 4 (kitkat) (android 4.4.2, api level 19) virtual device , have started xamarin android player device manager console: i run xamarin android player test quick start, has problem, got message: fail initialize device google 0 answer suck account need 10 reputation upload picture , how can reputation? try check installed devices. when installed xamarin android player no devices downloaded automatically. need download , install needed devices manually.

javascript - how to remove dom reference and event delegation to dom elements/fields from object properties -

if have object properties referencing dom element, , delegates events on widgets/ fields in dom, removing main wrapper dom element jquery mainobj.properties.elem.$html_main.empty().remove() removes events handler other object properties($form,$table,$tab), , need manually assign each one(properties references) null gc. if assign null main parent object, children of automatically eligible gc. if assign mainobj = null, child object, properties, properties.elem, properties.elem.$form.... etc null , collectible gc. there lingering dom links child objecta after nullifying mainobj. my obj: mainobj { properties:{ elem:{ $form:'referencetodomform', $table: 'referncetotableelement' $tab: 'referencetodivelement', ... }, $html_main:'referencetomaindom', otherprops:{ ...}, ... } } if higher level object no longer reachable ...

android - java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first -

private void showsigndialog() { dialog = new dialog(cust_my_deliveries_details.this); dialog.getwindow(); dialog.getwindow().setbackgrounddrawable(new colordrawable(android.graphics.color.transparent)); dialog.requestwindowfeature(window.feature_no_title); //dialog.setcontentview(r.layout.notification_dialog); dialog.setcanceledontouchoutside(true); layoutinflater layoutinflater; layoutinflater = layoutinflater.from(cust_my_deliveries_details.this); view view = layoutinflater.inflate( r.layout.signature_bord, null); relativelayout relativelayoutsign = (relativelayout)view.findviewbyid(r.id.relativelayoutsign); relativelayout relative_clearsign = (relativelayout)view.findviewbyid(r.id.relative_clearsign); relativelayout relative_oksign = (relativelayout)view.findviewbyid(r.id.relative_oksign); relativelayoutsign.addview(signatureview); dialog.setcontentview(view); dialog.show(); } at first time application displaying ...

html5 - Aligning the bottoms of an img (float:left) and a nav (right:float) -

case: want 'main menu div'. needs logo on left, , horizontal nav bar on right. .mainmenu { } #logo { float:left; } .menu { float:right; text-align:right; } .menu ul { list-style: none; padding:0; margin:0; } .menu ul li { display:inline; padding:1em; } <div class="mainmenu clearfix"> <div id="logo"> <a href="home.html"><img src="img/logo.png"></a> </div> <div class="menu"> <nav> <ul> <li><a href="wat.html">what</a></li> <li><a href="who.html">who</a></li> <li><a href="contact.html">contact</a></li> </ul> </nav> </div> </div> problem: nav bar in top right corner due float:right; want bottom right, aligned bottom of logo. qu...

wordpress - Modify Woo-commerce product name as appears on product page -

(site runs on avada child+wp+woo) woo commerce product page has product title appears near product image. i'm looking way add product name, 1 of it's attributes, e.g. "disney's little princess - dvd" "disney's little princess" original product name , "dvd" taken 1 of product attributes. appreciate help. follow following steps place woocommerce template files in theme go file template folder>woocommerce >single-product>title.php edit file want

scala - How to handle a 'Configuration error[Cannot connect to database [...]]' -

i implementing web service play framework, uses multiple databases. databases configured in conf/application.conf specifying db.database1..., db.database2... properties. at startup, play try establish connections databases configured in database , if 1 connection fails, service not start. in case, not databases necessary start web service, web service can still run limited functionality, if databases not available. since not databases under control, crucial web service handle connection error. therefore question: is there way either handle connection error overriding 'onerror' method or insert try-catch @ right place or manually create datasources @ runtime handle error when created i prefer solution 2. i using play version 2.4.2 scala version 2.11.7. since whole exceptions fills multiple pages, insert first lines here: creationexception: unable create injector, see following errors: 1) error in custom provider, configuration error: configuration error...

python - How to stop this program? -

i want stop logging keystrokes after time script can other things. have read similar questions have not found solution works me. in of cases terminate whole program. the progress have made using waitingmessages not go stocked not finish either. evident doing wrong here, can give me working examples within answers. i using python 3.4.1 in windows environment. import pyhook, pythoncom, sys, logging, time, ctypes def syp(event): file_log = 'c:\\users\\public\\archive.txt' logging.basicconfig(filename=file_log, level=logging.debug, format='%(message)s') chr(event.ascii) logging.log(10,chr(event.ascii)) return true timeout=time.time()+30 hooks_manager = pyhook.hookmanager() hooks_manager.keydown = syp hooks_manager.hookkeyboard() while true: pythoncom.pumpwaitingmessages() #<--------- hate u stupid method u.u if timeout <= time.time(): hooks_manager.unhookkeyboard() ctypes.windll.user32.postquitmessage(0) ...

arrays - Returning object from webapi to angularjs - not defined error -

model: public class examplemodel { public int64 id { get; set; } public string name { get; set; } } apicontroller: [httppost] public ihttpactionresult action(examplemodel model) { if (!modelstate.isvalid) { return badrequest(modelstate); } if (modelstate.isvalid) { //do return ok(model); } return badrequest(); } angularjs controller: app.controller('createcontroller', ['$scope', '$http', function ($scope, $http) { $scope.example = { name: "" }; $scope.create = function () { $http.post('api/create', this.example).success(function (response) { $scope.examples.push(response); }) .error(function (response) { var errors = []; (var key in response.data.modelstate) { (var = 0; < response.data.modelstate[key].length; i++) { errors.push(response.data.modelstate[key][i]); } } $...

i want upload main and subreprt in jasperserver -

i want upload main , subreprt in jasperserver.but got error error message error filling report error trace com.jaspersoft.jasperserver.api.jsexception: error filling report @ com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.engineserviceimpl$fillresultlistener.reportfillerror(engineserviceimpl.java:1262) @ net.sf.jasperreports.engine.fill.basefillhandle.notifyerror(basefillhandle.java:211) @ net.sf.jasperreports.engine.fill.basefillhandle$reportfiller.run(basefillhandle.java:135) @ com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.engineserviceimpl$synchronousexecutor.execute(engineserviceimpl.java:886) @ net.sf.jasperreports.engine.fill.basefillhandle.startfill(basefillhandle.java:165) @ com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.engineserviceimpl$asynchronousreportfiller.fillreport(engineserviceimpl.java:842) @ com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.engineserviceimpl.fillreport(eng...

objective c - FinderSync issues with sidebar icon, toolbar icon and context menu -

i developing mac app must provide support findersync application extension. works fine, except sidebar , toolbar icon issues. is there way programatically add toolbar , sidebar icons without user intervention? documentation, didn't find me that. refer these icons, mentioning user must manually drag folder manually sidebar, or manually customize toolbar, not api achieving @ runtime. there apps add if removes them toolbar. is there other way display icon folder, except iconset? noticed there other apps out there have icon in sidebar, not seem have icon set in bundle resources , cfbundleiconfile set icns resource. is there way disable menu item in menuformenukind: ? in normal nsmenu situation, menu item should have no action or target, not case. if so, menu item still enabled. thanks lot help! welcome world of pain. i've been developing finder sync extension well, here answers questions: now i'm searching way add programmatically toolbar button, saw ph...

php - Site in site apache2 -

hi all! i have old site on clear php, new functionality start writing on yii2. -- old site | -- index.php (old site) | -- yii2 | -- web | -- index.php (new site) i need configure request on site.ll/* -> index.php (old site) site.ll/v2/* -> yii2/web/index.php (new site) i trying this: alias /v2 /srv/site/yii2/web alias not ported on nginx, need run configuration on apache , on nginx. thanks! just using rewrites: rewriterule v2/*?$ /srv/old_site/yii2/web/index.php [nc,l] rewriterule v2/*?(.*)?/?$ /srv/old_site/yii2/web/index.php/$1 [nc,l] rewriterule v2/*?(.*)?/?(.*)?$ /srv/old_site/yii2/web/index.php/$1/$2 [nc,l]

javascript - How to use cordova.js in another .js intel xdk -

i'm developing app using intel xdk cordova. have .js functions, in .js use cordova's lib, can't. importing cordova.js before importing .js html page can't use cordova's lib. way can use creating tag in on html. project working cordova, i'm sure of because testing same code in script tag @ html works fine. so, how can use cordova's lib @ javascript? every html page this: <script type="text/javascript" src="cordova.js"> <script type="text/javascript" src="myjs.js"> but doesn't work. if in html page: <script> //use cordova's lib here </script> it works.

How to count the number of records with the same value in MongoDB collection? -

i have collection of such data: { "_id" : "ucl87yuj6s4yebbnq", "mrkporadadata" : "09/21/2015 11:17 am", "mrkporadahasloprzedmiotowe" : "ubezpieczeniowa", "mrkporadarodzajporady" : "ustna", "mrkporadasposobudzieleniaporady" : "internet", "mrkporadalp" : 1 } { "_id" : "eioktq35byk8xpwbt", "mrkporadadata" : "09/21/2015 11:19 am", "mrkporadahasloprzedmiotowe" : "finansowa (inne niż ubezpieczeniowa)", "mrkporadarodzajporady" : "sporządzenie pisma", "mrkporadasposobudzieleniaporady" : "osobicie", "mrkporadalp" : 2 } { "_id" : "x6kvlcspeqktjrftu", "mrkporadadata" : "09/21/2015 11:27 am", "mrkporadahasloprzedmiotowe" : "remontowo-budowlana", "mrkporadarodzajporady" : "wzór pisma", "mrkpor...

java - Similar SQL queries in different methods -

there 2 similar methods: collection<movie> findall(userdetails userdetails); //find movies rated user collection<movie> findall(userdetails userdetails, string s); //find movies rated user , containing "s" in title so, second first + regex. jpql code respectively: select movie........ //doesn't mater //the same logic and select movie........ lower(movie.title) :s //the same logic all difference 1 line of code, forces me code repeating in these 2 methods. how can avoid code repeating in case? i thought implement private method receive queries these 2 , process "the same logic". approach? keep both methods , create method receives result , process data. collection<movie> findall(...) { // params here result result = select movie........ //doesn't mater return processdata(result); }

jquery - Group a single column with letter and name in datatable? -

how can have letter , name grouping single column using rowgrouping plug-in , jquery datatables? eg: values: aaa=>1,aaa=>2,aaa=>3,aab=>1,aab=>2,aab=>3,aac=>1,aac=>2,... should group ( sgroupby ) letter a , b , name aaa , aab , aac . solution plug-in rowgrouping no longer being developed, not recommend using it. use alternative way perform row grouping shown in row grouping example . for example, use code below group rows first letter when sorted column containing names. var table = $('#example').datatable({ "drawcallback": function (settings){ var api = this.api(); // zero-based index of column containing names var col_name = 0; // if ordered column containing names if (api.order()[0][0] === col_name) { var rows = api.rows({ page: 'current' }).nodes(); var group_last = null; api.column(col_name, { page: 'current' })....

google spreadsheet - Making QUERY function case insensitive -

=query(d4:f385;"select d,f d contains '"&j4&"'") if in j4 cell have tree , query grabs cells containing tree , not tree . how make case insensitive? changing formula from: =query(d4:f385;"select d,f d contains '"&j4&"'") to: =query(d4:f385;"select d,f lower(d) contains '"&j4&"'") trick! the more elegant solution welcomed.

Microsoft Band Accelerometer update time interval cannot be changed (iOS SDK) -

Image
how can control accelerometer update time interval on microsoftband (ios sdk) microsoft band documentation says accelerometer frequency can changed, here screenshot documentation to 3 hz, 62, 31, , 8 hz default update time 31hz, need change it for example - iphone accelerometer time interval can changed cmmotionmanager().accelerometerupdateinterval = 0.01 what need have feature above on microsoftband , , change accelerometer frequency 1 of 62/31/8 hz band.sensormanager.startaccelerometerupdatestoqueue(nsoperationqueue(), errorref: nil, withhandler: { (acceldata, er) -> void in let x = string(format: "%f",acceldata.x) let y = string(format: "%f",acceldata.y) let z = string(format: "%f",acceldata.z) var date: string { return "\(nsdate().timeintervalsince1970 * 1000)" } let st...

php - Like function results error -

i have written code users searches in webpage. here sample code going wrong. $first = true; foreach ($terms $each) { if ($first) { $query .= "keywords '%$each%' "; $first = false; } else { $query .= "or keywords '%$each%' "; } } here example fails: when user enters "best o" should display words contains " %best% %o% " in single word going display results contains 2 words there space entered user in between best , o. it's not searching them in single word. it's searching "best" once , "o" once in words.

c# - Crystal Reports in VS2010: Prompted Parameter value in Design Time -

i have crystal report , in design time on vs2010 apply parameter field via [database expert][add cmd][create parameter] wizard. prompts me specific value new parameter. don't see why should going dynamic! in c# code, solution works if dynamic value @ run time matches design-time prompted value. seems defeat purpose. in run-time code have: crystalreport.setparametervalue("tenantid", tenantid); tenanid cr parameter in design time tenanid picked dynamic value can't make dynamic? use: crystalreport.parameterfields(1).addcurrentvalue (num) where " num " parameter value

c# - get the image stream of the camera -

i'm developing windows phone 8.1 silverlight in c#. managed stream of camera , output on screen of phone (using photocamera). app ocr need image perform operations on (the goal detect specific object through camera , not picture). have idea how achieve (-> function api sends image every often)? there lot of microsoft tutorial, can't find 1 particular usage. well seems tutorial looking for. other people same problem : https://msdn.microsoft.com/fr-fr/library/windows/apps/hh202982(v=vs.105).aspx .

python - Run motor till stop button is pressed but have the ability to switch between windows -

i wish make motor control app. have 3 windows, follows (unfortunately cannot upload pictures yet, can upload them other way ): so, want when user clicks "go" button motor rotates , when user clicks "stop" button motor stops. after "go" button has been pressed go different window such window in top , bottom picture. however, gui freezes after clicking "go" button. there way doesn't freeze gui , allow me desired functionality? #! usr/bin/env python import threading import serial import time import tkinter tk system_state_is_run=false class dh_corp_scada2(tk.tk): def __init__(self, *args,**kwargs): tk.tk.__init__(self, *args, *kwargs) container=tk.frame(self) container.pack(side="top",fill="both",expand=true) container.grid_rowconfigure(0,weight=10) container.grid_columnconfigure(0,weight=10) self.frames={} f i...

javascript - FB JS SDK can't be fully loaded in browser -

Image
i have problem facebook js sdk, use facebook fancy "gadgets". while of scripts loaded, fb api not loaded @ (nor after long, long time). i'm using piece of code loading: <div id="fb-root"></div> <script> (function (d, s, id) { var js, fjs = d.getelementsbytagname(s)[0]; if (d.getelementbyid(id)) return; js = d.createelement(s); js.id = id; js.src = "//connect.facebook.net/pl_pl/sdk.js#xfbml=1&version=v2.3"; fjs.parentnode.insertbefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> i looked google looks nobody experienced similar problem. looking @ facebook's docs on loading sdk , see 1 key difference between facebook documents , how doing this, appending #xfbml=1&version=v2.3 js.src . please try load sdk...

android.widget.TextView cannot be cast to android.view.ViewGroup0 -

cannot find source of error. saw other questions concerning same problem, caused missing closing-tag. cannot find 1 missing in code... my main activity.xml file: <?xml version="1.0" encoding="utf-8"?> <linearlayout 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="@dimen/activity_vertical_margin" tools:context=".mainactivity" android:orientation="horizontal"> <textview android:text="@string/main_textview" android:layout_width="0px" android:layout_weight="2" android:background="#fff...

ios - watchos2 - Can I implement multiple storyboards? -

in ios, instantiate smaller (sub-) storyboards using this: - (ibaction)showtrains:(id)sender { uistoryboard *trainstoryboard = [uistoryboard storyboardwithname:@"train" bundle:nil]; uiviewcontroller *maintrainviewcontroller = [trainstoryboard instantiateinitialviewcontroller]; maintrainviewcontroller.modaltransitionstyle = uimodaltransitionstylecrossdissolve; [self presentviewcontroller:maintrainviewcontroller animated:yes completion: nil]; } i understand in xcode 7+, can subdivide watches storyboards. has done this, , how, please... it's not possible @ moment since storyboard ( uistoryboard ) part of uikit framework can see it's not available in uikit 3rd party developers on watch now. there is nothing related storyboards in watchkit framework well.

javascript - Splitting paragraph into sentences -

i'm using following python code (which found online while ago) split paragraphs sentences. def splitparagraphintosentences(paragraph): import re sentenceenders = re.compile(r""" # split sentences on whitespace between them. (?: # group 2 positive lookbehinds. (?<=[.!?]) # either end of sentence punct, | (?<=[.!?]['"]) # or end of sentence punct , quote. ) # end group of 2 positive lookbehinds. (?<! mr\. ) # don't end sentence on "mr." (?<! mrs\. ) # don't end sentence on "mrs." (?<! jr\. ) # don't end sentence on "jr." (?<! dr\. ) # don't end sentence on "dr." (?<! prof\. ) # don't end sentence on "prof." (?<! sr\. ) # don't end sentence on "sr."." \s+ # split on whitespace between sen...

visual studio - downgrade c++ compiler specefications -

Image
i want build project built vs2010 , i'm using vs2015 (firebird sgbd). problem have lot of error messages due new features in vs2015 , i.e. snprintf define . since c++ skills not great, asking following questions: is possible use vs 2015 , sort of downgrade c++ compiler , linker earlier specifications ? is possible same thing vs online ? in visual studio, please right click project , select properties. change platform toolset v100. (be note that, vs2010 needs installed on machine well) for build in vso, please use /p:platformtoolset=v100 argument use visual c++ 2010 tools , libraries build application.

.net - Creating C# OAuth 2 client -

i'm creating own oauth 2.0 client in c#. work, i'm wondering if function authorization correct , safe. should data encryption? i've seen oauth clients doing hmacsha1 encryption. sorry i'm new things. here goes code: public string getaccesstoken() { string uri = "http://192.168.1.89:8080/oauth/token"; client.defaultrequestheaders.authorization = new authenticationheadervalue( "basic", convert.tobase64string(system.text.asciiencoding.ascii.getbytes( string.format("{0}:{1}", client_id, client_secret)))); client.baseaddress = new uri(uri); var parameters = new dictionary<string, string>(); parameters["password"] = password; parameters["username"] = username; parameters["grant_type"] = grant_type; parameters["scope"] = scope; parameters["client_id"] = client_id; parameters["client_secret"] = client_secret; var re...

html - Replace text inside each line in Notepad++ -

i have this: ...something...data-src="text"...something...src="images/bbp/bbp0001/01small.jpg"...something... ...something...data-src="text"...something...src="images/bbp/bbp0001/02small.jpg"...something... ...something...data-src="text"...something...src="images/bbp/bbp0001/03small.jpg"...something... . . . ...something...data-src="text"...something...src="images/bbp/bbp0001/48small.jpg"...something... i want this: ...something...data-src="images/bbp/bbp0001/01small.jpg"...something...src="images/bbp/bbp0001/01small.jpg"...something... ...something...data-src="images/bbp/bbp0001/02small.jpg"...something...src="images/bbp/bbp0001/02small.jpg"...something... ...something...data-src="images/bbp/bbp0001/03small.jpg"...something...src="images/bbp/bbp0001/03small.jpg"...something... . . . ...something...data-src="images/bbp/bbp00...

Update multiple areas with jQuery.load() -

jquery allows update single part of page if has id: $('#mydiv').load('http://my/url/#mydiv'); i need update several parts of page (around form). realise could: call load 1 time per region want update, crazy-inefficient. restructure how i'm doing things, detach original form, .load(...) whole page , reattach old form... has habit of messing around focus states. i guess i'm after way download page (as jquery object) , cross-update particular sections. i'm assuming that's how existing .load() code works. how that? one solution use $.get : $.get('http://my/url/', function(response) { var $page = $(response); $("#mydiv1").replacewith($page.find("#mydiv1")); $("#mydiv2").replacewith($page.find("#mydiv2")); }); one important thing note jquery remove elements <html> , <body> or <header> , if element direct descendant of 1 of those, use .filter find ins...

javascript - Include user locale to the Keycloak ID token -

i keycloak (1.4.0) include users' chosen locale id token. i have come far creating user attribute mapper, supposed map locale attribute token, not work. does know how this? thanks in advance. edit: have learnt know abput keycloak locales class: http://grepcode.com/file/repository.jboss.org/nexus/content/repositories/releases/org.keycloak/keycloak-forms-common-freemarker/1.2.0.final/org/keycloak/freemarker/localehelper.java#localehelper.0logger i suppose have this: open admin console of realm. go clients , select client this works settings > access type confidential or public (not bearer-only) go mappers create mapping attribute json check "add id token" to access mapped claim use this: final principal userprincipal = httprequest.getuserprincipal(); if (userprincipal instanceof keycloakprincipal) { keycloakprincipal<keycloaksecuritycontext> kp = (keycloakprincipal<keycloaksecuritycontext>) userprincipal; idtoken to...

Should I pay for Google Drive SDK for iOS -

some times ago received message developer responsible pay data transfer using google drive sdk ios. is still actual, how calculate price it? understood if many users download huge data via google drive storage, expensive me developer using sdk. your linked question google cloud storage. untelated google drive has no cost developer if storing files in user's drives.

c# - Dock Ability arrows editable -

hi wondering there way edit dock ability arrows on dock guide docking manager using syncfusion wpf? can edit complete style of docking manager want ability edit arrows have theme in specific way need arrows different possible @ all? , if how can access it? to need edit drag provider templates below xaml example has similar problem or curious how it <resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:syncfusion="http://schemas.syncfusion.com/wpf" xmlns:sys="clr-namespace:system;assembly=mscorlib"> <!-- control template topdragprovider --> <controltemplate x:key="topdragprovidertemplate" targettype="{x:type contentcontrol}"> <image name="img" width="29" height="32" syncfusion:dockpreviewmanagervs2005.provideraction="globaltop" source="pack://applicati...

php - Laravel add http to urls -

is there helper in laravel 5.0 automatically adds http url without it? similar codeigniter's prep_url found here . no can add yourself. in composer.json file add files key under autoload , point helper file e.g. "autoload": { "files": [ "app/helpers.php" ] } then create app/helpers.php code (lifted https://github.com/bcit-ci/codeigniter/blob/master/system/helpers/url_helper.php ): <?php if ( ! function_exists('prep_url')) { /** * prep url * * adds http:// part if no scheme included * * @param string url * @return string */ function prep_url($str = '') { if ($str === 'http://' or $str === '') { return ''; } $url = parse_url($str); if ( ! $url or ! isset($url['scheme'])) { return 'http://'.$str; } return $str; } } n...

How to call a c++ function that returns a class from c# -

i have functions written in c++ , want use functions in c# project. worked couple of functions in functions in returned class, doesent seem work (i have same class in both sides). created adapter returns class called cprofile : class cprofile { public double timestamp; public int diml, dimr; }; extern "c" __declspec(dllexport) cprofile getprofileadapter(int nint) { std::cout << "get profile" << std::endl; profile profile=r->getprofile(nint); cprofile cprofile; std::cout << "get time stamp" << std::endl; cprofile.timestamp=profile.timestamp; std::cout << "get diml" << std::endl; cprofile.diml=profile.leftprofile.size(); std::cout << "get dimr" << std::endl; cprofile.dimr=profile.rightprofile.size(); return cprofile; } and in c# project call function : class cprofile { public double timestamp; public int diml, dimr; }...

sql server - How to insert an item in a database and sort again -

suppose have database primarykey id , varchar name, , need data ordered id. so data is james jhon patrick and on and want insert row in second row james lee john patrick how can it? do have update rows after "lee" , change id? is there simpler way keep order? thank you. learn here lot why want "insert row in second row"? doing indeed require update other records, , should not changing primary key values of records. changing them require updates in tables have foreign keys referring table. let database handle primary keys. if need number sort of priority or sorting purposes, suggest separate column that.

c - Sum and get the average of the values in the array -

sum , average of values in array, , stop ask number when sum exceeds 10,000.i need clear example of these conditions. the language fit need example in c my code ``` #include <stdio.h> int main() { int array[10]; int i, num, negative_sum = 0, positive_sum = 0; float total = 0.0, average; printf ("enter value of n \n"); scanf("%d", &num); printf("enter %d numbers (negative, positve , zero) \n", num); (i = 0; < num; i++) { scanf("%d", &array[i]); } printf("input array elements \n"); (i = 0; < num; i++) { printf("%+3d\n", array[i]); } (i = 0; < num; i++) { if (array[i] < 0) { negative_sum = negative_sum + array[i]; } else if (array[i] > 0) { positive_sum = positive_sum + array[i]; } else if (array[i] == 0) { ; ...