Posts

Showing posts from May, 2012

class - how to get multiple screen data and submit from final screen in android? -

i have 5 screens homedetails,addressdetails,officedetails, positiondetails,applydetails. these details submit applydetails class. here doubt is, when click submit button in applydetails class, send classes information server. how can homedetails,addressdetails,officedetails,positiondetails data in applydetails class. you can save data using sharedpreferences. for ex. wanna save string in mainactivity class sp = getsharedpreferences("savedata", 0); sharedpreferences.editor ed = sp.edit(); ed.putstring("string1", stringtobesent); ed.commit(); now retrieve in class use sp = getsharedpreferences("savedata", 0); string retrievedstring = sp.getstring("string1","");

How to detect repeated values in array of integer and create a new one with them in java? -

everybody, thankful if me in question. point have initial array "a" bunch of numbers, of them can repeat many times, of them - once. task create new array "b" consists of repeated numbers. if number array "a" repeats more once - in array "b" must reflected once. sequence of elements in new array shoulb same in initial. instance: *initial array "a": 2 3 3 4 5 6 9 2 7 3 3 new array "b": 2 3* i have decided generate array "a" randomly every time, it's without difficulties, regards defining repretitions have problems. thing have done found repeated numbers.and result have right *initial array "a": 2 3 3 4 5 6 9 2 7 3 3 new array "b": 2 3 3 3* my code: import java.util.*; public class processingtool { public static int[] arraycreatingmethod(){ random rand = new random(); int myarraydim = rand.nextint(50); int [] myarray = new int [myarraydim]; (in

best css framework for all types of websites -

i know best css framework use types of responsive non responsive websites ecommerce, crm, real estate , many more? bootstrap, gumby ,yaml, 960 grid or blueprint css, 1 best create new theme or modify themes created? this opinion-based question, , closed off-topic or broad. there no definitive answer 'which best?', come down whichever one's best suited needs. if want opinion though, choose bootstrap. because it's 1 i've used out of 3 examples in list.

angular ui grid - How to acces sorted, paged and filtered data from a UIGrid -

i want access filtered , sorted rows if hidden in different pages. the line below works long i'm not using pagination $scope.gridapi.core.getvisiblerows($scope.gridapi.grid) and can access rows using following lines in case, rows not sorted correctly. var myrows = []; angular.foreach($scope.gridapi.grid.rows,function(v,k){ if(v.visible) myrows.push(v); }); is there simple enough solution this?

json - Set request headers for Rspec and Rack::Test in Ruby on Rails -

i'm trying test login , logout json endpoints application using rspec. using devise , devise_token_auth gems in order build json endpoints authentication. i can log user in, when logging out there needs several request headers present logout function find correct user , complete. i've tried add headers current rack session, seems drop them when request created . here code far: helper method ( spec/support/api_helper.rb ): def login_user user = create(:user) post '/api/v1/auth/sign_in', email: user.email, password: user.password, format: :json return { 'token-type' => 'bearer', 'uid' => last_response.headers['uid'], 'access-token' => last_response.headers['access-token'], 'client' => last_response.headers['client'], 'expiry' => last_response.headers['expiry'

ios - Watchkit upload invalid bundle -

Image
from today (04/01) watchkit apps can uploaded. following message when uploading (also using application loader): anybody else well? i had same issue, solved changing iphoneos_deployment_target = 8.0; iphoneos_deployment_target = 8.2; in project file (your_app.xcodeproj > project.pbxproj) infoplist_file = "your_app watchkit extension/info.plist »;.

php - i want to use left and inner join in 3 tables in mysql? -

these tables. first 1 appusers table. create table if not exists `appusers` ( `id` int(11) unsigned not null auto_increment, `email` varchar(50) not null, `is_active` tinyint(2) not null default '0', `zip` varchar(20) not null, `city` text not null, `country` text not null, `created` timestamp not null default current_timestamp on update current_timestamp, primary key (`id`) ) engine=innodb default charset=latin1 auto_increment=23 ; second table stickeruses table. create table if not exists `stickeruses` ( `id` int(11) not null auto_increment, `user_id` int(11) not null, `sticker_id` int(11) not null, `count` int(11) not null, primary key (`id`) ) engine=innodb default charset=latin1 auto_increment=24 ; third table devices create table if not exists `devices` ( `id` int(11) not null auto_increment, `user_id` int(11) not null, `regid` varchar(300) not null, `imei` varchar(50) not null, `device_type` tinyint(2) not null, `notification` tinyint(2) not null default

java - Charset in JTextPane which using AdvancedRTFEditorKit -

Image
i'm having problems charset encodings. i'm using advancedrtfeditorkit (free closed source library: http://java-sl.com/advanced_rtf_editor_kit.html ). if copy special characters (ěščřžýáíé) ms word , paste them sample delivered advancedrtfeditorkit library, works fine. if same simple sscce uses advancedrtfeditorkit, appear rectangles. know i'm doing wrong? this problem occurs ms office products. libreoffice works fine. my sscce: public static void main(string[] args) { jframe frame = new jframe(); frame.setsize(350, 300); frame.setdefaultcloseoperation(jframe.exit_on_close); jtextpane pane = new jtextpane(); pane.seteditorkit(new advancedrtfeditorkit()); frame.add(pane); frame.setvisible(true); } after many changes in code figured out there isn't problem app. problem running app directly netbeans ide. don't know why, ide somehow encode/decode interaction os.

scala - Is it possible to write typeclass with different implementations? -

this follow-up previous question suppose have trait converterto , two implementations: trait converterto[t] { def convert(s: string): option[t] } object converters1 { implicit val toint: converterto[int] = ??? } object converters2 { implicit val toint: converterto[int] = ??? } i have 2 classes a1 , a2 class a1 { def foo[t](s: string)(implicit ct: converterto[t]) = ct.convert(s) } class a2 { def bar[t](s: string)(implicit ct: converterto[t]) = ct.convert(s) } now foo[t] call use converters1 , bar[t] call use converters2 without importing converters1 , converters2 in client code. val a1 = new a1() val a2 = new a2() ... val = a1.foo[int]("0") // use converters1 without importing ... val j = a2.bar[int]("0") // use converters2 without importing can done in scala ? import converters in class. class a1 { import converters1._ private def fooprivate[t](s: string)(implicit ct: converterto[t]) = ct.convert(s) def foo

python - Insert into MongoDB retuns cannot encode object -

i'm doing rather simple insert local mongodb sourced of python pandas dataframe. i'm calling datframe.loc[n].to_dict() , getting dictionary directly df. far until attempt insert, i'm getting 'cannot encode object'. looking @ dict directly showed looked (while writing question) dawned me check each type in dict , found long id number had converted numpy.int64 instead of simple int (which when created dict manually int insert fine). so, unable find within pandas documentation on adding arguments to_dict allow me override behavior , while there brute force methods fixing issue, there must bit more eloquent way sort issue without resorting sort of thing. question then, how convert row of dataframe dict insertion mongodb, ensuring using acceptable content types ... or, can further here , use simpler approach each row of dataframe document within mongo? thanks as requested, here addendum post sample of data using. {'account created': 'about 3 hou

Send job results to sql table -

ok newb question here: i trying create query job log query table. select login_name, total_elapsed_time, total_elapsed_time sys.dm_exec_sessions when use creates new table. want create new record in existing table query_results. use insert select this insert query_results(login_name, total_elapsed_time, total_elapsed_time) select login_name, total_elapsed_time, total_elapsed_time sys.dm_exec_sessions

sql - Simple select query running slow -

i have 1000 entries in table. it's simple table 10 columns. query: select * my_table server runs query, processing long time. p.s. know not enough info, please comment , add needed. got it. not related sql. server got overflown data. spamming it.

Size of dynamic array in C doesn't change -

i getting realloc(): invalid next size program. coded understand what's happening. #include <stdio.h> #include <stdlib.h> int main() { char *inp; printf("%lu ",sizeof(inp)); char *res = (char*)malloc(15*sizeof(char*)); printf("%lu ",sizeof(res)); res = "hello world"; printf("%lu\n",sizeof(res)); return 0; } and surprisingly outputs 8 8 8 . can explain why that? why 8 default? , how malloc() effects size of inp ? you using sizeof .returns size in bytes of object representation of type. remember sizeof operator. now sizeof returning here 8 constant type of size_t why isn't changing? because in tha cases using same type char * . here 8 bytes size of character pointer 64 bit. you can have @ this- printf("size of array of 10 int: %d\n" sizeof(int[10])); this give output: 40 . 40 bytes. and malloc never affect size of char* . still needs 64 bits store address

compilation - Is lua called from redis interpretted or compiled? -

redis supports lua scripting. using eval command, can execute lua script in redis. lua script compiled or interpretted when redis calls lua script? lua scripts sent lua library execution compiled lua vm instructions before execution. these instructions interpreted lua vm.

javascript - Check/Uncheck using jQuery not working -

i trying make check boxes behave radio buttons in asp .net mvc web application. have got 20-30 check boxes grouped in two. example: <input type="checkbox" id="@riggingtype.riggingtypeid 1" name="riggingtypeplus" value="@riggingtype.riggingtypeid" checked="@riggingtypeids.contains(riggingtype.riggingtypeid)" /> <input type="checkbox" id="@riggingtype.riggingtypeid 2" name="riggingtypeminus" value="@riggingtype.riggingtypeid" checked="@riggingtypeids.contains(riggingtype.riggingtypeid)" /> goal: i want make check boxes behave in such way if plus check box checked minus unchecked automatically , vice versa. have written following code try , achieve functionality: $(":checkbox").change(function () { var inputs = $(this).parents("form").eq(0).find(":checkbox"); var idx = inputs.index(this); if (thi

reporting services - How to enable the export to 'csv' in visual studio -

Image
one of colleagues not able export csv visual studio. not getting option export 'csv' getting on below screen shot. we using vs 2010 devloper edition. we not referencing report server well. i beileve need change in report server config (rsreportserver.config) file unable find report server config file in local system. we can see reports having export option in report server problem local machine. any highly appreciable. for developer's visual studio environment, rendering options can found in file: c:\program files (x86)\microsoft visual studio 9.0\common7\ide\privateassemblies\rsreportdesigner.config

After update Facebook IOS SDK generated dialogs we are consistently getting CAPTCHA's -

after facebook ios sdk update, our app generates message "a link in post might unsafe" , "security check failed" when our user try post facebook app. never had before facebook sdk update. there peculiarities in facebook sdk update should take account avoid situation in future? thank in advance help. best regards, awem games can post example of full url blocked? way can check happening. there can various reasons why content want share blocked. unlikely linked using new sdk. can due having testing; url shared high amount of times since testing new sdk? you can use following form appeal blocked content: https://www.facebook.com/help/contact/244560538958131

java - Contact Listener has no effect in Libgdx -

i working on libgdx collision detection between bodies , tried implementing using contact listener has no effect in code. here code public class firstlevel implements screen{ ...... private player player; ...... ... gdx.input.setinputprocessor(player); world.setcontactlistener(player); .... } "player" class implements contactlistener , inputprocessor. here player class public class player implements screen, inputprocessor,contactlistener { private body polybody,polybodys; private player player; private world world; boolean colliding ; private body enemybody; private sprite polysprite; public final float width,height; private rectangle rectangle; private vector2 movement=new vector2(); private float speed=580; private body rec; public player(world world,float x,float y,float width) { this.width=width; //imp height=width*2; bodydef polygon=new bodydef(); polygon.type=bodytype.dynamicbody; polygon.position.set(x,y); // polygonsha

reporting services - SSRS (SQL2014) - "Subscriptions cannot be created because the credentials used to run the report are not stored -

after deploying reports reporting server, tried add subscription on 1 of reports. not possible, , got error described in link. http://www.kodyaz.com/reporting-services/subscriptions-cannot-be-created.aspx all reports use same shared data source. i applied solution proposed in link , worked. but each time deploy reports (from sql server data tools visual studio 2013); error comes back. i tried modify properties of shared datasource sql server data tools visual studio 2013 before deploying;similarly shown in hyperlink, in case not able access reports anymore. so, seems modify credentials "online" web browser; , not "offline" sql server data tools visual studio 2013. i remarked 1 difference between "offline" , "online" properties of shared data source : online, possible check box "use windows credentials when connecting data source". checkbox not exist in sql server data tools visual studio 2013. this means : each time

Javascript in HTML does not execute -

<html> <head> <title>test environment</title> </head> <body> <script> document.bgcolor="#222222"; document.fgcolor="#11ee11"; document.writeln("test environment."); document.writeln("last update: " + document.lastmodified); var today = new date(); var dd = today.getdate(); var mm = today.getmonth()+1; //january 0! var yyyy = today.getfullyear(); if(dd<10) { dd='0'+dd } if(mm<10) { mm='0'+mm } today = dd+'/'+mm+'/'+yyyy; function enterexpenses(){ var _desc = window.prompt("what kind of expenses?"); var _amount = window.prompt("amount spent?"); var _entry = {type:_desc amount:_amount date:today}; document.writeln(_entry.date); document.writeln(_entry.type); document.writeln(_entry.amount); } </script> <form> <button onclick="enterexpenses()">click me</button> </form

jsf - pe:triStateCheckbox doesn't work with p:ajax -

i'm using pf 5.1 + pf extensions 3.0.0 + omnifaces 1.8.1 on 8.0.0.10 trying make following example here <pe:tristatecheckbox/> listener not called when change state of component, neither error given. this code of jsf page: <pe:tristatecheckbox style="vertical-align:middle;" value="#{bean.notification}"> <p:ajax listener="#{bean.togglenotification}"/> </pe:tristatecheckbox> and bean: private int notification; public void togglenotification() { system.out.println("toggle"); } //getters , setters what may doing wrong? thank you. ok, code in showcase not same code in real world. went github need specify event name: <pe:tristatecheckbox id="ajaxtristate" value="#{tristatecheckboxcontroller.value2}"> <p:ajax event="change" update="growl" listener="#{tristatecheckboxcontroller.addmessage}"/&

javascript - Simulate turning on Sticky Keys in Windows -

using javascript, trying provide users option turn on sticky keys. manually can done pressing shift key 5 times. no success following. tried shiftkeyarg set true. function stickykeys() { var keyboardevent1 = document.createevent("keyboardevent"); var initmethod = typeof keyboardevent1.initkeyboardevent !== 'undefined' ? "initkeyboardevent" : "initkeyevent"; keyboardevent1[initmethod]( "keydown", // event type : keydown, keyup, keypress true, // bubbles true, // cancelable window, // viewarg: should window false, // ctrlkeyarg false, // altkeyarg false, // shiftkeyarg false, // metakeyarg 16, 0 ); var keyboardevent2 = document.createevent("keyboardevent"); var initmethod = typeof keyboardevent2.initkeyboardevent !== 'undefined' ? "initkeyboardevent" : "initkeyevent"; keyboardevent2[initmethod]( "keyup", // event type : keydown, keyup, keypress true, // bubbles true, // cancelable wi

javascript - Allow selecting of row once for each datatable shown -

i using datatables.js https://www.datatables.net/ , running in problem want user select 1 row reach table shown. i've tried several things can't work, script checks datatables instead of 1 selecting in. understand because in code fetching tables using var table = $('table').datatable(); but have no idea how specify checks if selected class set on 1 of rows in datatables. var table = $('table').datatable(); $('table tbody').on( 'click', 'tr', function () { if ( $(this).hasclass('selected') ) { $(this).removeclass('selected'); } else { table.$('tr.selected').removeclass('selected'); $(this).addclass('selected'); } } ); in on() event row's table instead of using table defined outside of function. code $('table tbody').on( 'click', 'tr', function () { var table = $(this).closest("table"); if

Copying and Editing Jenkins Jobs -

i have been using jenkins couple of months now, , have been able set simple ci system. have build tab - build , deploy 25 different components successfully, based on building svn trunk. i'm taking first branch - people develop on trunk , develop fixes on branch. i have ci , running both branch , trunk - create second tab - repeat of jobs first tab, time changing svn path check out branch. as have rather lot of jobs , task quite repetitive, there easy way ? i'm hoping each job tab might single xml can edit / rename give me second tab ? yes, each job is single xml file, located under $jenkins_home/jobs/$job_name/config.xml . there number of places in config.xml reference it's location, copy-pasting actual file isn't best option. jenkins ui has "copy job" function. click "new item" want it select "copy existing item" specify name of existing item copy specify name new job then go configure new job , change need.

java - Calling Graphics function from another functionJava -

i trying button call graphics function in java take lives left , draw appropriate parts hang man game. working except drawing. believe because of way calling function i'm not sure. thanks code button: if(temptext == label.gettext()){ lives--; panel2.paintcomponent(); if (lives == 0){ joptionpane.showmessagedialog(null,"you lose"); buttona.setenabled(false); buttonb.setenabled(false); buttonc.setenabled(false); buttond.setenabled(false); buttone.setenabled(false); buttonf.setenabled(false); buttong.setenabled(false); buttonh.setenabled(false); buttoni.setenabled(false); buttonj.setenabled(false); buttonk.setenabled(false); buttonl.setenabled(false); buttonm.setenabled(false); buttonn.setenabled(false);

amazon web services - Does AWS cfn-init need a Profile/Role for DescribeStackResource? -

from this page: to use aws cloudformation bootstrap features, need provide aws credentials bootstrap scripts. recommend assign iam role on ec2 instance when instance launched. this seems pretty straightforward, when @ example on place in aws documents, never set roles or profiles this. example, here . what missing? there scenarios cfn-init requires permissions while not in others? no, no longer need add cloudformation:describestackresource policies of role associated instance profile in order access cloudformation metadata. scripts such cfn-get-metadata , cfn-init authorized using special cfn header instead of standard aws authorization header . request cfn scripts looks this: # command succeeds regardless of instance profile cfn-get-metadata --region us-west-1 --stack cftest --resource launchconfig --key aws::cloudformation::init /?action=describestackresource&stackname=cftest&version=2010-05-15&contenttype=json&logicalresourceid=launchc

mysql - PHP link security -

i've newssystem link index.php?article=news&id=10 , work comments mysqli_query($db, "select * news_comments news_id = '10'"); but when change link example index.php?article=news&id=10=asd comments not there, because added asd @ end. can me? you'll need ensure value of "id" integer. not sure code looks like, like: $id = intval($_get['id']); mysqli_query($db, "select * news_comments news_id = '$id'"); you sanitizing input correct?

json - Apache Camel HTTP / HTTP4 ignores Content-Type header -

i'm trying send http call through apache camel using camel-http. when set header content-type ignores header , doesn't include in call. i have tried set header has follows: exchange.getout().setheader('content-type', 'application/json'), and exchange.getout().setheader(exchange.content_type, 'application/json'); i have tried using camel-http , camel-http4 , doesn't work of them. since have to, mandatorily, send content-type header, how can force camel-http include it? note: i'm setting other headers same way correctly send call, it's content-type 1 doesn't work you need following set content-type: <setheader headername="content-type"> <constant>application/json</constant> </setheader> this work set content-type.

c++ - Calling Qpainter's method paint to refresh image and change color -

i have created object call player inherits qgraphicsobject . what trying change image of player , colour of bounding shape when click on mouse. thing don't know values send player->paint() update image. i override 2 pure virtual functions follows in player.h : class player : public qgraphicsobject { public: player(); qrectf boundingrect() const; qpainterpath shape() const; void paint(qpainter *painter, const qstyleoptiongraphicsitem *option,qwidget *widget); void mousepressevent(qgraphicsscenemouseevent *event); } in player.cpp player::player() { qpixmap m_playerpixmap(":/images/images/chevalier/test1.png"); } qrectf player::boundingrect() const { return qrectf(-15, 0, 128, 130); } qpainterpath player::shape() const { qpainterpath path; path.addellipse(-15, 70, 100, 60); return path; } void player::paint(qpainter *painter, const qstyleoptiongraphicsitem *option,qwidget *widget) { qpen linepen; line

excel - Using a countif to count cells that can equal two different criteria -

i looking use countif or countifs add set of 7 cells each cell trigger 2 different criteria. the cells contain numbers , need counter if see if cell greater 0 or lower other static cell. most tutorials , examples can find either describe , statements or end getting cell counted twice triggers both criteria if number between 2 comparison factors. here pseudo code of looking for. countif( balance , greater 0 or greater last months payment ) count cell once please ask questions , pre-thanks responses , time taken read question. -------------------edit------------------------- don't worry answered own question. all hail rubber duck method. --------------second edit 07/04/15---------------- thank-you responses. had solved issue 30 secs after posting question , did post edit "revised" user called mike? , removed. i realized ask if balance less since impossible balance go less 0 matter of checking lower last months payment. i busy trying build

python - Minimum of Numpy Array Ignoring Diagonal -

i have find maximum value of numpy array ignoring diagonal elements. np.amax() provides ways find ignoring specific axes. how can achieve same ignoring diagonal elements? you use mask mask = np.ones(a.shape, dtype=bool) np.fill_diagonal(mask, 0) max_value = a[mask].max() where a matrix want find max of. mask selects off-diagonal elements, a[mask] long vector of off-diagonal elements. take max. or, if don't mind modifying original array np.fill_diagonal(a, -np.inf) max_value = a.max() of course, can make copy , above without modifying original. also, assuming a floating point format.

generics - How is ArrayList represented internally in Java Collection Framework.? -

i going through lectures of algorithms on coursera robert sedgewick.i bit confused when mr.robert pointed out 1 cannot use generics arrays not allowed. arraylist in collection framework uses arrays internally , generic datatypes allowed.i mean can following: arraylist<integer> list = new arraylist<integer>(); one hack pointed out this: public class fixedcapacitystack<item>{ private item[] s; private int n = 0; public fixedcapacitystack(int capacity) { s = (item[]) new object[capacity];} //this hack he mentioned ugly hack , must avoided , produces warning during compilation. my question is: 1.) how arraylist internally represent various generics types? 2.) if (assumed) use hack mentioned above why doesn't produce warning when compile program arraylist? 3.) there better way apart cast above? per source: 1 - arraylist stores items in object[] , , casts value when retrieving individual elements. there's @suppresswarnings(

animateWithDuration in Swift - Could not find member 'CurveEaseOut' -

i following error when attempting pass variable in animation in swift: could not find member 'curveeaseout' my code seems fine if type degrees in manually: uiview.animatewithduration(2.0, delay: nstimeinterval(0.0), options: .curveeaseout, animations: { self.arrowimage.transform = cgaffinetransformmakerotation((180.0 * cgfloat(m_pi)) / 180.0) }, completion: nil) but have issue if attempt use variable: var turn = double() turn = 180.0 uiview.animatewithduration(2.0, delay: nstimeinterval(0.0), options: .curveeaseout, animations: { self.arrowimage.transform = cgaffinetransformmakerotation((turn * cgfloat(m_pi)) / turn) }, completion: nil) perhaps it's use of double()? i've tried various different types , can't find solution. there nothing wrong .curveeaseout. problem think within closure. try var turn:cgfloat = 180.0 if error remains arrowimage optional , have use if let unwrapped it uiview.animatewithduration

looking for a data structure that support relation m-m between two concepts -

Image
i looking data structure model following relations between 2 concepts type , entity. number of entity , type more 100 million. the direction of arrow show need access type entity , reverse. i looking n efficient data structure; otherwise implemented 2 maps: (type,entities) , (entity, types) you can use bipartite graph model type of data adjacency list representation. you want efficient data structure, type of operations need perform on data? see this operations , time complexities. for adjacency list implementation, nodes can represented in array. node name->index number mapping can stored lookup table. reference here .

Haskell: ScopedTypeVariables needed in pattern matching type annotations -

why code require scopedtypevariables extension? {-# language scopedtypevariables #-} char = case '3' of (x :: char) -> x nothing -> '?' when read documentation on scopedtypevariables , seems mean unifying type variables in function body parent function signature. code snippet isn't unifying type variables though! also effect of loading scopedtypevariables without loading explicitforall ? other usecases of scopedtypevariables seem require explicitforall work. in above snippet, there's no explicitforall . scopedtypevariables enables explicitforall automatically sake of sanity suggest using scopedtypevariables when using other type system extensions (except possibly ones dealing classes/instances/contexts) , never using explicitforall directly. the reason scopedtypevariables required pattern variable signatures such signatures part of extension. among other uses, give way bring type variable scope. example: f

android - Changing background color of actionbar -

my android app uses minimum sdk version 15. trying change background color of actionbar , want changing style , theme. i've tried many things background remains dark. here styles like: <style name="apptheme" parent="@style/theme.appcompat.light.darkactionbar"> <item name="android:actionbarstyle">@style/myactionbar</item> </style> <style name="myactionbar" parent="@android:style/widget.holo.light.actionbar"> <item name="android:background">#eeeeee</item> </style> in manifext set application's theme apptheme. by default appcompat support library uses value of colorprimary attribute color of actionbar . <style name="apptheme" parent="theme.appcompat.light.darkactionbar"> <item name="colorprimary">#eeeeee</item> </style> but if want make color of actionbar independent primary color of the

javascript - jQuery 2.1 | Remove source substring of duplicate substring -

i wish preserve following (as opposed preceding) duplicated substring of comma-delimited string while removing preceding duplicating substring. 1- initial state of string before duplicate appended : aaa,bbb,ccc,ddd,eee 2- bbb dynamically appended string : aaa,bbb,ccc,ddd,eee,bbb 3- preceding bbb must removed : aaa,ccc,ddd,eee,bbb how can following function, or function matter, reproduce seek? function unique(list) { var result = []; $.each(list, function(i, e) { if ($.inarray(e, result) == -1) { result.push(e); } }); return result; } the quick , easy way reverse array, use duplicate removal function , reverse back: function unique(list) { var result = []; $.each(list, function(i, e) { if ($.inarray(e, result) == -1) { result.push(e); } }); return result; } var arr = ["aaa", "bbb", "ccc", "ddd", "eee", "bbb"]; console.log(unique(arr.reve

Crystal reports cross-tab month date function -

i have cross-tab table want group each column specific month each year. (ex. march 2011, march 2012, march 2013 , on). i'm guessing formula needed since there's no predefined functions in cr can me group dates that. is true?

html - How can I reference a specific DIV tag INSIDE an XML tag with jquery? -

title says basically. i using ebay trading api , trying extract text message sent user. api unhelpfully returns ton of html actual user message inside div id userinputtedtext . i trying data out using jquery - raw xml response in format: <xmlresponse> <messages> <message> <text> "<!doctype html public ...>\n\n\n<html ...>\n\n <div id="userinputtedtext"> ****message user **** so have been trying use variation of... $xml = $.parsexml( xmlresponse ) $xml.find("message").find('text').find('userinputtedtext').html() ...but nothing seems work. i should perhaps note can text node , data out in more complicated multi-step process feel there must simpler way. in fact notice node seems have html wrapped in " , interspersed bunch of \n line breaks seems weird me. can shed light on why is? you need

c# - How to serialize a Class contains BitmapImage? -

i have deepcopy method, serializes object passed in parameter , returns deserialized object make deep copy. my method is: public static class genericcopier<t> { public static t deepcopy(object objecttocopy) { using (memorystream memorystream = new memorystream()) { binaryformatter binaryformatter = new binaryformatter(); binaryformatter.serialize(memorystream, objecttocopy); memorystream.seek(0, seekorigin.begin); return (t)binaryformatter.deserialize(memorystream); } } } it works well, if object passed parameter doesn't contain bitmapimage field , properties. public class myclass { public string teststring {get; set;} public bitmapimage testimage { get; set;} } if make deepcopy of myclass, myclass orginal = new myclass(){ teststring = "test"}; myclass copy = genericcopier<mycla

How do i build namespaces xmlns, xmlns:xsi, and schema xsi:schemalocaton in my XML via VB.net? -

i need replicate xml header: <xdatafeed xmlns="http://foo.com/namespace" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" . xsi:schemalocation="http://foo.com/namespace c:\fooxsd.xml"> with code: 'export object xml dim writer new xmlserializer(datafeed.gettype) dim ns new xmlserializernamespaces() ns.add("xmlns", "http://foo.com/namespace") ns.add("xsi", "http://www.w3.org/2001/xmlschema-instance") dim file new system.io.streamwriter("c:\foo.xml") writer.serialize(file, datafeed, ns) file.close() and i'm hitting 2 issues: when try add namespace without prefix foo.com, removes namespaces. code above adds foo.com's namespace as: xmlns:xmlns="http://foo.com/namespace" which not correct. how add in namespace without prefix? i have searched hou

angularjs - How to integrate whole bootstrap template with angular js -

i have bootstrap template , converting angular js. but problem face navigation tools not working , bootstrap template drop functionality work scroll bar, sidebar navigation , similar functionality require js include. conflict ? require redevelop whole template angular js or missing include bootstrap before converting. i read documentation @ https://angular-ui.github.io/bootstrap . not helpful convert whole template. i want guidance how can convert bootstrap template angularjs. i have not posted code. because messy. , wanted guidance how possible. thanks in advance.

php - CodeIgniter pagination Previous and active Links not Working -

i have code clicking on pagination links functions fine , if click on link particular link not showing active link . code follows function viewcategory($name) { $this->load->database(); $this->load->model('categorypostmod'); $page = $this->uri->segment(5); $this->load->helper("url"); $this->load->library('table'); $this->load->model("site_model"); $this->load->helper('form'); $this->load->library('pagination'); $config['base_url'] = "http://localhost/b3/index.php/categorypost/viewcategory/" . $name . "/page/"; $config['per_page'] = 2; $config['num_links'] = 5; log_message('info', 'count ' . $this->categorypostmod->getcategorycount($name)); $config['total_rows'] = $this->categorypostmod->getcategorycount($name); $config['full_tag_open']

android - EPERM, operation not permitted -

i using titanium , genymotion android emulator. getting following error:- [error] error while firing "post-execute" event [error] error: eperm, operation not permitted 'c:\users\sudatta.titanium\analytics_session.json' @ fs.opensync (fs.js:439:18) @ fs.writefilesync (fs.js:978:15) @ c:\users\sudatta\appdata\roaming\npm\node_modules\titanium\node_modules\node-appc\lib\analytics.js:192:7 @ c:\users\sudatta\appdata\roaming\npm\node_modules\titanium\node_modules\node-appc\node_modules\async\lib\async.js @ done (c:\users\sudatta\appdata\roaming\npm\node_modules\titanium\node_modules\node-appc\node_modules\async\lib\as @ c:\users\sudatta\appdata\roaming\npm\node_modules\titanium\node_modules\node-appc\node_modules\async\lib\async.js @ c:\users\sudatta\appdata\roaming\npm\node_modules\titanium\node_modules\node-appc\node_modules\async\lib\async.js @ c:\users\sudatta\appdata\roaming\npm\node_modules\titanium\node_modules\node-appc\lib\ana

javascript - AngularJs - Find relational information in two arrays -

i'm getting 2 json arrays api. data examples: serie type: [ {"id":1,"bettypeid":1, "nameeng":"win"}, {"id":2,"bettypeid":1,"nameeng":"draw"} ] bet type: [ {"id":1,"nameeng":"3-way result","sportid":1 {"id":2,"nameeng":"double chance","sportid":1} ] as can see, serie type objects has bettypeid. need remote bet type object array there no serie type it. i have tried looping in bet type array don't how filter in serie types. what steps achieve this? you can filter array way: bettypesarray = bettypesarray.filter(function(bet) { // if seriestype item references bet, keep return seriestypearray.some(function(serie) { return serie.bettypeid === bet.id; }); }); does solve problem?

javascript - In nodeJs is there a way to loop through an array without using array size? -

let's have myarray = ['item1', 'item2'] i tried for (var item in myarray) {console.log(item)} it prints 0 1 what wish have item1 item2 is there other syntax works without using for (var = 0; < myarray.length; i++) you can use array.foreach var myarray = ['1','2',3,4] myarray.foreach(function(value){ console.log(value); });

javascript - Placing quotes in JS parameters -

i dynamically populating unordered list js mobile app. using jquery mobile , phonegap developing. in list want call function parameters when clicked. able call function downloadpdf() without using parameters, not if add them. think has quotes/double qoutes. var $li = $("<li><a href='#' onclick='downloadpdf('"+val.title+"', '"+val.url+"')'>"+val.title+"</a></li>"); i not able debug running on phone, hope more trained eye able see what's wrong here. both val.title , val.url holds values of string type. do not use inline events. using jquery, makes easy attach events var li = $("<li><a href='#'>"+val.title+"</a></li>"); li.find("a").on("click", function(){ downloadpdf(val.title,val.url); }); or use data attributes , generic onclick handler var li = $("<li><a class='downloa

javascript - slice not working as expected on my array -

Image
i have array scraped webpage: myvar = document.queryselectorall('#tblitinerarymodulestaydetail > tbody > tr') which in console returns array: what need subset array: start 3rd item then keep every odd number of items so need subset of var items 3 , 5 in it. i tried: myvar.slice(3,5) . returned error "undefined not function" had been successful have array 3 items. i'd need subset on keeping odd items in array. how subset myvar have variable items 3 , 5 left in it? if myvar length 10. how subset include items 3, 5, 7, 9? myvar = document.queryselectorall('#tblitinerarymodulestaydetail > tbody > tr') myvar nodelist , it's not array. can't use array functions in there. but can use apply or call array functionality on nodelist. how functionality? array.prototype.slice.call(myvar, 3,5); now can use slice in nodelist. but actual question, subset matching particular criteria not possible via slice

Javascript oop instances -

i developing javascript oop , observer pattern. in first method model g put inside mesh , mesh inside scene. can find our g model in scene.children. in second method in intersected[i].object can find our model g. problem if modify property of intersected[i].object not reflected model g. g = new geometrymodel(); tjsv = new threejsview(document.getelementbyid('maincanvas'), g); geometrymodel.prototype.populatescene = function(scene) { var i; (i = 0; < this.geometries.length; i++) { var g = this.geometries[i];//<----- g model var material = new three.meshbasicmaterial( { color: g.color, transparent: g.transparent, opacity: g.opacity }); var mesh = new three.mesh(g, material); this.addlabels(g, mesh); scene.add(mesh); if (g.linewidth > 0) { var egh = new three.edgeshelper( mesh, g.linecolor ); egh.material.linewidth = g.linewidth; scene.add( egh ); } } } threejsview.prototype.selectbyraycaster = function(x, y){ var i; var inter

How can I virtualize a "datagrid like" Control Horizontally and Vertically on XAML/C# (Windows 8.1 - WinRT) -

Image
problem i'm trying create "datagrid like" control on universal app (winrt). control has show lots of elements (cells) has small view-area, it's perfect candidate virtualization, needs. how can have virtualization both horizontally , vertically such thing? what tried (one-direction virtualization) i have tried using both listview, gridview , itemscontrol. managed have vertically or horizontally virtualization those. the important thing had achieve one-direction virtualization , have table changing itemspanel of of (listview/gridview/itemscontrol) this: <scrollviewer verticalscrollbarvisibility="auto" horizontalscrollbarvisibility="auto" horizontalscrollmode ="auto" verticalscrollmode ="auto" zoommode="disabled" viewchanged="datagridview_onviewchanged" width="700"> <itemscontrol verticalalignment