Posts

Showing posts from July, 2012

asp.net - ASP membership send registration HTML mail with image -

i have asp.net site membership provider. when user registered send mail registration compilation .txt file (containing html). trying add image html. problem cant see image in mail. 'images' folder under main site folder. confermation.txt file <body style='text-align:right;font-family:arial'> <div style='margin:0 auto'> <img id="image1" src="images/logo.png" style="width:350px;" /> <br /> please press following link<br /> <br /> <a href="<%verificationurl%>">press here</a> <br /><br /> </div> asp.net <asp:createuserwizard runat="server" enableviewstate="false" disablecreateduser="true" id="createuserwizard1" width="300px onsendingmail="createuserwizard_sendingmail"> <layouttemplate> <

sql - Mysql query, get exact value -

i have table 1 i'm trying chat_id members excat match example want chat id members 1,2 when select * member_to_chat member_id in (1,2) returns results , chat number 3, wrong because in chat have 3 people need if give member_id 1 , 2 chat_id 1, possible mysql, thank in advance! , sorry english if it's not good. member_to_chat id | member_id | chat_id 1 1 1 2 2 1 ---------------------- 3 1 2 4 3 2 ---------------------- 5 1 3 6 2 3 7 3 3 the result given member_id 1,2 - chat_id has 1, or if pass 1,2,3 has return chat_id 3, thank again suggesstions http://sqlfiddle.com/#!9/d7519/3 select distinct chat_id member_to_chat m not exists (select chat_id member_to_chat member_id not in(1,2) , chat_id=m.chat_id) , exists (select chat_id member_to_chat member_id=1) , exists (select chat_id member_

MySQL average of non-null columns -

i've kludged way through doing this, feel there's cleaner/faster/better solution, , keen learn: update mytable set favg = (coalesce(f1,0) + coalesce(f2,0) + coalesce(f3,0) + coalesce(f4,0)) / ( case when f1 not null 1 else 0 end + case when f2 not null 1 else 0 end + case when f3 not null 1 else 0 end + case when f4 not null 1 else 0 end ) so, how can improved? you can simplify count taking advantage of fact mysql treats booleans integers in numeric context: update mytable set favg = (coalesce(f1,0) + coalesce(f2,0) + coalesce(f3,0) + coalesce(f4,0)) / ((f1 not null) + (f2 not null) + (f3 not null) + (f4 not null));

Changing IP with PowerCLI in Powershell -

i've created script makes clone of vm in vcenter, renames it, changes ip of vm once has powered (from ip of template). having prompt ask ip should be. issue, need enter required ip twice. once label vm, , again change ip of box. is there way of carrying on variable '$newvmip' entered here: add-pssnapin vmware.vimautomation.core connect-viserver -server vcenter01 -user myusername -password password1 start-sleep -s 6 $templatevm = "windows qa - 172.30.30.110 - template" $newvmip = read-host "please input ip of new vm" $newvmfor = read-host "please input vm for?" $newvmdate = read-host "please input todays date" $newvmname = "windows qa - $newvmip - $newvmfor - $newvmdate" new-vm -name $newvmname -vm $templatevm -vmhost "esx01.coname.local" move-vm -vm $newvmname -destination testing start-vm -vm $newvmname start-sleep -s 200 to second part of script: $username = "vmadmin" $password = "

php - jQuery Custom add attribute -

