Posts

Showing posts from September, 2010

Local notification on webpage update in webview that runs in background - Android -

i using gcm send notifications web server android app, want stop using gcm , examine local notification idea instead. my app has webview , idea webview somehow run in bg , when web page in webview updated, webview wake , generate local notification on device. way, don't have send notifications. need update page server , user local notification. is there way that? how? knows tutorial or example that? thank you

python - I'm creating Space Invaders but it's not working like it should -

for programming class i'm working on space invaders game... code isn't perfect it's working. mostly... i won't go lot of detail (i'll include link codeskulptor page can see yourself) 1 thing that's bugging me enemies slowing down, should speed up! i'm printing horizontal velocity (vx) console , can see it's increasing. speeding works until point slow down again, while vx still increasing?! easy spot when there 4 enemies left... all enemy/alien objects stored in list, when hit laser, deleted list function called 'kill'. heres function: def kill(enemy): global points points += 1 enemies in enemylist_1: if enemies.vx > 0: enemies.vx += 1.0/4/60 elif enemies.vx < 0: enemies.vx -= 1.0/4/60 enemylist_1.remove(enemy) as can see enemy objects in enemylist_1 list , removed when function called (the function called following function in enemies class): def laserhit(self, la

mobile safari - meteor iron-router with polymer paper-button not routing and iron-router layout template events not firing -

live demo, source link @ bottom problem 1: i'm using meteor 1.0 , initial problem in ios safari, <a> tag not route href path. routes fine in other desktop browsers. the <a> tag wrapped around <paper-button> element. <a href="{{pathfor 'vis1'}}" class="non-a"> <paper-button unresolved>home</paper-button> </a> this way polymer-project.org has implemented buttons. found if remove <paper-button> , have <a> itself, page route correctly in ios safari. can't figure out why problem in mobile safari. problem 2: while trying debug tried attaching 'click' event <a> s (while viewing in safari's ios simulator inspector) using template.navbar.events({ 'click .navigation':function(e){ console.log('click on navbar'); }, 'click a':function(e){ //e.stoppropagation(); console.log('click on tag');

html5 - Getting information from another website using Javascript -

i wonder if possible information web paguina via javascript. if not possible using javascript, explain me alternative it. what want make statistical operations of web page in particular , grab information page run statistics operations. i found this: parent.frames['page_name'].document.getelementbyid(id).value; parent.frames['page_name'].document.getelementbyname(element_name).value; possible? thank much.

mysql - WHERE fieldname IS MIN(somedate) Is there a way to write this without using a subquery? -

our server having hard time running query. hoping me out suggesting way of re-writing same results without sub query. the purpose of subquery use min in clause: i'd results returned earliest co.created date. so wish this: select my.data account_id, co.id user_id, def.def_medium, co.created (tables associated joins) min(co.created) but cannot came this: select my.data account_id, co.id user_id, def.def_medium, co.created abc_emails.cid208 co inner join abc_emails.def208 def on def.eid = co.id inner join abc_emails.my208 on my.eid = co.id , my.my_id = 2765 inner join (select my.data account_id, min(created) created abc_emails.my208 inner join abc_emails.cid208 co on co.id = my.eid my_id = 2765 group account_id ) b1 on b1.account_id = my.data group account_id, user_id, def_medium but it's been runnin

jquery - How Do I Parse a Pipe-Delimited String into Key-Value Pairs in Javascript -

i want parse following sort of string key-value pairs in javascript object: var stringvar = 'plnc||0|eor|<br>subd|pines|1|eor|<br>city|fort myers|1|eor|<br>'; each word of 4 capital letters (plnc, subd, , city) key, while word(s) in following pipe value (the first one, plnc, undefined, 1 subd 'pines', 1 city 'fort myers'). note '|eor| ' precedes every key-value pair. what best way of doing this? i realised it's technically csv format interesting line endings. there limitations in variable values cannot contain | or < br> since tokens define structure of string. of course escape them. var stringvar = 'plnc||0|eor|<br>subd|pines|1|eor|<br>city|fort myers|1|eor|<br>'; function decodestring(str, variable_sep, line_endings) { var result = []; var lines = str.split(line_endings); (var i=0; i<lines.length; i++) { var line = lines[i]; var variables = li

Asp.net C# listview paging Failed to load viewstate -

i have problem paging using datapager on list view. page simple. enter search text. click on search button. display result list view. result display fine every time click on page number got following error: server error in '/' application. failed load viewstate. control tree viewstate being loaded must match control tree used save viewstate during previous request. example, when adding controls dynamically, controls added during post-back must match type , position of controls added during initial request. description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.web.httpexception: failed load viewstate. control tree viewstate being loaded must match control tree used save viewstate during previous request. example, when adding controls dynamically, controls added during post-back must match type , position of controls added during initial req

SharePoint GetFolderByServerRelativeUrl /Files API not returning list of files as expected -

i'm new sharepoint , i'm having trouble few of simple examples i've found , i'm not sure if there's permission don't have correct or if i'm not understanding properly. when use browser access url: https://mysite.com/_api/web/getfolderbyserverrelativeurl('/scf/shared%20documents/fy%202014%20memos') part of return xml says there 87 items <d:itemcount m:type="edm.int32">87</d:itemcount> , correctly correlate number of files inside folder. here's confused. when use following show contents of folder, don't of file information listed in result xml expect: https://mysite.com/_api/web/getfolderbyserverrelativeurl('/scf/shared%20documents/fy%202014%20memos')/files i've tried following specific file info, file not found message: https://mysite.com/_api/web/getfolderbyserverrelativeurl('/scf/shared%20documents/fy%202014%20memos/096.pdf') am missing simple? this behavior occurs since

Hadoop setJarByClass not working -

my wordcount example following structure: public class wordcount extends configured implements tool { public static class map extends mapper<longwritable, text, text, intwritable> {} public static class reduce extends reducer<text, intwritable, text, intwritable> {} public static void main(string[] args) throws exception { basicconfigurator.configure(); logger.getrootlogger().setlevel(level.warn); int res = toolrunner.run(new configuration(), new wordcount(), args); system.exit(res); } @override public int run(string[] args) throws exception { configuration conf = new configuration(); filesystem fs = filesystem.get(conf); if (fs.exists(new path(args[1]))) { fs.delete(new path(args[1]), true); } job job = job.getinstance(conf, "wordcount"); long starttime = system.currenttimemillis(); job.setoutputkeyclass(

python - GAE - Issue with GET -

i'm trying make basic sign form on google app engine redirects , writes 'welcome, (name_of_user)' when input valid. seems i'm having problem last function. redirect page shows 'welcome, '. code appreciated. thank you. http://pastebin.com/jtsrxkpb please take few minutes , learn how put code in posts it'll part of permanent record of question. in welcomehandler , user = self.request.get('username') has no query parameter named username , since self.redirect("/welcome") isn't passing one. try self.redirect("/welcome?username=something")

Python: Convention for date with no year -

i have script looks @ list of birthdays , calculates age. birthdays have year, month, day , have month, day. for ones years, have dob = date(year, month, day) but ones without years, appropriate convention storing date, since date() requires year argument? right i'm saying without birth year born in year 1500 (so can @ least identify them later on), it's stupid solution. if there no year ; don't use datetime.date class. date must have year . either compute date field on fly everytime need if year present, and/or make self.date property on custom object raise error if used object without year.

haskell - Restricting monad type in data constructor -

i'm looking create small monadic interpreter in haskell , ran problem ghc complaining me kinds don't match up. specifically, here declaration data type value: data value = wrong | num int | fun (value -> monad value) and when compile this, ghc gives following error message: the first argument of ‘monad’ should have kind ‘* -> *’, ‘value’ has kind ‘*’ in type ‘value -> (monad value)’ in definition of data constructor ‘fun’ in data declaration ‘value’ but monad value of kind * . don't see problem here? could kindly point me bug i'm not seeing? lot! p.s. interpreter based on 1 introduced in wadler's paper the essence of functional programming . essentially, monad expects type constructor takes 1 argument. value type constructor takes no arguments. so, value must have kind * -> * (meaning takes 1 argument) instead of * (meaning takes no arguments). also, if value did take 1 argument (allowing type c

css - Can foundation be used in BigCartel? -

i'm trying customize big cartel ecommerce , want responsive. problem know foundation responsive framework , don't know how import it. i've tried copy source code, i'm unable save because editor says it's long , haven't found online resource can link it's done jquery. i'll glad if can give me way include foundation or if it's not possible, other responsive framework. you can use foundation (or other framework) big cartel, unfortunately copying/pasting entire source code big cartel theme isn't possible due content editor limit mentioned. instead you'll need have files hosted on separate webserver, or service dropbox - so: <link rel="stylesheet" href="http://webserver.com/css/foundation.css"> <!-- how link custom stylesheet --> <link rel="stylesheet" href="http://webserver.com/css/app.css"> <script src="http://webserver.com/js/vendor/modernizr.js"></s

Functional Programming in java Venkat Subramaniam memoizer -

in book functional programming in java venkat subramaniam, autor gives example of memoizer works perfectly, next leave implementation of memoizer class: public class memoizer { public static <t,r> r callmemoizer( final bifunction< function<t,r>,t,r> function, final t input ){ function<t,r> memoized = new function<t,r>(){ hashmap<t,r> store = new hashmap<>(); @override public r apply(t input) { return store.computeifabsent(input, key -> function.apply(this, key)); } }; return memoized.apply(input); } } so here question, wouldn't function memoized created in every call method callmemoizer? assume not because other ways hashmap store won't storing values... please explain me how , why piece of code works... the local variable function<t,r> memoized = new function<t,r>() created each time callmemoizer invoked. i

c# - Mobile Services: How to handle the case where your query string is too long? -

with azure mobile services offline support i'm issuing pullasync query so: // list contains 53 emails var devicecontactemails = new list<string> { "derek@gmail.com", "sarah@gmail.com", ... }; var query = _usertable.where(x => devicecontactemails.contains(x.email)); await _usertable.pullasync(query); the mobile services sdk translates query url encoded request filter (this list of 60 emails used contains cut out lot of middle brevity): https://rememberwhen.azure-mobile.net/tables/user?$filter=((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((email%20eq%20'carlin_jmecwrv_stulberg%40tfbnw.net')%20or%20(email%20eq%20'carlin_jmecwrv_stulberg%40tfbnw.net'))%20or%20(email%20eq%20'carlin_jmecwrv_stulberg%40tfbnw.net'))%20eq%20'carlin_jmecwrv_stulberg%40tfbnw.net'))%20or%20(email%20eq%20'carlin_jmecwrv_stulberg%40tfbnw.net'))&$skip=0&$top=50&__includedeleted=true&__systemproperties=__cre

c# - Sqlite insert overwriting record -

i trying create .net application storing information in sqlite file. issue running once sql command executed, there 1 record visible, if current row being overwritten. table creation: bool pathexist = directory.exists(appdatapath + "oncalldb.sqlite"); if (!pathexist) { sqliteconnection.createfile(appdatapath + "oncalldb.sqlite"); sqliteconnection dbnewconnection = new sqliteconnection("data source=" + appdatapath + "oncalldb.sqlite;version=3;"); dbnewconnection.open(); string sqltablecreation = "create table calls (id integer primary key, name varchar(30), ticket varchar(20), phone varchar(20), day varchar(20), start_time varchar(20), end_time varchar(20), raw_time varchar(20), weighted_time varchar(20), date datetime, notes varchar(255))"; sqlitecommand command = new sqlitecommand(sqltablecreation, dbnewconnection); command.executenonquery(); dbnewconnection.close(); } insert statement: sqliteco

java - TestNG single dataProvider/multiple tests/running in parallel? -

i've engineered test suite project i'm working on using testng tests share common data provider reads parameter data xml file , feeds test instance. i'm wondering if there's way enable parallel option in suite xml file without tests blowing because endeavouring talk same static data provider @ same time. know can enable 'parallel' @ dataprovider level, allow multiple data providers accessed @ same time, seems silly solution in case because necessitate creating multiple instances of exact same dp - 1 per test - in order effect i'm looking for. thanks in advance insights! edit1 turns out wasn't testng problem - test class extends has static member creating lots-o-problems.

ruby on rails - Can't access polymorphic association from test, but can from browser -

note 2 puts lines in method. when accessed followers , result empty, whereas when accessed follower.all , result contains 1 or more expected objects. how can be? book.rb (model) has_many :followers, as: :followable, dependent: :destroy def followed_by_user?(user) puts "--- followers: #{followers.inspect}" # empty puts "--- follower.all: #{follower.all.inspect}" # contains expected user followers.map{|l| l.user_id}.include?(user.id) # returns false end there's no logical contradiction. first puts shows followers associated this instance of user; second puts showing all of followers, including ones associated other users. so it's reasonable first set empty , second set non-empty.

gcc - Using -flto with autotools -

given c++ program uses gnu autotools, what's easiest way compile -flto (link time optimization)? understanding is customary on unix such optimization flags specified user or packager, not programmer. according this post , -flto flag needs passed compilation flag , linker flag, so: ./configure cxxflags="-flto" ldflags="-flto" ... or possibly: ./configure cxxflags="-flto" ldflags="-wc,-flto" ... might work.

boost - How to initialize a vector with elements between two point and step c++ -

i'm going initialize vector elements scaled uniformly between 2 numbers known steps. pseudo code. typedef vector<double> a(startnumber, step, endnumber); e.g. vector<double> a(1, 1, 10); // = {1, 2, ...., 10}; is there way in c++? sure: template <typename t> std::vector<t> createrange(t start, t end, t step) { std::vector<t> result; (; start < end; start += step) { result.push_back(start); } return result; } anything else more complicated without being better (e.g. iota() or generate() ). this'll work if step > 0. if want work negative steps, have switch on sign check start > end in case instead.

python - Strange result when checking if an ip address is in a network with netaddr -

when run following code in python 2.7 true of these checks. from netaddr import * testip = '192.168.2.5' testnetwork = '192.168.3.0/23' if testip in ipnetwork(testnetwork): print "logic fail" if ipaddress(testip) in ipnetwork(testnetwork): print "logic fail" if testip in ipset([testnetwork]): print "logic fail" if ipaddress(testip) in ipset([testnetwork]): print "logic fail" output is: logic fail logic fail logic fail logic fail that isn't strange result, cidr specified used called "supernetting", so: 192.168.3.0/23 effectively covers 192.168.2.1 through 192.168.3.254 giving around 512 possible addresses work /23 same network mask 255.255.254.0 which 3 gets bumped 2 to visualize, can use online subnet calculator http://mxtoolbox.com/subnetcalculator.aspx

UNIX copy lines to new file IF one column matches AND another has a value below 5x10^-8 -

similar question many previous ones (including mine) can't find solution. purely syntax error , cannot figure out how make work. i have 2 files in unix. in file1 have 5 columns , 6000 rows. trying match rows in file2 rows in file1 if column 1 matches , if value in row 5 of file1 less 0.00000005 said row. file1: snps context intergenic risk allele frequency p-value rs9747992 intergenic 1 0.086 2.00e-07 rs2059865 intron 0 0.235 3.00e-07 rs117020818 intergenic 1 0.046 7.00e-07 rs1074145 intergenic 1 0.162 4.00e-09 file2: snpid hg18chr bp a1 a2 zscore pval ceumaf rs3131972 1 742584 g 0.289 0.7726 . rs3131969 1 744045 g 0.393 0.6946 . rs3131967 1 744197 t c 0.443 0.658 . rs1048488 1 750775 t c -0.289 0.7726 . i can first part keeps outputting file larger first two. unsure if real result file or full of duplicates? cannot 'less than' command. have tried putting command second pattern ,

java - Does this situation cause Memory Leak? -

i writing android project, write these code, want know if code cause memory leak. as see set "onitemselectedlistener" in foldactivity, implement "itemselectedlistener" in foldfragment, fragment monitor listener, worried when fragment replaced, can fragment retrieve gc? i think fragment has reference foldactivity cause gc can never retrieve has been replaced other fragment. public class folderactivity extends activity { // ... spinner spinner; protected void oncreate(bundle savedinstancestate) { // ... final view spinnerview = inflater.inflater(r.layout.category_spinner, null); spinner = spinnerview.findviewbyid(r.id.categoryspinner); // ... } protected void onpostcreate(bundle savedinstancestate) { // ... if (getfragmentmanager.findfragmentbyid(r.id.fragment) == null) { fragment folderfragment = new folderfragment(); if (getintent().hasextra(extra_dir)) {

html - a part of my div become hidden when i move her to the top -

the issue when try move 3 boxes in second line goes under firs line div's here code : http://jsfiddle.net/hvvdvqdt/ html : <!-- first row --> <secction class="rowone"> <div class="col "> <div class="block hours"> 8h00 </div> </div> <div class="col "> <div class="block hours noss"> 8h00 </div> </div> <div class="col "> <div class="block hours noss"> 8h00 </div> </div> <div class="col "> <div class="block hours noss"> 8h00 </div> </div> </secction> <!-- end of first row -->

actionscript 3 - How to make my flash button (embedded in html code) to open a link? -

i'm trying play flash file through html. button in flash supposed open webpage doesn't open when try through browser. buttons work fine when test them in flash. html code uses .swf file. </div> <div class="bodytext"> <object width="800px" height="400px" data="c:\users\me\documents\adobeflash\tulsi\algo- mainmenu.swf"></object> </div> <br/> the action script button flash file below: button_1.addeventlistener(mouseevent.click, fl_clicktogotowebpage); function fl_clicktogotowebpage(event:mouseevent):void { navigatetourl(new urlrequest("http://www.adobe.com"), "_self"); } i faced same problem, , figured out problem .swf file itself. flash allows network publish settings .swf versions. changed settings this: file -> publish settings -> [flash .swf] -> local playback security - access network only

xcode6 - Screen Size Issue For an Image in iOS -

Image
i want display title page game. want use pre-rendered images. needs work iphones , ipads. far using these assets screenshot below i have used these sizes: in 1x place image resolution of 320 x 480. in 2x place image resolution of 640 x 960. in retina 4 2x place image resolution of 640 x 1136. in 3x place image resolution of 1242 x 2207. only iphone 4 , 5's show correctly. both 6 , 6plus wrong. for ipad: 1x image of 760*1024 2x image of 1536*2048 only ipad 2 displays correct. air , retina wrong. i have read through documentation can find both on here , searching hours on google. unsure simple thing must overlooking. trying not possible? testing on simulator , thinking issue that? also may have misunderstanding under impression @3x iphone 6 , 6+. if not, @3x for? for reason image sets in asset catalogs not include size iphone 6 or iphone 6+, when using full screen image may need handle manually via code. what i'm doing (and it's not pretty work

c# - How to return updated partial View along with its parent View (postback) -

i have parent view 2 partial views inside it, partial views contains few textbox , button, when submit button, partial views show message. code below : view : <%@ page title="" language="c#" masterpagefile="~/views/shared/site.master" inherits="system.web.mvc.viewpage(of test.parentmodels)" %> <% html.renderpartial("login", model.loginmodel)%> <% html.renderpartial("register", model.registermodel)%> model : public class loginmodel { //code here } public class registermodel { //code here } public class parentmodel { public loginmodel loginmodel {get; set;} public registermodel registermodel {get; set;} } controller : //login page call method on submit public login(loginmodel model) { //do changed login html view return view("login", model); } the problem don't know how return updated partial view along parent (postback) , don't want use ajax achie

How to search in the mysql command history -

the mysql command-line client supports history (you can use cursor-keys access , navigate it), there way search string can in (for example) bash? in bash can do: history | grep "command" is there similar in mysql? usually lists mysql commands have been used: less ~/.mysql_history

html - Border gradient height -

Image
alright, managed create linear gradient effect on border. however, gradient 'end earlier'. that, want border fade white @ around first paragraph. below can see current sitation , code: html: <article class="newsarticle"> <div class="newsarticletext"> <p class="newsarticletitle">size announces project nero</p> <br /><br /> <p class="newsarticledesc"> <b>sed ut perspiciatis unde omnis iste natus error</b> <br /><br /> duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. <br /><br /> voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab

php - Is this an acceptable use of eval()? -

i'm trying use imploded string operator. , php novice, eval() option works, far. i've read other questions/answers on eval() . in cases, people trying allow actual code input user, not i'm doing here. here is: /* * user choices multiple-select customizer custom control. * setting's choice values names of wordpress conditional tags. * each choice set given 'key'=>'label' not 'key'=>'function' * i'm limited using strings here, e.g. is_front_page, is_singular. * result linear array, e.g. array( is_front_page, is_singular ). */ $conditions = get_theme_mod( 'theme_setting' ); /* * here's trouble begins. * need append `()` each array value using array_walk. */ array_walk( $conditions, function(&$value, $key) { $value = $value . '()'; }); /* * next implode array values insert or operator * instead of "is_front_page, is_singular", i'd end * "is_front_page() || is_singular

jquery - javascript preventDefault only on parent item -

i creating drop down nav in javascript. list items have children prevent default action , else. have working when applied default action applied child list items. here html: <i id="mobnavtrig" class="fa fa-align-justify fa-2x"></i> <div class="mobilenav"> <li class="page_item page-item-2"><a href="/">home</a></li> <li class="page_item page-item-10"><a href="?page_id=10">who are</a></li> <li class="page_item page-item-25 page_item_has_children current_page_item parent"><a href="?page_id=25">case studies</a> <ul class='children'> <li class="page_item page-item-55"><a href="?page_id=55">barratt developments</a></li> <li class="page_item page-item-53"><a href="

android - Show a loader spinner, when the checkbox is checked -

i have checkbox, when checked, shows me spinner, can not load data's spinner contains. llf = (linearlayout) view.findviewbyid(r.id.init_tour_foreign_producer_layout); llf.setvisibility(view.invisible); myspinner = (spinner)view.findviewbyid(r.id.spinner_init_tour); myspinner.setadapter(new arrayadapter<tour>(this.getactivity(), android.r.layout.simple_spinner_item, s.getunstartedtours())); /*---------- managing checkbox ----------*/ cballproducer = (checkbox) view .findviewbyid(r.id.enter_collection_check_other_tour); cballproducer .setoncheckedchangelistener(new compoundbutton.oncheckedchangelistener() { @override public void oncheckedchanged(compoundbutton buttonview, boolean ischecked) { //checked = ischecked; if(ischecked){ llf.setvisibility(view.visible); //myspinner.setselecti

java - Spring Data Mongodb - repository for collection with different types -

i have mongo collection may contain 3 types of entities map java types: node leaftype1 leaftype2 collection ment store tree-like structure using dbrefs of child nodes in parent entry. i didn't find information subject in spring reference documentation i'm asking here: there way use repository mechanism work collection may contain different types of objects? declaring several repositories different types in 1 collection seems not idea because struggle situations when queried object not of expected type , creating 1 repository abstract class possible types inherrit doesn't seems work. to illustrate mean: /** * seems not safe */ public interface noderepository extends mongorepository<node, string> { } public interface leaftype1repository extends mongorepository<leaftype1, string> { } public interface leaftype2repository extends mongorepository<leaftype2, string> { } /** * doesn't work @ */ public interface mycollectionrepository

clojure - exclude certain clj namespaces from compilation in leiningen -

i have project works fine using lein run . want compile standalone jar using lein uberjar . however, there couple of source files in src/projectname/ directory called e.g. playground.clj , stats.clj use experimenting emacs & repl, don't want compile final project. with make , specify files should compiled. clojure/leiningen, seems, files compiled default - how can exclude files ? haven't found in leiningen docs. i using :aot :all . place change something? again, couldn't find detailed documentation on this. update: the suggestions far haven't worked. has worked, however, include desired namespaces instead of excluding ones should not compiled. e.g.: (defproject myproject "version" ;; ... :profiles {:uberjar {:aot [myproject.data myproject.db myproject.util]}}) have @ leiningen's sample project.clj , describes how use :jar-exclusions or :uberjar-exclusions exclude

oop - Code design: Who's responsible for changing object data? -

assuming have kind of data structure work on (for example images) want pre- , postprocess in different ways make further processing steps easier. what's best way implement responsibility oop language c++? further assuming have lot of different processing algorithms inherent complexity want encapsulate them in dedicated classes. means though algorithm implementations externally have set kind of info in data indicate having been processed. , doesn't clean design me because having been processed seems info associated data , data object should determine , set on own. it looks common source of error in complex applications: implements processing algorithm, forgets set flags in data appropriately, in different parts of application won't work expected , have lots of fun spotting error. can outline general structure of , fail-save way implement sth this? to make sure understand asking, here assumptions based on reading of question: the data kind of binary form

servlets - I am uploading file with DiskFileItemFactory.But file is not uploading using Java -

i trying upload file using java web application using diskfileitemfactory .but problem not getting file.it shows empty array in iteration. iter.size() 0. see below of code. public modelandview upload( modelmap model, httpsession session, httpservletrequest request, httpservletresponse resp) throws ioexception, servletexception, fileuploadexception { if (servletfileupload.ismultipartcontent(request)) { system.out.println("file available"); } boolean ismultipart = servletfileupload.ismultipartcontent(request); if (ismultipart) { // resourceimpl resource = new resourceimpl(); try { //create factory disk-based file items fileitemfactory factory = new diskfileitemfactory(); servletfileupload upload = new servletfileupload(factory); list items = upload.parserequest(request); system.out.println(items.size()); iterator iter = items.iterator(); while (iter.hasnext()) { fileitem item = (fileite

apache - htaccess i don't know what the code mean -

i have site, it's working until today give me error 500 open htaccess , find code <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{http_host} ^www\.adminapi\.* [or] rewritecond %{http_host} ^adminapi\.* [nc] rewriterule .* http://www.*mysitehere*.com/adminapi [l] rewriterule ^adminapi - [l] rewriterule ^$ app/webroot/ [l] rewriterule (.*) app/webroot/$1 [l] </ifmodule> so remove code htaccess site didn't work before can me understand code

c# - how to change class member visibility? -

i have class combobox inside. want add items combobox different class, cannot see it. i've instantiated class (with combobox) using 'new', i.e.: check_reg _check_reg = new check_reg(); but in second class see _form1.choose_quar_selectedindexchanged paramter, handler shown when double click combo box in form, not me add items. i'm sure it's basic question... please me it. thx! for sure can create public instance method inside class "check_reg" add items combobox. something this: public void additem(listitem li) { ddl.items.add(li); } and can use this: check_reg _check_reg = new check_reg(); _check_reg.additem(new listitem("text", "value")); hope helps. cheers

javascript - bootstrap switch does not work for dynamically created checkbox input -

i have following combination of scripts : jquery , bootstrap , modernizer , json2html . calling : <script> $('#my01switch').bootstrapswitch({ ontext: 'on', offtext: 'off', size: 'large', oncolor: 'success', offcolor: 'warning', labeltext: '*' }); </script> just before closing body tag, on : <input name="my01switch" id="my01switch" data-toggle="switch" checked="" type="checkbox"> the above dynamically generated input tag. please help. check if document ready before execute bootstrap switch plugin: $(document).ready(function() { //code }); update switch checkbox code: add class checkbox <input name=\"my01switch\" id=\"my01switch\" type=\"checkbox\" data-toggle=\"switch\" checked=\"true\" cl

javascript - Why I'm not able to show the image in Bootstrap tool-tip? -

i'm using bootstrap framework v3.3.0 website. i want show on image tool-tip when user hovers mouse pointer on icon. i'm having following html : <div class="col-sm-5"> <div class="input-group"> <input type="text" class="form-control" name="trans_id" id="trans_id"/> <span class="input-group-addon"> <a href="#" class="glyphicon glyphicon-question-sign" rel="tooltip" data-html="true" title="localhost/img/demo_img.png"></a> </span> </div> </div> jquery code follows : $(document).ready(function() { $('.input-group-addon').tooltip({ selector: "a[rel=tooltip]" }) }); on hovering i'm not able display image. text mentioned in title(i.e. complete image location path displayed tool -tip.) all necessary css , jquery files included. please me in

javascript - RequireJS: how to add a prefix to path -

i'm developing spa using knockout.js v3 , requirejs. i have ko components written this: define(['text!settings.html'], function( htmlstring) { 'use strict'; function settingsviewmodel(params) { ... } // return component definition return { viewmodel: settingsviewmodel, template: htmlstring }; }); now want support localization , have duplicated html each supported language, example: en/settings.html de/settings.html se/settings.html i let user change language , refresh app new language, possible instruct require text plugin add language prefix html, when write: text!settings.html it load: text!de/settings.html not sure if can let text plugin prefix urls. might able create custom template loader: var templatefromlanguageurlloader = { loadtemplate: function(name, templateconfig, callback) { if (templateconfig.languageurl) { //

javascript - Google Visualization Organizational Chart (Node Children) -

Image
i have organizational chart many levels, image below taken part of it. try childs , sub childs of selected node, if "power business unit" node selected 3 childs , every single child same. got first level can't depth of tree provide number of loops reach last child. 1- how can last child in chart? how depth of tree? 2- there zoom in/zoom out toolbar or something, can add chart? that code of drawing: google.load('visualization', '1', { packages: ['table', 'orgchart'] }); google.setonloadcallback(drawchart); function drawchart() { var data = new google.visualization.datatable(); data.addcolumn('string', 'node'); data.addcolumn('string', 'parent'); data.addcolumn('string', 'nodeid'); data.addrows(json.parse(document.getelementbyid("<%=hiddenfield1.clientid%>").value)); // var chart = new google.visualizat

php - Select records from one table and sort the result using a column from another table -

i'm working on payroll system crm located @ work , i'm trying save having store redundant data on period of years stack up. i tried relate " how value mysql table ordered table? " had no luck. i have users table =========================================== # id | username | first_name | last_name # =========================================== # 1 | joe | joe | blow # =========================================== i have timesheets table stores data of each individual session sake of keeping short have condensed little in question , misses full date/time in start , finish. ============================================ # id | username | start | finish # ============================================ # 1 | joe | 00:00 | 23:59 # ============================================ what want achieve order results timesheets table last_name column in users table username derived timesheets table. what trying attempt her

javascript - Am I doing it right? {{#each}} -

i have question because i'm curious if right. i'm reading tutorials ember.js every 1 typing that: {{#each friend in model}} {{friend.firstname}} {{friend.lastname}} {{/each}} and in app route example: app/templates/works/index.hbs have: {{#each}} {{#link-to 'works.work' this.id class="trigger"}} <h3 class="title">{{name}}</h3> <p class="description">{{description}}</p> <img {{bind-attr src=image}}> {{/link-to}} {{/each}} but still working fine, thats convention or doing wrong time? you should go first form, non-context switching form of {{each}}, second form deprecated. see here. the first form less confusing don't need think of context properties.

Recieve feedback that a user has input into your android app? -

i've created simple movie review app has top ten movies of time. know controversial topic lots of different opinions have created edittext box user can input there favorite film. i'm wondering how can save information view can make changes list according users preferences etc. for case suggest using sqlite databases , of course can use sharedprefrences save key-value pair.

Oracle Apex Checkbox checked on load -

there checkbox in oracle apex page. when page load, checkbox should checked default. i have followed instruction on how set oracle apex checkbox default value , use before footer computation point , item value computation type . it's not work me. how can achieve ? mileage vary depending on apex version. seems long way - why not set default value attribute of item? is item associated database column?