Posts

Showing posts from August, 2012

postgresql - Rails database table changed name, but index in another table refers to old name -

i changed table name "addresses" "locations". here 2 models class location < activerecord::base has_many :years, dependent: :destroy has_many :people, through: :years class year < activerecord::base belongs_to :location belongs_to :person i made change rename_table :addresses, :locations migration , changed names of folders, files , references in relevant controllers , views. seems ok except years database still has column address_id in years table. needs location_id . can migrate change.? links newly named database preserved? i've backed database , made spreadsheet copy of years output. an prechange version of project @ https://bitbucket.org/mtnbiker/crores5/src . i'm reluctant merge changes master until have sorted out. thanks suggestions. ps. don't recommend changing table name, had field named address in addresses table , wanted rid of confusion. needless say, i'm newbie. i think thing you're looking

asp.net - Kendo ui checkbox bind -

user tab i have kendogrid displays roles. when click on edit of role opens pop window multiple tabs. on 1 of tab have users . tab displays list of users , checkbox checked if user has role. when check checkbox of other user role must assigned me user , save in database. how call method in service on onclick event of checkbox or there other way. the error iam getting when click on checkbox says addroleusr() undefined. addroleusr() defined in service.below grid definition. fron picture attached when click on user changes must saved on grid. thanks function editeventgrid() { editds = new kendo.data.datasource({ type: "json", schema: { data: function (response) { return json.parse(response.d); // asmx services return json in following format { "d": <result> }. }, model: {// define model of data source. required validation , property types.

android - Unfortunately Your application has stopped -

i trying switch 1 activity other using intents, first activity running when second activity starts app gets stopped. have attached code this. manifest : <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.sampleapp" android:versioncode="1" android:versionname="1.0" > ... <application ... <activity android:name="com.example.sampleapp.mainactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name="com.example.sampleapp.welwithname"

Folder name to combobox in VB.NET -

Image
i wanted combo box fill in runtime checking directory name in directory. here code : private sub editform_load(sender object, e eventargs) handles mybase.load call clear() end sub private sub clear() qtytb.enabled = false parttb.clear() qtytb.clear() dtcb.items.clear() mthcb.selectedindex = "" yrcb.selectedindex = "" radiobutton2.checked = true radiobutton1.checked = true textbox1.clear() textbox2.clear() >> dim di new directoryinfo("d:\database\" & pick_item.deptlbl.text) if di.exists = true each subdirectory directoryinfo in di.getdirectories() yrcb.items.add(cint(subdirectory.name.tostring)) next end if<< end sub that complete code combobox , load form when debug, appear messagebox error dont know error in code "conversion "" string integer not valid

Pattern Match Failure in List in Haskell -

i have 1 problem pattern matching. when give input (x:y:ys) list containing 3 elements, hugs complain there is: pattern match failure . guess problem here takenearestones agent (y:ys) (x:nearestones) because fails match 3 elements list containing 2 elements this full code: takenearestones agent (x:y:ys) nearestones | first == second = takenearestones agent (y:ys) (x:nearestones) | otherwise = (x:nearestones) first=(manhattandistance x (agentcoord agent)) second=(manhattandistance y (agentcoord agent) how can overcome this? in advance since function recursive , decreasing list, going work you're way down list of 1 element, in case match fail. can fix adding case of function handles feel appropriate something like takenearestones agent [x] nearestones = dosomething takenearestones agent [] nearestones = dosomethingelse

How do I create public class level object variable in C#? -

i made class, address book making. having trouble making public address class level object variable. have no idea how code it. namespace add_new_name { class address { public string strname; public string stremailaddress; public string strcomment; public string strphonenumber; public string straddress; //property name #region property name public string name { { return strname; } set { strname = value; } } //end property address #endregion //property email address #region email address public string emailaddress { { return stremailaddress; } set { stremailaddress = value; } } //end property email address #endregion //pr

python - Error from installing Django using pip on mac -

hello i'm getting error on mac when tried installing django using pip. created directory , virtual environment. ran error when attempting install django. exception: traceback (most recent call last): file "/library/python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/basecommand.py", line 209, in main status = self.run(options, args) file "/library/python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/commands/install.py", line 317, in run prefix=options.prefix_path, file "/library/python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/req/req_set.py", line 731, in install **kwargs file "/library/python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/req/req_install.py", line 841, in install self.move_wheel_files(self.source_dir, root=root, prefix=prefix) file "/library/python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/req/req_install.py", line 1040, in move_wheel_files isolated=self.isolated, file "/library/python/2.7/site-packages/pip-8.0.2-

C# WebBrowser control not displaying custom HTML -

i have web browser control reason isn't loading html: string updatingchathtml = "" + "<html> " + "<head>" + "<style>" + "body {" + " margin: 0px;" + " padding: 0px;" + " background: " + chatbackground + ";\n" + " font-family: arial;" + " font-size: 11px; " + " text-align: left;" + "}" + "</style>" + "</head>" + "<body>"; txtchat.documenttext = updatingchathtml + "</body></html>"; (txtchat webbrowser control). the weird thing is, working before changed something, can't figure out changed caused stop working. i have breakpoint set after last line above, , can see updatingchathtml has proper value it's meant to, txtchat.documenttex

asp.net - Copy to C Drive(Root) as administrator -

i want copy file in c root directory administrator, working fine path. user using having administrator rights still i'm unable copy. my code is: string strcmdtext = string.empty; strcmdtext = "copy /y " + "\"" + fullpath + "\"" + " " + "\"" + _name.fullpath + "\\" + subject + ".msg" + "\""; system.diagnostics.process process = new system.diagnostics.process(); system.diagnostics.processstartinfo startinfo = new system.diagnostics.processstartinfo(); startinfo.filename = "cmd.exe"; startinfo.verb = "runas"; startinfo.createnowindow = true; startinfo.redirectstandardoutput = true; startinfo.redirectstandardinput = true; startinfo.useshellexecute = false; startinfo.arguments = strcmdtext; startinfo.windowstyle = system.diagnostics.processwindowstyle.hidden; process.startinfo = startinfo; process.start(); streamwriter sw = process.standardinput; sw.writeline(s

java - What char variable really is? -

both statements valid: char c1 = 'a'; char c2 = 97; now, if add char variable, lets say: char c3 = 10; and sum c2 , c3 so: int sum = c2 + c3 i not compile error , why that? , why need ever sum 2 chars? thanks each character represented type 'char' in java mapped number in ascii table. when add values adding operands numeric equivalent (the char types cast int) x (120 ascii val) - p(80 ascii val) give integer value 40. dec char dec char dec char dec char --------- --------- --------- ---------- 0 nul (null) 32 space 64 @ 96 ` 1 soh (start of heading) 33 ! 65 97 2 stx (start of text) 34 " 66 b 98 b 3 etx (end of text) 35 # 67 c 99 c 4 eot (end of transmission) 36 $ 68 d 100 d 5 enq (enquiry)

java - How to write business objects with uses Bean Validation in JavaEE? -

i'm learning bean validation , in books recommended business objects should use bean validation , validation should count other layers in classic mutlitiered javaee application. means bean validation should implemented once. how should manage that? lets have following layers in java application: jsf-ui->controller->dto->ejb/cdi (with business objects)->dao->database how controller in frontend should know validation occurs in logic layer in business objects?

meteor - How to fetch query parameters in a template? -

i using meteor 1.2.1 + iron-router autopublish turned on i construct anchor href based on collection values returned helper and query params is possible in template tag, e.g. query_param1 should read url? <template name="dataentry"> {{#each data}} <li> <a href="/listing?name={{name}}&color=<query_param1>"> data name </a> </li> {{/each}} </template> above, {{name}} returned collection , query parameters appended create full hyperlink href . you can use @stephen's suggestion this. in template html, <template name="dataentry"> {{#each data}} <li> <a href="/listing?{{queryparams}}"> data name </a> </li> {{/each}} </template> in template js, template.dataentry.helpers({ "queryparams": function

Android Facebook SDK share via a page -

i want app able make share on facebook appear link via page (to give facebook page credit). possible? i have tried 2 ways official facebook sdk implementation, little bit complecated. easyfacebookimplementation easy. try answers here. how integrate facebook in android application?

Removing duplicate rows from a csv file using a python script -

goal i have downloaded csv file hotmail, has lot of duplicates in it. these duplicates complete copies , don't know why phone created them. i want rid of duplicates. approach write python script remove duplicates. technical specification windows xp sp 3 python 2.7 csv file 400 contacts update: 2016 if happy use helpful more_itertools external library: from more_itertools import unique_everseen open('1.csv','r') f, open('2.csv','w') out_file: out_file.writelines(unique_everseen(f)) a more efficient version of @icyflame's solution with open('1.csv','r') in_file, open('2.csv','w') out_file: seen = set() # set fast o(1) amortized lookup line in in_file: if line in seen: continue # skip duplicate seen.add(line) out_file.write(line) to edit same file in-place use this import fileinput seen = set() # set fast o(1) amortized lookup line in file

javascript - How to get an H1 text inside a div through an omouseover event and innerHTML property -

i'm trying write content of h1 inside div when put mouse on h1, [object htmlheadingelement], not text itself. i'm total beginner , i'm trying innerhtml property. thank all! html code: <h1 id="phrase" onmouseover="writeindiv2()">hi all</h1> javascript code: var text = document.getelementbyid("phrase"); function writeindiv2(){ if(div2.style.display != "none"){ div2.innerhtml = text; } } you have 3 options text-content: // webkit, mozilla, opera (and other standards-compliant) browsers var text = document.getelementbyid("phrase").textcontent; // microsoft internet explorer (though might have changed in ie 10) var text = document.getelementbyid("phrase").innertext; // possibly works, though assumes h1 contains text-node var text = document.getelementbyid("phrase").firstchild.nodevalue; for efficiency, following html: <h1 onmouseover="writeindiv2(t

html5 - why are some images not display in IE8? -

in website bannner images not displayed in ie8 , red cross appeared in place of image, works in mozilla , chrome. googled , tried suggestion not working. ie8 won't show jpegs cmyk. make sure change them rgb using image editor. if have imagemagick installed (if not, it!) can use: identify -verbose yourimage.jpg to find out file. again, using imagemagick can run: convert cmyk_image.jpg -colorspace rgb rgb_image.jpg to convert rgb – warned, colours might different don't assume ok without checking. if want file overwrite original use: mogrify -colorspace rgb cmyk_image.jpg

android - Data Model class is not visible to my AndroidTest classes while is visible to main project -

Image
my project contains 2 modules. main app module , sdk module. have following lines of code in build.gradle file of app module. dependencies { releasecompile project(path : ':sdk', configuration : 'prodrelease') debugcompile project(path : ':sdk', configuration : 'proddebug') testcompile project(path : ':sdk', configuration : 'mockdebug') ... } therefore, sdk must visible whole of app module. have no problem in project under main folder. however, i'm trying write espresso test cases in order test activity , need create model. model resides somewhere in sdk module. thought module must visible androidtest class seems not. wrote import address manually still not recognizable. any suggestion appreciated. thanks. ok, found problem. adding following line, sdk module got visibility androidtest classes. androidtestcompile project(path : ':sdk', configuration : 'proddebug') more expla

javascript - cross-domain drag and drop from an iframe -

i getting "securityerror: operation insecure" in firefox when dragging link iframe. my situation similar this: http://jsfiddle.net/ee7x1h4u/ the error occurs on line in ondrop() event when try drag , drop title of youtube video inside iframe: urldata = event.datatransfer.getdata('text/plain'); is possible make work in own server (meteorjs backend)? thanks! the issue not server rather client side javascript security. security built modern web browsers designed protect users websites suffering cross site scripting attacks. there no way override safely, work around use proxy script under main domain both pages under t b e samedomain within same security restriction space.

node.js - node request library return an error on api call -

i'm using bitly api shorten links: http://dev.bitly.com/links.html#v3_shorten in console log im getting error... var bitly = require('bitly'); var bitly = new bitly('key'); module.exports = function(req, res) { var term = req.query.text; handlesearchstring(term, req, res); }; function handlesearchstring(term, req, res) { var response; try { response = sync.await(request({ url: 'https://api-ssl.bitly.com/v3/link/shorten', qs: { //link: term, 'access_token': key, 'longurl': term, }, timeout: 15 * 1000 }, sync.defer())); } catch (e) { res.status(500).send('\nerror!\n'); return; } var html = '<p> ' + response + ' </p>'; res.json([{ body: html }]); }; console.log outputs error!,

c# - WCF ServiceRoute POST 405 method not allowed -

i error on operationcontract post : 405 method not allowed get work fine. i've tried on local , remote server webserver e.g. localhost/mypostmethod/myparam i host service these : routetable.routes.add( new serviceroute(@"default", new customwebservicehostfactory(), typeof(defaultservice))); (i use webhttpbinding inside customwebservicehostfactory) can not change settings inside iis on remote server. think it's not necessary ether. seems problem somewhere inside code. tried many thinks , i'm little bit desperate right now. happy suggestions. added header... solved. <system.webserver> <httpprotocol> <customheaders> <add name="access-control-allow-methods" value="get, post" /> </customheaders> </httpprotocol> </system.webserver>

Enums with parameters and methods in scala -

after using java many years trying scala. lets have simple enum this public enum foo{ example("test", false), another("other", true); private string s; private boolean b; private foo(string s, boolean b){ this.s = s; this.b = b; } public string getsomething(){ return this.s; } public boolean issomething(){ return this.b; } } with docu , on stackoverflow got far as: object foo extends enumeration { type foo = value val example, = value def issomething( f : foo) : boolean = f match { case example => false case => true } def getsomething( f : foo) : string = f match { case example => "test" case => "other" } } but don't several reasons. first values scattered on methods , need change them everytime add new entry. second if want call function in form of foo.getsomething(another) or that, find strange rather another.getsomething. appreciate tips on chan

shell - Prepend text to beginning of file names -

i prepend string of text beginning of each file in directory. string uniwisc . when run script: #!/bin/sh url="ftp://rammftp.cira.colostate.edu/lindsey/spc/ir/" wget -r -nd --no-parent -nc -p /awips2/edex/data/goes14/ $url find /awips2/edex/data/goes14/ -type f -exec cp {} /awips2/edex/data/uniwisc/ \; f in /awips2/edex/data/uniwisc/*; f="$(basename $f)" mv "$f" "uniwisc.$f" done; find /awips2/edex/data/uniwisc/ -type f -mmin -6 -exec mv {} /awips2/edex/data/manual/ \; exit 0 i error mv: cannot stat '<filenames>' "no such file or directory. there number of different ways can that. using paramater expansion, built bash shell: for f in <dir path>/*; mv "$f" "${f%/*}/uniwisc.${f##*/}" done using rename command: rename 's!^!uniwisc.!' * using basename , codegnome suggested: for f in <dir path>/*; mv "$f" "$(dirname &q

php - Admin user loses admin status -

okey, i'm working on site, , have 2 pages dont want every member see, , have tried add admin check them. problem can see 2 admin pages in menu when first logg in(as admin). if click them, throws me default page. , menu loaded default user. here login, page arrays , page loadings: $database = new databaseobject($host, $username, $password, $database); if(!isset($_session['user_id']) && $_post['login']){ $username = $database->clean($_post['username']); $password = $database->clean($_post['password']); $result = $database->query("select id, admin, username, password users username='$username' limit 1"); try{ if($database->num_rows($result) == 0){ throw new exception ('user not exist!'); } $user = $database->fetch($result); $user_type = $user['admin']; if(sha1($password) != $u

javascript - How to handle undefined response from AJAX call on Autocomplete box? -

i have following function: function getgames(request) { //replace spaces '+' var url = request.term.replace(/\s/g,"+"); return $.ajax({ 'url': "php/gamescript.php?search=" + url, 'datatype': 'json' }).then(function(data){ return $.map(data.game || [], function(v,i){ return { label: v.gametitle + ' game (' + v.releasedate + ')', value: v.gametitle } }); }) } and above it, code handles returned data: function autocomplete() { $(".searchbox").autocomplete({ source: function(request, response) { $.when( getgames(request) ) .done(function(games) { var term = request.term.tolowercase(); var combine = games .map((v,i) => { //precompute such values if possible

How to unnest cells in a DataFrame, employing pandas and python? -

suppose have dataframe df: a b c v f 3|4|5 v 2 6 v f 4|5 i'd produce df : a b c v f 3 v f 4 v f 5 v 2 6 v f 4 v f 5 i know how make transformation in r, using tidyr package. there easy way of doing in pandas? you could: import numpy np df = df.set_index(['a', 'b']) df = df.astype(str) + '| ' # there's space ' ' match replace later df = df.c.str.split('|', expand=true).stack().reset_index(-1, drop=true).replace(' ', np.nan).dropna().reset_index() # , replace has space ' ' to get: b 0 0 v f 3 1 v f 4 2 v f 5 3 v 2 6 4 v f 4 5 v f 5

java - log4j INFO level not logging information -

i using log4j ogging project. unfortunately, not able log info levels in application havelogged manually.. though logging database logs perfectly! here properties file : log4j.rootlogger=off log4j.appender.servicelog=org.apache.log4j.rollingfileappender log4j.appender.servicelog.file=c:/users/prateekg/desktop/log4j/log log4j.appender.dblog=org.apache.log4j.rollingfileappender log4j.appender.dblog.file=c:/users/prateekg/desktop/log4j/dblog log4j.appender.servicelog.maxfilesize=1mb log4j.appender.servicelog.maxbackupindex=1 log4j.appender.servicelog.layout=org.apache.log4j.patternlayout log4j.appender.servicelog.layout.conversionpattern=%d{yyyy-mm-dd hh:mm:ss} %-5p %c{1}:%l - %m%n log4j.appender.dblog.layout=org.apache.log4j.patternlayout log4j.appender.dblog.layout.conversionpattern=%d{yyyy-mm-dd hh:mm:ss} %-5p %c{1}:%l - %m%n log4j.category.servicelog=info,servicelog log4j.category.org.springframework.jdbc=debug, dblog edit: this log code: public static logger logge

Mysql Variables not working through php mysql query -

i have query: $query = " set @points := -1; set @num := 0; select `id`,`rank`, @num := if(@points = `rank`, @num, @num + 1) `point_rank` `said` order `rank` *1 desc, `id` asc"; i'm using query php; giving me error: you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'set @num := 0; if copy , paste code in phpmyadmin sql query panel, works perfectly, php code lines it's not working, seems there's issues while setting vars. instead of setting variables in separate set , have tried using cross join : $query = " select `id`, `rank`, @num := if(@points = `rank`, @num, @num + 1) `point_rank` `said` cross join (select @points:=-1, @num:=0) c order `rank` *1 desc, `id` asc";

sql - Select row twice with one column modification -

i have table , sql (running on oracle): t (it's example, table huge) a b c ------- 1 4 7 2 5 5 3 6 8 sql: select a, b, c t union select 'r',b,c t b = c , (condition tables, etc) it returns: 1 4 7 2 5 5 3 6 8 r 5 5 is possible avoid union here (and don't add join)? in other words - possible optimize query avoid oracle table t twice? this read table once. join done auxiliary table contains 2 values(of course in in memory - no i/o) with t as( select '1' a, '4' b, '7' c dual union select '2', '5', '5' dual union select '3', '6', '8' dual ) select decode(aux.col,1,t.a,'r'), t.b, t.c t join (select '1' col dual union select '2' dual) aux on (aux.col='1' or t.b=t.c); the query not depend on '1' , '2'. can be: select decode(aux.col, 'bla', t.a,'r'), t.b, t.c t join (select 'bl

javascript - Create JSON with through Excel Hierarchy -

i have table tree products. category, group , subgroup. when export json excel file out without hierarchy: example: [ { "id_cat": 4, "desc cat": "acessorios para veiculos", "id_gr": 1, "desc gr": "acessorios nautica", "id_sub": 15, "desc sub": "bombas" }, { "id_cat": 4, "desc cat": "acessorios para veiculos", "id_gr": 1, "desc gr": "acessorios nautica", "id_sub": 16, "desc sub": "cabos" }, { "id_cat": 4, "desc cat": "acessorios para veiculos", "id_gr": 1, "desc gr": "acessorios nautica", "id_sub": 17, "desc sub": "helices" }, must generate file this: [ { "category": { "id": 4, &qu

7zip - Ho to setup and use the LZMA compression algorithm SDK -

making research on net, found 1 of recent, optimized , high-performance algorithms data compression, in term of compression ratio , decompression time lzma algorithm. it's supported in many popular software winrar, winzip, , 7-zip (by default). i have found lzma sdk here http://www.7-zip.org/sdk.html haven't found way install in windows or use source code provided (examples). for example : in doc ==> 7cc.txt : there test applications called 7zmain.c there no such file in sdk folder ... command 7z.exe or 7z in cmd won't work !!! note : have installed latest version of 7-zip 15.14 any suggestions ... thanks in lzma sdk , found file lzmautil.sln that can run in visual studio. after building solution can either add arguments in visual studio or run command line usage: lzma <e|d> inputfile outputfile e: encode file d: decode file

css - Drupal Zen subtheme - stop responsiveness at specific breakpoint -

im devoloping drupal zen subtheme. when resizing browser, zen correctly resizes fit browser/window size. thats great, there way tell zen stop being responsive @ breakpoint? just apply max-width container.

excel - VBA Class with Static Variables -

i'm running issue. i'm trying define couple variables used in several methods in class module. i keep getting invalid outside procedure error. can point me in right direction? feel scope issue but, i'm unsure on how validate this. ' class file_ops ' attributes private pdb_file string private pdb_path string pdb_file = "db.xlsx" pdb_path = thisworkbook.path + "\" public sub open_db(pdb_file, pdb_path) workbooks.open filename:=pdb_path + pdb_file end sub public sub close_db(pdb_file) pdb_file.close savechanges:=false end sub

asp.net - Publish to Azure - 'Unrecognized link extension 'contentLibExtension' -

when go , right click projects , hit publish , follow steps following error error: unrecognized link extension 'contentlibextension'. i've tried mentioned here publish azure fails " unrecognized link extension 'contentlibextension'" error , still doesn't work. anyone run this? i've been following tutorial http://docs.asp.net/en/latest/tutorials/your-first-aspnet-application.html#id4 i have iss express , sql server express installed. not sure here.

spring - ClassPathXmlApplicationContext to load beans -

i trying access bean through classpathxmlapplicationcontext. xml under web-inf directory here code: applicationcontext context = new classpathxmlapplicationcontext("web-inf\\spring\\scgid-send-mail.xml"); but while passing path getting error: java.io.filenotfoundexception: class path resource [web-inf/spring/scgid-send-mail.xml] cannot opened because not exist org.springframework.core.io.classpathresource.getinputstream(classpathresource.java:157) org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:328) org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:302) org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:174) org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:209)

unix - echo statements in a shell script run by cron -

this question has answer here: cron job log - how log? 6 answers i using echo statements in shell script. shell script run cronjob.will output of echo statements automatically logged somewhere ?. if yes,where ? thank you usually crond email output user. better off doing (example crontab entry) * * * * * /path/to/my/script.sh 2&>1 > /tmp/mylogfile.log

r - reshape2: dcast margin behavior -

i'm writing ask understanding behavior of reshape2::dcast confusing me. when run following 4 lines (the example dataset 'french_fries' comes 'reshape2' package), 3 data.frames different lengths, whereas expect them identical except permuted rows , columns: library('reshape2') ff_d <- melt(french_fries, id=1:4, na.rm=true) # "french_fries" included in 'reshape2' package = dcast(ff_d, treatment + subject ~ variable, mean, margins=t) # think these data.frames long paste directly question b = dcast(ff_d, subject + treatment ~ variable, mean, margins=t) d = merge(a, b, = t) # expecting 'd' , 'a' (and 'b') identical. are variables on left side of formula being treated nested, margins of second variable within levels of first? i'd grateful insights, , particularly explanations of how 3 types of margins using 1 function call, e.g. treament=all subject, subject=all treatment, , both=all. many thanks!

java - How to submit a list of checkmark values into a form in Thymeleaf? -

i trying create table displays list of logs have been added. in addition displaying info wanted have column of checkboxes when clicked allow me delete them corresponding delete button. the issue having unable put values checkboxes array of longs. want keep functionality of table displays correctly. for table have following code: <form method="post" th:action="@{/projects/log/delete/}" th:object="${deleteform}"> <div th:each="log : ${alllogs}" class="row"> <tbody> <tr class="active"> <td> <input type="checkbox" th:field="*{logids}" th:value="${log.id}" /> </td> <td th:text="${log.teamused}"></td> <td th:text="${log.opponentstarters}"></td> <td th:text="${log.opponentothers}"></td> <td th:text="${log.mystar

inheritance - What is the use of a sub class object being referred by a super class variable in java? -

this question has answer here: using superclass initialise subclass object java [duplicate] 5 answers suppose b extends a , have declaration a a=new b(); use of referencing sub class object super class variable?and fields , methods accessible object a((only child class methods , variables) or (from both child , parent class))? thank u the reason abstraction. idea don't need know every little tiny detail object. example, you're driving car. part, pedal on right makes go faster, pedal on left slows down, , big round thing in front of steers car. how happens isn't important driver (a.k.a. user) know, important details work in order car move.

Having issue in javascript code. light box does not open second time -

i have code opens lightbox when user click link. opens lightbox, when user clicks on overlay closes or hides overlay , lightbox. when user click on link again open lightbox again not open. here code var el = document.getelementbyid('element'); var body = document.getelementsbytagname('body'); el.innerhtml = '<p><a id="clickme" href="#">click me</a></p>'; document.getelementbyid('clickme').onclick = function (e) { e.preventdefault(); if (overlay) { overlay.style.display = 'block'; } else { document.body.innerhtml = '<div id="overlay" style="display:block;position:absolute;width:100%;height:100%;opacity:0.3;z-index:100;background:#000;"></div>'+document.body.innerhtml; } document.body.innerhtml = '&

php - How to automatically parse a subdomain with WordPress -

we have unique wordpress installation , front page iframe needs redirect address depends on url it's being accessed (more specifically, depends on subdomain). let's say, if address : <subdomain>.<domain> then iframe should redirect to: <subdomain>.<otherdomain> ex: chc.mynewdomain.com should contains iframe redirecting to: chc.myolddomain.com the questions are: 1- how have subdomains go unique wordpress install? 2- how parse subdomain in underlying wordpress (php) code, possibly check against white list of subdomains, , build dynamically iframe url? to have subdomains go same wordpress install: first, setup wildcard domain entry. procedure varies depending on dns host then setup wild card entry in httpd config (typically involves adding * in hostname) as handling in wordpress, depends trying do. scenario want different page every subdomain have enable wordpress multi site multiple site. then, have install domain mappin

c# - Issues with making a 3D model faces semi-transparent using HelixToolkit -

Image
i trying display 3d model depicted below using helixtoolkit. (the following snapshot's taken solidworks.) i set brush color of diffusematerial used material , backmaterial of geometrymodel3d tranparent color. model3dgroup facevisualentity = modelfaces.first(modelface => modelface.content.getname() == facename).content model3dgroup; // breaking 3d-model down constituting mesh.. // foreach (var child in facevisualentity.children) { if (child geometrymodel3d) { geometrymodel3d body = child geometrymodel3d; body.material = new diffusematerial(new solidcolorbrush("#40ff0000")); body.backmaterial = new diffusematerial(new solidcolorbrush("#40ff0000")); } } however, can see in helixviewport3d below. while sides of box seem transparent, wonder why pipes inside box cannot seen. changed color of pipe walls opaque value, cannot see them yet. the fact using transparency feature of helixtoolkit not achie

How to parse first line of HTTP Get Request in java? -

i wondering if there quick way parse first line of http request grab directory information? example, if have: /test.txt http/1.1, easiest way test.txt or whatever request might be. file might change hard coding out. is string.split() easiest way. if best way split be. can't split "/", because there more 1 need. possible split grab after first "/" , stop @ first space. thanks. edit: would better remove , http/1.1 since won't need them, , grab else? 3.1.1. request line a request-line begins method token, followed single space (sp), request-target, single space (sp), protocol version, , ends crlf. request-line = method sp request-target sp http-version crlf source: http://tools.ietf.org/html/rfc7230 your method fine. remove method , http-version : string requesturi = firstlinestr.substring(firstlinestr.indexof(' ')+1, firstlinestr.lastindexof(' '));

python - Optimizing distance calculation between rows and matrices with numpy -

i have image processing problem trying create known histogram of activated patches . i have codebook (a numpy array, 200x36) , image (another numpy array, 128x128). each pixel, have see codebook vector nearest . the distance between codebook vector , pixel defined euclidean distance between vector , 6x6 patch left cornered @ pixel, reshaped form 1x36 vector. for each pixel, extracting patch , computing nearest codebook vector using code d,i=spatial.kdtree(cdata).query(patch.reshape((1,6*6))) . o(n) number of pixels. there way improve running time? reasonable approximation fine.

javascript - get value of each tr to be passed in an ajax request -

i have table data db. want data tr of each td , pass on ajax request passed page. while($row = mysqli_fetch_array($result, mysqli_both)) { echo '<tr>'; echo '<td id="t_name">' .$row['name']. '<input type="hidden" id="sell_id" value='.$row['id'].'> <input type="hidden" id="t_id" value='.$row['telco_id'].' > </td>'; echo '<td id="keyword_name">' .$row['keyword']. ' <input type="hidden" id="keyword_id" value='.$row['keyword_id'].' > </td>'; echo '<td id="main_cross">' .$row['main_message']. '</td>'; echo '<td id="alternate_cross">'

How do I write a SCons script with hard-to-predict dynamic sources? -

i'm trying set build system involving code generator. exact files generated unknown until after generator run, i'd able run further build steps pattern matching (run program on files extension). possible? some of answers here involving code generation seem assume output known or listing of generated files created. isn't impossible in case, i'd avoid since makes things more complicated. https://bitbucket.org/scons/scons/wiki/dynamicsourcegenerator seems indicate it's possible add additional targets during builder actions, while build run , list generated files, build steps introduced don't run. https://bitbucket.org/scons/scons/wiki/nondeterministicdependencies uses scanners add build steps. put glob(...) in scanner, , succeeds in detecting generated files, files inexplicably deleted before runs dependent step. is use case possible? , why scons deleting generated files? a toy example source (the file referenced in sconscript) an example genera

jasper reports - Replacing aspose JRPptExporterParameter.PPT_TEMPLATE_PRESENTATION in jasperreports 5.0 -

i generating ppt report using jasperreports , aspose library (ppt exporter aspose). i'm trying eliminate aspose project , use ppt exporter jasperreports 5.0. problem @ moment generated report needs external .pot file added using aspose: com.aspose.slides.jasperreports.jrpptexporter exporter = new com.aspose.slides.jasperreports.jrpptexporter(); ...... exporter.setparameter(com.aspose.slides.jasperreports.jrpptexporterparameter.ppt_template_presentation, ppttemplate); exporter.exportreport(); i didn't find similar parameter in jrexporterparameter jasperreports , couldn't find efficient solution yet. there method of using external .pot file? thinking creating second jasperprint object .pot file , exporting both jasperprint objects setting jrexporterparameter.jasper_print_list not sure if fits you, i've written custom pptx exporter (only pptx, not binary ppt), based on apache poi. poi element can initalized own template pptx (not yet implemented in versio

angularjs - Append Data to existing json array through Angular-Bootstrap dialog modal -

i facing issue while adding data through angular dialog modal here plunker http://plnkr.co/edit/ejpkmxqnacun3gjilval?p=preview <table class="table table-bordered"> <thead> <tr> <th> <input type="checkbox" ng-model="isall" ng-click="selectallrows()"/>all </th> <th> id </th> <th> name </th> </tr> </thead> <tbody> <tr ng-repeat="row in data" ng-class="{'success' : tableselection[$index]}"> <td> <input type="checkbox" ng-model="tableselection[$index]" /> </td> <td>{{row.id}}</td> <td>{{row.name}}</td> </tr> </tbody