Posts

Showing posts from July, 2012

ios - Customize UIImagePickerController to have a white border -

Image
i'm trying reach controller looks similar this: notice customize size of capture screen, , white border around it. know, it's impossible change background color of uiimagepickerviewcontroller, im trying implement overlayview go above it. the main issue need make mask view show camera in middle of overlay view, , far came short. any ideas on how implement this? how can make mask view cuts "hole" in overlay view see camera underneath it? thanks! i suggest creating custom camera. let put sorts of overlays etc. check out avcapturesession there bunch of tutorials online describing how easily. first result google search: https://dannygtech.wordpress.com/2014/03/04/custom-camera-on-ios-avcapturesession-avcapturevideopreviewlayer-tutorial/

timestamp - Convert unix epoch time to a date in Apache Derby -

is there function in apache derby can convert unix epoch time value (eg. 1453974057 ) date? if have seconds since unix epoch, use: select {fn timestampadd(sql_tsi_second, 1453974057, timestamp('1970-01-01-00.00.00.000000')) } dt sysibm.sysdummy1 just replace "sysibm.sysdummy1" original table, , replace 1453974057 value. when dealing milliseconds gets bit more complicated because can't use timestampadd directly (you sql state 22003: resulting value outside range data type integer.) if have milliseconds since unix epoch, use: select --the following block converts milliseconds since linux epoch timestamp { fn timestampadd( sql_tsi_frac_second, ( --add millisecond component 1453974057235 - { fn timestampdiff( sql_tsi_second, timestamp('1970-01-01-00.00.00.000000'), { fn timestampadd(sql_tsi_second, 1453974057235/1000, timestamp('1970

sql - Error converting Nvarchar data type to datetime from VB.NET -

i have problem regarding dates program stored procedure in sql. my program takes date excel spreadsheet , parses such: tempdate = date.fromoadate(exws.cells(exrow, mymatchedcolumns(2)).value) dim format() = {"dd/mm/yyyy", "dd-mm-yyyy", "yyyy-mm-dd"} duedate = date.parseexact(tempdate, format, system.globalization.datetimeformatinfo.invariantinfo, globalization.datetimestyles.none) duedate 'date' variable i'm assuming @ point 'duedate' universal date object. think best way parse both english regional date , polish dates, since used on polish machine. however, when sending values stored procedure: mysqlstring = "exec bsp.partprice_sp " & _ "'" & duedate & "', " & _ "'" & mypartid & "', " & _ "'" & currency &

java - Access HTTP response when using Jersey client proxy -

i'm using jersey 2.22 consume rest api. approach contract-first, service interface , wrappers used call rest api (using org.glassfish.jersey.client.proxy package). webclient webclient = clientbuilder.newclient(); webtarget webtarget = webclient.getwebtarget(endpoint); serviceclass proxy = webresourcefactory.newresource(serviceclass.class, webtarget); object returnedobject = proxy.servicemethod("id1"); the question is: how underlying http response (http status + body)? when returnedobject null, need analyze response error message returned example. there way it? saw can plug filters , interceptors catch response, that's not need. you should return response result of interface method instead of plain dto. i'm not sure level of control you're expecting (considering reply @peeskillet comment), response object give opportunity fine tune server's response (headers, cookies, status etc.) , read of them @ client side - might see t

php - Codeigniter, testing if file uploader has file -

