Posts

Showing posts from April, 2012

How to add List<int> to a DataContract of a web service -

i want create datacontract class 2 different list members. when try start web service, error method, sendemail, not supported test wcf client. data contract: [datacontract] [knowntype(typeof(int[]))] public class emailinfo { private string strfromuserid = string.empty; private string strfromaddress = string.empty; private string strfromname = string.empty; private object lstindividualids = null; private object lstgroupids = null; private string strsubject = string.empty; private string strmessage = string.empty; [datamember] public string fromuserid { { return strfromuserid; } set { strfromuserid = value; } } [datamember] public string fromaddress { { return strfromaddress; } set { strfromaddress = value; } } [datamember] public string fromname { { return strfromname; } set { strfromname = value; } } [datamember] public object individualids ...

oracle - add item inside Interactive Report Region -

i need add text box @ top of inetractive report region or between action bar , report itself. tried make irr without heading not successful in either. help you need create dynamic action fired on page load , set execute javascript code posted below: document.getelementbyid('apexir_toolbar').innerhtml = document.getelementbyid('apexir_toolbar').innerhtml + '<label for="p5_x" class="uoptional"></label></td><td align="left" valign="middle"><input type="hidden" name="p_arg_names" value="11759631789729827" /><input type="text" id="p5_x" name="p_t01" class="text_field" style="margin:5px" value="" size="30" maxlength="4000" />'; or using oracle-apex 'jquerysh' notation: $x('apexir_toolbar').innerhtml = $x('apexir_toolbar').innerhtml + '...

javascript - Setting controller attributes inside ajax call -

i new in angularjs , i'm doubt controller attributes. created attribute called anuncio, attribute has array of objects showed in image bellow: var anunciomodule = angular.module('anunciomodule',[]); anunciomodule.controller('registrationcontroller',['$http',function ($http){ this.anuncios; this.loadanuncios = function loadanuncios(){ $http.get('http://localhost:8080/pederofer/anuncios/get.action').then(function(result){ this.anuncios.push.apply(this.anuncios, result.data); }); } }]); when call webservice function loadanuncios , try set values directly using "this.anuncios" message "this.anuncios undefined". if create var called anuncs , set "this.anuncios = anucs", , instead of set ajax call directly this.anuncios set anucs image bellow, works. var anunciomodule = angular.module('anunciomodule',[]); var anuncs =[]; anunciomodule.controller('reg...

ftp - InternetOpenUrl failed: '' download.file in R -

i trying download file following : "download.file(url,"db.zip", "auto", quiet = false, mode = "wb", cacheok = true)" but keep getting error stating in download.file(url, "db.zip", "auto", quiet = false, mode = "wb", : internetopenurl failed: '' i've searched countless places , haven't found valid reason. , says theirs working

java - Is it possible to convert HTML into XHTML with Jsoup 1.8.1? -

string body = "<br>"; document document = jsoup.parsebodyfragment(body); document.outputsettings().escapemode(escapemode.xhtml); string str = document.body().html(); system.out.println(str); expect: <br /> result: <br> can jsoup convert value html xhtml? see document.outputsettings.syntax.xml : private string toxhtml( string html ) { final document document = jsoup.parse(html); document.outputsettings().syntax(document.outputsettings.syntax.xml); return document.html(); }

Create a bash script to compile SCSS into CSS that takes arguments -

how can create bash script compile scss css works different filename , paths? for example i'm running command compile scss file css file in different directory: sass test.scss ../css/test2.css it's tedious run on , on again, can write makes easier? i'm new bash scripting. is looking for? #!/bin/bash f=${1:-test} sass ${f}.scss ../css/${f}.css this script runs sass filename.scss ../css/filename.css . if filename (without extension) isn't set first argument defaults test . can update accept more 1 input file. but not going save time since still have call script instead of sass . replacing command doesn't accomplish anything. use !sass instead rerun last sass command on same file or !! rerun previous command. bash history . how use: save script file, xx . make xx executable: chmod u+x xx run without argument on test: ./xx run filename without extension: ./xx myscssfile here's version take list of filenames input or default tes...

Finding imports and dependencies of a go program -

the go list -json command run command line tell imports , dependencies of go program ( in json format). there way information within go program i.e @ runtime, either running 'go list' command somehow or way? i don't think can without using go binary since go needs analyze source code. it's pretty easy must have access go , source code @ run time. heres quick example: package main import ( "encoding/json" "fmt" "os/exec" ) func main() { cmd := exec.command("go", "list", "-json") stdout, err := cmd.output() if err != nil { println(err.error()) return } var list golist err = json.unmarshal(stdout, &list) _, d := range list.deps { fmt.printf(" - %s\n", d) } } type golist struct { dir string importpath string name string target string stale bool root string ...

mysql - Using a prepared statement in php & mysqli -

i using prepared statements first time. , cannot select work. reason, returns records cannot them variables. know returns records because if add echo '1'; loop echo's 1 each record. any assistance great. code below: function builditems($quote_id){ if ($stmt = $this->link->prepare("select * `0_quotes_items` `quote_id` = ?")) { // bind variable parameter string. $stmt->bind_param("i", $quote_id); // execute statement. $stmt->execute(); while ($row = $stmt->fetch()) { echo $row['id']; } // close prepared statement. $stmt->close(); } } update: in error log, see following error after adding while ($row = $stmt->fetch_assoc()) { suggested: php fatal error: call undefined method mysqli_stmt::fetch_assoc() i found link same issue had, not understand how imple...

ios - local declaration of 'date format' hides instance variable? -

getting 7 warning messages these 3 statements : // , grab date components same date hijricomponents = [hijricalendar components:(nsdaycalendarunit | nsmonthcalendarunit | nsyearcalendarunit) fromdate:[nsdate date] ]; [dateformat setdateformat:@"d/m/yyyy"]; nsdate *dateee = [dateformat datefromstring:datestr]; self.gdaylabel.text = [nsstring stringwithformat: @"%ld", (long)[gregoriancomponents day]]; self.gmonthlabel.text = [nsstring stringwithformat: @"%ld", (long)[gregoriancomponents month]]; self.gyearlabel.text = [nsstring stringwithformat: @"%ld", (long)[gregoriancomponents year]]; check xyzviewcontroller.h file. dateformat declared there property. in method has local variable same name. either rename local variable or use global o...

c++ - Difference between CPtrArray and CArray -

microsoft / msdn has 2 similar container classes: ctypedptrarray , carray . ctypedptrarray supposed array of typed-pointers, while carray can array of type (including pointers), , see nothing in documentation suggest ctypedptrarray safer/faster/easier carray . is there meaningful difference between these two? ctypedptrarray<cptrarray, cmyfoo*> arrayone; carray<cmyfoo*, cmyfoo*> arraytwo;

moved git working copy, changes no longer detected -

so had uncommitted changes in working copy. ran out of disk space moved working copy volume. git not recognize there changes committed. not sure how should solve this. thanks. ok, let's have small summary of comes mind after little information have: if corrupted clone copying part of (why ever), corrupted, there no magic voodoo button can solve such data loss. doubt issue here, description not fit, in such case 1 expect git complain or @ least point out missing or changed files. if remarks right, git instead not show local modifications, claims there none. second, if somehow git lost control on files indeed have local modifications (whatever means...), there 1 thing try recover @ least part of changes: make second clone of repository other location date (remember: in git there not "server" acting central repository, there clones @ eye level). copy on files supposedly broken clone fresh one, _only files under git control, source files, images , like. in c...

(Beginner) C++ regarding inheritance -

i'm trying workout problem in c++ regarding inheritance , wondering how go doing correctly. i have 3 classes set up: - enemy (which has member data: int damage, int health , int level) - wolf - bear the way inheritance set is: wolf is-a enemy , bear is-a enemy. in other words, both wolf , bear inherit enemy. i want set program when create new enemy so: enemy anenemy; then in enemy::enemy() constructor randomly decide whether enemy wolf or bear. how 1 approach problem? know i'd have generate random number in enemy::enemy() constructor , based on result of random number turn enemy either bear or wolf. can't wrap head around how "turn it" (the enemy) wolf or bear. any appreciate. thanks! you have 2 problems right : first, polymorphism (look up) based on references or pointers, not values. therefore, when create ennemy (who might bear or wolf "at random") cannot hold variable of value type it, because type won't same. e...

seo - Meta keywords and google -

i recall article (by google employee) says keywords obsolete regarding seo. may true, possible meta keywords can determine relevancy of adsense ads? words, should meta keywords ignored or used? no , ignore keyword meta tag. neither google crawler nor google adsense using meta keywords, because completly useless, create content, use headers , structured content, , good.

java - Why isn't the AmazonS3Client using the proxy I set? -

i'm running code: string urlstring = rooturl + "/" + path; awscredentials mycredentials = new basicawscredentials(environmentvariables.aws_access_key, environmentvariables.aws_secret_key); clientconfiguration clientconfiguration = new clientconfiguration(); if ("true".equalsignorecase(environmentvariables.proxyset)) { logger.info("environmentvariables.proxyhost=" + environmentvariables.proxyhost); clientconfiguration.setproxydomain(environmentvariables.proxyhost); logger.info("environmentvariables.proxyport=" + environmentvariables.proxyport); clientconfiguration.setproxyport(integer.valueof(environmentvariables.proxyport)); } transfermanager tx = null; try { tx = new transfermanager(new amazons3client(mycredentials, clientconfiguration)); objectmetadata objectmetadata = new objectmetadata(); objectmetadata.setcontenttype(pathtocontenttype(path)); ...

ios - UICollectionView very slow to load because of dequeueWithReusableIdentifier, can I load it in background? -

i'm facing issue reaaaally don't find answer to. have collectionview, , every time tap button, reloaddata of collectionview new parameters. problem takes around 1-2s wich annoying , freeze ui. i know if there way reload collectionview in background , diplay when it's done, (in pseudo-code) : self.collectionview.hidden = yes; dispatch_async({ [self.collectionview reloaddata]; }); and when it's updated : self.collectionview.hidden = no; i haven't found how on internet, , need help. full code cellforrowatindexpath method : - (uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath { uicollectionviewcell *cell = nil; if (indexpath.row >= 1 && indexpath.row <= 7) { static nsstring *cellidentifier = @"agzdaylettercell"; cell =(agzdaylettercollectionviewcell*)[collectionview dequeuereusablecellwithreuseidentifier:cellidentifier forindex...

python - Add many in Django Admin -

Image
in models list view in django admin, there button add 1 model. extend bit , able add multiple items @ once. models images, , nice able add multiple images @ 1 time. i've had success @ creating custom fields within individual model view, don't know begin on list view. can @ least point me in right direction? edit: i want change view, , add button on top right "add multiple images" i think want use tabularinline or stackedinline assuming have model has set of images , model each image (so e.g. class portfolio(models.model): name = models.charfield(max_length=100) class image(models.model): port = models.foreignkey(portolio) name = models.charfield(max_length=100) img = models.imagefield() # or you're storing image, e.g. url, you can create in admin.py class imageinline(admin.tabularinline): model = image class portfolioadmin(admin.modeladmin): inlines = [ imageinline, ] (you can specify extras, e.g. ...

json - Django d3.js in HTML file not loading unless I manually open HTML file -

i'm trying implement bubble chart on webpage using django framework , d3.js framework. have html file, , data stored in json file. accessing json file seems fine, because when manually open html file in browser works/loads fine, however, when hit webpage url endpoint via django, d3 part of page shows blank (console says "node undefined"). using example code given here . any appreciated. thanks. d3 js code: <script src="http://d3js.org/d3.v3.min.js"></script> <div class="cloud"> <script> var diameter = 960, format = d3.format(",d"), color = d3.scale.category20c(); var bubble = d3.layout.pack() .sort(null) .size([diameter, diameter]) .padding(1.5); var svg = d3.select("body").append("svg") .attr("width", diameter) .attr("height", diameter) .attr("class", "bubble"); d3.json("cloud.json", function(error, r...

Why are reference types not destroyed immediately like value types? -

many tutorials reference types created on heap , can destroyed when last reference disappears. on contrary, value types created on stack , destroyed automatically right after go out of scope. information can found in many literature. but couldn't figure out reason why reference types not destroyed such in value type case. many tutorials reference types ... can destroyed when last reference disappears. how else know when reference type has gone out of scope?

javascript - Change DIV width that is before another DIV -

i have structure dynamic divs , have same class, since created automatically. the problem here that, last of them prior other div other class, have style width:100% instead of width:50% others set css. here's sample: <div class="awp_box awp_box_inner"></div> <div class="awp_box awp_box_inner"></div> <div class="awp_box awp_box_inner"></div> <div class="awp_stock_container awp_sct" style="max-width: 400px !important;"></div> so want change third div, first , one, other times second, other times fourth, etc... i css time i'm having hard time finding solution one. can please give me hand here guiding me in right track put working? based on comments, following script give need. $(document).ready(function(){ $('.awp_sct').prev().addclass('full'); }); it add class previous element of .awp_sct. demo

c# - Linq Foreign Key Select -

i have 2 tables 1 (articles) many (details) relationship. details may not contain data particular article entry. articles: id, title, numb (pk), name details: id (pk), person, numb (fk), name in entity framework, there appropriate navigation properties , shows correct one:many relationship. what want articles match end user's query (by 'name') all, if any, data details table (id, person, numb, name). what i'm stuck on right can query articles fine ( var article = db.articles.where(b => b.name.equals(name)); ), while result include hashset details.numb on each row of articles, there no data in hashset. there appropriate corresponding entries in database article.numb => details.numb. actually there 2 ways achieve this. enable lazy loading. call include method other answers says. using lazy loading see msdn article more detail. db.contextoptions.lazyloadingenabled = true; using include method var article = db.db.articles...

r - Why 'Error: length(url) == 1 is not TRUE' with rvest web scraping -

i'm trying scrap web data first step requires login. i've been able log other websites weird error website. library("rvest") library("magrittr") research <- html_session("https://www.fitchratings.com/") signin <- research %>% html_nodes("form") %>% extract2(1) %>% html_form() %>% set_values ( 'username' = "abc", 'password' = "1234" ) research <- research %>% submit_form(signin) when run 'submit_form' line following error: > research <- research %>% + submit_form(signin) submitting '<unnamed>' error: length(url) == 1 not true submitting unnamed correct b/c there no name assigned sign in button. appreciated! i having same issue. jumped through few hoops dev version of rvest running, , it's working smoothly now. here's how went it: first thing first. need install rtools. make sure r closed...

algorithm - Java-Randomized Queue Iterator Causes Invalid Range Exception -

i have implementation of randomized queue in java. although enqueue, dequeue , sample operations work fine, iterator causes invalid range exception thrown every time in shuffle method. i not understand why since random number generation in shuffle() method bound size of queue. here code: private int n=0; private item[] queue; public randomizedqueue(){ queue= (item[]) new object[8]; } // construct empty randomized queue public boolean isempty(){ return n==0; } // queue empty? public int size(){ return n; }// return number of items on queue private void resize(int capacity){ item[] copy=(item[]) new object[capacity]; for(int i=0;i<n;i++){ copy[i]=queue[i]; } queue=copy; } private class queueiterator implements iterator<item>{ int i=0; public queueiterator(){ if(n>0){ shuffle(); } } @override public boolean hasnext() { return i<n; } @ove...

c# - Linq GroupBy Clause -

var result = rows.groupby(x => new { y = x["academicyearid"] }) .select( g => new { academicyearid = g.key.y, classgroups = g.groupby(x => new { y = x["classname"], h = x["classgroupid"], = x["classyearid"] }) .select( classyear => new { classname = classyear.key.y, classgroupid = classyear.key.h, classyearid=classyear.key.i, classdivisions = classyear.groupby(x => new { b = x["division"], = x["divisionid"] }) .select( clsdiv => new { divisionid = clsdiv.key.a, division = clsdiv.key.b }) }) }); this working code, want "classdivisions" orderby divisi...

c# - Is send command from ViewModel to View violating MVVM? -

i want datagrid scroll bottom new item added underlying observablecollection . achieve this, make interface similar icommand in "reverse" way. public interface iviewmodelcommand { void execute(object parameter); } implementation public class viewmodelrelaycommand : iviewmodelcommand { private readonly action<object> _action; public viewmodelrelaycommand(action<object> action) { if(action == null) throw new argumentnullexception("action"); _action = action; } public void execute(object parameter) { _action(parameter); } } my viewmodel private iviewmodelcommand _scrollaction; public iviewmodelcommand scrollaction { { return _scrollaction; } set { if (_scrollaction == value) return; _scrollaction = value;onpropertychanged(); } } then create behavior datagrid. (scroll end code taken he...

This is a c# coding with sql. Syntax error when value changes -

i newbie in c# , sql. code showing syntax error when i'm inserting contact no. having 10 digits no error when less it. data type in table big int. using sql server 2008. please help. code given below. squery = "insert receivechallanprint1 (challanno,referencno,title,author,isbn,challandate," + "receivedon,publisher,publisheraddress,publishercontactno,publisheremail,templatename," + "templatesubject,templatebody,emailattachment1" + ")"; squery = squery + " values("; squery = squery + "'" + convert.toint32( dgvchallanactive.rows[i].cells["challanno"].value.tostring()) + "',"; squery = squery + "'"+convert.toint32( dgvchallanactive.rows[i].cells["referenceno"].value.tostring())+ "',"; squery = squery + "'" + convert.tostring(dgvchallanactive.rows[i...

removing NA values from a DataFrame in Python 3.4 -

import pandas pd import statistics df=print(pd.read_csv('001.csv',keep_default_na=false, na_values=[""])) print(df) i using code create data frame has no na values. have couple of csv files , want calculate mean of 1 of columns - sulfate. column has many 'na' values, trying exclude. after using above code, 'na's aren't excluded data frame. please suggest. method 1 : df[['a','c']].apply(lambda x: my_func(x) if(np.all(pd.notnull(x[1]))) else x, axis = 1) use pandas notnull method 2 : df = df[np.isfinite(df['eps'])] method 3 : using dropna here in [24]: df = pd.dataframe(np.random.randn(10,3)) in [25]: df.ix[::2,0] = np.nan; df.ix[::4,1] = np.nan; df.ix[::3,2] = np.nan; in [26]: df out[26]: 0 1 2 0 nan nan nan 1 2.677677 -1.466923 -0.750366 2 nan 0.798002 -0.906038 3 0.672201 0.964789 nan 4 nan nan 0.050742 5 -1.250970 ...

javascript - I used ionicons in my project , but it can not be showed -

as title says,i used follow element in project can not showed. <i class="ion-android-checkbox"></i> i not know how solve problem.if can tell me how solve problem, thank much. here answer. hope can helps someone. http://forum.ionicframework.com/t/ionicons-breaking-on-ionic-beta-13-fixed/13640

awk - pattern matching and selecting digits for printing -

i have file long line containing many columns header each column this. bmr_22@o15-bmr_1@o23-h23 bmr_14@o22-bmr_1@o26-h26 bmr_14@o14-bmr_1@o26-h26 bmr_14@o12-bmr_1@o16-h16 bmr_17@o26-bmr_2@o24-h24 bms_88@o22-bmr_4@o22-h22 bms_89@o22-bmr_4@o26-h26 bms_89@o12-bmr_4@o12-h12 bmr_15@o25-bmr_15@o26-h26 bms_96@o25-bmr_5@o16-h16 bmr_13@o23-bmr_6@o26-h26 bmr_27@o22-bmr_126@o12-h12 bmr_17@o26-bmr_6@o13-h13 bmr_26@o26-bmr_6@o16-h16 bmr_29@o26-bmr_7@o16-h16 bms_86@o23-bmr_19@o26-h26 bms_78@o16-bmr_9@o16-h16 bms_96@o24-bmr_10@o23-h23 bmr_14@o25-bmr_11@o24-h24 bms_90@o22-bmr_11@o26-h26 bmr_25@o13-bmr_11@o12-h12 bmr_120@o24-bmr_11@o13-h13 bmr_25@o22-bmr_11@o13-h13 bms_65@o24-bmr_12@o23-h23 bmr_31@o11-bmr_12@o12-h12 i select columns based on criteria. if use command below: awk 'nr==1{for (i=1;i<=nf;i++) if ($i~/^bmr_[1-9]@o13-bmr/) print $i } ' inputfile i like: bmr_1@o13-bmr_14@o13-h13 bmr_2@o13-bmr_16@o13-h13 bmr_6@o13-bmr_27@o23-h23 bmr_2@o13-bmr_16@o12-h12 bmr_1@o13-bmr_30@...

php - Auto populate and generate dynamic row -

i'm creating auto populate text fields database , dynamic add , remove rows. there problem coming in script. when add new row script doesn't work. this html file. <link rel="stylesheet" href="css/jquery-ui-1.10.3.custom.min.css" /> <link rel="stylesheet" href="css/bootstrap.min.css" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script src="js/jquery-1.10.2.min.js"></script> <script src="js/jquery-ui-1.10.3.custom.min.js"></script> <script src="js/bootstrap.min.js"></script> <body> <script> $(window).load(function() { $(".loader").fadeout("fast"); ); </script> <div class="my-form"> <form name="form" action="demo.php" method="post"> <input type="hidden" val...

deployment - How to skip action defined in Installer's BeforeUninstall function when upgrading to WiX -

our current setup project created using vdproj needs migrated wix. during process, facing problem while upgrading existing vdproj msi wix msi. existing implementation performs action on 'beforeuninstall' event of installer, should not called when upgrading, on using wix msi, action being called. how skip event while upgrading using wix installer? i have tried setting properties 'previousversionsinstalled', 'newerproductfound' still action called. if you're doing major upgrade in wix should using majorupgrade element. if there upgrade going on, set wix_upgrade_detected property documented here: http://wixtoolset.org/documentation/manual/v3/xsd/wix/majorupgrade.html i recommend away installer class method of running custom action code , @ dtf managed code custom actions. don't know can call installer classes wix anyway, because in vs depend on infrastructure (the installutilb dll) proprietary visual studio.

Python static variable generator function -

i using following function generate static variable in python: #static variable generator function def static_num(self): k = 0 while true: k += 1 yield k when calling function main code: regression_iteration = self.static_num() print " completed test number %s %s \n\n" % (regression_iteration, testname) i output: "completed test number <generator object static_num @ 0x027be260> be_sink_ncq" why not getting incremented integer? static variable generator going wrong? edit: i calling function static_num in following manner now: regression_iteration = self.static_num().next() but returns '1' since value of 'k' being initialized 0 every time function called. therefore, not required output 1,2,3,4 .... on every call of function its hard whether need use approach -- strongly doubt it, instead of generator abuse using mutable types default initializers: def counter(init=[0]): init[...

mysql - Updating a database info when a file is updated in PHP -

i have database(mysql) table stores link of files can downloaded , contains last time these files updated. i time values(timestamps) in database table change whenever run code update files in filemanager in cpanel. how do in php? tried searching, no avail. need guidance on this. so far have done create interface can insert files in database using sb admin v2.0. takes care of updating timevalue. however, not need interface because run code update files. so looking @ how last modified time of file using php? if updating files system via external script (not php) need "listen" files. so, use cron job run (pseudo) code. $files = array( 'file1.txt' => array('timestamp' => '12345678'), 'file2.txt' => array('timestamp' => '12346879'), ); $target = '/uploads'; $weeds = array('.', '..'); $uploadedfiles = array_diff(scandir($target), $weeds); foreach ($uploadedfiles $...

php - How To Track For Which Foreign Key To Add A Value To? (ex: Add The Data For The Correct User FK) -

i have no idea how phrase correctly, hope title not far off. i know how add values table using php , passing values via sql. however, don't know how how ensure correct foreign key used particular entry. i think it's best describe through example. say have userbase table has usernameid(pk). have table called age , has column called age , usernameid(fk). so i'm saying there usernameid foreign key in age table. now, when have form on website , asks age person , person logged in, how can ensure when add age of particular user, gets added correct usernameid(fk). i'm going make assumption usernameid ready created, juts need know how ensure data gets connected right fk. does make sense saying? i've been searching google have no idea how describe want! while creating table define foreign key constraint. eg. create table age ( id int not null, age int not null, username varchar(10), primary key (id), foreign key (username) references user(username) )...

java - How to solve JavaFX ProgressIndicator repainting issues while downloading? -

i downloading file ftp client loop private void download(string date){ try { ftpfile ftpfile = client.mlistfile(filename()); long ftpfilesize = ftpfile.getsize(); frame.setmaximumprogress((int) ftpfilesize); file downloadfile = new file(folder + filename()); outputstream outputstream2 = new bufferedoutputstream(new fileoutputstream(downloadfile)); inputstream inputstream = client.retrievefilestream(filename); byte[] bytesarray = new byte[4096]; int bytesread = -1; int bytes = 0; while ((bytesread = inputstream.read(bytesarray)) != -1){ outputstream2.write(bytesarray, 0, bytesread); bytes += bytesread; } if (client.completependingcommand()){ outputstream2.close(); inputstream.close(); } else{ joptionpane.showmessagedialog(null, "downloading error."); } } catch (ioexception e) { if(e ins...

winapi - SendMessage not working for windows 8 metro apps using win32 lib -

i know how minimize desktop app window win32 app in vc++ using sendmessage(). fails if window of windows store app(metro app). api use minimizing windows store app window. , different other question( question because writing desktop app. want code minimize metro app window using vc++ win32 lib. , other question ipc between 2 apps both apps being written us. you can find information how metro app in win 8 may communicate backedn desktop app on same machine here: how can metro app in windows 8 communicate backend desktop app on same machine?

Java - Creating Object Arrays -

i can't seem work out these object arrays, i'm attempting create list of player names values stored, each integer , multiple strings each. this i'm working on far, object arrays correct storage package this? error in line 237 when try add player in class addplayer: player[usercount].setname(name); the error is:- exception in thread "main" index out of bounds. import java.util.arraylist; import java.util.hashmap; import java.util.list; import java.util.map; import java.util.scanner; public class playerkarma { static scanner input = new scanner(system.in); static private string[] username = {"name1","name2","test","moretesting","fervor","stackoverflow","imported","quaternion","jetstream"}; static private int[] karma = {1000,800,800,5,15,-4,-403,54,11,210}; static private boolean exit = false; static private int maxkarmachange = 10; //how players...

vtk - Get Patient's Information from DICOM images -

i'm using vtkdicomimagereader patient's information name, descriptive name, studyid , studyuid, , image data. wanted patient's id. how can that? vtkdicomimagereader doesn't provide function. posisble solutions: using vtkmedicalimagereader2. get library read dicom image's dcm file/extension. use itk-snap. what best way patient's id? thanks bunch! :) the "best" way ... well, more or less opinion based. 8) if patient id necessary information need, it´s might enough use vtkmedicalimagereader2 . depending on vtk version, because there bug in earlier version, returns null instead of patient data. but of course there external libs read dicom header informations. e.g. can take @ vtkgdcmimagereader

javascript - Angular js display gmail like overlapping email threads -

i trying build (similar gmail email thread): |--------------------------| | first message (clipped) | |--------------------------| |--------------------------| |======= 4 messages ======| |--------------------------| |--------------------------| | 2nd last msg (clipped) | |--------------------------| | hello there, | | last message | | complete text | | displayed | |--------------------------| you have multiple messages, collapsed , user can see last message, part of 1st , 2nd last message. when user clicks on center part of collapsed part, messages expanded. is there angular custom directive provides similar or open source use provide expand/collapse option. trying avoid writing scratch. i had @ bootstrap accordion, expand/collapse entire message thread. any guidance/help appreciated. thanks! with css can achieve desired result: <div class="inbox"> <div class="message"...

HTML5 insert data to input field -

i developing appin phonegap.. recall button there in page when user press recall button data stored in local storage , data needs enter in appropriate inputfields... not getting data in input fields ..i giving code below.. if error pls help.. <body onload="onload();"> <div class="app"> <form> * first name:<br> <input type="text" style="width:80%;" id="fn" input name="first" maxlength="15"> <br> </form> </div> <script language="javascript"> function onload() { if (localstorage.getitem('name1') == "roy") { document.getelementbyid("fn").value=localstorage.getitem('fnm'); } } </script> try setting , getting localstorage values using json methods shown below. setting value: localstorage.getitem('key',json.stringify('value')) getting value: json.parse(localstorage...

javascript - My Code is not working on Live Server -

if(isset($_session['jobsess'])) { $jobslug=$_session['jobsess']; header('location:http://cablingjobs.com/jobs/view/'.$jobslug.'/'); exit; } i put above code in staging site of wpengine.its working. but when when using same on live site doesn't redirect. i.e. header() not working properly. may issue cache cause when see source of site. each link having content. for example: src='http://3bceom1dyooq2orklp30o45s.wpengine.netdna-cdn.com/wp-includes/js/thickbox/thickbox.js?ver=3.1-20121105' what 3bceom1dyooq2orklp30o45s in above link ? it seems script hosted on cdn (content delivery network) . and part 3bceom1dyooq2orklp30o45s added cdn in url.

post - PHP $_FILES["fileToUpload"]["tmp_name"] -

how can turn $_files["filetoupload"]["tmp_name"] variable used in move_uploaded_file? this works: $filename = compress_image(($_files["filetoupload"]["tmp_name"]), $url, 30); but trying this: $filename = compress_image($images, $url, 30); but, when above not work. one alternative starting on was: file_put_contents($target_file , $image); in case, image named directory properly, image broken. to clarify: need turn ($_files["filetoupload"]["tmp_name"]) variable result of ob_start(); echo imagejpeg($image,null,30); $image =ob_get_clean(); ob_end_clean(); $image = addslashes($image); i need use $image save directory. $image has been stored mysql. have tried encode, , decode on $image, still no luck. let me explain problem step-by-step: the mess starts @ line: $image = imagecreatefromstring(file_get_contents($_files['filetoupload']['tmp_name'])); ...

php - WAMP Server localhost - www folder doesn't run code file -

Image
well, wamp server displayed "it works!" in localhost. find this? if open localhost we'll see this: tutorial right here also how run files c:\wamp\www folder? every time click file:///c:/wamp/www/ downloads file. what's wrong this? http://localhost/ this found directories , files inside www folder

stdin piping from python to java utf8 encoding error -

i trying pipe unicode characters python java. python code: thai = u"ฉันจะกลับบ้านในคืนนี้" command = "java - jar tokenizer.jar " + thai p = subprocess.popen(command, stdout = subprocess.pipe, stdin = subprocess.pipe, stderr = subprocess.pipe) i plan pipe them java via args[] . the results of tokenizer different when ran in java this: public static void main(string[] args) { string thai = "ฉันจะกลับบ้านในคืนนี้" thaianalyzer ana = new thaianalyzer(); ana.analyze(thai) } vs public static void main(string[] args) { string thai; thai = args[0] // "ฉันจะกลับบ้านในคืนนี้"(this string should passed python) thaianalyzer ana = new thaianalyzer(); ana.analyze(args[0]) } i believe encoding issue. pardon short java code not have code me. what trying example if pipe python java tokenize string "hi going home" i might end "hi", "i", "am", "going", ...

java - making a class with abstraction is also encapsulation? -

encapsulation said wrapping of data , method , hidding functionality(method , instance variable) not needed outside of object my question making variable private , public encapsulation ? or making class abstraction encapsulation ? for example: have switch(electic switch) class doing on or off make switch class have used abstraction , encapsulated switch class using abstraction can map motor or bulb or electric instrument public class switch { private boolean isoff = true; private iswitchlistener listener; public switch(iswitchlistener listener) { this.listener = listener; } public void trigger() { isoff = !isoff; if(isoff) { listener.off(); } else { listener.on(); } } } public class bulb implements iswitchlistener { @override public void on() { // todo auto-generated method stub system.out.println("bulb glittering"); } @override public...

android - Launch new activity (within same app) after login successful -

following code url overriding. after users logs in successfully, main activity loads next webpage. want redirect new activity(within app only) user experience made better. how do this? following code isn't working. tracked successful login event using debugger in firefox , used particular part of url "app?service". note: code works after click event happens in newly loaded webpage. want happen automatically after successful login. webview.setwebviewclient(new webviewclient() { @override public boolean shouldoverrideurlloading(webview view, string url) { if (url.contains("app?service")) { intent intent = new intent(login.this, status.class); intent.putextra("url", url); startactivity(intent); } return true; } @override public void onpagefinished(webview view, string url) { //my code } }); can...

Prebuild trainer for video face recognition processing in opencv c++ -

currently trying on gender recognition/ classifcation using opencv , fisherface algorithm. @ moment, training program apporximately 2500+ images due different lightings. problem takes me 35 minutes execute file. everytime execute file have re-train program. processing 2500+ images , takes 35 minutes before video face recognition program comes on. my xecution line in terminal ./main haarcascade_frontalface_alt.xml image_to_train.txt 0 ./main object build cpp/ .exe in windows haarcascade_frontalface_alt.xml face detection provided opencv image_to_train.txt 2500 images are 0 webcam is there anyway pre-built .txt file on iamges dont have retrain them everytime. thinking database, database runs single image processing through whole database again(brute-force concept). codes of training program these 2 lines in entire video recognition process. images passed these functions 1 one 2500 images execution time.looking opencv documentation still didnt idea on how can extract...

javascript - How to keep an element fixed top within another element? -

here jsfiddle , html: <div class="wrapper"> <div class="blur"></div> <div class="content"> text<br> text<br> text<br> text<br> text<br> text<br> text<br> text<br> text<br> </div> </div> and css: .wrapper{ position: relative; width: 300px; height: 100px; margin: 100px auto; background-color: #c0c0c0; overflow-x: hidden; overflow-y: auto; } .blur{ width: 400px; height: 50px; position: absolute; background-color: #000000; -webkit-filter: blur(10px); -ms-filter: blur(10px); -o-filter: blur(10px); -moz-filter: blur(10px); filter: blur(10px); left: -50px; top: -20px; } how keep .blur element fixed top within .wrapper element when scroll .content element? think jquery scrolltop might solution. tell me how th...

hadoop - Haddop MRUnit MapDriver.addInput() giving NotSerializableException: java.nio.HeapByteBuffer error -

i using mrunit unit test our mapreducer below pom changes <dependency> <groupid>org.apache.mrunit</groupid> <artifactid>mrunit</artifactid> <version>1.1.0</version> <classifier>hadoop1</classifier> <scope>test</scope> </dependency> i not using avro. i have added below lines rid of serialization issue configuration conf = driver.getconfiguration(); conf.set("io.serializations", "org.apache.hadoop.io.serializer.javaserialization," + "org.apache.hadoop.io.serializer.writableserialization"); now, using below api add inputs mapdriver.addinput(map<string, bytebuffer> key, map<string, bytebuffer> val) but when adding inputs above call, getting below error java.lang.runtimeexception: java.io.notserializableexception: java.nio.heapbytebuffer @ org.apache.hadoop.mrunit.internal.io.serialization.copy(serialization.java:86) @ org.apa...

can not connect to cassandra when using pdo php -

i install pdo cassandra , add in php.ini . when connect cassandra using php pdo. web blank (the connection reset). check error log apache, got child pid 18080 exit signal segmentation fault. i using [cqlsh 5.0.1 | cassandra 2.1.3 | cql spec 3.2.0 | native protocol v3] thrift version 0.9.0 ubuntu 14.04.1 sample connect cassandra $db = new pdo("cassandra:host=localhost;port=9042;cqlversion=3.2.0", 'cassandra', 'cassandra'); can tell me how fix this? thanks your problem apache problem rather cassandra one. library painfully outdated , doesn't seem getting updates either. last commit in jul 2012: commit d1a1d4bc0a940422e111f37c958170b074b6025a author: <we dont need bit> date: fri jul 13 15:05:22 2012 -0500 ... you have 2 options, find more updated library, or use old version of cassandra. i'd go former, planet cassandra has section driver options various languages .

javascript - Check if selector contains text (ie. is not media) in jQuery -

is there way use jquery see if selector text based field. ie. when user clicks element, check if it's element contain text , not image, video etc. what best way achieve in jquery? you have test element children know if 1 of them contain non-text element. if ($(this).find("img,video,object").length==0) { alert("i text element"); } else { alert("i not text element"); } and might have test element if can trigger click event.