Posts

Showing posts from February, 2010

how to split a string and stored in a php variable -

i split long string 3 parts.how can stored in 3 different variables in php. code is <?php $str = "q5vrfsc+6rs08jlvwdmc/sqwr6mpptzo/p6uh+bpdbe="; $parts = str_split($str, strlen($str)/3+1); print_r($parts); ?> the output is array ( [0] => q5vrfsc+6rs08jl [1] => vwdmc/sqwr6mppt [2] => zo/p6uh+bpdbe= ) pls me this should work you: $str = "q5vrfsc+6rs08jlvwdmc/sqwr6mpptzo/p6uh+bpdbe="; $parts = str_split($str, strlen($str)/3+1); echo "a = " . $a = $parts[0] . "<br />"; echo "b = " . $b = $parts[1] . "<br />"; echo "c = " . $c = $parts[2] . "<br />"; output: a = q5vrfsc+6rs08jl b = vwdmc/sqwr6mppt c = zo/p6uh+bpdbe= with code can output $a , $b , $c , single parts of string

php - how to replace and add style into specific tag -

i have problem. can't replace , add inline style css. have input: <p style="text-align: justify;"><span style="font-size: 11pt;">hello world<br /></span></p> <p id="tem" style="text-align: justify;">test</p> <p >&nbsp;</p> <p>&nbsp;</p> and want output: <p style="text-align: justify;margin:0;"><span style="font-size: 11pt;">hello world<br /></span></p> <p id="tem" style="text-align: justify;margin:0;">test</p> <p style="margin:0;">&nbsp;</p> <p style="margin:0;">&nbsp;</p> i have tried way demo $re = "/(<p[^>]+\")([^>\"]+)/miu"; $str = "<p id=\"tem\" style=\"text-align: justify;\"><span style=\"font-size: 11pt;\">hello world<br /><

php - How to access language file inside config? -

how can use language file inside config.php php codeigniter? searched find solution out side config can set item in config use language file setting config item value, how can set config item using language file inside config file? example want bellow: $config['item'] = array( '1' => $ci->lang->line('my_name') ); you use wrong way. try make view function in config file. can make in template or may in model. you should change application architecture.

razor - Poll an azure queue and update view when data arrives in queue Asp.net Mvc4 -

i have scenario request sent service via client response comes inside message queue in azure, how can poll queue @ client end , update view when response comes have update label when data recieved in queue. azure has 2 types of queues - azure queue , service bus queue . although in theory can access them client side (i assume javascript) because cors has been introduced time ago (not sure cors support servicebusqueue), might not best option. problems might face: lot's of clients trying process messages (locking , releasing), azure queue not support sessions have either create queue per client or use service bus queue (as said earlier not sure cors) sessions what should happen when client not online anymore? message stays in queue? till when? expiration? different approach you can message processing on server , notify user change using singlalr. gives better flexibility (one message can trigger notification many users etc). signalr scaleout azure service

node.js - npm not istalled in ubentu 12.04 LTS -

pp@pp-desktop:~$ sudo apt-get install npm reading package lists... done building dependency tree reading state information... done packages not installed. may mean have requested impossible situation or if using unstable distribution required packages have not yet been created or been moved out of incoming. following information may resolve situation: the following packages have unmet dependencies: npm : depends: nodejs not going installed depends: nodejs-dev depends: node-request not going installed depends: node-mkdirp not going installed depends: node-minimatch not going installed depends: node-semver not going installed depends: node-ini not going installed depends: node-graceful-fs not going installed depends: node-abbrev not going installed depends: node-nopt not going installed depends: node-fstream not going installed depends: node-rimraf not going installed depends: node-tar not going

ios - HMCharacteristicWriteAction what to pass for targetValue -

in homekit code is hmaction *myaction = [[hmcharacteristicwriteaction alloc] initwithcharacteristic:[[lightbulbservice characteristics] objectatindex:0] targetvalue:characteristicvalue]; hmcharacteristicwriteaction have method initwithcharacterstic requried 2 parameter 1) initwithcharacteristic need pass, hmservice object. 2) targetvalue, need pass targetvalue ? i need know is, target value characteristic ? the target value depends on characteristic writing. lightbulb may support characteristics such as hmcharacteristictypehue - integer 0-360 (degrees) hmcharacteristictypesaturation - integer 0 - 100 (percentage) hmcharacteristictypebrightness - integer 0 - 100 (percentage). hmcharacteristictypepowerstate - boolean on or off. you can pretty guarantee lightbulb support hmcharacteristictypepowerstate . others maybe not. lightbulb can support additional characteristics, defined manufacturer - strobe might support 'blink rate' characteristi

