Posts

Showing posts from September, 2015

mysql - Django database model for my website -

i building aviation website need store aircraft manufacturer, type , version of particular aircraft....boeing 777 300 example. here boeing manufact., 777 version , 300 model. model use is: class manufa(mod...): name=charfield .... manufact=models.foreignkey(manufact) type=models.foreignkey(type) version=models.foreignkey(version) this allows easy search problem every time have display item in search, have make 3 separate queries full name of aircraft form foreign key id....for search page 100 items...thats unimaginable number of queries.. if store these names if change version name or have edit each of rows...how solve can aircraft name same row...no second query.. you have read more of great django docs ;) https://docs.djangoproject.com/en/dev/ref/models/querysets/#select-related btw. should post full model definition

javascript - Will an object referenced within an object get garbage collected? -

var = { b: "this"; }; = null; when removing reference object literal 'a' referencing in beginning, reference "this" removed well, or cause memory leak? do have change code this: delete a.b; = null; ? this not cause memory leak. garbage collector typically works walking set of live references, marking set of objects finds , collecting didn't see. in case neither value assigned a or literal "this" found , both eligible collection

ios - How to run a segue on itself OR another viewController -

Image
i have main tableviewcontroller. when user tap on cell in tableview, if condition statement true, show main tableviewcontroller again(but show data on screen), , if condition false, show viewcontroller. in prepareforsegue method have this: if segue.identifier == "identifier1" { let destination = segue.destinationviewcontroller as? mainviewcontroller // destination!.x = // x variable in view controller } else if segue.identifier == "identifier2" { let destination = segue.destinationviewcontroller as? viewcontroller2 destination!.y = } also, run segue after tap on cells in tableview added this: override func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) { tableview.deselectrowatindexpath(indexpath, animated: true) if condition true { self.performseguewithidentifier("identifier1", sender: self) } else{ self.performseguewithidentifier("identifier2", sender

python - How can I write on new lines in a text file while preserving old ones -

when open text file , write in , @ end of program close it, lines stay in text file. when reopen program, rather writing on new set of lines, overwrites there. want keep both pieces of text, data logging. ideas on how fix this. you should use a mode, this: with open("file","a") f: f.write("something") this append file instead of overwriting it.

c++ - SDL2 not recieving any events at all -

in sdl2 project, sdl_pollevents( sdl_event* e ) doesn't send events, , allways returns 0 , can't process events. event processing loop looks fine : sdl_event e; while( sdl_pollevent( &e ) > 0 ) { //this never reached ! printf( "recieved event %d\n", e.type ); switch(e.type) { case sdl_quit: quit = true; } } on other hand, compiles fine, drawing works, , i'm sure it's not stuck in infinite loop ( made print out message @ each frame ). i link against sdl2 , other dependencies, make gcc/g++ call sdl-config --cflags . how can fixed ? you shouldn't call sdl-config --cflags . sdl ( first version of library ), not sdl2 . somehow conflicts , stops events reaching sdl_pollevents() . remove , should work !

winforms - How to replace multiple texts in a file in c#? -

i automating process using c#. script below, update table set param_val = replace(param_val,'proxy430/','proxy440/') param_key = 'proxy_url'; update table set param_val = replace (param_val, '.420/', '.430/') param_val '%.420/%'; for every month, upgrade version 44 in place of 43 , 43 in place of 42 , run script. automate, i've written c# code , used below code string text = file.readalltext(filepath); text.replace(oldvale, newvalue); file.writealltext(filepath, text); but, issue can replace 1 word only. how replace 2 texts in file. in case, proxy430 should replaced proxy440 , proxy440 proxy450 in single shot. how achieve this? if call replace in right order can accomplish 2 replacements on single line. string teststring = @"update table set param_val = replace(param_val, 'proxy430/', 'proxy440/') param_key = 'proxy_url'; update table set param_v

c# - Rounding to 3 decimal places in a distance formula -

i have double need rounded 3 decimal places. i'm not sure how accurately implement math.round. have far: double distance= math.sqrt(deltax + deltay); math.round((decimal)distance, 3); console.writeline("distance :" + distance); use return value of math.round (already noted uwe keim ) , remove decimal cast. double distance = math.sqrt(10.438295 + 10.4384534295); console.writeline("distance :" + math.round(distance, 3));

sql - Query attributes, where one attribute is missing -

i have question regarding query. there 2 tables: objects table: ============== object id date 1 2016-03-15 2 2016-01-20 attributes table: ================= parent id attribute attributedata 1 size xl 2 size s 2 price 20 query join data this: ========================================== objet id size price 1 xl null 2 s 20 this: ========================================== objet id size price 2 s 20 a left join doesn't - because there no entry in attribute table price id1. i sorry beein such newbie on this. glad help. steffen i think conditional aggregation want: select parentid, max(case when attribute = 'size' attributedata end) size, max(case when attribute = 'price' attributedata end) price attributes group parentid; using left join do: select o.*, s.attributedata size, p.attributedata price objects o left join attributes s

java - Disabling broadcast in SimpMessageTemplate.sentToUser(...) in Spring 4.2.4 -

i trying connect in 2 sessions same spring security user , subscribe same queue using spring 4.2.4. separate messages each session. it's easy using @sendtouser , seems it's not trivial when using simpmessagingtemplate.sendtouser(...) - every session receives messages specific other session. example @sendtouser : @controller public class testcontroller { @messagemapping("/queue/hello") @sendtouser(value = "/queue/hello", broadcast = false) public string test() { return integer.tostring(new random().nextint()); } } example simpmessagingtemplate : template.convertandsendtouser("sessionuser{id=123}", "/queue/hello", "test"); i've tried adding sessionid in headers suggested example in thread: sending-error-message-in-spring-websockets unfortunately not in version of spring. have ideas? seems setting session id in headers still works, has simpsessionid, not sessionid. assumptions

Android Conflict with dependency appcompat -

i trying add espresso-contrib library project. here build.gradle file : apply plugin: 'com.android.application' android { compilesdkversion 23 buildtoolsversion "23.0.2" defaultconfig { applicationid "example.com.littlebox_hari" minsdkversion 19 targetsdkversion 23 versioncode 1 versionname "1.0" testinstrumentationrunner "android.support.test.runner.androidjunitrunner" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } /*configurations.all { resolutionstrategy { force 'com.android.support:appcompat-v7:23.4.0' } }*/ } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) testcompile 'junit:junit:4.12' compile 'com.android.support:

google maps - How to cluster latitude-longitude data based on fixed radius from centroid as the only constraint? -

Image
i have around 200k latitude & longitude data points. how can cluster them each clusters have latitude & longitude points strictly within radius = 1 km centroid only? i tried leadercluster algorithm/package in r eventhough specify radius =1 km not strictly enforcing i.e. give clusters lot of point 5 - 10 kms cluster centroid within same cluster. not meeting requirement. number of points in cluster can vary & not problem. is there way enforce strict radius constraint in heirarchical or clustering algorithm? looking steps & implementation in r/python. tried searching in stackoverflow couldn't find solution in r/python. how visualize cluster centroids in google maps after clustering in done? edit parameters using in elki. please verify this not clustering, set cover type of problem. @ least if looking good cover. clustering algorithm finding structure in data; looking forced quantization. anyway, here 2 strategies can try e.g. in elki: c

Python 2 to 3 conversion: iterating over lines in subprocess stdout -

i have following python 2 example code want make compatible python 3: call = 'for in {1..5}; sleep 1; echo "hello $i"; done' p = subprocess.popen(call, stdout=subprocess.pipe, shell=true) line in iter(p.stdout.readline, ''): print(line, end='') this works in python 2 in python 3 p.stdout not allow me specify encoding , reading return byte strings, rather unicode, comparison '' return false , iter won't stop. this issue seems imply in python 3.6 there'll way define encoding. for now, have changed iter call stop when finds empty bytes string iter(p.stdout.readline, b'') , seems work in 2 , 3. questions are: safe in both 2 , 3? there better way of ensuring compatibility? note: i'm not using for line in p.stdout: because need each line printed it's generated , according this answer p.stdout has large buffer. you can add unversal_newlines=true . p = subprocess.popen(call, stdout=subprocess.p

ms access - sql query return the rows without common attributes -

i'm new sql ans ms-access. so, have table tab1, columns id, decscription, number want make query returns id of rows without common description , number. desirable output this i have tried select id tab1 group id, description, number having count(*)=1; but returns logical error. if want return rows unique, can do: select * tab1 not exists (select 1 tab1 t tab1.description = t.description , tab1.number = t.number , tab1.id <> t.id ); you can using aggregation. id : select max(id) tab1 group description, number having min(id) = max(id);

javascript - Mimicking old Gmail compose window with addon or userscript? -

gmail has forced users use crappy compose. links: official notice thenextweb comments mark shields comments there must way mimic old compose, either addon or userscript. know how create one?

wpf - C# MVVM: Binding a RadioButton to a boolean Property -

i quiet new programming , learning c# , mvvm pattern. i need code database tool chiliplants university. there should able add new object observablecollection. to add new item observablecollection new window opens. looks this: window add i want 2 radioboxes bound property called "hybridseed". defined in viewmodel: //public property hybridseed public bool hybridseed { { return chilimodel.hybridseed; } set { if (chilimodel.hybridseed == value) return; chilimodel.hybridseed = value; onpropertychanged("hybridseed"); } } the radiobox part of view looks this: <radiobutton grid.row="5" content="ja" grid.column="1" horizontalalignment="left" margin="10,10,0,0" verticalalignment="top"/> <radiobutton grid.row="5" content="nein" grid.column="1" horizontalalignment=

c# - Test to ensure the user input is a double and is greater than zero? -

in c# trying have user input number. want check that they have entered string can converted double and they have entered value greater zero the method have created string invalue; double outcome; console.writeline("enter amount: "); invalue = console.readline(); while (double.tryparse(invalue, out outcome) == false) { console.writeline("initial value must of type double"); console.writeline("\nplease enter number again: "); invalue = console.readline(); } outcome = double.parse(invalue); while (outcome < 0) { console.writeline("initial value must of @ least value of zero"); console.writeline("\nplease enter number again: "); invalue = console.readline(); outcome = double.parse(invalue); } return outcome; the problem if user entered "-10" , "f" exception occur. because program move past first check (that checks double) value of -10 when "f" entered throws except

soap - python suds UsernameToken -

code: security = security() token = usernametoken('b77a5c561934e089', 'kmfhknzyn1u/pgaiy3+h0bohdki=') security.tokens.append(token) client.set_options(wsse=security) my problem one: when including usernametoken, receive kind of header: <soap-env:header> <wsse:security mustunderstand="true"> <wsse:usernametoken> <wsse:username>b77a5c561934e089</wsse:username> <wsse:password>kmfhknzyn1u/pgaiy3+h0bohdki=</wsse:password> </wsse:usernametoken> </wsse:security> </soap-env:header> but need response requirement on web service: <sp:signedsupportingtokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> <wsp:policy> <sp:usernametoken sp:includetoken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/includetoken/alwaystorecipient"> <wsp:policy> <sp:wssus

javascript - I am taking user input and splitting it - how to best check types for each and also remove spaces? -

i'm not sure if there's better way this. basically, taking user inputs example - hair salon, 1, 4 when split , ['hair salon',' 1',' 4'] . doing error check make sure 3 values passed max, how can remove spaces ( ' 4' ) , check 'hair salon' string, , other 2 numbers? thanks suppose have user input hair salon, 1, 4 now split(','), array var arr = ['hair salon', '1','4'] you every input string for(i=0;i<arr.length;i++) { arr[i] = arr[i].trim() // remove space & front } in case needed data type of inputs, can check using typeof (arr[i])) - in loop hope, suffice need

AngularJS + OAuth -

i'm trying write login solution angular app, means allow user connect via facebok/google/twitter or register normally. found angular-oauth useful, didn't seem work facebook (or twitter). anyone knows of all-inclusive solution this? take @ oauth.io easy implementation in javascript 80+ oauth providers fast & secure

mysql - Exception "Parameter index out of range (1 > number of parameters, which is 0)." -

query="insert paint_inventory(id,name,type,gallons,quarters) values(?,?,?,?,?)"; con.preparestatement(query); pstm.setint(1,integer.parseint(itemid_newitem_field.gettext())); pstm.setstring(2,name_newitem_field.gettext()); pstm.setstring(3,type_newitem_field.gettext()); pstm.setint(4,integer.parseint(gallons_quantity_newitem_field.gettext())); pstm.setint(5,integer.parseint(quarters_quantity_newitem_field.gettext())); pstm.execute(); joptionpane.showmessagedialog(rootpane,"item has been registered"); pstm defined in code? hope need assign preparestatement pstm can set parameter values. also ensure pstm not used preparestatement in same method or other methods. each preparestatement should have separate variable name set parameter values. query="insert paint_inventory(id,name,type,gallons,quarters) values(?,?,?,?,?)"; pstm = con.preparestatement(query); -- assign pstm set values ... ...

ios - UICollectionView scrolling/swipe to next item swift -

i have uicollectionview in view controller. when user clicks 1 of images, goes separate page open image. instead of going gallery each time change pictures, swipe left or right next or previous picture. i have seen answers "pagingenabled = true" put exactly? i new swift. below code. in advance. viewcontroller.swift import uikit class viewcontroller: uiviewcontroller, uicollectionviewdatasource, uicollectionviewdelegate { @iboutlet weak var collectionview: uicollectionview! let appleproducts = ["iphone", "apple watch", "mac", "ipad"] let imagearray = [uiimage(named: "pug"), uiimage(named: "pug2"), uiimage(named: "pug3"), uiimage(named: "pug4")] override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } f

operating system - Non-Preemptive multitasking Scheduling Algorithm -

what causes transition of process 1 state state if non-preemptive multitasking scheme being used manage multiple tasks in system? suppose process in running state. moves waiting state i/o. in case, ready process context switched , executed.

python - Download file with Kivy app without locking event loop -

here's kivy application has button , progress bar. when button pressed, zip file downloaded web , unzipped. progress bar advances mark download's progress. the problem is, downloading locks kivy event loop, freezing application during download. how can download , unzip file in background? from __future__ import division import os import requests import zipfile kivy.app import app kivy.lang import builder kivy.uix.boxlayout import boxlayout zip_url = 'https://www.python.org/ftp/python/3.5.1/python-3.5.1-embed-win32.zip' zip_filename = 'python351.zip' kv_string = """ <rootwidget> boxlayout: orientation: "vertical" button: id: download_button text: "download content" on_press: self.parent.parent.download_content() progressbar: id: download_progress_bar max: 1 value: 0.1 """ builder.load_string(kv_s

android - Locate Ble Device GATT service recommend -

im pretty new android programming i'd know if possible implement location service locate ble devices discovered on our app. im having trouble understanding different specs bluetooth , examples using heart rate monitor. quite overwhelming considering wide range of service , characterististics choose from. suggestions ? also, there other examples me coding profile ? showing location of discovered ble device if possible. please me understand better. in advance i quite new topic, too, please don't count on answer. as understand whole topic, can make peripheral ble device send position client. therefore might need programm peripheral device has location service enabled. therefore need matching uuid think. can "advertise" location of peripheral client (your smartphone). still don't know though, how exactly. know this ? starter kit software examples , explaining texts, maybe helps. if found out how deal problem, happy hear, if thread seems forgott

Jdbc Odbc Driver error -

i have small problem jdbc.odbc.jdbcodbcdriver . it gives me following error: java.sql.sqlexception: driver not support function the code: saverec.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent e) { saverecclick = 1; if (saverecclick == 1) { try { field2.setenabled(false); field3.setenabled(false); field4.setenabled(false); field5.setenabled(false); field6.setenabled(false); table.setenabled(true); mainframe(); string mydriver = "sun.jdbc.odbc.jdbcodbcdriver"; string myurl = "jdbc:odbc:dlfishhunter"; con = drivermanager.getconnection("jdbc:odbc:dlfishhunter"); stmt = con.createstatement(); string query = " insert data (user, datum, location, kind, size , bait)" + &qu

java - JComponents not drawn correctly -

i trying add components jpanel, aren't sized correctly , not in right location. code componenent. button = new jbutton(); button.setsize(100, 100); button.setlocation(400, 400); button.setcursor(new cursor(cursor.crosshair_cursor)); vm.panel.add(button); it's behind other things i'm drawing, it's not visible (that's why made cursor crosshair, see button was). i'm drawing. g.drawimage(imageio.read(getclass().getresourceasstream("/background.jpg")), 0, 0, vm.panel.getwidth(), vm.panel.getheight(), null); g.setcolor(color.white); g.fillroundrect(200, 200, 880, 560, 100, 100); g.setcolor(color.black); g.setfont(new font("arial", font.plain, 48)); g.drawstring("login", 575, 300); however size , location button aren't set correctly. the default layout manager jpanel flowlayout. layout manager determine size , location of button. so use appropriate layout manager button displayed how want it. for example wa

Why is dict definition faster in Python 2.7 than in Python 3.x? -

i have encountered (not unusual) situation in had either use map() or list comprehension expression. , wondered 1 faster. this stackoverflow answer provided me solution, started test myself. results same, found unexpected behavior when switching python 3 got curious about, , namely: λ iulian-pc ~ → python --version python 2.7.6 λ iulian-pc ~ → python3 --version python 3.4.3 λ iulian-pc ~ → python -mtimeit '{}' 10000000 loops, best of 3: 0.0306 usec per loop λ iulian-pc ~ → python3 -mtimeit '{}' 10000000 loops, best of 3: 0.105 usec per loop λ iulian-pc ~ → python -mtimeit 'dict()' 10000000 loops, best of 3: 0.103 usec per loop λ iulian-pc ~ → python3 -mtimeit 'dict()' 10000000 loops, best of 3: 0.165 usec per loop i had assumption python 3 faster python 2, turned out in several posts ( 1 , 2 ) it's not case. thought maybe python 3.5 perform better @ such simple task, s

jquery - Javascript changes variable when changing iFrame height -

i build script changed iframe height when child loaded in iframe. when console.log value, returns integer. when change iframe height value child send, variable changed value last time when function worked. spend 1 day find out bug. the code in child: (function() { // page initialization code here // dom available here window.parent.postmessage( // height of content document.body.scrollheight // set target domain ,"*" ) })(); }; the code in parent gave wright height: function listenmessage(msg) { var before = msg.data; if(before % 1 === 0) { console.log(before); } } if (window.addeventlistener) { window.addeventlistener("message", listenmessage, false); } else { window.attachevent("onmessage", listenmessage);

html - Css nth-child works strange -

i try make striped table. when try use nth-child, works strange template: ... <tr class="striped">...</tr> <tr class="more">...</tr> ... css: tr.striped:nth-child(odd) { background-color : rgba($maincolor, .1); } but tr striped class colored. maybe miss feature of specification? use : tr:nth-child(4n+1) instead of: tr.striped:nth-child(odd) demo: https://jsfiddle.net/sabeti05/epnjn1wo/

shell - Possible modification of nested for loop -

i newbie, , trying modify code below takes less time run. (right takes ages.) please or give suggestions, if possible. thank beforehand. #!/bin/sh pheno in `cat /wrk/abc/composition/results/list.txt`; header=`head -1 /wrk/abc/composition/results/"$pheno"/meta_"$pheno".out` echo "pheno $header" > results.txt pheno in `cat /wrk/abc/composition/results/list.txt`; awk -v p="$pheno" \ 'nr == fnr{a[$1]; next}($3) in a{print p, $0}' \ list.txt \ /wrk/abc/composition/results/"$pheno"/meta_"$pheno".out \ >> results.txt done done assuming list.txt line separated, here's same code simplified, no useless cat s, (the for loops swapped while read s), , using cd reduce unreadable long paths, followed notes. should little faster, , work same before, such was: cd /wrk/abc/composition/results/ while read pheno ; { echo -n pheno; head -1 "$pheno&

Cross-compiling on Linux for iOS -

i trying cross-compile ruby ios devices. have rather lengthy script downloads latest source code ruby, unzips it, , compiles it. the script follows: #!/bin/bash rm -rf ~/built/ruby ar=~/toolchain/armv7-apple-darwin11-ar as=~/toolchain/armv7-apple-darwin11-as cc=~/toolchain/armv7-apple-darwin11-clang cxx=~/toolchain/armv7-apple-darwin11-clang++ ld=~/toolchain/armv7-apple-darwin11-ld nm=~/toolchain/armv7-apple-darwin11-nm objdump=~/toolchain/armv7-apple-darwin11-objdump ranlib=~/toolchain/armv7-apple-darwin11-ranlib strip=~/toolchain/armv7-apple-darwin11-strip sdk=/home/citrusui/sdks/iphoneos9.3.sdk cflags="-arch armv7 -arch arm64 -isysroot $sdk" ldflags="-wl,-segalign,4000" destdir=~/built/ruby/var/stash apt install autoconf bison clang jq xutils-dev curl https://api.github.com/repos/ruby/ruby/tags -o ruby.json url=`jq -r 'map(select(.name != "yarv_migration_base"))[0].tarball_url' ruby.json` tag=`jq -r 'map(select(.name != "yarv_m

c# - NHibernate cascade setting on child -

i try learn nhibernate first time. i'm using book: nhibernate2 there don't understand. on "contact.hbm.xml" mapping file there defined mapping orderheader table. orderheader table has 2 foreign keys contact table: "billtocontact_id" , "shiptocontact_id". <bag name="billtoorderheaders" inverse="true" lazy="true" cascade="all-delete-orphan"> <key column="billtocontact_id"/> <one-to-many class="ordering.data.orderheader, ordering.data"/> </bag> <bag name="shiptoorderheaders" inverse="true" lazy="true" cascade="all-delete-orphan"> <key column="shiptocontact_id"/> <one-to-many class="ordering.data.orderheader, ordering.data"/> </bag> in mapping have cascade="all-delete-orphan". aa understand, necessary set on prima

mysql - The ordering of indexes group -

i read somewhere there different between these 2 indexes groups: add key id_user (id_user,seen); add key id_user (seen,id_user); well there? if yes order should based on parameter? in reality have these 2 queries on 1 table: query1: select * mytable id_user = :id , seen null query2: select * mytable id_user = :id , timestamp > :tm so kind of indexes proper in case? have 3 separated indexed on id_user , seen , timestamp columns. both queries have equality condition on id_user . hence, either can take advantage of index id_user first key in index. so, recommend first index mention. mysql has documentation on multi-column indexes. suggest start there learn them. your query can take advantage of indexes on (id_user, seen) , (id_user, timestamp) . probably, first key important. should try different indexes , see best meet performance goals.

ruby on rails - How to Track Devise User Registration as Conversion in Google Analytics -

i'm using devise rails 3.2 app , want able add track new registrations conversions in google analytics. i'd have new users directed same page being redirected now, if possible (i.e. may pass thru view redirects current page users redirected after create). can please me figure out best way devise? # users/registrations_controller.rb # post /resource def create build_resource if resource.save if resource.active_for_authentication? set_flash_message :notice, :signed_up if is_navigational_format? sign_up(resource_name, resource) respond_with resource, :location => after_sign_up_path_for(resource) else set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format? expire_session_data_after_sign_in! respond_with resource, :location => after_inactive_sign_up_path_for(resource) end else clean_up_passwords resource respond_with resource end end def aft

arrays - Trying to reset values of Comboboxes using a loop (GUI/Java) -

i'm using netbeans make gpa calculator uses series of combo boxes (5, same). i'm trying reset values first value after calculator runs using loop: javax.swing.jcombobox aocomboboxes []=new javax.swing.jcombobox [6]; aocomboboxes [0]= cmbxacc200; aocomboboxes [1]= cmbxbusm241; aocomboboxes [2]= cmbxfin201; aocomboboxes [3]= cmbxis110; aocomboboxes [4]=cmbxis201; aocomboboxes[5]=cmbxis303; (int i=0; i<aocomboboxes.length; i++) { aocomboboxes[0].setselectedindex(0); } is possible? right now, code doesn't function , i'm not sure if because of error in way i've written code, or if isn't possible this. i'm more curious whether possible because i'll want run loop data each combo box , assign variable: int ilettergrade; for (int i=0; i<aocomboboxes.length; i++) { ilettergrade=aocomboboxes[0].getselectedindex(); } well 1st loop reset aocomboboxes[0] 6 times because have hard cod

html - javascript string replace special characters -

i have function removes filter html string if checkbox unchecked or adds if checked. having problems removing %20 or + symbol in front of string want remove using string replace function. this code works: var addfilter = change.value; if (change.checked == true) { //add filter } else { var removefilter1 = addfilter; var removefilter2 = addfilter; if(currfilter != '') { var url = currfilter.replace(removefilter1, ""); var url = url.replace(removefilter2, ""); window.open(url, "_self"); } } ...basically tried setting removefilter1 = "%20" + addfilter; , removefilter2 = "+" + addfilter; rid of space characters in url doesn't when make change. i'm pretty sure has replace function not working special characters not sure how fix. isnt big of deal because still works spaces included bothering me lol. %20 space, shown %20 in url denote space urls c

linux - ping pong DMA in kernel -

i using soc dma data programmable logic side (pl) processor side (ps). overall scheme allocate 2 separate dma buffers , ping-pong data these buffers user-space application can access data without collisions. have done using single dma transactions in loop (in kthread) each transaction either on first or second buffer. able notify poll() method of either first or second buffer. now investigate scatter-gather and/or cyclic dma. struct scatterlist sg[2] struct dma_async_tx_descriptor *chan_desc; struct dma_slave_config config; sg_init_table(sg, array_size(sg)); addr_0 = (unsigned int *)dma_alloc_coherent(null, dma_size, &handle_0, gfp_kernel); addr_1 = (unsigned int *)dma_alloc_coherent(null, dma_size, &handle_1, gfp_kernel); sg_dma_address(&sg[0]) = handle_0; sg_dma_len(&sg[0]) = dma_size; sg_dma_address(&sg[1]) = handle_1; sg_dma_len(&sg[1]) = dma_size; memset(&config, 0, sizeof(config)); config.direction = dma_dev_to_mem; config.dst_addr

Angularjs and IE10 no post data when saving resource -

i'm having trouble figuring out why models not getting saved in angularjs when using ie10. working in ie8, 9, chrome , firefox. problem seeing using fiddler no post data getting sent request. request fired right place, post data @ all. post. i have code follows: app.factory('things', function($resource){ return $resource('/api/v1/thing\\/', {}, { query: {method:'get', params:{},isarray:true}}); }); things.save({ 'user': { 'first_name':$("#student_first_name").val(), 'last_name':$("#student_last_name").val() }, function(){ //console.log("success"); }, function(){ //console.log("error adding student."); }}); i using django on backend tastypie.

java - JSTL using var in foreach items -

i have c:foreach, iterates let's 20 24 <c:foreach var="i" begin="20" end="24"> and inside it, c:foreach <c:foreach items="${'${i}'}" var="entry"> because pass controller multiple lists this: for(team t : teams) { string name = team.getteamid() + ""; model.addobject(name, tabledata); } where team object , model modelandview. controller seems work fine, in jsp used data it. can't items correctly.. need obtain items="20" when var 20 , don't know try anymore. there teams id 20 24, i've checked , error says either numberformatexceptions or don't know how iterate on provided items.. thanks in advance! if want obtain items="20" in second foreach, can try this: <c:foreach var="i" begin="20" end="24"> <c:set var="tmp" value="${i}"> <c:foreach items="${tmp}" var="entry&q

javascript - scope array in angularjs is undefined -

i building angularjs app have issue $scope var. i have following definition: $scope.data = { object: { id: undefined, name: undefined, category: { id: undefined, name: undefined }, description: undefined, featured: 1, seassons: undefined }, progress: 0, emptyresponse : false }; the issue when tried set property $scope.data.object.name following error in console: typeerror: cannot set property 'name' of undefined. there way initialize arrays inside $scope var? tried $scope.data.object = [] which works, in scope of function, , if call function again lose previous data. there way this? way works, if set value of property view through ng-model, in cases need logic in controller. the controller correctly defined function videocreatecontroller($scope,....) full controller, method failing isvalid, if execute create function w