Posts

Showing posts from May, 2011

php - change array output with changing value -

so have table value $i column counts/labels each row (goes 1 12). i have array add, table column. trying do, have array change value outputting each time $i value changes. this sort of looks coding: <?php $i=1; $myarray= array('one', 'two', 'three', 'etc...') ?> <center> <?php echo'<table width="100%">'; echo '<tr>'; echo '<th></th>'; echo '<th>country</th>'; echo '<th>greeting</th>'; echo '<th>translation</th>'; echo '<th>language</th>'; echo '</tr>'; $number_of_rows = 11; ($row = 0; $row <= $number_of_rows; $row++) { echo '<tr>'; echo '<td >'. $i++ . '</td>'; echo '<td >'. “blue” . '</td>'; echo '<td >...

junit - Is it possible to have a main method with a @Before and @Test method in the same class? Java -

this question has answer here: how sequentially execute 2 java classes via mvn command 1 answer i want pass commandline arguments java class junit test annotations, possible? example: @before public void before(string a, string b) { // processing } @test public void test() { } public static void main(string[] args) { if (args[0] != null) default_content_dir = args[0]; if (args[1] != null) default_fonts_dir = args[1]; if (args[2] != null) formmldir = args[2]; before(default_content_dir, default_fonts_dir); } is possible? possible? yes. want? not. public class customemain { public static void main(string [] args) { customsetup(args); junitcore.main(new string [] {"sometest"}); } } the problem no 1 invokes junit themselves. use ant, maven, eclipse, or other build tool. if case there cu...

ios - Localising a UILabel with attributed string from a Storyboard -

i have uilabel text set "attributed" in storyboard. when generate main.strings file translating different language text label not appear. i tried add manually entry main.strings file copying object id. tried setting "text" property , "attributedtext" property when run app translated string not used. so, how localise uilabel set "attributed" on storyboard? i ended solving combination of storyboard , code, using this answer reference. to start with, attributed string used on storyboard applied 1.5 line spacing whole string, easier set text on code preserving storyboard's label formatting. the storyboard contains uilabel text property set attributed , 1.5 line height multiple. on view controller code have setupui method , outlet uilabel. @interface myclass () @property (weak, nonatomic) iboutlet uilabel *alabel; @end @implementation myclass - (void)setupui { nsmutableattributedstring *attributedstring = [[nsmutable...

indexing - Oracle:How to check index status? -

i create index createdate_idx on field createdate , make query: select * tablename createdate>=to_date('2016-02-29','yyyy-mm-dd'); but not sure whether index createdate_idx has been used or not. how can make confirm? explain plan show index used , other information. for example: explain plan select * tablename createdate>=to_date('2016-02-29','yyyy-mm-dd'); select * table(dbms_xplan.display); plan hash value: 3955337982 ------------------------------------------------------------------------------- | id | operation | name | rows | bytes | cost (%cpu)| time | ------------------------------------------------------------------------------- | 0 | select statement | | 1 | 9 | 2 (0)| 00:00:01 | |* 1 | table access full| tablename | 1 | 9 | 2 (0)| 00:00:01 | ------------------------------------------------------------------------------- predicate information (ide...

javascript - jQuery multiselect is not a function -

i'm new sort of web related stuff have been working away few weeks on web project @ work. today though hit problem couldn't solve. have been using multiselect plugin, http://www.erichynds.com/examples/jquery-ui-multiselect-widget/demos/ , while without issue. today tried include datatables plugin ( https://www.datatables.net/ ) after doing multiselect function no longer available. attached simple example showing minimal example of when things break down when plugin included. shown, code work , when run show dropdown box. when uncommented line included , datatable plugin added, console in chrome gives error: uncaught typeerror: $(...).multiselect not function(anonymous function) @ test.php:20i @ datatables.min.js:14j.firewith @ datatables.min.js:14n.extend.ready @ datatables.min.js:14k @ datatables.min.js:14 from seems plugins in conflict somehow, i'm not quite sure how resolve this. <link rel="stylesheet" type="text/css" href="../...

php - How do I insert into database with codeigniter without it putting the single quotes? -

i'm making feature in app users can select multiple db items , change department belong @ once. have in codeigniter model currently: function multimove($dept, $jobstring) { $sql = "update jobs set department = ? id in(?)"; $this->db->query($sql, array($jobstring, $dept)); echo $this->db->last_query(); } the function takes in 2 values department number , id's of selected jobs. i'm trying achieve sql function: update jobs set department = 3 id in(5,6,48); but codeigniter generates this: update jobs set department = '3' id in('5,6,48'); it puts single quotes on values , creates errors. there way around this? calling model $this->load->model('model_jobs'); $this->model_jobs->multimove(3,'2,3,8'); model function multimove($dept,$jobstring) { $ids = explode(",",$jobstring); $upd_data = array('department' => $dept ); $this->db->...

reverse engineering - How do you debug libc in OSX? -

i expect able statically link against build of libc debug symbols, run program through lldb. otool -l <my binary> makes dynamically linked library (dll) is: /usr/lib/libsystem.b.dylib (compatibility version 1.0.0, current version 1226.10.1) which guess libc dll (though nm doesn't list i'd expect in libc). maybe kind of stub loader. in /usr/lib/ seems apple not supply debug build of libsystem. how debug libc on osx (10.11.3)? possible duplicate of: on mac os x, how can debug build of system/libc source level debugging? i'm having hard time following question, there points made think cover you're asking: otool -l show dylibs linking against. /usr/lib/libsystem.b.dylib umbrella library re-exports multiple dylibs, including libc (/usr/lib/system/libsystem_c.dylib). if want see symbols part of system's c runtime, want use nm on dylib, not libsystem. if statically linking in own libc, won't show in 'otool -l' because ...

Transfer Multi rows Array PHP to Array Javascript -

i followed topic convert array php java , not successful me. code: <script> var dataobject=<?php $returnarry=getdataarray("select product_id, product_name, product_price product"); echo json_encode(returnarry); ?>; //how convert dataobject array </script> how convert dataobject array php function convert php arrays javascript json_encode() only.note json_encode() available in php 5.2 , up, please check whther you're using older version. ref: http://php.net/manual/en/function.json-encode.php you can see example in same page: example #1 json_encode() example <?php $arr = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5); echo json_encode($arr); ?> the above example output: {"a":1,"b":2,"c":3,"d":4,"e":5} for multi dimensional arrays use below one: $arr = array(); while($row = my...

sql - Python - None returned by using cursor.fetchone() -

internet searches have told me use cursor.fetchone() way particular row sql database in python. when use it, none. i'm pretty sure there stuff in there, i'm confused why happening. here code db = sqlite3.connect('dataset.db') curs = db.cursor() curs.execute("create table data(id integer primary key, dataobj real)") def adddata(info): curs.execute('''insert data(dataobj) values (?)''', (info, )) def write(dataholder): #to put row vals table x in range(0, len(dataholder)): adddata(dataholder[x]) db.commit() def read(x): sqlquery = "select dataobj data id = ?" result = curs.execute(sqlquery, (x, )).fetchone() #should return row data table print result #returns none dataholder = [0.1, 0.2, 0.3, 0.4, 0.5] write(dataholder) x in range(0, len(dataholder)): read(dataholder[x + 1]) i'm using can save work on program , resume when restart it. feel i'm doing dumb, sorry if it'...

c# - How to get disabled DropDownList control value to controller -

work on asp.net mvc5.my project dropdownlist work problem arise when disabled dropdownlist control can not value in controller. my razor syntax bellow: <div class="form-group"> @html.labelfor(m => m.productname, new {@class = "col-md-3 control-label"}) <div class="col-md-3"> @html.dropdownlist("productid", null, "select product", new {@placeholder = "select product", @class = "form-control", @disabled = "disabled" }) </div> </div> my controller syntax fill above dropdownlist private void loadproductsinviewdata(object selectedvalue = null) { var datas = productrepository.getall().orderby(p => p.name); viewbag.productid = new selectlist(datas, "productid", "name", selectedvalue); } why in controller create/edit event can no...

CSS or jQuery to right align image in Viewport and still allow scrolling to left -

i'm working on html page webkit, , have image wider viewport (2048 x 1536px). i'd have right half of image appear in viewport starting point, , allow scrolling left see rest of image. i've tried few things in css (float, negative margin offsets) without luck. <!doctype html> <html laneg="en"> <head> <title>viewport example</title> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=0.44, maximum-scale=1.0, target-densitydpi=device-dpi"/> </head> <body> <img src="image25.jpg" width="4800" height="2400" /> </body> </html> visual representation: http://i44.tinypic.com/351j1pw.jpg you might want force browser scroll. scroll 4800px horizontally make sure it's on right on every device. or use image's width instead of specifiying number. <script type="text/javasc...

android - losing values from ListView items that have been scrolled out of view -

i changing textview value using button ,some kind of counter.such as, when clicking add button value increasing , decreasing when clicking minus button , when item scrolled out of view losing value, adapter class: package com.nerdcastle.nazmul.mealdemo; import android.content.context; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.baseadapter; import android.widget.button; import android.widget.listadapter; import android.widget.textview; import java.util.arraylist; /** * created nazmul on 2/22/2016. */ public class adapterformealsubmission extends baseadapter implements listadapter { private arraylist<string> employeenamelist; private arraylist<string> quantitylist; private context context; int count = 0; public adapterformealsubmission(arraylist<string> employeenamelist, arraylist<string> quantitylist, context context) { this.employeenamelist = ...

Maximo Anywhere online-offline login issue -

i using maximo anywhere 7.5.2.0 - work execution app the issue , online - offline login sometime getting failed. first time of app flashed in ipad, can able login in app both mode online , offline. after time cannot able login. got "the user name , password combination entered not valid" error correct credentials. i have enclosed logs here. object {errormsg: "the user name , password combination entered not valid."} " ---------------------------------------- rejected @ object.<anonymous> (http://11.11.11.11:0989/maximoanywhere/apps/services/preview/workexecution/common/0/default/js/platform/auth/userauthenticationmanager.js:498:17) @ http://11.11.11.11:0989/maximoanywhere/apps/services/preview/workexecution/common/0/default/dojo/dojo.js:2:285161 @ _7c0 (http://11.11.11.11:0989/maximoanywhere/apps/services/preview/workexecution/common/0/default/dojo/dojo.js:2:273376) @ _7ba (http://11.11.11.11:0989/maximoanywhere/apps/serv...

php - How do I check uploaded file is empty? -

i attempting validation on uploaded images. when check see if images have been selected , uploaded should return error message if no images have been uploaded. in method returns false . heres method: class event{ private $dbh; private $post_data; public function __construct($post_data, pdo $dbh){ $this->dbh = $dbh; $this->post_data = array_map('trim', $post_data); } public function checkvalidimages(){ $errors = array(); if(empty($this->post_data['event-images'])){ $errors[] = 'please select @ least 1 image upload.'; } if(count($errors) > 0){ return $errors; }else{ return false; } } and calling here: // check images valid $images = new event($_files, $dbh); var_dump($imageerrors = $images->checkvalidimages()); the var_dump...

c# - Unable to retrieve email folders on specific mail server.. possible causes -

i failing retrieve folders of email account using imapx: imapx.imapclient m_imapclient = new imapx.imapclient( imapserveraddress, (int) imapserverport, system.security.authentication.sslprotocols.ssl3, false); m_imapclient.connect(); m_imapclient.login( emailaddress, emailpassword); //the 2 functions above each return true //this last statement throws exception: imapx.collections.foldercollection vfolders = m_imapclient.folders; and is: 'm_imapclient.folders' threw exception of type 'system.nullreferenceexception' imapx.collections.commonfoldercollection {system.nullreferenceexception} what's wrong, i'm using imap, ssl, port 993. imapx 2. works imap.google.com on 993, doesn't work network server.. ideas of why happen? this issue has been fixed, thank you! details see issue: unable mail folders after successfull login on imap server . problem occured on parsing information returned imapx server folders. servers not quote folder names. ...

c++ - How to fill an array with random floating point numbers? -

i'm hoping find way fill array random floating point numbers. array size 50 , i'm hoping fill array random float numbers range 1-25. here have far. appreciate tips or answers can offer. thank you. #include <iostream> #include <ctime> #include <cstdlib> using namespace std; int main() { float myarray[50]; for(int = 1; <= 25; i++) { srand(time(0)); myarray[i] = (rand()% 50 + 1); cout << myarray[i] << endl; system("pause"); return 0; } } if c++11 not option, can use rand , dividing result rand_max constant casted float obtain uniform distribution of floats in range [0, 1]; can multiply 24 , add 1 desired range: myarray[i] = rand()/float(rand_max)*24.f+1.f; by way, other observed, move srand out of loop - rng seed (normally) must initialized once. (notice dividing rand_max give distribution includes right extreme of interval; if want exclude it, should divide e.g. rand_max+1 ) of course, r...

CMake to compile java code -

is possible use cmake compile , run java code? from command line commands write on terminal is: javac -classpath theclasspath mainclass.java java -classpath theclasspath mainclass if so, please give me idea of how can achieved? ps: not want generate jar file; compile java class , if possible run it. thanks. update : have changed command. not know why additional text not displayed. might because used "<" , ">". cmake has limited support compiling java code , executing java class files. the standard module findjava can used find jdk installed on local machine. standard module usejava provides few functions java. among function add_jar compile java source files jar file. here small example demonstrates how use add_jar . given java sample source file helloworld.java : public class helloworld { public static void main(string[] args) { system.out.println("hello, world!"); } } the following cmake list f...

oracle - Copying a row in the same table (within a loop of array of tables) -

there great answer @shannonseverance on question copying row in same table without having type 50+ column names (while changing 2 columns) that showed how dynamically copy row within table same table (changing pk) declare r table_name%rowtype; begin select * r table_name pk_id = "original_primary_key"; -- select pk_seq.nextval r.pk_id dual; -- 11g can use instead: r.pk_id := pk_seq.nextval; r.fk_id := "new_foreign_key"; insert table_name values r; end; i apply approach within function called each time within array of table names so can select using execute immediate - how declare 'r'? can replace 'table_name' in code variable passed function? table(1)="table1"; table(2)="table2"; t 1..table.count loop copytablecontacts(table(i)); end loop; tia mike in end, have amended function slightly i build 2 arrays 1 - list of table names user_tab_columns table 2 - each table in array1, build comma delimi...

mysql error code 1022 duplicate key in table -

i searched through prior posts didn't quite find answer, here goes ... i have table create table `leags` ( `lid` int(10) not null auto_increment, `lname` varchar(255) not null, `description` varchar(255) default null, `links` varchar(255) default null, `cid` int(10) not null, primary key (`lid`), key `index2` (`lid`,`lname`), key `index3` (`lid`,`lname`,`cid`), key `cid_idx` (`cid`), constraint `cid` foreign key (`cid`) references `cats` (`cid`) ) engine=innodb auto_increment=2 default charset=utf8 comment='leagues'$$ i have table has above pk foreign key. create table `tams` ( `tid` int(10) not null , `tname` varchar(255) not null , `lid` int(10) null , `url` text null , primary key (`tid`) , index `index2` (`tid` asc, `tname` asc) , index `index3` (`tid` asc, `tname` asc, `lid` asc) , index `lid_idx` (`lid` asc) , constraint `lid` foreign key (`lid` ) references leags` (`lid` ) on delete no action...

how rails determines which form field had an error -

Image
i trying validate form on client side via js. have nested fields in form , need know, field hat error since there can more fields of same type, e.g. fon number. inside error of model, says, 'type' of field had error 'person.fon' not of fon fields. use nested_form gem every field has unique id how rails determines exactly, field had error? when use standard form validation, right fields wrapped in error div. thats how rails it with @model.errors info, 1 of fields(fon, email, etc.) had error, not one. you need see in logs , see incorrect form it. after see line wrong.

c - shm_open() function no such file or directory -

i'm trying create new shared memory file using shm_open(), i'm getting errno 2 (no such file or directory). shm_open ("/diag_public", o_creat | o_rdwr, s_iwusr | s_irusr | s_iwgrp | s_irgrp | s_iroth); i've tried creating own standalone app run shm_open same name , options, , is successful... so checked /dev/shm has drwxrwxrwt permissions , process running actual code has -rwxrwxrwx permissions. also, mount | grep shm returns: tmpfs on /dev/shm type tmpfs (rw) i'm out of ideas... suggestions on going wrong? thanks. make sure passing o_creat. seems giving error. man page says enoent returned under 2 conditions. shm_open first 1 seems valid though. man shm_open errors on failure, errno set indicate cause of error. values may appear in errno include following: ... enoent attempt made shm_open() name did not exist, , o_creat not specified. enoent attempt made shm_unlink() name not exist.

Provide username and password for chef recipe -

i'm using chef's windows cookbook provision windows servers. here's recipe: # windows sdk windows 7 , .net 4 - .net tools v4 windows_package "windows sdk windows 7 , .net 4 - .net tools v4" source "\\\\myserver\\mydrive\\chef\\winsdknetfx40tools_amd64\\winsdk_nfx40tools_amd64.msi" installer_type :msi action :install end the problem i'm running permissions error when trying access unc path. possible provide username/password windows_package can tell access share as? i've tried store credentials via credentials manager, that's not working. windows not allow credentials included directly in unc path. there not appear chef support authenticating while accessing files on unc paths. chef's mount resource supports mounting remote path. allows passing username , password on windows. mount unc path before windows_package call , reference mounted drive path instead of unc path. untested example: mount "...

ruby - Undefined authenticated? method in Rails 4 -

i'm reading book (beginning rails 3), trying on rails 4. so, have 1 problem: def self.authenticate(email, password) user = where('email = ?', email) return user if user && user.authenticated?(password) end def authenticated?(password) self.hashed_password == encrypt(password) end when in rails console : user.authenticate('test@test.com', 123) rails returns me error, undefined method authenticated? . irb(main):034:0> user.authenticate('test@test.com', 123) nomethoderror: ←[1m←[35muser load (1.0ms)←[0m select "users".* "users" (email = 'test@test.com') undefined method `authenticated?' #<activerecord::relation []> c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/relation/delegati on.rb:121:in `method_missing' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/rel...

css - Detect support for -webkit-filter with javascript -

using javascript, how detect if browser supports webkit filters? based on info provided @ default css filter values brightness , contrast , have tried following , few of other default values: if (window.matchmedia && window.matchmedia("( -webkit-filter:opacity(1) )").matches) { alert("supported"); }else{ alert("not supported"); } an relatively easy way test whether css property supported following: create element apply css in question element read value - if same value set in step 2, supported, otherwise not js: var e = document.queryselector("img"); e.style.webkitfilter = "grayscale(1)"; if(window.getcomputedstyle(e).webkitfilter == "grayscale(1)"){ "supported!"; } see example

user - Is it possible to keep track of how many times a file is ever opened over time? -

to repeat title basically, possible keep track of how many times file ever opened on time? look @ class filesystemwatcher: http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx with it, i'm not sure you'll able tell when files opened, if updated.

Enable TImage to open JPEGs, GIFs and PNGs in Delphi XE3? -

i'm looking reuse code draws images on device context in dll. uses timage works fine in original program. in dll bmps , tiffs load fine throws error loading jpgs pngs , gifs original loaded fine. i'm having troble finding in original code enable them. see in vcl.graphics looks see if clr defined tried adding conditional defines of project didn't work. can't seem find other option in project settings i'm missing enable clr. include jpeg , pngimage , gifimg uses clause. these units enable usage of corresponding image types , register file extensions.

java - Android HTC sense 4 and HTC sense 5 - answer incoming call feature doesnt work -

hi write app answers incoming call on press overlayed button . working perfect on android 4.0.3 - 4.3 not on htc sense 4 , htc sense 5 . know how bring in life function htc sense ? thanks lot ) code use in regular android call acceptation : /////////////////////////////////////////////////////////////////////////////////////////////// public static void answerincomingcall(context context) { intent = new intent(intent.action_media_button); i.putextra(intent.extra_key_event, new keyevent(keyevent.action_up, keyevent.keycode_headsethook)); context.sendorderedbroadcast(i, null); } /////////////////////////////////////////////////////////////////////////////////////////////// not worked htc sense. after modified bit , worked on htc opensens emulator didnt work on real htc sense 5 , 4 : /////////////////////////////////////////////////////////////////////////////////////////////// public static void answerincomingcallhtc(context context) { intent = new i...

ruby on rails - CarrierWave + Mini_Magick: undefined method `write' for "":String -

recently switched rmagick mini_magick. receiving error undefined method 'write' "":string . here's uploader looks like... class backgrounduploader < carrierwave::uploader::base include carrierwave::minimagick include carrierwave::mimetypes process :set_content_type storage :file def store_dir "uploads/backgrounds/#{model.id}" end def default_url "/assets/fallback/default.jpg" end process :resize_to_fit => [1024, 1024] process :convert => 'jpg' process :fix_exif_rotation def fix_exif_rotation manipulate! |img| img.auto_orient img = img.gaussian_blur 5 img = yield(img) if block_given? img end end def extension_white_list %w(jpg jpeg png) end end the issue lies in fix_exif_rotation method. if comment out line process :fix_exif_rotation works fine. i've removed ! end of auto_orient call seems have caused issues others when switching rmag...

java - How to refactor validators -

i thinking implementation validators. service method starts this: if(badsituation()){ return response.status(400).entity("bad situtaion").build(); } if(badsituation2()){ return response.status(400).entity("bad situtaion2").build(); } ... if(badsituationn()){ return response.status(400).entity("bad situtaionn").build(); } since validators multiply fast have decided refactor them design pattern. thinking chain of responsibility or composite , had problem practical realization. can suggest how code should refactored? you can use cor pattern validation "behavior" : each of validators implement base chainedvalidator interface (some of behavior can moved parent abstract class same chain members): public class myfirstvalidator implements chainedvalidator{ //this cor implementation has 'composite' background chainedvalidator nextvalidator; @override private void dovalidate(requ...

How do I unit test django urls? -

i have achieved 100% test coverage in application everywhere except urls.py . have recommendations how write meaningful unit tests urls? fwiw question has arisen experimenting test-driven development , want failing tests before write code fix them. one way reverse url names , validate example urlpatterns = [ url(r'^archive/(\d{4})/$', archive, name="archive"), url(r'^archive-summary/(\d{4})/$', archive, name="archive-summary"), ] now, in test from django.urls import reverse url = reverse('archive', args=[1988]) assertequal(url, '/archive/1988/') url = reverse('archive-summary', args=[1988]) assertequal(url, '/archive-summary/1988/') you testing views anyways. now, test url connect right view, use resolve from django.urls import resolve resolver = resolve('/summary/') assertequal(resolver.view_name, 'summary') now in variable resolver ( resolvermatch class in...

Unity3D Facebook SDK Achievements -

i'm trying implement achievements facebook unity sdk. i hoping give me qualitative description of process required this. here's i've done far. hosted web build on server created achievements folder on site , created test achievements html file in https://developers.facebook.com/blog/post/539/ my main confusion difference between registering achievement , positing achievement. is registering achievement needs done once , if should done? need create script in unity registers achievements game run before rest of testing? i'm unsure how method call works registering , posting achievement. i'm under impression need call fb.api(string endpoint,facebook.httpmethod,facebookdelegate callback,dictionary formdata) but i'm not sure input arguments need be. here's attempt far(i'm pretty sure string endpoint i've used wrong) private void registerachievement() { string achievement ="http://www.invadingspaces.com/unity/testing/achi...

cljsbuild - Multiple ClojureScript files on same page -

i have project using jasmine test javascript. trying switch using clojurescript front end. project.clj like (defproject myproject "0.1.0-snapshot" :dependencies [[org.clojure/clojure "1.5.1"] [org.clojure/clojurescript"0.0-1889"] [org.clojure/google-closure-library-third-party "0.0-2029"] [domina "1.0.0"] [hiccups "0.2.0"]] :plugins [[lein-cljsbuild "0.3.3"]] :cljsbuild { :builds [{ :source-paths ["src/clojurescript"] :compiler { :output-to "public/javascripts/main.js" :optimizations :whitespace :pretty-print true}} { :source-paths ["spec/clojurescript"] :compiler { ...

php - Get the ids and loop through post data -

i post form same input names+id @ end that: <input type="text" name="machine_1"> <input type="text" name="machine_11"> <input type="text" name="machine_23"> how loop through on each of them , id's in loop? i tried way, loop lot without data , happens if there more thank 100 id? for($i=0; $i<100; $i++){ $_post["machine"]=$_post["machine_".$i]; $id=$i; } post associate array, can loop through that's been posted this: //$k contains id //$v contains submitted value foreach($_post $k => $v) { //test if id contains 'machine' if(stristr($k, 'machine')) { echo $v; } }

javascript - Show DIV dynamically when clicking on Radio Selection -

i have been supplied code can't seem working, i've looked around previous questions can't find it. maybe it's totally wrong , should start again? what want show div when radio button selected. here code: <script type="text/javascript"> jquery(document).ready(function($){ $('input[name="item_meta[478]"]').change(function(){ var val1 = $("input[name='item_meta[478]']:checked").val(); if (val1== "españa") { document.getelementbyid("div1").style.display = "block"; document.getelementbyid("div2").style.display = "none"; } if (val1== "intracomunitario") { document.getelementbyid("div2").style.display = "block"; document.getelementbyid("div1").style.display = "none"; } } </script> <form> show form? <input type="radio" onclick="frmcheckdependent(this.value,'478')" checked=...

Javascript array push in a for loop -

i have 2 for loops on second 1 using push array called myarray , not pushing data has desired. returning array console in second for loop outputs following: ["scottsdale cfs"] ["scottsdale cfs", "denver cfs"] ["warren cfs"] ["warren cfs", "millford cfs"] ["rockaway cfs"] ["rockaway cfs", "border cfs"] however, data show this: ["scottsdale cfs", "denver cfs", "warren cfs", "millford cfs", "rockaway cfs", "border cfs"] how can accomplish this? note: reason showing because iterating through json file checks through first center , retrieves data in array , goes next , same. problem arrays each have 2 elements why trying push 1 array. var looper = function(sec0, vz, lorr) { var myarray = []; for(var i=0;i<vz[0]['areas'].length;i++){ var ttext = object.keys(...

jquery - Can't figure out why this doesn't work -

$(function () { // document ready $(window).scroll(function() { var top_offset = $('body').offset().top; if ((top_offset <= 650)) { $('.fluid-width-video-wrapper').addclass('fluid-width-video-wrapper-bottom'); } else { $('.fluid-width-video-wrapper').removeclass('fluid-width-video-wrapper-bottom'); } }); }); i literally can't figure out why doesn't work, should add class .fluid-width-video-wrapper if page scrolled more 650px, or remove class if isn't. can show me my-no-doubt idiotic mistake here? offset gives top , left pixel offsets of element relative document. since body element starts @ top left corner, it'll give top:0 , left:0 99% of time, unless you've done special body tag in css. what want $(window).scrolltop() which tells how far down page have scrolled.

html - how to update icomoon fonts to existing icomoon fonts? -

updating fonts existing fonts i’m using 5 icomoon fonts in our website downloaded icomoon. want include 2 more fonts. should do? can add new 2 fonts existing fonts? if yes, how can add them? i'm assuming want add new "icons" existing fonts. font pack download icomoon comes "selection.json" file. if have file, import icomoon app using import icons button. after doing so, can select more icons generate new font. if don't have access "selection.json" file, import svg font using same import icons button. downside in case may need add glyph names again. anonther way save/load created fonts using project manager: main menu > manage projects. may want download project can load later. more info: https://icomoon.io/#docs/save-load

How to do double "for loop" (first for files, second for datas in files) in R -

i've started r, i'm self-taught person , have problem loop. looking answers can't find anything. i've got lot of files different names , i've got lot datas in 1 file. made loop 1 file , works - it's (but has more calculations): 12bielawica9.txt looks like na na na 0.002 0.002 na na na na na na na na na na na na na na na na na 0.008 0.006 na na na na na na na na na na na na na na but it's more bigger it contains results of researches, that's why there's lot of nas. looks different reasearches....(there's less nas) wrote in r dane = dane = read.table("12bielawica9.txt", header=t) (i in dane) { x = sd(i, na.rm=t) y = length (na.omit(i)) if (y == 0) { cat(file="12bielawica9.txt", append=t, (paste("-","\t"))) } else if (x == "0") { cat(file="12bielawica9.txt", append=t, paste(format(mean(i, na.rm=t) - me...

mobile - iOS 7 Safari auto shrinking/hiding UI elements not working when scroll -

when scroll on web page in ios 7s safari url bar shrinks , bottom navigation bar disappears. in site working on these 2 things not happen. the momentum/inertial scrolling not working until added -webkit-overflow-scrolling: touch; html element. i can't imagine element have added code have lock mobile safari this. hoping isn't repeat question, it's hard know call besides "shrinking/hiding". i accidentally stumbled upon solution last night in article maximiliano firtman's article breaking mobile web . article points out many issues new mobile safari in ios 7. the solution problem close answer (his being if there overflow: scroll; on page not trigger auto ui hide feature) mine overflow: hidden; style.

qt - error in #include <QFtp> what should i do -

i want use ftp qt project. when add #include <qftp> in program , run compiler says: "error: qftp: no such file or directory". you should add this, project file. qt += network qftp part of network module

bash approach for ease of calling binary with large amount of parameters -

trying figure out best way automate running command takes lot of parameters , changing of them. current approach this: #!/bin/bash # 5 more of these value=42 stuff=12 charlie=96 # note these not sequential, bad example param[0]='--oneparameter=17' param[1]='--anotherparam=foo' param[2]='--yetanotherparam=bar' param[3]='--someparam4=314' # above continues 15 parameters or # , ones one: param[16]="--someparam=astring${stuff}.foo" param[20]="--someparam20=filename${value}.foo" then call binary: ./mybinary ${param[@]} and well. then change parameter second run: param[1]='--anotherparam=bar' value=84 # here need include lines depends on value # parameter expansion work param[20]="--someparam20=filename${value}.foo" ./mybinary ${param[@]} this continues 30 runs or so... the above works it's ugly , error-prone can't figure out better way it! appreciated! thanks. if it's small nu...

html - Attribute "data-content-id" inside of a div -

i've div class="contentmiddle"> . need give container "data content id". can this? <div class="contentmiddle" data-contentid="1">content</div> sure! there no reason can't have class , id on element. can't have more 1 id. that's bit of rule of thumb when comes programming. check out http://html5doctor.com/html5-custom-data-attributes/ more. please post link example code if need users dig deeper.

erlang - Saving a digraph to mnesia is hindered because of its side-effects -

updated the digraph library in erlang implements data type side-effectful. each operation on data type saves new state in ets table -- instead of returning altered version of itself, more common in functional languages. the problem usage perspective, impedes effort store or pass around state in convenient way requiring me first "collect" state before can start juggle around. the closest solution have seen far serializer/deserializer , these have drawback tied current structure of digraphs instead of operating on abstract type -- prevents future proof solution. update pascal pointed out serializer utilizes interface of digraph, , hence eliminates drawback mentioned above. better, albeit still inconvenient, see no better alternative. what recommendation on how store digraphs? should go different data type altogether? thanks. i not sure understand concern. fact digraph stored in ets transparent in user interface, might want chnge either exchange digr...

java - Column headers in a boxlayout -

Image
i using boxlayout manager fit other jpanels horizontally. on each 1 of panels contained inside of boxlayout, box layout lays out jbuttons vertically. here visual image. i able add borders between each set of buttons, add top button says each value in column is. borders don't seem hard, not sure if possible add column header current layout manager have. do need switch layout managers, or there way add column headers each panel? glue seems idea, not sure how position header @ top, while still centering other buttons. do need switch layout managers, or there way add column headers each panel? glue seems idea, not sure how position header @ top, while still centering other buttons. wrap jpanel around each of columns borderlayout , put header in borderlayout.north . original column panel can put in borderlayout.center . there no need stick 1 layout. typically easier nest different layouts obtain result

code signing - Windows 8 Certificate Warning: We can't verify who created this file -

Image
despite signing c++ app on windows 8 signtool valid timestamp server , certificate, when (local) or users (remote) attempt run app, windows displays following message: open file - security warning can't verify created file. sure want run file? i using signtool comodo certificate , sign options /f , /p , , /tr . confident signature successful because removes of runtime security warnings users. 'security warning' dialog: perhaps bit late, figured i'd post in case others arrive @ article same problem. seems microsoft, in 2013, made change windows such executables opened network drive give warning, if signed. source (it mentioned in comments section) : http://blogs.msdn.com/b/ieinternals/archive/2011/03/22/authenticode-code-signing-for-developers-for-file-downloads-building-smartscreen-application-reputation.aspx?pageindex=2 ) it seems way make go away user4437298 suggested, add network drive trusted zone.

c# - WCF Client for web service with WS-Security, signed headers, authentication tokens and encryption of body -

i assigned create client web service. have no previous experience web services , have been trying no success. web service hosted @ https://ws.conf.ebs.health.gov.on.ca:1441/edtservice/edtservice able create proxy classes visual studio 2012 , create basic client rejected service since did not include of security specifications services require. following extract documentation, available @ http://www.health.gov.on.ca/en/pro/publications/ohip/default.aspx the ws-security section includes: technical specifications of wss 1.1 • identity requirements; • signing requirements ; • encryption requirements; , • time stamps idp ensure confidentiality , integrity of sensitive information within message, sender software must use public key technology sign soap headers , body. signing certificate can available certificate , can self signed. if response data specified encrypted, specific web service technical specification, data encrypted using, @ least, aes128-cbc symmetric encryption algor...