video - IMFByteStream QueryInterface to get IMFAttributes -

i wanted open video file using imfsourceresolver returned byte stream type of given url unsupported. did open video irandomaccessstream , convert imfbytestream , use createobjectfrombytestream() imfmediasource . according link createobjectfrombytestream says if mf_e_unsupported_bytestream_type returned specify mime type setting mf_bytestream_content_type attribute on byte stream. link mf_bytestream_content_type says attribute value, query byte stream object imfattributes interface. not figure out how that. is possible imfattribute interface imfbytestream ? if how? , should values mf_bytestream_content_type ? from msdn ( http://msdn.microsoft.com/en-us/library/windows/desktop/aa374773%28v=vs.85%29.aspx ) to find out whether byte stream supports attributes, query byte stream object imfattributes interface. according info, byte-streams support imfattributes , others don't. if query imfbytestream imfattributes , returns e_nointerface mean yours

Android: Register another app as mediaButtonEvenReceiver -

in android, possible register app receiver media button events? for example, want start playing music google play music programmatically (ie: without leaving app , launching google play music). i've tried: componentname myeventreceiver = new componentname("com.google.android.music", "com.google.android.music.mediabuttonintentreceiver"); audiomanager myaudiomanager = (audiomanager) getsystemservice(context.audio_service); myaudiomanager.registermediabuttoneventreceiver(myeventreceiver); // build pendingintent remote control client intent mediabuttonintent = new intent(intent.action_media_button); mediabuttonintent.setcomponent(myeventreceiver); pendingintent mediapendingintent = pendingintent.getbroadcast(getapplicationcontext(), 0, mediabuttonintent, 0); // create , register remote control client remotecontrolclient myremotecontrolclient = new remotecontrolclient(mediapendingintent); myaudiomanager.registerremotecontrolclient(myremotecontrolclient); i

google chrome - Expect to send the Ctrl+A to the browser -

i want start google-chrome , send ctrl+a chrome process, begin recording screencastify. have set shortcut key screencastify ctrl+a. following code snippet have used: !#!/usr/bin/expect spawn google-chrome --new-window <url> send "\x01"; interact the ctrl+a not triggering recording on browser. expect cannot work gui programs chrome. so, used xdotool .

java - How To Receive JSON Data In Cross Origin Resource Sharing (CORS) with Spring REST -

i trying send / receive json data from / to controller class in project. the controller class of project follows : @requestmapping(value = "/dummy/",method = requestmethod.post,headers="accept=application/json") public response getdummyjson() { /* method 2: getting dummy json data file , sending json object */ jsonparser parser = new jsonparser(); jsonobject jsonobject = null; try { object obj = parser.parse(new filereader("d:\\jsonstruc.json")); jsonobject = (jsonobject) obj; } catch (exception e) { system.out.println("error parsing: - "); } return response.status(200).entity(jsonobject).build(); } @requestmapping(value = "/insert/dummy/",method= requestmethod.post,headers="accept=application/json") public response setdummyjson(@requestbody jsonobject inputjsonobj){ /*step 1: display json data sent angularjs */ system.out

android - Type mismatch: cannot convert from FragmentOne to Fragment when create FragmentOne in seperate class? -

when fragment fr=new fragmentone(); gives me error if create fragmentone() class in same activity not give error when create fragmentone() out side of activity gives me error public class mainactivity extends actionbaractivity implements navigationdrawerfragment.navigationdrawercallbacks { /** * fragment managing behaviors, interactions , presentation of * navigation drawer. */ private navigationdrawerfragment mnavigationdrawerfragment; /** * used store last screen title. use in * {@link #restoreactionbar()}. */ private charsequence mtitle; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); mnavigationdrawerfragment = (navigationdrawerfragment) getsupportfragmentmanager() .findfragmentbyid(r.id.navigation_drawer); mtitle = gettitle(); // set drawer. mnavigationdraw

android - How to find a toast belonging -

when using android phone (home screen). toast string popup somehow. how can find apps did it? i checked log , can not find it. i checked apps running, much. directly can't, there way may enables achieve that, @ first there's no way know app launched toast, can know package launched toast, can listen toasts displayed , know it's contents using accessibility service info class , listen notification_state_changed : accessibilityserviceinfo info = new accessibilityserviceinfo(); info.eventtypes = accessibilityevent.type_notification_state_changed; // notify when notification happens then using accessibilityevent event type , if it's toast can package name of it's source may enables figure out what's app fires : accessibilityevent.geteventtype(); accessibilityevent.getpackagename():

ruby on rails - Neo4j gem - Querying multiple parameters in one property -

i'm not sure if title best description. i'm building basic filtering capabilities via form events. events have category select drop down. now when want filter, can select via checkboxes categories want display. i'm bit stumped how that. possible in 1 query? or separate 1 each category? my old query current_user.friends.events(:event, :rel).where("rel.admin = {admin_p} , event.detail = {detail_p}").params(admin_p: true, detail_p: true).pluck(:event) in case, need event.category = category1, category2, cateogry3 . isn't how it's written. ways achieve this? in cypher, in lets match results within array. match (u:user)-[r1:invited_to]->(e:event) e.uuid in [1, 2, 3, 4, 5] return e that match events of uuid properties in array. in ruby gem, handled automatically in queryproxy if use array in method. current_user.events.where(category: [1, 2, 3, 4, 5]) in form, ensure each checkbox's value corresponds id. put ids array , se

jquery - MVC4 Post Form with Image64 -

i'm trying post generated image not in ajax. problem param set null @ server side. here action : [httppost] public actionresult downloadimagedirect(string dataurl) { var url = dataurl.tostring().substring(dataurl.tostring().indexof(",") + 1); var image = convert.frombase64string(url); return base.file(image, "image/png", "pere_noel.png"); } here form : <form id="imgdownload" target="_blank" action="/home/downloadimagedirect" method="post"> <input type="hidden" id="dataurl" /> </form> and here javascript : yesbutton.on('tap click', function () { var finalurl = mykineticjsgroup.todataurl({ x: centerelem(rect.getwidth(), cadreimg).x, y: centerelem(rect.getheight(), cadreimg).y, width: centerelem(rect.getwidth(), cadreimg).width, height:

oracleforms - how to save .fmx file (oracle forms) deployed on a website -

is there way save oracle forms(3-tier) .fmx file running server, accessed using web browser.. what getting tags containing .fmx file location . on accessing files .fmx running. need dump of .fmx following code received browser: <!-- forms applet definition (start) --> <object classid="clsid:cafecafe-0013-0001-0022-abcdefabcdef" codebase="/forms/jinitiator/jinit.exe#version=1,3,1,22" width="800" height="600" hspace="0" vspace="0"> <param name="type" value="application/x-jinit-applet;version=1.3.1.22"> <param name="codebase" value="/forms/java"> <param name="code" value="oracle.forms.engine.main" > <param name="archive" value="frmall_jinit.jar,jcalendarjinit.jar,jcalendar.jar,jacob.jar,frmwebutil.jar,icons.jar" > <param name="serverurl"

java - How to allow specific requests when using spring-security -

i've scenario need let request (let's request method get) no 401 error can thrown. below spring security configuration: @configuration @enablewebsecurity public class securityconfiguration extends websecurityconfigureradapter { @override public void configure(websecurity web) throws exception { web.ignoring() .antmatchers("/bower_components/**") .antmatchers("/fonts/**") .antmatchers("/images/**") .antmatchers("/scripts/**") .antmatchers("/styles/**") .antmatchers("/views/**") .antmatchers("/i18n/**") .antmatchers("/swagger-ui/**") .antmatchers("/app/rest/register") .antmatchers("/app/rest/activate"); } } and resourceserverconfigureradapter implementation: how can allow requests?

plsql - Decode with alias name in cursor -

i want use decode function in cursor alias names avoid column ambiguity used below approach. i have code such as: declare cl number; cursor c select c1.rowid,c1.col1, decode(c1.col2, 'xyz', c1.col3, 10) cl table1 d,table2 c1 c1.process_id=13525 , d.col3(+)=cl; begin rec in c loop dbms_output.put_line(nvl(rec.cl,'-1')); end loop; end; in this, when fire query removing condition 'and d.col3(+)=cl' retrieve me data value of 'cl' . when assign condtion not retrive data , not go in loop of cursor.i have matching data in d.col3. suppose if cl 5 present in d.col3 should give me data did because need remove duplicate records.because single condition duplicate records.here col3 in d table primary key. so not getting why not go in loop gets value query. you can't use alias in where clause: using alias in clause in such cases, sub-query or cte might help. like (untested!): with

javascript - display values on a textbox when click one from a jquery result with php -

when select date html5 date field, appear list of available vehicles date.i used jquery $.post retrive data. need select 1 of vehicle number , driver id list , diplay values in text fields in same form without refreshing form. <script type="text/javascript"> $(document).ready(function(){ //send data process if vehicles available selected date input $('#odate').change(function(){ var cdate=$(this).val(); $.post('searchexistingdrivers.php',{dates:cdate}, function(data) { $('#odateinfo').slidedown(300); $('#odateinfo').html(data); //alert(data); }); }); $('a').click(function(){ var id = $(this).attr('id'); //fetch vehicle number var parent = $(this).parent(); parent.slideup('slow', function() {$(this).remove();})

jquery - Getting error while detect chrome extension installed or not using javascript -

here code, var myextension = chrome.management.get( "my_extention_id" ); if (myextension.enabled) { // installed } else { ... } source : http://developer.chrome.com/extensions/management.html#method-get have tried method. i'm getting following error: uncaught typeerror: cannot read property 'get' of undefined if it's undefined you're missing management declaration in manifest: "permissions": [ "management" ], source

javascript - Firefox makes weird things on event modification -

i've done little keydown event modification 2d 'framework'. window.addeventlistener('keydown', function(e) { e = e || window.event; e.key = that.keycodetokeyname[e.keycode]; fireevent('keydown', e); }); where that.keycodetokeyname is that.keycodetokeyname = {8: 'backspace', 9: 'tab', 13: 'enter', 16: 'shift', 17: 'ctrl', 18: 'alt', 19: 'pause', 20: 'capslock', 27: 'esc', 32: 'space', 33: 'pageup', 34: 'pagedown', 35: 'end', 36: 'home', 37: 'left', 38: 'up', 39: 'right', 40: 'down', 45: 'insert', 46: 'delete', 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5', 54: '6', 55: '7', 56: '8', 57: '9', 65: 'a', 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 7

asp.net mvc - System.Web.MVC.HtmlHelper Ambiguous Issue -

i have asp.net mvc application. inside views, can't use extension methods labelfor<>, textboxfor<>. have got error this: (ambiguous name -- choose following:) system.web.webpages.html.htmlhelper system.web.mvc.htmlhelper how can fix this? edit: views/web.config: <?xml version="1.0"?> <configuration> <configsections> <sectiongroup name="system.web.webpages.razor" type="system.web.webpages.razor.configuration.razorwebsectiongroup, system.web.webpages.razor, version=2.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35"> <section name="host" type="system.web.webpages.razor.configuration.hostsection, system.web.webpages.razor, version=2.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" requirepermission="false" /> <section name="pages" type="system.web.webpages.razor.configuration.razorpagessection, system.web.webpages.razor,

nginx - Compile Lua scripts used on OpenResty -

i'm using openresty + lua several projects, , flexibility lua gives me, in fact wrote micro-web apps directly in lua scripts, served nginx-openresty. but, if want distribute web app, lua code should either "plain" or, @ least, obfuscated. instead, considering luajit i'm using compiles lua native code, possible pre-compile lua scripts native code (not lua .o object files), , load them in openresty, instead of direct .lua source files? nope. there's no way compile luajit code machine code. doesn't work way, 2 main reasons: luajit selects traces compile based on how ran @ runtime. means generated traces can change depending on data being processed (ex. different if branches can compiled depending on 1 taken more often). thus, it's impossible precompile them ahead of time. some operations cannot compiled, because hasn't been implemented yet (ex. closure creation), not ever in areas worth optimizing (ex. require ), or because it's

c++ - How to delete a STXXL priority queue? -

i created stxxl priority queue in program. if not need pq more, how delete it? delete[] buffer in c++. want free memory used it. i looked through their examples , description , cannot find way. once pq created, memory occupied pq until end of program? for example, if define 2 priority queues: q1 , q2. typedef stxxl::priority_queue_generator < sufnode<unsigned char>, comparatorgreater<unsigned char>, mem*1024*1024, 1024*1024 >::result pqueue_type0; pqueue_type0 q1(pool1); then q1, delete it, can allocate more memory q2. typedef stxxl::priority_queue_generator< sufnode<unsigned char>, comparatorgreater2<unsigned char>, mem*1024*1024, 1024*1024 >::result pqueue_type20; pqueue_type20 q2(pool2); when q1 goes out of scope, it's memory automatically freed. don't put in 1 big function. put q1 , things in 1 function, , q2 in function. the biggest problem if q1 needed create q2, , q2 needed create q3, e

Android - adjust scrollview when keyboard is up for android 5.0 (lollipop) -

i have problem on android lollipop, screen doesn't adjust size when softkeyboard comes up. this manifest intro example 1 of activity made: android:windowsoftinputmode="statealwayshidden|adjustresize" is there new added , have take account android 5.0 ? scrollview works fine on android < 5.0. the problem didn't work translucent status bar , had set android:fitssystemwindows="true" in main layout

android - Lollipop transitions - Fragment to Activity -

Image
i trying figure out how activity(or fragment??) transitions in lollipop. using appcompat v7 - v21. here scenario: when item in gridview(inside fragment) clicked, wish image make transition in link here . how achieve it? , there way can using styles? , if through code, can have sample of how fragment activity? [edit] this achieved till now: styles.xml: values-v21 <?xml version="1.0" encoding="utf-8"?> <resources> <style name="appbasetheme" parent="theme.appcompat.light.darkactionbar"> <!-- api 21 theme customizations can go here. --> <item name="windowactionbar">false</item> <item name="android:colorprimary">@color/dark_grey</item> <item name="android:colorprimarydark">@color/dark_grey</item> <item name="android:coloraccent">@color/dark_grey</item> <item name=&quo

c# - How to trim class members? -

i have 2 classes like: class customer { string name; string address; string phone; } class company { string name; string taxid; } if trim every class member 1 method, how on way? for example: customer.name = "aaa " customer.address = "city1 " customer.phone = " 999 " i want remove space, like: customer.name = "aaa" customer.address = "city1" customer.phone = "999" public static class stringhelper { /// <summary>trim string properties of given object</summary> public static tself trimstringproperties<tself>(this tself input) { if (input == null) return input; var stringproperties = typeof(tself).getproperties() .where(p => p.propertytype == typeof(string)); foreach (var stringproperty in stringproperties) { string currentvalue = (string)stringproperty.getvalue(input, null);

c# - Regex for matching attribute values in invalid xml file -

i have invalid xml's ( < > & "" characters inside attribute value). need parse them correct xml file in c#. the way can think of escaping invalid characters inside attributes. works fine < > , & (&lt ;, &gt ;, &amp ;). have problems detecting , changing "" inside attributes. right using regex matching attribute values: /="(.*?)" my test case this: <add sqlquery="select blaat test count == "1"" test="dfsdf"/> <add sqlquery="select blaat test count == "1"" test="dfsdf" /> <add sqlquery="select blaat test count == "1" , blaat > 3" test="dfsdf"/> <add xmldiff_action="movenodefrom('1')" alias="jkhkjh" /> <add xmldiff_action="movenodefrom('1')" /> regex test link not greedy as can see in test matching stops @ quote "1"" if cha

How can I resolve the error in Transit mode code of Google Map in PHP -

hey freineds code of google map in php working other modes of travel(driving,walking, bycycling )other transit mode.i found mistake in calculating time taken reach desttination . code in php : <?php $infos = json_decode(file_get_contents('http://maps.googleapis.com/maps/api/distancematrix/json?origins=guildford,+surrey&destinations=embankment,+london&mode=walking')); print_r($infos->rows[0]->elements[0]->duration); ?> please me freinds. there no transit mode in google distance matrix api. mode — specifies mode of transport use when calculating directions. valid values are : driving (default) indicates standard driving directions using road network. walking requests walking directions via pedestrian paths & sidewalks (where available). bicycling requests bicycling directions via bicycle paths & preferred streets (currently available in , canadian cities). https://developers.google.com/maps

Soundcloud Javascript API: can't disable visual player -

i'm having issue soundcloud javscript api cannot seem turn off visual player (the artwork image shows background) in order have artwork image show small square image left of player instead of background image. i've tried in setting parameters nothing seems disable visual player (i can change height, turn off comments, etc...). here's code: sc.get("/users/"+slt.userid+"/tracks", {limit: slt.tracks, offset : ((trackpage-1)*slt.tracks), visual: false, show_artwork: false }, function(tracks){ (var = 0; < slt.tracks; i++) { if ( tracks[i] !== undefined ) { var track = tracks[i]; } sc.oembed(track.uri, { maxheight: slt.maxheight, show_comments: slt.show_comments, show_user: true, show_artwork: false, visual: false}, document.getelementbyid(("slt-track-"+_trackcount))); } } }); any appreciated!!! thanks! answering own question

sql server - SQL Query returns comma separated data -

i running below query through ms query on odbc connection: select oa_cstexpbal_0.costcentre, oa_cstexpbal_0.expensecode, oa_cstexpbal_0.yearno, oa_cstexpbal_0.baltype, oa_cstexpbal_0.openbal, oa_cstexpbal_0.periodbal openacc.pub.oa_cstexpbal oa_cstexpbal_0 (oa_cstexpbal_0.yearno='2016') , (oa_cstexpbal_0.baltype='av') and returns below data 1 column periodbal: 406186.06;317084.39;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0 is there way can separate out periodbal data stop coming through comma separated? i connecting sql 2008 db call openacc.pub , using original query pull through data. column retuning ; periodbal. when dumped excel can corrected through text columns ideally want try , in query (if possible). assuming use ms sql server want split data separated semicolon in column rows handle them in sql. if correct, need split them. sql server can not default have various way so. see post http://sqlperformance.com/2012/07/t-sql-queries/spli

What is the Groovy truth of an empty closure? -

i trying predict behavior of code in groovy userlist.find { } .find documentation when find method invoked , passed closure returns first element evaluates closure groovies understanding of true . when find method called without parameters returns first object in list matches true according groovy truth. what happens if empty closure used? will evaluate true , first element of list returned? will evaluate false , after iterating on list null returned? will behave .find() ? from groovy closures formal definition ( alternative source ): closures have return value. value may specified via 1 or more explicit return statement in closure body, or value of last executed statement if return not explicitly specified. if last executed statement has no value (for example, if last statement call void method), null returned. and groovy truth object references non-null object references coerced true. ... assert !null that suggests me truth of

java - Reloading android view in a fragment -

i'm using android eclipse while working on project user can save , upload notes images. i have fragment holds textview , thumbnail images. user can add additional images using camera , can remove images viewing(clicking) image (in separate activity) , deleting it. my problem refreshing layout of fragment reflect deleted image. following function being called deal this: public viewgroup removenoteimagefromview(string location) { list<string> imagelinks = new arraylist<string>(); (string string : imagelocations) { if (string.equalsignorecase(location)) { break; } imagelinks.add(string); } //remove imageviews linear layout linearlayout linear = (linearlayout) rootview.findviewbyid(r.id.imagecontainer); if (linear.getchildcount() != 0) { linear.removeallviewsinlayout(); linear.refreshdrawablestate(); linear.postinvalidate(); } imagelocations.addall(imageli

c# - Live Filtering in DataGrid using TextBox -

ihave textbox , datagrid. when type in in textbox, want filter data in datagrid. i have done below mentioned code: in xaml: <collectionviewsource x:key="groupsviewsource" source="{binding groups, updatesourcetrigger=propertychanged}" filter="collectionviewsource_filter"> <collectionviewsource.sortdescriptions> <scm:sortdescription propertyname="groupname"/> </collectionviewsource.sortdescriptions> </collectionviewsource> <datagrid grid.row="5" grid.column="1" itemssource="{binding source={staticresource groupsviewsource}}" selecteditem="{binding selectedgroup}" autogeneratecolumns="false" canuseraddrows="false" selectionmode="single" selectionunit="fullrow" enablerowvirtualization="false" virtualizingpanel.iscontainervirtualizable="false" rowedite

Error:Attribute "android:orientation" has already been defined -

i have added "viewpagerindicator" library , "com.android.support:gridlayout-v7:21.0.0" dependance in project . both of them has declare 'orientation' attribute in 'viewpagerindicator' library written - <declare-styleable name="circlepageindicator"> <attr name="android:orientation"> </declare-styleable> i getting above error how can resolve this. try use @ build.gradle compile 'fr.baloomba:viewpagerindicator:2.4.2' see more details @ http://mvnrepository.com/artifact/fr.baloomba/viewpagerindicator/2.4.2

java - How can I specify exact rhino implementation instead of that embedded to JDK? -

i use rhino script in application. found on different environments works different. example, on open-jdk code doesn't work eval("json.stringify({id:1})") whereas on oracle's jdk works. this because each jdk contains it's own implementation of rhino. i added following dependencies: <dependency> <groupid>org.mozilla</groupid> <artifactid>rhino</artifactid> <version>1.7r4</version> </dependency> how can specify use implementation ? update : call rhino not directly through javax.script api new scriptenginemanager().getenginebyname("javascript").eval("json.stringify({})") you need implementation of javax.script.scriptengine uses uses package org.mozilla.javascript , rather jdk's implementation, uses repackaged sun.org.mozilla.javascript.internal . de.christophkraemer:rhino-script-engine such implementation, borrowed openjdk source. more details here .

ios - Replace extension of a filename in swift -

given string format filename.fileextension want replace fileextension newextension . how can it? in java be foo.substring(0, foo.lastindexof(".")) + ".newextension" stringbyappendingpathextension no longer works in swift 2.0 (if using string ). does still work nsstring . can do: var storepath = (nssearchpathfordirectoriesindomains(.documentdirectory , .userdomainmask, true)[0]) nsstring storepath = storepath.stringbyappendingpathextension("model.sqlite")!

c - Making calculator in yacc and lex char array -

i'm working yacc , lex, , have problem something. i working on caluclator. calculator can : example: user: = 1+3 user: calc: 4 problem is, can 1 character. want maximum 3 characters. example: user: abc = 1+3 user: abc calc: 4 also want add more. my code works : user: abc = 1+3 user: abc calc: 4 user: ab calc: 4 /* because scan first character */ user: calc: 4 /* because scan first character */ part of code connecting problem : -yacc %{ int symbolval(char symbol); void updatesymbolval(char symbol, int val); %} %union {double num; char id;} %token <id> identifier %type <id> assignment %% assignment : identifier equals exp { updatesymbolval($1, $3); } term : /*something */ | identifier { $$ = symbolval($1); } %% /* c code */ int symbolval(char symbol) { int bucker = computesymbolindex(symbol); return symbols[bucket]; } void updatesymbolval(char symbol,int val) { int bucket = computesymbolindex(symbol);

angularjs - How to fix this expression -

i trying print multiple * based on rating value. in javascript console array(10).join('*') produces 10 stars. when using in angularjs view, expression not evaluated. missing something? <div data-ng-controller="skillscontroller"> <ul> <li data-ng-repeat="skill in skills">{{skill.name}} - {{array(skill.rating).join('*')}}</li> </ul> </div> app.js app.controller('skillscontroller', function($scope){ $scope.skills = [ { name: 'ruby', rating: 5 }, { name: 'java', rating: 10} ]; }) array not part of $scope. can following in controller. app.controller('skillscontroller', function($scope){ $scope.skills = [ { name: 'ruby', rating: 5 }, { name: 'java', rating: 10} ]; $scope.array = array; }); i transformation in filter or directive. app.filter('stars', function() { return function(i

f# - SqlDataConnection type provider - setting database connection string with script parameter -

the normal way of using sqldataconnection type provider follows: type dbschema = sqldataconnection<"data source=myserver\instance;initialcatalog=mydatabase;integrated security=sspi;"> let db = dbschema.getdatacontext() however have problem want use type provider in f# script connection string database passed parameter. this: let connectionstring= array.get args 1 type dbschema = sqldataconnection<connectionstring> however gives error "this not constant expression or valid custom attribute value" is there way this? unfortunately there's no way this, type provider requires compile time literal string. when you're compiling application, type provider's able connect , retrieve metadata database , generate types compiler. can choose extract out connection string string literal writing in form [<literal>] let connstring = "data source=..." type dbschema = sqldataconnection<connstring> assuming 2 dat

php - javascript S.get to check already exist data -

this question has answer here: how return response asynchronous call? 24 answers the following function used check value present in table or not.all other database related process ok here in given function give me alert of existing value submit form.but want when matches same value in table .the form cant submited.i cant find problem in given code please held tried out using post not working.thanks function validateeditbranch() { var branch_city = document.forms['e_branch_form']['e_branch_city'].value; branch_city=branch_city.trim(); if(branch_city == "" ){ alert("please, enter branch city"); document.forms['e_branch_form']['e_branch_city'].value=''; return false; }else { $.get("?action=database_manage&am

Cordova and Jquery Post to codeigniter RESTapi -

i'm making cordova application. made 2 simple form login , register. use jquery post data ci's controller ( http://example.com/api/register example) everythings works fine until try validate data ci. if($this->form_validation->run() == false) { // code } i tried use form_validation library seems use properly, need load form in codeigniter first. problem here, can't load form in ci because i'm in cordova application. how can use ci form_validation library without loading form first? thank help.

javascript - Internal Server Error when response text from ajax POST call is big -

i using ajax call following: $(function () { $.ajax({ type: 'post', url: 'frmhistoryreportfinal.aspx/getdatatable', data: json_data, contenttype: 'application/json;charset=utf-8', datatype: 'json', success: function (responsetext) { if (responsetext.d == "") return; parseddata = json.parse(responsetext.d); alert(parseddata); count = 0; }, error: function (xhr, textstatus, errorthrown) { //process error alert(xhr); alert(textstatus); alert(errorthrown); } }); }); when have small set of data returned c# codebehind. ajax call functions well. when have json string larger data, 200 records returned ajax call gives error("internal server error"). please me resolve issue need handle large datasets.

html - Div background won't display with nested children -

i'm trying create first website, , i'm wanting make section in recent posts on left, , sidebar on right. i'm not having problems positioning them problem main div isn't drawing background it. if put raw-text in div, draw background correctly raw-text, not of <div> 's inside of it. please note, in code snipit text white, , body has black background, page-content div supposed have grey background #666 it's not showing up. body { background: #000; } /* page content */ #page-content { background:#666; color: #fff; opacity: .8; } #recent-updates { width: 75%; float: left; } #sidebar-right { width: 25%; float: right; } <html> <body> <div id='page-content'> <div id='recent-updates'> oneoneoneoneoneoneone </div> <!-- recent-updates --> <div id='sidebar-right'> twotwot

sql - Comparing value in a table vs count of rows in other table -

i have 2 tables (primary key - unit_id) , b (primary key - unit_id) i have value (eg :4 ) in table , has unit_id. i have 4 rows in table b same unit id i have write sql query check whether value in table matches count (rows) in table b same unit_id you can use inner join , see how many values table in table b : select a.unit_id table1 inner join table2 b on a.unit_id = b.unit_id im assumin need , because @stanislavl pointed out, cant have more 1 unique unit_id in each table.

Upload file more than 4GB by jquery to asp.net MVC -

im working on asp mvc application . in application want upload file more 4gb or 5 gb server side jquery cant upload more 6mg . 1 me! above code application this settings 1gb, can adjust value upon request in web config <system.web> <httpruntime maxrequestlength="1048576" /> ... <system.webserver> <security> <requestfiltering> <requestlimits maxallowedcontentlength="1073741824" /> </requestfiltering> </security> maxrequestlength in kb maxallowedcontentlength in byte

.net - Using TransactionScope to time out regular (non db related) c# code -

i trying use transactionscope class put specific timeout code execution. more specifically, static void main(string[] args) { int counter = 0; try { using (var scope = new transactionscope(transactionscopeoption.required, new timespan(0, 0, 5))) { (int = 0; < 50000; i++) { console.writeline("counter : {0}", counter); counter++; thread.sleep(100); } scope.complete(); } } catch (exception ex) { console.writeline("exception : {0}", ex); } } after reading transactionscope , expect above code block in using statement aborted in 5 seconds. but not behave so. loop continues proceed irrespective of transaction timeout (which did not expect). execution of loop ends when = 50000 , below exception after using state

php - preg_replace replacing html tags -

so i have code : $wzor = '/^<span class=\"person\">(.*?)</span>/'; $text = str_replace($wzor, '', $text); i want remove spans class person text code doesn't work my input like: <ul> <li><span class="label">spółdzielnia socjalna giełda pracy</span><span class="person">0zł brutto</span></li> </ul> <ul> <li><span class="label">loyd spÓŁka akcyjna</span><span class="person">0zł brutto</span></li> </ul> <ul> <li><span class="label">loyd 8 sp. z o.o.</span><span class="person">0zł brutto</span></li> <li><span class="label">loyd 1 sp. z o.o.</span><span class="person">0zł brutto</span></li> <li><span class="label">loyd 7 sp. z o.o.</span><

angularjs - Angular App clear user browser cache programmatically‏ -

this question has answer here: clear cache in javascript 15 answers is there way, can clear views , scripts cached in user browser after interval (eg: after 2 hrs) don't need clear cache manually. think, it's application may require when there changes made on production user don't see updates until clear browser cache. suggestion, please? you'll have involve server, @ end of every 1 of scripts/partials/css attach datetime updates every 2 hours (or whatever interval want) so include angular this: <script type="text/javascript" src=".../angular.js?12345"></script> then hour later server change time this: <script type="text/javascript" src=".../angular.js?12346"></script> or want it, force user go new data.

jquery - Making actions appears in JQGrid only when a boolean is true -

Image
i have data displayed in jqgrid, , actions column, have icons delete , edit actions. in data retrieve display in grid, have boolean, , display icons when boolean true. how done? here piece of code of jqgrid display: jquery("#datagrid").jqgrid({ stateoptions: getstateoptions("creation-site"), url: listurl, datatype: "json", loaderror: viewerror, colnames: ['', 'nom', 'n de dépôt geopost', 'iata', 'groupe id', 'site de rattachement', 'poste comptable', 'centre cout', 'description'], colmodel: [ {name: 'myac', width: 80, fixed: true, sortable: false, resize: false, formatter: 'actions', formatoptions: {keys: true, editbutton: true, }}, {name: 'nom', index: 'nom', editable: true, edittype: "text", sortable: true}, {name: 'geopostdepotnumber', index: