Posts

Showing posts from April, 2012

python - Filtering a dataframe based on a regex -

say have dataframe my_df column 'brand' , drop rows brand either toyota or bmw . i thought following it: my_regex = re.compile('^(bmw$|toyota$).*$') my_function = lambda x: my_regex.match(x.lower()) my_df[~df['brand'].apply(my_function)] but error: valueerror: cannot index vector containing na / nan values why? how can filter dataframe using regex? i think re.match returns none when there no match , breaks indexing; below alternative solution using pandas vectorized string methods ; note pandas string methods can handle null values: >>> df = pd.dataframe( {'brand':['bmw', 'ford', np.nan, none, 'toyota', 'audi']}) >>> df brand 0 bmw 1 ford 2 nan 3 none 4 toyota 5 audi [6 rows x 1 columns] >>> idx = df.brand.str.contains('^bmw$|^toyota$', flags=re.ignorecase, regex=true, na=false) >>> idx 0 true 1 false 2

java - Setting text on Label (Actor) stops drawing -

i can't figure this, , pulling hair out right now!! i have stage label added it, set , first time call stage.draw() works fine. however, set text of label nothing gets drawn. funny thing is, when don't change text draws expected, when call label.settext("the text") doesn't draw. i have stepped through code , have noted down height , width , x , y values before , after setting text of label , , same (before , after). also, when draw stage it's drawn above sprite , , positioning sprite based on label 's position. sprite draws fine before set text on label , after. ps: have made sure sprite not drawn "over" label . this setup: i have maingame class renders player class, when ever back button pressed sprite stage gets drawn, or should drawn. spritebatch.begin(); player.update(spritebatch, delta); spritebatch.end(); // pause menu drawn separate sprite batch needs in middle relative screen , above else if (player

assembly - Nasm kernel32.dll DeleteFile -

Image
alright, tried use deletefile method kernel32.dll (using nasm assembler), doesn't deletes file, , exits error. extern _getstdhandle@4 extern _writeconsolea@20 extern _deletefilea@4 extern _exitprocess@4 section .data msg: db "could not delete file", 10, 0 len: equ $- msg section .bss numcharswritten resb 1 section .text global _start _start: mov edx, [esp+8] push dword [edx] ; pushes argument. call _deletefilea@4 ; deletes file add esp, 8 ; removes 2 arguments cmp eax, 0 ; <cmp> = (eax == 0) je _error ; if(<cmp>) jump _error push dword 0x0a ; exit value call _exitprocess@4 ; exit _error: push dword -0x0b call _getstdhandle@4 push dword 0 ; arg4, unused push numcharswritten ; arg3, pointer numcharswritten push

angularjs - Show a loading screen as background images load in ng-repeat -

i have list loaded through ng-repeat each element contains img tag. i'd show sort of loading indicator (occluding list items) until every image within every item has finished loading. i guess need hook event broadcast angular back-img directive don't know start here. okay, solved problem. first of all, @vladimir, you're totally right -- back-img directive colleague wrote, obscured solution me while. what i've done write simple directive calls $scope -bound function on img 's load event. controller counts number of images have loaded, , once enough images have loaded, removes loading indicator , shows list of images. here's summary of code: my directive: app.directive('loadedimage', function($parse) { return { restrict: 'a', scope: true, link: function(scope, element, attrs) { element.bind("load", function(event) { var invoker = $parse(attrs.loadedcallback); invoker(sc

java - Log4j to write json array to disk -

im creating log file system. log file in json format server can read after dont think thats important. need know can log4j configured write file without tags info,debug, timestamp etc in file. have looked here but polutes file with other things. want data write show in file. i'd set kind of file rotation on file if gets big after max size reached. this relatively easy, using log4j.properties configuration file (place @ top of classpath, , log4j 'just find it'): # default logger, logs console log4j.logger.com.foo.bar=debug,a1 log4j.appender.a1=org.apache.log4j.consoleappender log4j.appender.a1.layout=org.apache.log4j.patternlayout # note pattern here, emits lot of stuff - btw, don't use in production # %c expensive - see javadoc conversionpattern meaning of # % modifiers: log4j.appender.a1.layout.conversionpattern=%d{mmm dd, hh:mm:ss} [%c{2}] %-5p - %m%n # logging file can enabled using 1 log4j.logger.com.example=debug, r log4j.appender.r=org.apac

avr - Siemens MC35 + ATcommand -

i 2 things. recognize when calling - in terminal appear ring , answer have send command ata . how can recognize when doing else. should use new thread , read port until send ring ? there beter solution? what symbol of end of response? i'm reading char using for() , not know number of signs. example below doesn't work properly while(readcharuart()!=10) {}; while(readcharuart()!=13) { getchar() = .. } you on right track. for ring yes, correct way have 1 thread read modem responses until unsolicited result code ring . if time time want run @ commands (say ata), should let thread well, e.g. have 1 thread takes care of both issuing @ commands , monitor ur codes. regarding formatting of responses modem, described in chapter 5.7.1 responses in itu v.250 standard. short summary (reading spec highly recommended!): <header>ring<trailer> where header , trailer both "\r\n" (unless modem configured strangely).

javascript - Chrome extension keyboard command firing twice when popup is open -

in following chrome extension, receive keyboard command twice when shortcut pressed, when browser popup open. here's how replicate it: install following chrome extension. navigate chrome extensions page scroll bottom , click "keyboard shortcuts" set shortcut extension alt+shift+s in extensions page, click "background page" link extension open background page console. hit alt+shift+s. you'll see "command" being logged once. now open browser popup should have appeared when extension installed. hit alt+shift+s. go background page console , you'll see "command" logged twice. here code: manifest.json { "manifest_version": 2, "name": "test", "version": "1.0", "background": { "scripts": ["background.js"] }, "browser_action": { "default_popup": "popup.html" }, &q

Decorator function in python part2 -

def request(method="get", path="", data=none): def wrapper(func): func.routed = true func.method = method func.path = path func.data = data return func return wrapper def response(fmt="%s", contenttype="text/plain"): def wrapper(func): func.format = fmt func.contenttype = contenttype return func return wrapper @request("get", "%(channel)d/value") @response("%d") def digitalread(self, channel): self.checkdigitalchannel(channel) return self.__digitalread__(channel) from last discussion, talked @a @b def func: would become func=a()(b() func()) above, @request , @response wrapper how new digitalread function like? the function have attributes given in wrappers within decorators added it.

Is there a conditional command in applescript that lets the user quit the app -

is there conditional command in applescript lets user quit app. turned applescript app using automator. however, script set run until cycled through hundreds of scripts. there conditional command statement can use end application while running? property myusername : "" if myusername "" display dialog "user name:" default answer "" buttons {"cancel", "continue…"} default button 2 copy result list {button_pressed, text_returned} set {returnedtext, returnedbutton} result list ---> {"some text", "ok"} if button_pressed "cancel" beep return end if if text_returned not "" set myusername text_returned "hello," using "karen" (returnedtext) using "karen" else display dialog "stored user name: " & myusername buttons {"ok"} default button 1 icon 1 end if "for informati

c - Am I using structs in the wrong way? -

i have come across wierd , mysterous (at least me) error finding hard time finding. gives me error @ line call function input(student_list1[max], &total_entries); compiler says: incompatible type agument 1 in 'input' what doing wrong here? sense simple , stupid have gone through code several times without avail. #define max 10 #define name_len 15 struct person { char name[name_len+1]; int age; }; void input(struct person student_list1[max], int *total_entries); int main(void) { struct person student_list1[max]; int total_entries=0, i; input(student_list1[max], &total_entries); for(i=0; i<total_entries; i++) { printf("student 1:\tnamn: %s.\tage: %s.\n", student_list1[i].name, student_list1[i].age); } return 0; } //main end void input(struct person student_list1[max], int *total_entries) { int done=0; while(done!=1) { int i=0; printf("name of student: "); f

javascript - Change value of element inside img tag in JS -

i have html fragment display product image: <img src="/some/path" border="0" id="bigimg" data-zoom-image="/some/path"> the code data-zoom-image path larger image on mouse over, can zoom in on image. i have javascript function when click somewhere else change picture... this: function showlarge(path) { var full_path = 'upload/product_image/large_'+path; document.getelementbyid("bigimg").src = full_path; document.getelementbyid("bigimg").data-zoom-image = full_path; } i want change data-zoom-image value when src of image changes... tried adding line document.getelementbyid("bigimg").data-zoom-image = full_path; doesn't work... how should this... thank you you can use setattribute changes value of existing attribute on specified element. document.getelementbyid("bigimg").setattribute('data-zoom-image',full_path); the document here: https://devel

web crawler - how find all instances of a word occurring anywhere in a website -

i want make list of occurrences of word in web application. few places looking @ html pages, code files, database, uploaded documents, images, videos. please suggest me other places should look, word can occur. know crawler can used task, if had same experience in past please suggest automated tools available find word on in website. since files local, don't think need crawler. need search files. as said in comment, os should able find occurrences. the program ack should able want. it's written in perl, it's portable windows. here's so question installing it on windows. work html files , source code. some caveats: i'm not sure how work databases. depends entirely on how databases store data. should search tool specific database. i'm not sure mean searching work in images , videos. expect automatically find text in images/videos, , parse it? kind of search capability doesn't exist. "uploaded documents"... kind of documents

javascript - Stuck with Compass and Foundation 5 -

i want develop front end foundation 5. have downloaded , use in project. now want able edit it. understand have sass , have chosen compass. i have been able download compass, sass, ruby, node.js, etc. , after testing works fine , have done tests. i stuck in using compass , foundation , editing foundation files , request help. this current project created foundation on command line. http://imgur.com/ssi1vzp now need start using compass in order modify css files sass. any shalt appreciated. so have default page can rename , change bits , pieces of :-) to use sass (and compass) , foundation create styles want in new file called _overrides.scss in same directory app.scss text editor of choice , tell compass watch directory ( cd site root first) compass watch -s compressed compass tell it's 'polling changes' , overwrite app.css [note, compass smart enough work out lives in different directory, 'stylesheets']

how do I represent this as a ember data model? -

i'm using ember-data 1.0.0-beta.7+canary.b45e23ba the restful service returning json payload of: { "postaladdresses": [ { "street": "12345 test drive", "city": "testville", "subnational": "wa", "postalcode": "98027", "country": "united states", "id": 1 }, { "street": "12345 work drive", "city": "testville", "subnational": "wa", "postalcode": "98027", "country": "united states", "id": 2 } ], } how should ds.model looks? var postaladdresses = ds.model.extend({ street: ds.attr('string', {defaultvalue: ''}), city: ds.attr('string', {defaultvalue: ''}), subnational: ds.attr('string', {defaultvalue: '&

html - Fixed background image bug Chrome Mac -

i'm building website uses fixed background images transition between sections. currently, pure css. effect works on every browser i've tested in, except one: chrome on mac (version 33.0.1750.146 or version 34.0.1847.45 beta). seems work fine on chrome on pc. what happens pretty strange...on scroll, image repeated , overlayed , overall distorted. after bit more scroll, disappears. not reappear on scroll up. any ideas or solutions?! current page: http://margusity.com/follies-beta current screenshot (broken, chrome): http://cloud.ikilledtheinter.net/ulra current screenshot (working, safari): http://cloud.ikilledtheinter.net/ulxh seemingly relevant css: .chris, .eric, { background-position: center center; background-repeat: no-repeat; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; background-attachment: fixed; position: relative; z-index: 50; width: 100%; height: 100%; } .chri

javascript - Jquery Auto Complete Does Not Append -

jquery newbie here. jquery append not seem working. appreciated. i using jquery version 1.8.3 , ui 1.9.2. below code. $('.tinputer').autocomplete({ source: "http://localhost/myapp/items/search_item", minlength: 1, select: function(event, ui) { var $itemrow = $(this).closest('tr'); $itemrow.find('#item_description').val(ui.item.description); $itemrow.find('#unit_price').val(ui.item.price); $itemrow.find('#qty').focus(); verify_item(ui.item.value); } }).data("autocomplete" )._renderitem = function( ul, item ) { return $( "<li></li>" ) .data( "item.autocomplete", item ) .append( "<a>" + item.value + item.description + "</a>" ) .appendto( ul ); }; fiddle - http://jsfiddle.net/yw2y7/1/ try typing in item box on second row. fi

linux - Why a segfault instead of privilege instruction error? -

i trying execute privileged instruction rdmsr in user mode, , expect kind of privilege error, segfault instead. have checked asm , loading 0x186 ecx , supposed perfevtsel0 , based on manual , page 1171. what cause of segfault, , how can modify code below fix it? i want resolve before hacking kernel module, because don't want segfault blow kernel. update: running on intel(r) xeon(r) cpu x3470 . #define _gnu_source #include <stdio.h> #include <stdlib.h> #include <inttypes.h> #include <sched.h> #include <assert.h> uint64_t read_msr(int ecx) { unsigned int a, d; __asm __volatile("rdmsr" : "=a"(a), "=d"(d) : "c"(ecx)); return ((uint64_t)a) | (((uint64_t)d) << 32); } int main(int ac, char **av) { uint64_t start, end; cpu_set_t cpuset; unsigned int c = 0x186; int = 0; cpu_zero(&cpuset); cpu_set(i, &cpuset); assert(sched_setaffinity(0, size

javascript - How to add object literal within object literal -

this question has answer here: how can add key/value pair javascript object? 17 answers assuming have object literal looks this: c = {"a":"a","b":"b","c":"c"}; and want add object this.. "d" : {"e":e} where e variable. , e = "valueofe" c have kind of value.. c = {"a":"a","b":"b","c":"c", "d" : { "e" : "valueofe"}}; how that? the values in object literals can arbitrary expressions, means can contain other object literals, make use of existing variables, , on; if you're asking think are, can write: c = { "a": "a", "b": "b", "c": "c", "d": { "e": e } };

c# - 0x80070005 (E_ACCESSDENIED) while searching for htmlelement -

i'm trying find submit button on page , submit form using webbrowser , part of code keeps giving me an unhandled exception of type 'system.unauthorizedaccessexception' occurred in system.windows.forms.dll additional information: access denied. (exception hresult: 0x80070005 (e_accessdenied)) the code is: htmldocument pagehtml = this.webbrowser1.document; htmlelementcollection page = pagehtml.all; foreach (htmlelement element in page) { if (element.getattribute("type") == "submit") //line highlighted during error { element.invokemember("click"); } } not sure why doing found different way it htmlelementcollection page = webbrowser1.document.getelementsbytagname("input"); foreach (htmlelement element in page) {

javascript - angular - Submit form by controller -

i want submit form controller function. have following code :- <form ng-submit="uploadlogo()" name="logoform" method="post" enctype="multipart/form-data"> <div class="col-sm-6"> <input type="file" name="letterhead" id="letterhead" required /> <div> <button type="submit" class="btn btn-md btn-info">upload</button> </div> </form> controller $scope.uploadlogo = function () { practices.updatelogo().save(function (res) { console.log('res :' + res); }); } service updatelogo: function () { return $resource('/api/practicesupload', {}, { 'save': { method: 'post'} }); } routes app.post('/api/practicesupload', multipartmiddleware, practices.uploadlogo); serve

java - how to pass an object from one main method to a main method in another class -

i have 2 classes sum , f , , want use arraylist ( ac ) sum main method in f main method. class sum package pack; import java.util.arraylist; import java.util.iterator; class sum { public static void main(string[] args) { // todo auto-generated method stub arraylist < string > ac = new arraylist < string > (); ac.add("hai"); ac.add("hw"); ac.add("ai"); ac.add("hi"); ac.add("hai"); iterator = ac.iterator(); while (it.hasnext()) { system.out.println(it.next()); } } } class f package pack; import java.util.arraylist; import pack.sum; public class f extends sum { public static void main(string[] args) { //here use ac object of array list } } change sum class little bit class sum { public arrarylist<string> main() { // todo auto-generated method stu

javascript - Controller chaining in angularJS -

/** * created jetbrains webstorm. * user: faizan * date: 3/7/14 * time: 6:09 pm * change template use file | settings | file templates. */ angular.module("myapp",[]) .controller("ctrlparent",function($scope){ $scope.parentfunc= function(){ alert("this parent"); // $scope.$on("hello"); } }) .controller('ctrlbigchild',function($scope){ $scope.bigchildfunc= function(){ alert("this big child"); // $scope.$on("hello"); } }) .controller('ctrlchildone',function($scope){ $scope.childonefunc= function(){ alert("this child one"); // $scope.$on("hello"); } }) .controller('ctrlchildtwo',function($scope){ $scope.ctrlchildtwofunc= function(){ alert("this child two"); // $scope.$on("hello"); } }) .controller(

Android listview item collapse while scrolling? -

i have created listiem text dynamically. based on array count. first time view created successful. while scrolling listview items collapsed. time text view showing repeated. below have attached adapter code please check code, public class adapter extends baseadapter { private arraylist<persondataclass> list; private context ctx; private layoutinflater minflater; private viewholder holder; private textview[] textview; public adapter(context context, arraylist<persondataclass> personlist) { // todo auto-generated constructor stub minflater = layoutinflater.from(context); ctx = context; list = personlist; } @override public int getcount() { // todo auto-generated method stub return list.size(); } @override public object getitem(int arg0) { // todo auto-generated method stub return list.get(arg0); } @override public long getitemid(int arg0) { // todo auto-generated method stub return arg0; } @override public view getview(i

sql - What is the simplest way to convert table Rows into XML and viceversa -

i need develop sql server procedure convert table rows xml , transfer stored procedure(different server) through link server. on server have take xml data input , again convert table rows. simplest , time efficient way this. it not possible use xml datatype parameter in stored procedure on linked server. have use nvarchar(max) , convert xml in stored procedure. to create xml should use for xml (sql server) . raw , auto easy , if need more control use path . stay away explicit . to shred xml on receiving side should use nodes() method (xml data type) , value() method (xml data type) .

c# - Server Error in '/WebSite8' Application. Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index -

description: an exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.argument out of range exception: index out of range. must non-negative , less size of collection. parameter name: index code: protected void imagebutton1_click (object sender, eventargs e) { imagebutton lnkbtn = sender imagebutton; gridviewrow gvrow = lnkbtn.namingcontainer gridviewrow; string filepath = gridview2.datakeys[gvrow.rowindex].value.tostring(); response.contenttype = "image/jpg"; response.addheader("content-disposition", "attachment;filename=\"" + filepath + "\""); response.transmitfile(server.mappath(filepath)); response.end(); } it looks me facing issue @ point string filepath = gridview2.datakeys[gvrow.rowindex].value.tostring(); when tr

java - unable to open software and workspace center in myeclipse -

when try opening software , workspace center in myeclipse gets stuck @ 75% i have following error in .log file !entry org.eclipse.ui 4 0 2014-03-10 12:24:32.109 !message unhandled event loop exception !stack 0 org.eclipse.swt.swtexception: failed execute runnable (java.lang.nullpointerexception) @ org.eclipse.swt.swt.error(swt.java:3884) @ org.eclipse.swt.swt.error(swt.java:3799) @ org.eclipse.swt.widgets.synchronizer.runasyncmessages(synchronizer.java:137) @ org.eclipse.swt.widgets.display.runasyncmessages(display.java:3855) @ org.eclipse.swt.widgets.display.readanddispatch(display.java:3476) @ org.eclipse.ui.internal.workbench.runeventloop(workbench.java:2405) @ org.eclipse.ui.internal.workbench.runui(workbench.java:2369) @ org.eclipse.ui.internal.workbench.access$4(workbench.java:2221) @ org.eclipse.ui.internal.workbench$5.run(workbench.java:500) @ org.eclipse.core.databinding.observable.realm.runwithdefault(realm.java:332) @ org.e

sed - How to find the matching records from 2 files in unix -

i have 2 files contains email_ids. 1. test1.txt 2. test2.txt test1.txt contents are: abc@gmail.com xyz@gmail.com mns@gmail.com test2.txt contents are: jpg@gmail.com joy@yahoo.com abc@gmail.com pet@yahoo.com here abc@gmail.com common id between test1.txt , test2.txt. want find out such id's these 2 files , insert them 1 file. please suggest. need id's common in between these 2 files. try: awk 'nr==fnr{a[$1]; next} $1 in a' file1 file2 > file.new --edit: added explanation -- awk ' nr==fnr { # when first file being read (only fnr , nr equal) a[$1] # create (associative) element in array first field index next # start reading next record (line) } $1 in # while reading second file, if field 1 present in array print record (line) ' file1 file2 > file.new # first read file1 first file , file2 second file , write output 3rd file.

unicode - how to change to english number to nepali number in php -

in project have change english numerals nepali 1 upto 2 digits. e.g. if enter 1 should return १ , if enter 41 should return ४१ , have store ४१ in db , show in front end. how this? tried use "font-family: preeti;" when getting nepali numerals gives à¥Âª , not १. when use below function gives à¥Âª instead of १. how solve this? function convertnos($nos){ switch($nos){ case"०":return 0; case"१":return 1; case"२":return 2; case"३":return 3; case"४":return 4; case"५":return 5; case"६":return 6; case"७":return 7; case"८":return 8; case"९":return 9; case"0":return"०"; case"1":return"१"; case"2":return"२"; case"3":return"३"; case"4":return"४"; case"5":return"५"; case"6":return"६&qu

java - Open NLP Name Finder Output -

i starting learn opennlp api jave. found examples in website http://www.programcreek.com/2012/05/opennlp-tutorial/ i have tried name finder api found strange. if replace input as string []sentence = new string[]{ "john", "is", "good" }; the code still working, if change as string []sentence = new string[]{ "john", "is", "fine" }; there no output. i cannot understand causes problem. form model use? (en-ner-person.bin) , know how can build own model? thanks! assuming not throwing exception , can't find name "john," it's not working because model cannot find john when sentence "john fine" because opennlp machine learning approach , finds named entities based on model. en-person.bin model apparently not have sufficient samples of sentences similar enough "john fine" retu

wpf - Application thorws Exception when applying style for a CustomListBoxItem -

i have problem require bit of time. need add listboxes on multiple pages in windows phone 8 app, on each page normal/selected background listboxitem different(10-12 pages). 1 solution create different styles each listboxitem every page hard-coding color-codes in stylesheet(which dont want). have extended listboxitem class , added 2 dependency properties normal , selected item background listboxitem. may set these properties on each xaml page , dont have create different styles every page. here extended control public class customlistboxitem : listboxitem { public static readonly dependencyproperty normalbackgroundproperty = dependencyproperty.register("normalbackground", typeof(solidcolorbrush), typeof(customlistboxitem), new propertymetadata(null)); public static readonly dependencyproperty selectedbackgroundproperty = dependencyproperty.register("selectedbackground", typeof(solidcolorbrush), typeof(customlistboxitem), new propertymeta

c++ - Struct Not Completing Sort -

basicly here assignment i'm not asking complete assignment, assist me. sort array of structs in assignment, create array of structs , sort array. create struct (at least) 3 fields create array of structs read data array of structs (10 15 records) print array sort array (in ascending order) on 1 field of struct print array sort array (in descending order) on field of struct print array i stuck on step 5. this program of now. #include <iostream> #include <sstream> using namespace std; struct data { int a,b,c; } number [10]; int main(){ int enterdata; int *temp = new int[3]; (int = 0; i<10; i++){ //for (int n = 0; n<=3; n++){ cin>> number[i].a; cin>> number[i].b; cin>> number[i].c; if(i >= 10) break; //} } (int = 0; i<10; i++){ // (int n = 0; n<=3; n++){ cout << number[i].a << " "; cout << number[i].b << " "; cout << number[i].c &l

javascript - Search words in any order using JS -

i have code search typed words text box, typed word, search in web sql database , show result in html page. in can search word is, using like . (i.e) select * tblname searchword %<typedword>% if table has, hello doctor hi sir hello world welcome programmer and user types " hello ", shows me **hello** doctor **hello** world i need display result if user wrongly arranges words, i.e if user types " world hello " it not showing results. but, want show user hello world can please me? so want , search using each of words entered, rather exact string? howabout this: var yoursearchtext = 'world hello'; var searchterms = yoursearchtext.split(' '); var searchtermbits = []; for(var i=0; i<searchterms.length;i++) { searchtermbits.push("word %"+searchterms[i]+"%"); } var result = searchtermbits.join(" , "); var query = 'select * table '+result; this give query li

how to get parameter value from query string in a page loaded by jQuery Mobile page transition -

i have page, index.html, uses listview of jquery mobile. each item in listview refers same page (log.html), query string parameter appended, href log.html?id=1, log.html?id=2, , like. trying value of "id" parameter, not know how. if access log.html directly brower, can parsing location.search, if page loaded page transition in listview, location.search empty.

arrays - Setting a constructor and few objects in java -

so have class called memorystructure supposed represent support structure object called student has firstname, lastname, age , university. this trouble part: public class memorystructure { private student[] memoryarray; private int currentsize; private int arraysize; // constructor goes here /** * adds object <code>student</code> collection right after * last element in current collection. * * @param student * object added collection. */ public void add(student student) { // done can @ least go bit through explaining should write here? it's first touch java , having bit of trouble. also, should student made class constructor , setters/getters changing through memoryarray in above class? i supposed make new array once currentarray size gets bigger arraysize, should 2*arraysize , have elements previous array copied in. put in constructor? i hope question isn't broad.

c# - How to use StringFormat in XAML? -

i want show text this: 10 reviews this 1 works: <textblock text="{binding reviews, stringformat='reviews {0}'}"/> this 1 works error in xaml appears saying r unexpected @ position <textblock text="{binding reviews, stringformat='{0} reviews'}"/> try this: <textblock text="{binding reviews, stringformat='{}{0} reviews'}"/>

unix - html: How to split a very large html file, into pieces without breaking formatting -

i have large html file, downloaded place. need convert pdf eventually. there way split several html smaller parts (e.g. kind of pagination). (i not control part of creating html file, can nothing on server side) it sounds tedious manual process me. consider html2pdf , other similar utilities convert entire chunk pdf, doing pagination using pdftk . if css includes print style definitions, might of use. it's not possible automate answer.

Android Endless list memory management -

i'm implementing endless listview loading more items arraylist in onscrollstatechanged(...) method. if i'm implementing scheme fetching more 1 million entries, have million objects added arraylist, memory intensive. schemes can use efficient memory management ? ps: question number of items can put adapter. edit: more details: the source of data internet. have fetch data internet , put listview adapter. i think should keep current entries , 1 before or after them(maybe 100),put data cache. when scroll listview,fetch more entries , update cache before(do not 1 million @ 1 time).

ios7 - can not override GetRendererForOverlay on monotouch -

i want draw overlay on top of mkmapview defined delegate class defining view of overlays. can see seems ios 7 recommended use getrendererforoverlay instead of getviewforoverlay . problem can not find method name getrendererforoverlay override. in better word seems mkmapviewdelegate has not virtual method overriding getrendererforoverlay . how should use it? public class mymapdelegat : mkmapviewdelegate { [obsolete ("since ios 7 recommnended use getrendererforoverlay")] public override mkoverlayview getviewforoverlay (mkmapview mapview, nsobject overlay) { // note: don't call base implementation on model class // see http://docs.xamarin.com/guides/ios/application_fundamentals/delegates,_protocols,_and_events throw new notimplementedexception (); } } i read document has been suggested on note not find thing getrendererforoverlay. you can method getviewforoverlay ios7. need call var circleoverlay = mkcircle.

javascript - Right way for backbone view code -

i have side view list , when 1 of item in list clicked show corresponding view my code follows: view app.view.brandsidepanelview = backbone.view.extend({ tagname: 'div', template: _.template($('#brand-side-panel').html()), template_brand: _.template($('#brand-create').html()), template_offer: _.template($('#offer-create').html()), initialize: function() { this.render(); }, events: { 'click .bra-main': 'showbrandcreateview', 'click .bra-off': 'showoffercreate', 'click .bra-cmgn': 'showcampaigncreate' }, showbrandcreateview: function(e) { e.preventdefault(); this.reset(); $('.crt-cnt').html(this.template_brand()); }, showoffercreate: function(e){ e.preventdefault(); this.reset(); $('.crt-cnt').html(this.template_offe

c# - How to prevent user to add control on specific location? -

Image
previously have posted question how create non-client area? , got answer. now, want prevent user add control on specific client area.so, user can add control on allocated portion of client area. the control should looked this. class design & codes xwizardcontrol: main user control placed on form. xwizardpagewindow: container contains xwizardpages . control placed on xwizardcontrol . user add pages control collection dialog window. xwizardpagecollection: collection of xwizardpage . xwizardpage: user place other controls here. xwizardpagedesigner: control designer xwizardpage control you're setting nonclient rectangle incorrectly. "on entry, structure contains proposed window rectangle window. on exit, structure should contain screen coordinates of corresponding window client area." - msdn - also notice rect structure ltrb rectangle , not xywh rectangle. incorrect you shouldn't set values explicit: ncrect.top = 6

tags - fadeto jquery function on all page but few (tagged) elements -

i using simple script on webpage: <script> $(document).ready(function(){ $("notowned").fadeto(2000,0.2,function(){ }); }); </script> so elements (images) under "notowned" tag grayed out. however, quite counter-intuitive programs pages that, wanted reverse: fade out elements , add "owned" tags should not grayed out. tried various ways, making 2 tags, did not work. can me that? thanks! edit: here jfiddle link http://jsfiddle.net/4tkh6/ note have on 118 elements, want them grayed out default , "ungrey" of them tag or something. afaik fadetoggle removes them not me. playground <notowned> tag not standard tag neither in html5, don't use it . use standard elements <div> , if need 'em special assign custom data-* attribute purpose: <div data-owned="0">image 1</div> <div data-owned="1">image 2</div> <div data-owned="0">image 3&l

avi - Anyone know application to archive GoPro, MP4 and MOV movie material -

i have lot of movie material, because have gopro camera. in mov format. i want application can spot material , archive in , based on log make searches , export e.g. avid, final cut pro , windows movie maker. is there such application? i have used olympiclog ( http://www.olympiclog.net ). application allows shuttle through material , make annotations it. after done, can fuzzy search these annotations , make selection. selection can exported edl, windows movie maker project file. workes quite nice!

Design advice in Android application -

i'm making application in android should detect, classify , map road surface anomalities (potholes, speedbumps, road rugosity/roughness, etc.) using mobile sensors (accelerometer, gps), , i'm in need of little advice on design choices since i'm quite new android development. so far, have created background service (using asynctask) reads sensors , stores data in buffers. need use data provided service perform low level filters , computations must use pothole/speedbump/rugosity/mapping/etc. detection procedures. i want somehow modularise/layer these procedures such lowest level filters provide data higher level procedures , i'd love suggestions/best practices on how achieve this. i'd know how consume data provided background service (timer triggered event @ given interval, ...) ? i no android expert, have been developing app similar structure yours. accomplish it, using actual long-running service top-level background proccessing , data management

c# - CrystalReports: Show Parameter-Dialog on Export to file (e.g. PDF) -

we're trying show parameter-dialog exporting file. if cannot show dialog, export states not parameter values have been set. showing report in crystalreports reportviewer control, dialog gets shown automatically , works fine export not able show dialog or fill missing values. not want implement our own parameter-dialog. want use standard one? has working code scenario? appreciated. used programs: - visual studio 2012 , crystalreports 2013 after fighting same problem solution was: var crv = new crystalreportviewer(); crv.reportsource = reportdocument; crv.reuseparametervaluesonrefresh = true; crv.showfirstpage(); eventhough forums suggest calling crystalreportviewer.refreshreport() fails constantly. magic done via showfirstpage() . another hint on crystalreports : order matter!

c# - Windows phone 8 RSS live tile -

im trying show newest feed item text in live tile rss, when run app, there no feed text inside live tile. hope there can help. thanks. app.xaml.cs: private void application_launching(object sender, launchingeventargs e) { var taskname = "windowsphoneblogsta"; periodictask periodictask = scheduledactionservice.find(taskname) periodictask; if (periodictask != null) scheduledactionservice.remove(taskname); periodictask = new periodictask(taskname) { description = "periodic task update tile of <your app>." }; try { scheduledactionservice.add(periodictask); #if debug scheduledactionservice.launchfortest(taskname, timespan.fromseconds(30)); #endif } catch (invalidoperationexception) { } } scheduledagent.cs: public class scheduledagent : scheduledtaskagent { /// <remarks> /// scheduledagent constructor, initializes unhandledexception

java - JavaFX GridPane resizing of pane children -

this may duplicate question, haven't found solution suits needs. inspired jewelsea 's colorchoosersample , half-way through implementation realised manual size can set on control s, , not on pane s. these panes should smart enough resize automatically depending on parent. is there way gridpane s children grab vertical , horizontal space @ same time? vbox , hbox combined. bet solution involves anchorpane . keep in children panes , not controls . sscce buttons (copy - paste - run - resize window) import javafx.application.application; import javafx.beans.property.doubleproperty; import javafx.beans.property.simpledoubleproperty; import javafx.beans.value.changelistener; import javafx.beans.value.observablevalue; import javafx.geometry.bounds; import javafx.geometry.insets; import javafx.scene.node; import javafx.scene.scene; import javafx.scene.control.button; import javafx.scene.control.control; import javafx.scene.layout.gridpane; import javafx.stage.stage;

c# - How to check for duplicate keys and delete previous value from Dictionary? -

i have dictionary contains values keys. according condition, have duplicate keys strictly not permitted in dictionary . question is: how check previous duplicate key in current dictionary , delete add new? you can use containskey() method of dictionary find out whether dictionary contains key or not dict.containskey(key) it returns true if dictionary contains key otherwise returns false you don't need delete key can overwrite value if(dict.containskey(key)) { dict[key]=your_new_value; } else { dict.add ( key,your_new_value); }

c# - URL route configuration cannot deal with periods in url -

i have created mvc controller linked model file created ado.net wizard. id column isn't filled normal values integers or guids, strings can have periods. auto generated edit functionality gets screwed on because route engine takes character in id configuration , throws exception: the resource looking has been removed, had name changed, or temporarily unavailable. the edit action formated as: // get: .../edit/5 public actionresult edit(string id) { //my code } and when url doesn't contain spec character (ie: /edit/2982-4-112a ) works wonderfully, when contains periods (ie: /edit/125-2-10.5 ) exception follows. i have tried adding web.config line <httpruntime relaxedurltofilesystemmapping="true" /> didn't solve problem. how 1 work around this? i feel intercept parameter , exchange dot else until gets method @ point revert change. don't know how though. at moment solution this: at place links need generated string.replace(

c# - ConfigurationManager.ConnectionStrings[0].Name return LocalSqlServer -

Image
i have wcf web service , call wcf method ajax ( jquery ). i tested web service wcftestclient.exe , works well. but when call web service method jquery , have error ( object reference not set instance of object ). i debug , have in **configurationmanager.connectionstrings[0].name** : *localsqlserver* . my database key rms , not localsqlserver. i have 2 projects in solution, wcf , application console turn web service. here solution here web.config : <?xml version="1.0" encoding="utf-8"?> <configuration> <connectionstrings> <add name="rms" connectionstring="data source=192.168.40.137;initial catalog=rms_database;persist security info=true;user id=****;password=****" providername="system.data.sqlclient" /> </connectionstrings> <appsettings> <add key="aspnet:usetaskfriendlysynchronizationcontext" value="true" /> </appsettings> <syst