i have following code in view: if (isset($stockists)) { $id = $stockists->id; echo form_open_multipart($system_settings['admin_folder'].'/stockists/form/'.$id); } else { echo form_open_multipart($system_settings['admin_folder'].'/stockists/form/'); } <?php echo "<input type='file' name='userfile' size='20' />"; ?> there's lots of other text input fields in there sent database on submit. file loader i'm interested in though. in controller function, how can check if file exists in up-loader after submit? the following retruns false: $image = ($_files['userfile']); i need check in conditional statement if file exists in uploader. example: if ($_files['userfile']) { //do } but method not work. the super global $_files $_files['userfile'] isn't boolean. if (strlen($_files['userfile']['tmp_name']) > 0) {

jsf - <p:selectOneButton> with images -

i'm using jsf primefaces, want use buttonset of radiobutton images can't make work. here's code: <p:selectonebutton value="#{loginbean.user}" > <f:selectitem itemlabel="&lt;img src=&quot;/myapp/faces/javax.faces.resource/myimg1.png?ln=img&quot;/&gt;" itemvalue="1"/> <f:selectitem itemlabel="&lt;img src=&quot;/myapp/faces/javax.faces.resource/myimg2.png?ln=img&quot;/&gt;" itemvalue="2"/> </p:selectonebutton> i tried escaping characters "escape", "escapeitem" , "itemescaped" attributes. read last 1 in other question . solution in question uses <h:selectoneradio> , not <p:selectonebutton> . note: know works using jqueryui buttonset() method (primefaces uses on background) it's not script problem.. so, posible <p:selectonebutton> ? thanks! indeed, renderer of <p:selec

Which Event to be called when adding the products to order creation in magento admin? -

i have scenario want create order backend . want call api when selecting products order . want know api need call when add item order may call api ? i appreciate . regards surjan sales_quote_add_item event occured when add product order admin. follow steps. your config.xml like. <adminhtml> <events> <sales_quote_add_item> <observers> <unique_event_name> <class>module/observer</class> <method>productlevelchanges</method> </unique_event_name> </observers> </sales_quote_add_item> </events> </adminhtml> observer.php <?php class company_module_model_observer extends mage_core_model_abstract { public function productlevelchanges(varien_event_observer $observer){ $item = $observer->getquoteitem(); $productobject=mage::getmodel('ca

.net - Does c# have inner class extra overhead? -

i have following simple class: class stack { public class node // inner class { string item; node next; } } a stack n items uses: 8 bytes (reference string) + 8 bytes (reference node) + 16 bytes (sync block index + type object pointer) . wonder inner class overhead. need add 8 bytes ? stack n items uses ~ 40*n bytes or ~32*n bytes? c# inner classes not have hidden reference instance of outer class java it. if want behavior can create manually. there nothing in c#. an inner class has different access rules , differently structured name. also, inner classes share generic type parameters of outer class might create overhead. it's organization concept (in c#).

clojure - Ring: How to modify session in middleware -

how modify session in ring middleware? want have history of accessed urls stored there , can't session store values. sessions works correctly elsewhere @ code can return responses. assume has issue , i'm not understanding how middlewares work. here current code (defn wrap-history [handler] (fn [req] (handler (assoc-in req [:session :history] (vec (concat (-> req :session :history) [(request/request-url req)])))))) here app (i'm using ring-defaults includes session middleware) (def a

How to convert type long to type String ? To solve : 'Encode(java.lang.string)' in android.net.Uri cannot be applied to long -

i developing android app in data taken json. , generating listview through baseadapter. when click number ( textview ), need make phone call number. have tried follows //initialization public long abc; in getview(int position, view convertview, viewgroup parent) { abc = m.getnumber(); number.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent out = new intent(intent.action_call); out.setdata(uri.parse("tel:" + uri.encode(abc))); context.startactivity(out); } }); return convertview; } error getting 'encode(java.lang.string)' in android.net.uri cannot applied long. actually mean? how solve problem? your abc variable long. convert string error saying "encode(java.lang.string)' in android.net.uri cannot applied long" intent out = new intent(intent.action_call); out.setdata(uri.parse("tel:" + u

linux - java.text.ParseException: Unparseable date: "1901-01-01 00:00:00" -

this piece of code works correctly in windows, in linux throws java.text.parseexception: dateformat df = new simpledateformat("yyyy-mm-dd hh:mm:ss", new locale("es", "es")); df.setlenient(false); date date = df.parse("1901-01-01 00:00:00"); system.out.println(date); windows output: tue jan 01 00:00:00 cet 1901 linux output: exception in thread "main" java.lang.reflect.invocationtargetexception @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ com.simontuffs.onejar.boot.run(boot.java:340) @ com.simontuffs.onejar.boot.main(boot.java:166) caused by: java.text.parseexception: unparseable date: "1901-01-01 00:00:00" @ java.text.datefo

java - Android app crashes creating opening Intent -

my android app "e-mail" crashes when try open "readactivity". the method openmail(), declared in mainactivity, should start readactivity: public void openmail(view v, int index) { string[] mail = {"x", "y", "z"}; intent readintent = new intent(this, readactivity.class); <-- error occurs here readintent.putextra("mail", mail); startactivity(readintent); } the method called in listviewadapter: @override public view getview(final int position, view convertview, viewgroup parent) { holder holder = new holder(); view rowview = inflater.inflate(r.layout.listview_item, null); holder.imageview = (imageview) rowview.findviewbyid(r.id.imageview); holder.txvsendermail = (textview) rowview.findviewbyid(r.id.txvsender); holder.txvsubject = (textview) rowview.findviewbyid(r.id.txvsubject); holder.imageview.setimageresource(imageid[position]); holder.txvsendermail.settext(sende

java - MyBatis ManyToOne & OneToMany mapping -

i use java 7 , mybatis 3.2.2. problem following. have 3 classes - a, b, c. a has list of b, b has list of c. - 1 many c has set b, b has set a. - many one /* * java classes */ public class { private int id; private list<b> blist; ... } public class b { private int id; private a; private list<c> clist; ... } public class c { private int id; private b b; ... } /* * mybatis result maps */ <resultmap id="amap" type="a"> <id property="id" column="a_id" /> <collection property="list" column="b_id" oftype="b" resultmap="bmap"/> </resultmap> <resultmap id="bmap" type="b"> <id property="id" column="b_id" /> <association property="a" column="a_id" resultmap

regex - Python match and replace, what I do wrong? -

i have reg exp match data (is here ) , try replace matched data single : characetr test_str = u"there data" p = re.compile(ur'[a-z]+([\n].*?<\/div>[\n ]+<div class="large-3 small-3 columns">[\n ]+)[a-z]+', re.m|re.i|re.se) print re.sub(p, r':/1',test_str) i try on few other way it's not replace or replace not matched whole pattern 1)it's backslash issue. use : print re.sub(p, r':\1',test_str) not print re.sub(p, r':/1',test_str) . 2)you replacing pattern :\1 , means replace text : followed first group in regex. replace first group inside text should add 2 groups , before first , after. hope fix issue: test_str = u"there data" p = re.compile(ur'([a-z]+)([\n].*?<\/div>[\n ]+<div class="large-3 small-3 columns">[\n ]+)([a-z]+)', re.m|re.i|re.se) print re.sub(p, r'\1:\2\3',test_str)

Leading zeros in sum operation using c#.net -

example : int = 0000000; int b = 17; int c = + b; c value should 0000017 if b 223 means c should 0000223 you use output using .tostring("d7") , read more in article how to: pad number leading zeros c.tostring("d7");

C# multiple Attributes Calling Sequence -

i have multiple attributes want apply on controller .which need call them in order of sequence ,because if first attributes executes ,i initialize variables following attribute use. [authorizelicense] [merchantloggedin] [merchantauthorize] public class merchantcontroller : basecontroller { } definition of attributes public class authorizelicense:authorizeattribute { protected override bool authorizecore(httpcontextbase httpcontext) { if(somecondition true){ //initialize variables next attribute use; } } protected override void handleunauthorizedrequest(authorizationcontext filtercontext) { } } next attribute public class merchantloggedin:authorizeattribute { protected override bool authorizecore(httpcontextbase httpcontext) { //use initialize variables previous attribute } protected override void handleunauthorizedrequest(authorizationcontext filtercontext) { } } the ch

javascript - Stop Highcharts overwriting containers -

i wrote javascript function produce graphs inputed csv files. addresses of multiple csv files in graph_data. the reason making loop , not separate because number of csv files in "graph_data" can vary. this function seems work 1 shows graph of last csv , not earlier csv files. if change how many times loop runs produces other graphs never of them on same html page. i think highcharts overwriting previous graphs don't know how fix it. javascript: <script type="text/javascript"> var arraylength = {{graph_data}}.length; (var = 0; < arraylength; i++) { data = ({{graph_data}}[i]); var container="#container"+i; $.get(data, function(csv) { $(container).highcharts({ chart: { zoomtype: 'x', type: 'column', renderto: 'container'+i },

android - Mobile Point of Sale (mPOS) Development -

i asked develop mobile pos android application read chip card data device (like square) can connected audio jack of cellphone. till have done following: (1) detected device on audio jack. (2) read data there in chip. (3) read tags data/ public keys , certificates required transaction processing. (i aware not right/illegal read user data - not going store of on device) i know next step integrate application payment gateway. working on this, integrated payu money (a payemt gateway) android application. directs me "form" cardholder needs fill information such name, card number, expiry date etc. i have extracted data emv chip. unable send on form. don't want clients fill of data except pin number complete transaction. i tried other payment gateways directly take data app (point point) haven't found yet. now, stuck @ do ? go here ? steps follow project done ? i wondering if headed right direction ? all or guidance highly appreciated. thank you

python - Scraping web-page data with urllib with headers and proxy -

i have got web-page data, want proxy. how it? import urllib def get_main_html(): request = urllib.request.request(url, headers=headers) doc = lh.parse(urllib.request.urlopen(request)) return doc from documentation urllib auto-detect proxy settings , use those. through proxyhandler, part of normal handler chain when proxy setting detected. that’s thing, there occasions when may not helpful. 1 way setup our own proxyhandler, no proxies defined. done using similar steps setting basic authentication handle. check this, https://docs.python.org/3/howto/urllib2.html#proxies

javascript - Bootstrap and css are not being recognized in my plugin -

i trying make own plugin on wordpress bootstrap , css don't work, there no connection being formed between them. here code, if have idea thankful. function my_options_style() { wp_register_style('my_options_css', plugin_dir_url(__file__) . 'css/style.css', false, '1.0.0'); wp_register_style('bootstrap_options_css', plugin_dir_url(__file__) . 'includes/bootstrap-3.3.6-dist/css/bootstrap.min.css', false, '1.0.0'); wp_register_style('bootstrap_css', plugin_dir_url(__file__) . 'includes/bootstrap-3.3.6-dist/css/bootstrap-theme.min.css', false, '1.0.0'); wp_enqueue_style('my_options_css'); wp_enqueue_style('bootstrap_options_css'); wp_enqueue_style('bootstrap_css'); } add_action('admin_enqueue_scripts', 'my_options_style'); function theme_scripts() { wp_enqueue_script( 'my-ads', plugin_dir_url(__file__)

c# - Dynamically load assembly from local file and run with restricted privileges -

what need : read local c# text file, execute method that. i'm doing. read text file compile local x.dll csharpcodeprovider load dll assembly.loadfrom() then execute method gettype().getmethod().invoke() it works fine. now, want run code securely, i.e. restrict code accessing file system, network etc. basically, need run minimal privileges. i tried code restrict plugin access file system , network via appdomain (answer @babar), still not working expected. code in text file still able access file system. what i'm missing here? other way make work? the code (for loading , executing assembly) public class sandboxer { public static t getresult<t>(string untrustedassemblydirectory, string assemblyfullpath, string classname, string methodname, object[] methodparameters) { appdomainsetup adsetup = new appdomainsetup(); adsetup.applicationbase = path.getfullpath(untrustedassemblydirectory); permissionset permset = new permis

gridview - Format datetime conversion show default datetime -

i have cgridview date output 2013-03-25 13:30:00 but want in output monday 25 march 2013 1:30 pm i have used array('name'=>'appointment','value'=> 'date("j f y,g:i a", strtotime("$data->appointment"))'), but showing 1 january 1970,1:00 am what have missed here? please help. don't know why strtotime doesn't work here, yii can use : http://www.yiiframework.com/doc/api/1.1/cdateformatter http://www.yiiframework.com/doc/api/1.1/cdatetimeparser e.g. : array( 'name'=>'appointment', 'value'=>'yii::app()->dateformatter->format("eeee d mmmm y hh:mm:ss a", cdatetimeparser::parse($data->appointment, "yyyy-mm-dd h:mm:ss"))' ), if want use date format elsewhere, can define getter in model.

php - Where is Validator::make() method in laravel 5.2 -

i've started learning laravel 5.2, i've used validator::make($request, $options) method while following laravel-5 quick start guide , unable find make method in validator class or class implements, searched in files , found method in container interface, don't know how hooked validator class. thanks, as per facade class reference: facade class service container binding validator illuminate\validation\factory validator illuminate\validation\factory@make laravel 5.2 - facade class reference

listview - Android - Unable to increment or decrement value from list item -

Image
hi using custom listview getting data server , show in listview.. able data , show in listview dont know implement click event of button inside listitem. there 2 buttons increement , decrement qty. clicklistener working not working in right manner. please me correcting issue. did search many postrs in stack overflow unable understand it... here adapter class private activity activity; private layoutinflater inflater; private list<feeditem> feeditems; private list<feeditem> filteredfeeditems; imageview plus; imageview minus; int qty = 0; string result; string formatteddate; int id; public feedlistadapter(activity activity, list<feeditem> feeditems) { this.activity = activity; this.feeditems = feeditems; this.filteredfeeditems = feeditems; } @override public int getcount() { return filteredfeeditems.size(); } @override public object getitem(int position) { return filteredfeeditems.get(position); } @override public long getitemid(in

neo4j cypher query for hierarchical relationship matching -

i'm modeling set of nodes has hierarchical relationships (as parent relationship) additionally non-hierarchical relationship. let's it's family tree relationships birth country each person, simplicity so each birth country node , each person node, , might create relationship in cypher as: start parent=node(123), child=node(456) create parent-[:parent]->child; and start person=node(123), country=node(789) create person-[:born_in]->country; what i'd is, example, list of folks don't have ancestors england, or folks have ancestor japan, or like. feel should reasonable query, new cypher , haven't clue how construct it. update ** after more extensive testing of cases, i've found query doesn't work right in some. given child 1 parent england , grandparent not england, query children without ancestors england incorrectly returns child parent england. looks way i've written query, return grandparent having null relationship englan

Strange use of constructor in C++ -

i'm trying understand other person's code written in c++, there strange use of constructor i've never seen. code looks this: a* = new a(some initial values...); ... b* b = new (a) b(some initial values...); when initializing variable b there (a) between new , b(...) . mean? the line of code: b* b = new (a) b(some initial values...); is using "placement new" . the default behavior; creating new object of type b in same memory location object a . if there associated overloads placement new, behavior coded in overload, include default type behavior well. the code needs considered overloads , memory layout of objects , how classes a , b relate each other. it unusual create object on location of created object. imagine there code between these 2 presented here deconstructs (but still leaves memory "allocated") previous object a before constructing new 1 in place. the isocpp faq has further advice on use of technique , dan

python - jsonify a SQLAlchemy result set in Flask -

i'm trying jsonify sqlalchemy result set in flask/python. the flask mailing list suggested following method http://librelist.com/browser//flask/2011/2/16/jsonify-sqlalchemy-pagination-collection-result/#04a0754b63387f87e59dda564bde426e : return jsonify(json_list = qryresult) however i'm getting following error back: typeerror: <flaskext.sqlalchemy.basequery object @ 0x102c2df90> not json serializable what overlooking here? i have found question: how serialize sqlalchemy result json? seems similar didn't know whether flask had magic make easier mailing list post suggested. edit: clarification, model looks like class rating(db.model): __tablename__ = 'rating' id = db.column(db.integer, primary_key=true) fullurl = db.column(db.string()) url = db.column(db.string()) comments = db.column(db.text) overall = db.column(db.integer) shipping = db.column(db.integer) cost = db.column(db.integer) honesty = db.col

javascript - Resend autocomplete init function to google maps api -

i have function called "autocompleteaddress" is initializing auto complete on input. function looks per do function initautocomplete() { // create autocomplete object, restricting search geographical // location types. autocomplete = new google.maps.places.autocomplete( /** @type {!htmlinputelement} */(document.getelementbyid('autocomplete')), {types: ['geocode']}); // when user selects address dropdown, populate address // fields in form. autocomplete.addlistener('place_changed', fillinaddress); } now @ bottom have normal script send function name google api, following <script src="https://maps.googleapis.com/maps/api/js?key=your_api_key&signed_in=true&libraries=places&callback=initautocomplete" async defer></script> now doing modifications ui, , after modifications auto complete doesn't work more, reason being specific input destroyed , new 1 created. now question i

encoding - How do I code the Fibonacci sequence LMC? -

i wondering if possible create program creates fibonacci sequence in "little man computer". the program output in letter boxes individual numbers of sequence. input made asking user how high sequence go. example if input "20" go to number 13. any appreciated, isaac. source: link inp sta n loop lda sub n brp endloop lda out lda b add sta acc lda b sta lda acc sta b bra loop endloop hlt dat 0 b dat 1 n dat acc dat

c++ - How to insert an LLVM StoreInst in a Basic Block -

i going through instructions in basic block. after allocation instruction want make store variable , insert right after allocation instruction. right able find allocation instruction if(allocainst *ai=dyn_cast<allocainst>(&i)) but not know how create storeinst. want store number 10 in regardless of type variable is. i tried this storeinst* stinst = new storeinst(value *val, value *ptr, instruction *insertbefore); but not know put in place of val, ptr, , how adress of next instruction if needs pointer insertbefore to insert after instruction can use insertafter() method . in case: ai->insertafter(stinst) and create storeinst need provide with value *val want store. in case you'd need create constant represent "10" integer , pass there. value *ptr want put value. guess, ai in case. nullptr instruction *insertbefore , because inserting manually.

c# - Importing submodule using custom importer contains "<module>" in find_module fullname parameter -

Image
currently i'm working on custom importer ironpython, should add abstraction layer writing custom importer. abstraction layer ironpython module, bases on pep 302 , ironpython zipimporter module. architecture looks this: for testing importer code, i've written simple test package modules, looks this: /math/ __init__.py /mathimpl/ __init__.py __math2__.py /math/__init__.py: print ('import: /math/__init__.py') /math/mathimpl/__init__.py: # sample math package print ('begin import /math/mathimpl/__init__.py') import math2 print ('end import /math/mathimpl/__init__.py: ' + str(math2.add(1, 2))) /math/mathimpl/math2.py: # add 2 values def add(x, y): return x + y print ('import math2.py!') if try import mathimpl in script: import math.mathimpl my genericimporter get's called , searchs module/package in find_module method. returns instance of importer if found, else not: public obj

c# - Parameterized SQL, ORACLE vs SQL Server with regular expression -

oracle , sql server using different prefix parameters in parametrized string. sql using @p1 ora using :p1 i use in sql @ , in case ora database used : character should replaces @ . can please me create regular expression? here example sql: update test_table set text = :p1 text = 'jana:klara' or some_value = :value or info = 'two' similar question , alternative solutions can found here . you can use pattern search search: (?<=\w):(?=\w+) for instance: string output = regex.replace(input, @"(?<=\w):(?=\w+)", "@"); here's meaning of pattern: (?<=\w) - (?<= ... ) syntax declares positive look-behind. in other words, match must preceded contents of look-behind. in case, it's declaring matches must preceded non-word character. : - matches colon (?=\w+) - (?= ... ) syntax declares positive look-ahead. in other words, match must followed contents of look-ahead. in case, it's declaring

iphone - Application gets crashed -

this question has answer here: exc_bad_access signal received 32 answers i using below code auto share on facebook in iphone application, application crashed exc_bad_access message, when tap share button. nsmutabledictionary *variables = [nsmutabledictionary dictionarywithcapacity:4]; [variables setobject:@"yours content shared" forkey:@"message"]; // share prepared content fb fb_graph_response = [fbgraph dographpost:@"me/feed" withpostvars:variables]; nslog(@"postmefeedbuttonpressed: %@", fb_graph_response.htmlresponse); help me out in advance. it hard tell code provided, 1 idea: dictionary variables created autorelease object. means if not retained in fbgraph , deallocated app returns main run loop, in tabbing share button handled. in case, variables no longer exists after button pressed, , exc_bad_access er

html - Opening a drop-down menu popup on a div using Bootstrap -

is there way toggle drop-down on div using twitter-bootstrap? i have bunch of divs on page in form of square menu items. if square menu item div clicked drop-down show similar ' button dropdowns ' example on bootstrap website. code: code below using asp.net repeater. in itemtemplate dynamically generated on server can @ for-loop generate primary navigation items. make when 1 of these primary navigation items clicked sub-menu shows. don't care if uses popover or drop-down, need show sub-items. please disregard templating syntax. <asp:repeater id="repeater1" runat="server"> <headertemplate> <ul class="primarynav"> </headertemplate> <itemtemplate> <li class="primary-nav-item"> <asp:hyperlink id="navitem" runat="server" cssclass="mainnav-item-tile" navigateurl='<%# eval("nav

android - Is the Current active user profile the Owner? -

starting lollipop, android introduced multiple user profiles.where user can add new user or guest user.my application installed in owner profile.when message received application play audio on loudspeaker. so want detect device running in owner profile @ specific point ? ex: xxxmanager.isownerprofileactive(); note: there way app can figure out if profile in background/ foreground.using intent.action_user_background / intent.action_user_foreground broadcasted system.but looking api.

Ionic StatusBar undefined. Default is coming light -

i trying default statusbar black, it's coming light. when try set black error uncaught referenceerror: statusbar not defined including plugin on https://github.com/apache/cordova-plugin-statusbar.git . removed , added several times, statusbar still light. cordova-plugin-console 1.0.2 "console" cordova-plugin-device 1.1.1 "device" cordova-plugin-file 4.1.0 "file" cordova-plugin-media 2.1.0 "media" cordova-plugin-splashscreen 3.1.0 "splashscreen" cordova-plugin-statusbar 2.1.0 "statusbar" cordova-plugin-vibration 2.1.0 "vibration" cordova-plugin-whitelist 1.2.1 "whitelist" ionic-plugin-keyboard 1.0.8 "keyboard" the code is: console.log(statusbar); if (window.statusbar) { // org.apache.cordova.statusbar required statusbar.styledefault(); } you need wait deviceready event able use cordova plugins. the simplest way wrap code in ionic.platform.ready() call, this: ionic.p

javascript - mongodb (robomongo) different database's connection query -

ok i'm looking best way move around 2 databases within robomongo. for example i'm filtering 1 database on criterium db.getcollection('test').find({status: "new"}) i'm getting list of records now i'm getting list of unique parameters of records (some have parameter don't e.g. seconddatabaseid) - can see them in table view of query. , i'd make new query (list query) database condition records on different database. i'm kind of fresh in playing robomongo don't know if it's doable program or should start playing scripts? i'm looking best way move around 2 databases kind of connected. robomongo shell-centric tool, means can can in standard mongo shell. believe this answers question how make cross-db queries.

android - How to open a picture in gallery -

i want open picture in gallery. gallery path root + "/saved_images" , name fname. opens gallery can choose picture, want open directly picture. string root = environment.getexternalstoragepublicdirectory(environment.directory_pictures).tostring(); string fname = "image-" + formatteddate + ".jpg"; intent intent = new intent(); intent.setaction(intent.action_view); intent.setdataandtype(uri.parse(root + "/saved_images"+fname), "image/*"); startactivity(intent); environment.getexternalstoragepublicdirectory(environment.directory_pictures).tostring() returns in form of "/storage/emulated/0/pictures" . to have valid uri , misses "file://" in front of file path. additionally, if "saved_images" directory, missing / between directory name , filename. all together , intent.setdataandtype(uri.parse("file://" + root + "/saved_images/" + fname), "image/*");

XML with replaceable PHP variables -

i have question regarding use of xml. using xml data storage repositiory. wanted use xml store sentences variables, inside elements variables (php) replaced later on php values/variables once retrieved. i wondering whether correct use of xml dynamic variable? or there option store kind of data? below example: <argument-scheme xmlns:xsi="http://www.w3.org/2001/xmlschema" xmlns:schemalocation="g:\easyphp-devserver-14.1vc11\data\localweb\argupedia\frontend\arg-scheme-repository\arg-scheme.xsd" id='0' name='argument sign' > <premise> $paramarray[0] true in situation.</premise> <premise> $paramarray[1] indicated true when sign, $paramarray[0] true, in kind of situation."</premise> <conclusion>therefore, $paramarray[1] true in situation.</conclusion> <critical-question>"is correlation between " . $paramarray[0] . " , " . $paramarray[1] .

symfony - Symfony2 list all route with security -

using symfony2 2.7 , annotations, define routes follow : /** * @route("/my-route", name="api_my_route") * @method("get") * @security("has_role('some_role')") */ i list of routes associated security. something router:debug security annotations fulfilled.

database - Postgresql master node fail after restart with pgpool -

i set pgpool (master-slave mode) + postgresql streaming replication. check correctness of failover_command. if turn off network master node, pgpool waits specified time, if master node during time not responding, failover_command. , if restart postgresql master via init.d script executes pgpool failover_command immediately. result, master node switches slave node , slave node master node. avoid this, necessary switch off pgpool, , restart master node , include pgpool. how can problem solved? p.s. sorry english :)

ios - Build operations are disabled:'project.xcworkspace' has changed and is reloading -

Image
i got message, follows. then again tried rebuild it, lead me alert message. now if select xcode version, starts throwing error related dependency of external libraries have added. suggestion. i have exact same issue xcode 7.3. restarting ide helps.

javascript - How to download an Html page and its internal files in android? -

i'm working on application needs download source of web page link, internal files, images, css, javascript. after, need open html in webview, in offline mode, that's why need download page. i'd download images using jsoup, haven't ideia how link them downloaded html. could give me examples, or starting points start? thanks in advance essentially, you'll need (and app mentioned below does) go on references links additional additional assets / images / scripts , on, download them, , change html document point local downloaded copy. this, jsoup: find img elements on page, get location / url of image file src attribute of img elements (with .attr("abs:src:) ), download of images local directory change each of image elements src attribute values point location of downloaded image file, relative main html file stored, eg .attr("src", "assets/imagefilename.png"") . do other assets required page, eg. images, css,

xml - SimpleXML selecting attributes with PHP? -

okay i've never worked simplexml before , i'm having few problems here's php: map.api.php $location = $_session['location']; $address = $location; // business location $prepaddr = str_replace(' ','+',$address); $feedurl="http://nominatim.openstreetmap.org/search?q=". $prepaddr ."&format=xml&addressdetails=1&polygon=1"; $sxml = simplexml_load_file($feedurl); foreach($sxml->attributes() $type){ $lat = $type->place['lat']; $long = $type->place['lon']; } and here's example of xml table i'm working from. <searchresults timestamp="thu, 28 jan 16 14:16:34 +0000" attribution="data © openstreetmap contributors, odbl 1.0. http://www.openstreetmap.org/copyright" querystring="m27 6bu, 149 station road, swinton, manchester" polygon="true" exclude_place_ids="65827001" more_url="http://nominatim.openstreetmap.org/search.php?

python - Error initializing SparkContext. java.io.IOException: No space left on device -

after executing shell command launch pyspark session: pyspark --master yarn-client --num-executors 16 --driver-memory 16g --executor-memory 6g i following error: error sparkcontext: error initializing sparkcontext. java.io.ioexception: no space left on device @ java.io.fileoutputstream.writebytes(native method) @ java.io.fileoutputstream.write(fileoutputstream.java:345) @ java.util.zip.deflateroutputstream.deflate(deflateroutputstream.java:253) etc ... it seems slaves out of disk space. how clear up? edit: when running df -h on virtual machine want launch job on: filesystem size used avail use% mounted on /dev/mapper/rootvg01-lv01 20g 18g 2.5g 88% / devtmpfs 16g 0 16g 0% /dev tmpfs 16g 5.7g 10g 36% /dev/shm tmpfs 16g 1.6g 15g 11% /run tmpfs 16g 0 16g 0% /sys/fs/cgroup /dev/mapper/rootvg01-lv03 20g 933m 19g 5% /var /dev/mapper/root

sql - How can I add GETDATE() command on ntext field? -

i add dates on ntext field. update customer set notes='account has been updated'+ cast getdate() this when run query. "operand type clash: datetime incompatible ntext" can me this? you need cast date varchar can concatenated text/varchar have. 'account has been updated'+ cast(getdate() varchar(20))

javascript - Angular svg or canvas to use colour gradients -

Image
i using angular , d3 create donut (in directive). i can quite give filled area colour (in plunker blue). want have svg change colours smoothly from: 0% - 33.3% - red 33.4% - 66.66% - orange 66.7% - 100% green directive: app.directive('donutdirective', function() { return { restrict: 'e', scope: { radius: '=', percent: '=', text: '=', }, link: function(scope, element, attrs) { var radius = scope.radius, percent = scope.percent, percentlabel = scope.text, format = d3.format(".0%"), progress = 0; var svg = d3.select(element[0]) .append('svg') .style('width', radius/2+'px') .style('height', radius/2+'px'); var donutscale = d3.scale.linear() .domain([0, 100

css - Is there possible that remove !important property from element on specific resolution? -

i'm using carousel slider more 2 times , .item height 100% . had adjust main slider on specific height, added class .custom-slider in header tag put style !important tag, because there 100% height . .custom-slider { height: 645px !important; } its adjusted , working fine. have adjust on different resolution, have reduce height 645px 496px , due !important property new added height not working. i'm trying following style on 1024 reslution, not working. .custom-slider { height: 496px !important; } this accepted answer explained, didn't resolve issue, can guide me regarding this. appreciate. change style max-height , remove important! .custom-slider { max-height: 645px; } you make selector more specific adding tag or parents id/class. give style higher priority. body div.custom-slider { max-height: 645px; }

jquery - Change TableSorter sorting criteria -

i'm trying use jquery tablesorter plugin, sort table of books create querying mysql database php. the table sorted title mysql engine ( order book.title in query) , user free sort table in different manner via tablesorter (number of pages, author name, publication date, &c.). the thing is, books have names start numbers (such "1984" or "20.000 leagues under sea"). mysql puts these books on top, before other books start letter. have no quarrel this, strange "bug" (not bug maybe) emerges tablesorter: sorts number-starting titles (shifting them beggining of table end), leaving rest (and vast majority) of items order unchanged. think i've tracked down origin of problem, couldn't yet find (true) solution: it seems tablesorter looks @ first row determine type of column , deems numerical 1 because first element book title starts number, ignores cell starts alphabetic character. if reverse order of original sorting (changing mysql query