what trying if value of key matches php code want add selected attribute in option. possible collaborate php , jquery? $('#vessel_sub_category_id').append("<option value=" + key + " "if(key == <?php echo $select_update['vessel_sub_category_id']; ?>){'selected';}" >" + value + "</option>"); yes is. need put quotes around string echo in php :) $('#vessel_sub_category_id').append('<option value="' + key + '"' + if(key == '<?php echo $select_update['vessel_category_id']; ?>'){' selected';}+' >' + value + '</option>'); there smarter way achieve this: make sure php short tags enabled use ternary operators it this: $('#vessel_sub_category_id').append('<option value="' + key + '"'+ (key == '<?=$select_update['vessel_category_id'];?>

java - How to easily get vaadin testbench queries? -

i've seen vaadin testbench adds extension of by class available in selenium allows by.vaadin() in theory more awesome selenium counterparts. the problem i'm having is...how (or more tester) construct query readable by.vaadin() ? selenium use selenium ide can point @ element, how do same vaadin? i've started application in debug mode console seems generate java code: buttonelement button1 = $(tabsheetelement.class).id("maintabsheet") .$(horizontallayoutelement.class) .$$(horizontallayoutelement.class).$$(buttonelement.class).first(); according documentation ( http://vaadin.com/download/book-of-vaadin/current-br/html/testbench.selectors.html ) need selector in form of: "bookexamplestobetested::/vverticallayout[0]/childcomponentcontainer[1]/vlabel[0]" so how construct such query? preferably in point-and-click kind of way? as explained here a vaadin selector begins ui identifier. url path of ui, without slashes or o

matlab - Singular Value Decomposition positive value -

i using singular value decomposition (svd) applied singular spectrum analysis (ssa) of timeseries. % original time series x1= rand(1,10000); n = length(x1); % windows trajectory matrix l = 600; k=n-l+1; % trajectory matrix/matrix of lagged vectors x = buffer(x1, l, l-1, 'nodelay'); % covariance matrix = x * x' / k; % svd [u, s_temp, ~] = svd(a); % eigenvalues of squared eigenvalues of x s = sqrt(s_temp); d = diag(s); % principal components v = x' * u; = 1 : l v(:, i) = v(:, i) / d(i); end i wanted know if there way have singular components (i.e. columns of v) positive. x > 0 in case (and covariance matrix a) you may looking algorithm such non-negative matrix factorization . this available in statistics toolbox in command nnmf , , there freely available third-party toolbox well.

SSH issue when connection MySQL workbench to vagrant -

Image
i'm trying connect vagrant mysql server using mysql workbench. shows error shown in image. the workbench error log pasted below. 17:34:50 [inf][ ssh tunnel]: existing ssh tunnel not found, opening new 1 17:34:50 [inf][ ssh tunnel]: opening ssh tunnel 127.0.0.1:2222 17:34:50 [err][ sshtunnel.py]: traceback (most recent call last): file "/usr/share/mysql-workbench/sshtunnel.py", line 231, in _connect_ssh look_for_keys=has_key, allow_agent=has_key) file "/usr/lib/python2.7/dist-packages/paramiko/client.py", line 337, in connect self._auth(username, password, pkey, key_filenames, allow_agent, look_for_keys) file "/usr/lib/python2.7/dist-packages/paramiko/client.py", line 528, in _auth raise saved_exception authenticationexception: authentication failed. 17:34:50 [err][ ssh tunnel]: authentication error opening ssh tunnel: authentication error. please check username , password correct , try again. vagrant up comm

php - select('*') with group_by in Codeigniter -

i working in codeigniter. problem want show rows having same id. when perform group_by outputs 1 row of group. below model function category_content(){ $this->db->select('*'); $this->db->from('category'); $this->db->group_by('category_id'); $query = $this->db->get(); return $query->result_array(); } please help. as per sql properties group by groups matching records , show one. seems want sort them id. better use order by

android - Is Fragment.onStop() guaranteed to be called? -

from table @ link: http://developer.android.com/reference/android/app/activity.html#activitylifecycle we can see android activity not killable until after onstop() has been called (for honeycomb , beyond). do have same (documented) guarantee fragments? would appreciate pointing me @ documentation stated. edit: has been pointed out [fragment.onstop] generally tied activity.onstop of containing activity's lifecycle. http://developer.android.com/reference/android/app/fragment.html#onstop() but doesn't tell me fragment's onstop() guaranteed (at least not same level of clarity activity documentation gives.) there anywhere fragment.onstop() guarantee explicitly stated? edit 2: based on discussion below, debating whether activity.onstop() guaranteed (it seems safe assume if not, neither fragment.onstop guaranteed). have moved question activity.onstop new thread: is activity.onstop() guaranteed called (api 11 +) . it seems me necessary, not sufficient, activity

excel - How to programmatically determine current setting for Option Base in VBA -

Image
how can programmatically determine current setting option base in vba? option base can set 0 or 1 , , determines whether array indices start @ 0 or 1 (see msdn ). however, can't see easy way find out current setting is. hoping there might option() function pass parameter to, like: debug.print option("base") and tell me, doesn't seem there. while agree @jonsharpe if you're using lbound(arr) , ubound(arr) , don't need know @ runtime, think it's interesting question. first, example of looping through array. for = lbound(arr) ubound(arr) ' next now, in order exactly asked, you'll need access use vbide library. otherwise known "microsoft visual basic applications extensibility" library. provides access ide , code with-in it. can use discover if option base 1 has been declared. don't recommend trying @ runtime though. more useful kind of static code analysis during development. first, you'll n

html - How to remove unknown white border of asp:image inside panel -

i have white border of asp:image control , want remove can't find problem is here html , css: <asp:panel runat="server" cssclass="nav" id="nav"> <asp:image runat="server" id="logo" cssclass="logo" /> <asp:linkbutton runat="server" id="lb1" cssclass="navbuttons">home</asp:linkbutton> <asp:linkbutton runat="server" id="linkbutton1" cssclass="navbuttons">restorant</asp:linkbutton> <asp:linkbutton runat="server" id="linkbutton2" cssclass="navbuttons">rooms</asp:linkbutton> <asp:linkbutton runat="server" id="linkbutton3" cssclass="navbuttons">spa</asp:linkbutton> <asp:linkbutton runat="server" id="linkbutton4" cssclass="navbuttons">contact</asp:linkbutton> <

html - Selecting an element based on the presence of surrounding sibling elements -

Image
i have following html structure. <div class="fieldset"> <p>normal input<i class="icon-question tooltip-top" title="text goes here"></i></p> <div> <span><i class="icon-cart"></i></span> <input name=""> <span><i class="icon-cart"></i></span> <i class="icon-question tooltip-top" title="text goes here"></i> </div> </div> i trying change settings of border-radius according <input> positioned. for example, if <input> has <span> before it, border-radius 0 top , bottom left. i did using: .fieldset > div > span + input { border-radius: 0 4px 4px 0; } but, when there <span> after <input> input border radius should 0 right top , bottom side. can't use + selector one. how can achieve desired resul

F#: Breaking out of a loop -

i new programming , f# first language. i have list of urls that, when first accessed, either returned http error 404 or experienced gateway timeout. these urls, try accessing them 3 times. @ end of these 3 attempts, if webexception error still thrown, assume url doesn't exist, , add text file containing of invalid urls. here code: let tryaccessingagain (url: string) (numattempts: int) = async { attempt = 1 numattempts try let! html = fetchhtmlasync url let name = getnamefrompage html let id = getidfromurl url let newtextfile = file.create(htmldirectory + "\\" + id.tostring("00000") + " " + name.trimend([|' '|]) + ".html") use file = new streamwriter(newtextfile) file.write(html) file.close() :? system.net.webexception -> file.appendalltext("g:\user\in

Javascript Files Not Being Recognised Webstorm -

Image
all of sudden webstorm doesn't recognise javascript me. if add file : all see in ide afterwards : if refresh, restart webstorm, still not recognise file! webstorm has become unusable! if @bruno's link doesn't help, please try right click file , select "mark plain text". once done, right click again , select "mark javascript" - works me in phpstorm

android - Where is android_sdk_root? and how do I set it.? -

Image
i set android_sdk_home variable application find .android when trying run. error stating "android_sdk_root undefined". running win 7 new installation of android studio, inside parallels on macbook pro. thank response. checked location , identified same location android_sdk_home environment path. still says root undefined. created android_sdk_root enviroment path same location , still undefined. i received same error after installing android studio , trying run hello world. think need use sdk manager inside android studio install things first. open android studio, , click on sdk manager in toolbar. now install sdk tools need. tools -> android sdk tools tools -> android sdk platform-tools tools -> android sdk build-tools (highest version) for each android release targeting, hit appropriate android x.x folder , select (at minimum): sdk platform a system image emulator, such arm eabi v7a system image the sdk manager run (this can

android - Run Unit Test Before Launch -

i have created first unit test part of android project. followed guide found here . now include unit tests in "test" package before app launched phone. how include in gradle file?

How to iterate this PHP array using foreach -

i use code data api in form of array: $getcurrentstock = $myapi->getcurrentstock('array'); print_r($getcurrentstock); i getting data in form of array this: array ( [status] => ok [returnval] => array ( [0] => array ( [name] => alcatel [model] => hero ot-8020x [color] => black [warehouse] => hu11 [bar_code] => a20200125 [in_stock] => <20 [exp_delivery] => 0 [exp_available] => <20 [delivery_date] => - [price] => 301.90 [properties] => array ( [eu_warranty] => no [keypad] => touch screen [manual] => hun [simlock] => sim free [remarks] => data cable, headset [language] => ger, eng, esp, fra, ita, hun, ned, por, rom, tur [country] => china ) [ean] => [image] => http://www.mobileshop.bz/phone-pictures/api/3531-alcatel-hero-ot-8020x.jpg [id] => 3531 [category] => mobile ) [1] => array ( [name] => alcatel [model] => idol 2 mini ot-6016x [color] => gray [warehouse] => hu11 [bar_

Adding Files view on Ambari 1.7.0: ClassNotFoundException -

i'm trying add views on ambari 1.7.0. for files view available here: https://github.com/apache/ambari/tree/trunk/contrib/views/files i error after trying launch instance of view: 500 hdfsapi connection failed. check "webhdfs.url" property with following stack trace (just first lines): java.lang.runtimeexception: java.lang.classnotfoundexception: class org.apache.hadoop.hdfs.web.webhdfsfilesystem not found @ org.apache.hadoop.conf.configuration.getclass(configuration.java:1720) @ org.apache.hadoop.fs.filesystem.getfilesystemclass(filesystem.java:2415) @ org.apache.hadoop.fs.filesystem.createfilesystem(filesystem.java:2428) @ org.apache.hadoop.fs.filesystem.access$200(filesystem.java:88) @ org.apache.hadoop.fs.filesystem$cache.getinternal(filesystem.java:2467) i add following property during configuration of view: webhdfs.url webhdfs://mycluster1:50070 i'm not sure perhaps it's issue during building part version conflict, i'm working

c++ - Interrupt an arbitrary wait operation -

in boost.thread , have boost::thread::interrupt . however, usage limited. in particular, applies wait operations listed here . so, example, common mutex::lock operation cannot interrupted using method. boost support no full-range interruption capabilities, , there no way interrupt mutex::lock operation? know that, in windows api, wait operation can interrupted using alertable wait functions . you correct boost::thread::interrupt limited, , in fact not promoted std::thread in c++11 @ all. recommendation use condition variable.

for loop - Understanding any keyword in Python if statements -

i have 2 python list follows: >>> clean = ['snat2vip', 'http2https'] >>> ugly = ['/common/snat2vip', '/common/http2https'] i need iterate through each member of clean , see if exists anywhere in ugly. 'exists', mean present whole or substring in element of ugly. this came with: >>> item in clean: ... if (word in item word in ugly): ... print "yes" ... else: ... print "no" ... yes yes works expect.however,if add any ,the output changes follows: >>> item in clean: ... if any(word in item word in ugly): ... print "yes" ... else: ... print "no" ... no no what any change output ? as boolean value of expression (word in item word in ugly) true returns generator object. you can check using bool built-in function. bool(word in item word in ugly) so work any built-in function have follow:- i

hadoop - Spark 1.3.0 on YARN: Application failed 2 times due to AM Container -

when running spark 1.3.0 pi example on yarn (hadoop 2.6.0.2.2.0.0-2041) following script: # run on yarn cluster export hadoop_conf_dir=/etc/hadoop/conf /var/home2/test/spark/bin/spark-submit \ --class org.apache.spark.examples.sparkpi \ --master yarn-cluster \ --executor-memory 3g \ --num-executors 50 \ /var/home2/test/spark/lib/spark-examples-1.3.0-hadoop2.4.0.jar \ 1000 it fails "application failed 2 times due container" message (please see below). far understand, neccessary information run spark application in yarn mode provided in launch script. else should configured run on yarn. missing? other reasons yarn launch fail? [test@etl-hdp-mgmt pi]$ ./run-pi.sh spark assembly has been built hive, including datanucleus jars on classpath 15/04/01 12:59:57 warn util.nativecodeloader: unable load native-hadoop library platform... using builtin-java classes applicable 15/04/01 12:59:58 info client.rmproxy: connecting resourcemanager @ etl-hdp-yarn.foo.bar.com/192.168.0.1

php - How to use function in_array with CodeIgneter -

i trying use php function in_array within view using codeigneter. this method class user_details extends ci_model { public function checkid(){ $query = $this->db->query("select id users"); return $query->result_array(); } this controller $this->load->model('user_details'); $data['alluserid'] = $this->user_details->checkid(); $this->load->view('user_details/content',$data); this script trying use in view $id = $this->uri->segment(4);//user's id example: 218 if(in_array($id,$alluserid)){ echo 'exists'; } else { echo 'does not exist'; } unfortunately script not work expected. if check array using print_r($alluserid) following result: array ( [0] => array ( [id] => 217 ) [1] => array ( [id] => 218 ... ...and on... last week started learning codeigneter , did not understand approach yet. in_array() accept single dimensional array , passing 2 dimension

c# - Compare AES encryption OpenSSL versus .NET(RijndaelManaged) -

i need encrypt url. according specs of url should (rijndael) encoded using cbc encryption mode, using iv of 0., pkcs7 padding , key length of 128-bit. the decryption of url done in .net environment using rijndaelmanaged class. encrypt using openssl 1.0.2a (c++ unmanaged) , use following code (from internet): // ctx holds state of encryption algorithm doesn't // reset initial state while encrypting more 1 block. evp_cipher_ctx ctx; evp_cipher_ctx_init(&ctx); unsigned char key[] = {0x41, 0x41, 0x45, 0x43, 0x41, 0x77, 0x51, 0x46, 0x43, 0x67, 0x63, 0x49, 0x43, 0x5a, 0x6f, 0x4c }; unsigned char iv[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; assert(sizeof(key) == 16); // aes128 key size assert(sizeof(iv) == 16); // iv aes block size // if data isn't multiple of 16, default behavior pad // n bytes of value n, n number of padding bytes required // make data multiple of block size. pkcs7 padding. // output multiple of bloc

regex - ASP.Net Validation remove < > -

does know how set regular expression validator not allow characters < , > because when typing < > (without spaces) example recieve error. keep page validation enabled ideally, , there should never html input. many in advance

Azure CDN vs Direct access from blob -

i have couple of videos want end user view on web site. these videos transcoded deliver hls style streaming. 1) putting these videos in azure blob, make videos "progressive download" or streamed? 2) clients based in india / singapore. means blob location of azure in singapore closest. cdn give me specific advantage? 3) pointing single cdn blob make accessible cdn across world, or should configure 1 each geography (say 1 if customers come visit portal). i know questions not connected sure can see different varieties of addressing same problem thanks in advance vj azure blob supports standard http downloads, work standard file download web server. @ specific streaming scenarios, should take @ azure media services cdn should make better. first, cdn may have points of presence in more places there azure datacenters (depending on cdn provider use). secondly, if lot of concurrent users, cdn provides level of caching prevents azure blob download bandwidth be

C# - dll event handler -

i setting .dll file create new form , new button, want button something. possible create event handler in dll file? public static byte sbuton( string er, int by,int re) { form fg = new form(); fg.show(); button b1 = new button(); fg.controls.add(b1); b1.text = er; b1.location = new point(by, re); return 0; } this code creates form button in it. when try create new event handler, in form, error: "an object reference required non-static field, method or property". public static byte sbuton( string er, int by,int re) { form fg = new form(); fg.show(); button b1 = new button(); fg.controls.add(b1); b1.text = er; b1.location = new point(by, re); b1.click += new eventhandler(b1_click); } private void b1_click(object sender , eventargs e) { } code form want use dll private void button1_click(object sender, eventargs e) { if (richtextbox1.text.contains("add&quo

python - create a django form object and save it -

i have signup form object i'm using create signup page. i'm trying add guest user feature app. want create user account automatically when user visits page. i'm trying create form object in backend, populate , call save method explicitly. couldn't find way populate fields backend. how can achieve this? if want create model instance (in case user ) in view data doesn't come post or data, don't use forms, rather model's api. for instance user class provides helper function (example taken documentation) : from django.contrib.auth.models import user user = user.objects.create_user('john', 'lennon@thebeatles.com', 'johnpassword') more details here : https://docs.djangoproject.com/en/1.7/topics/auth/default/#user-objects and here : https://docs.djangoproject.com/en/1.7/ref/contrib/auth/#django.contrib.auth.models.usermanager.create_user this works model class. can use create guest user dynamically if don't kn

javascript - Get all xml files from a certain folder with AJAX -

i have following question: know how load xml file folder ajax. can load xml files folder without naming them specifically? tried won't work. $.ajax({ type: "get", url: "xml/*.xml", datatype: "xml", success: xmlparser }); i pretty sure url property of ajax needs point particular file. in: url: "xml/myxmlfile.xml,

mysql - SQL query with joins and optional matching -

i programming mapper info out of database. here database: spel( id, naam) spelbord(id, spel_id, level) fk spel_id --> id in spel veld(spelbord_id, posx, posy, veldnr, istarget, toegang) fk spelbord_id --> id in spelbord entiteit(spelbord_id, posx, posy, entiteitnr) fk spelbord_id --> spelbord_id in veld fk posx --> posx in veld fk posy --> posy in veld so query give me: posx, posy, veldnr, toegang, istarget (and entiteitnr if exists) of each veld. for example: 1, 2, 1, true, false, 1 (there entiteit on veld), or 1, 3, 1, true, false, null (there no entiteit on veld). this query doesn't seem work select v.posx, v.posy, v.veldnr, v.toegang, v.istarget, i.entiteitnr spel s join spelbord sb on sb.spel_id = s.id join veld v on sb.id = v.spelbord_id join entiteit on v.posx = i.veld_posx , v.posy = i.veld_posy order posx,posy with query i'm getting output there indeed entiteit connect it. what need change rows there no enti

Ruby regex syntax for "not matching one of the following" -

nice simple regex syntax question you. i have block of text , want find instances of href=" or href=' not followed either [ or http:// i can "not followed [ " with record.body =~ /href=['"](?!\[)/ and can "not followed http:// " record.body =~ /href=['"](?!http\:\/\/)/ but can't quite work out how combine two. just clear: want find bad strings this `href="www.foo.com"` but i'm ok (ie don't want find) strings this `href="http://www.foo.com"` `href="[registration_url]"` combine both using alternation operator. href=['"](?!http\:\/\/|\[) for more specific, be. href=(['"])(?!http\:\/\/|\[)(?:(?!\1).)*\1 this handle both single quoted or double quoted string in href part. , won't match strings href='foo.com" or href="foo.com' ( unmatched quotes ) (['"]) capture double quote or single quote. (?!http\:\/\/

php - How to use xml_parse_into_struct() -

i have trying use xml_parse_into_struct() , returning false my code looks $p = xml_parser_create(); if (xml_parse_into_struct($p,$contenido,$vals, $index)) { print_r($vals); } the content of variable $contenido looks <saltest31> <anuncio1> <id>12346</id> <titulo> bd authority</titulo> <descripcion>preciosa casa en jardines de las animas, en xalapa veracruz. 550 m2 de terreno la mayoria jardin con arboles frutales, amplias recamaras, cocina, salon de juegos, terraza y palapa cvica123</descripcion> <fecha>11/12/2014 10:27:15</fecha> <municipio>chalchuapa</municipio> <moneda>peso</moneda> <construccion>500</construccion> <terreno>550</terreno> <habitaciones>5</habitaciones> <banos>4</banos> <imagenes> <total>10</total&g

Font Awesome support for screen readers and accessibility -

according font awesome home page : font awesome won't trip screen readers, unlike other icon fonts. i know recommended add aria-hidden="true" attribute font icons screen readers can ignore them. my question is, font-awesome "won't trip screen readers" (i had on github site , can't find anything) , still need add aria-hidden="true" attribute? they plain talking out of nether regions of anatomy. icon font other image? icon fonts not have text alternatives when presented purely icon. on os x safari, read out unintelligible characters , not description of icon is...so...how should diplomatically.... font awesome's icons not accessible!!! just illustrate, here markup "buyselladds" icon <i class="fa fa-buysellads"></i> i can see no description of icon. can you? how can possibly accessible?

forms - Rails - select_tag / chechbox tag issue - can't get array of IDs -

i've got list of products in form that's resource want submit. works without using label tag, want label tag working. <%= label_tag "product_ids[#{product.id}]" %> <%= check_box_tag "product_ids[#{product.id}]" %> <%= product.name %> <% end %> this produces following output: "product_ids"=>{"2"=>"1", "6"=>"1", "3"=>"1"} is possible array of ids , not hash? change <%= check_box_tag "product_ids[]", nil, nil, id: "product_ids[#{product.id}]" %> and params['product_ids[]'] try way?

java - Library function to do bean comparison using Functions? -

since java 8 has made easier ever refer method directly (function/lambda), traditional reflection-based bean comparators (e.g. common-lang's equalsbuilder ) can implemented cleanly without reflection. wondering available in well-known library already? just clear, after function similar signature: static <t> boolean equals(t a, t b, function<t, ?>... proprefs); alternatively, non-confusion way of implementing using streams? given example class like class person { long id; string name, surname; int age; public long getid() { return id; } public string getname() { return name; } public string getsurname() { return surname; } public int getage() { return age; } } of course, can in compact form like @override public boolean equals(object obj) { if(obj==this) return true; if(!(obj instanceof person)) return false; person p=(person)obj; return stream.<functi

php - MYSQL INNER JOIN syntax error -

i have been trying fix issue on since morning :) i have 2 tables. table1= post table2=users. need extract data both tables. searched how use inner join, found codes. run query inside phpmyadmin , works fine here sql query select post.topic_id, post.category_id, post.topic_id, post.post_creator, post.post_date, post.post_content, users.username, users.gender, users.id post inner join users on post.post_creator=users.id post.post_creator=users.id , post.topic_id=19 order post.post_date desc but when use sql query inside php gives me error you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'inner join users on post.post_creator=users.id order post.post_date asc' @ line 1 below php code <?php include_once './forum_scripts/connect_to_mysql.php'; $cid = $_get['cid']; if(isset($_session['uid'])){ $logged = " | <a href ='

Understanding relations between model view and controller -

Image
i went through lot of readings mvc , each of these more or less clear. haven't understood yet how relate. mean, know these relationships but how implemented? happens in mvc framework? i have few questions: i read a view can't coupled controller , in other words can't have controller object inside, how use proper controller if view supposed trigger in it? how can model update view if unique job represent data? is business logic inside controller or model? have read conflicting points of view the basic explination of mvc have each of 3 layers. model this contains data. i.e database or set of classes. view this displays data user i.e html page. contains controls user interaction. controller all access data should go through layer. i.e load data data source(model) , save data data source. carries out data manipulation before saving or loading. this create separation of concerns theoretically allowing change in either layer without

Not understanding Ocaml type signatures -

i have been working on trying understand this, , working harder on going hurt relationship ocaml, figured ask help. i have simple function this site let line_stream_of_channel channel = stream.from (fun _ -> try (input_line channel) end_of_file -> none);; okay cool, signature below it: val line_stream_of_channel : in_channel -> string stream.t = <fun> in_channel argument , stream.t return value. now why in ocaml can't do: stream string and instead have string stream.t looking @ the type signature of stream didn't me anywhere either. i've noticed same syntax weirdness stuff lists have unnatural string list rather natural list string but weird ".t" portion of stream type above. can kinda explain going on here , why things done way? i've googled tutorials on explicit type signatures, types, etc in ocaml , in general lead here specific questions don't me. thank you! in ocaml's parameterize

ios - Getting Facebook Image using graph api - bigger image than picture.type(large) -

im requesting users image so: fbrequestconnection startwithgraphpath:@"me" parameters:@{@"fields":@"first_name, last_name, picture.type(large), email, gender, birthday, age_range"} httpmethod:@"get" completionhandler:^(fbrequestconnection *connection, id result, nserror *error) but large image still quite small, there way request larger image, or better, , xlarge image. shot in dark tried picture.type(xlarge) caused error. you can specify width , height using picture.width(200) or picture.height(200) sizes want, , graph api return url picture that's closest size. note not profile pictures have size want, still need handle smaller images.

javascript - How to Display Column Data in Input Once Different Column Data Has Been Selected? -

Image
i have form select field , input field: the select field takes of customer names customer table's customer_name column, , allows user choose customer name. once customer's name has been chosen, take name , display in "add customer name" input, , take customers phone number (from phone_num column in customer table) , display in "customer phone" input. i using my_sql , php this. so far, can correctly display customer names in "customer" select field. but, name not appear in "add customer name" input nor display customer's phone number in "customer phone" input. does know how using php, javascript, or perhaps mix of both? here code part of web form: <script type="text/javascript"> $(document).ready(function () { $("#customer").change(function() { if($( "#customer option:selected" ).text() == 'add customer') { $( "#cust

Android AsyncTask called "multiple" times -

i'm new android programming. have main activity gets data db through service handler (url). want insert data well, on different activity, , want main activity date each time been called (onresume(),onrestart()). i've found on android api reference asynctask: the task can executed once (an exception thrown if second execution attempted.) mean cannot call asynctask whenever activity resumes, or cannot have multiple "instances" of asynctask running @ same time? it literally means, while asynctask running, cannot launch again. in mainactivity.class have line: task.execute(); if task either finished or not , call method again exception thrown. and put method in onresume () practice. 1 thing notice is: if put in onrestart () remember, callback works when change configuration, not called if create activity . the doc lifecycle of activity .

node.js - Project Managment in GitHub - Nodejs -

i working part of team responsible building server side (nodejs) system has website (html 5 + js) , mobile application (cordova). server's code placed @ github , each time make commit, data pushed server (heroku). currently, (server side team) working in single branch (development) single server, , due this, have lots of conflicts each time 1 of commits code. problem have, though debug our code locally before committing it, forget or need change small (for example: website team demands change variable name send them) must make new commit. so, after week of work have 100 commits. we have tried fork project slows project development. could please refer me source explains how should manage our project? first thing first, need compartmentalise development design not developers working on same scripts. module, class or component. react example helps in case of break down web user interface development component. each engineer should working on different compone

twitter bootstrap - Import Flat-Ui in Meteor app -

Image
i'm trying include flat-ui theme bootstrap in meteor. have added mrt:bootstrap-3 , less packages. have copied folders fonts, img, js , less flat-ui project inside lib/flay-ui-2.2.2/ in project directory. have following compiling error: while building application: lib/flat-ui-2.2.2/less/modules/button-groups.less:12:35: less compiler error: variable @brand-primary undefined lib/flat-ui-2.2.2/less/modules/buttons.less:10:14: less compiler error: variable @btn-font-size-base undefined ... it looks not compiling in right order, how can solve issue? have tried rename flat-ui.less flat-ui.import.less without success. update 1 following indication of @user3435693 able compile. still have troubles. i'm not able use checkbox , switches. example, see switches this instead of this plus i'm not able see glyphicons. suggestion? i think doesn't suffice if rename flat-ui.less flat-ui.import.less . if prefer use files flat ui repo instead of package,

java - Checking for normal distribution hypothesis of discrete dataset -

i newbie in statistics topic, guess might obvious missing here. basically examine if double array of integer values (histogram) conforms normal distribution (mean , standard deviation specified) significance level, basing on statistical tests apache commons math. what understand common way calculate p-value , decide if null hypothesis true or not. my first "baby" step check if 2 arrays coming same distribution using one-way anova test (second part taken example in documentation): double samples1[] = new double[100]; double samples2[] = new double[100]; random rand = new random(); (int = 0; < 100000; i++) { int index1 = (int) (rand.nextgaussian()*5 + 50); int index2 = (int) (rand.nextgaussian()*5 + 50); try { samples1[index1-1]++; } catch (arrayindexoutofboundsexception e) {} try { samples2[index2-1]++; } catch (arrayindexoutofboundsexception e) {} } list classes = new arraylist<>(); classes.add(sample