Posts

Showing posts from March, 2012

javascript - Is it possible to add an horizontal scroll bar to an html select box? -

Image
this question has answer here: how horizontal scroll bar in select box in ie? 2 answers i have below html code. <!doctype html> <html> <body> <select> <option value="volvo">volvoooooooooooooooootooooooolargeeeeeeeeeeee</option> <option value="saab">saab</option> <option value="opel">opel</option> <option value="audi">audi</option> <option value="volvo">volvo</option> <option value="saab">saab</option> <option value="opel">opel</option> <option value="audi">audi</option> <option value="volvo">volvo</option> <option value="saab">saab</option>

html - jQuery get the form select value -

i working jquery code. code listen event "change" radio button. want use select instead. how can make work?. see code below $("#filters input:radio").on("change", function () { i think should $("#filters select").on("change", function () { as select not input tag?

image processing - writing coeffcients to a wavelet packet tree in MATLAB -

i trying create empty wavelet packet tree , filling terminal nodes coefficients. in short following simple code :- clc,close all,clear all; img = imread('barbara.png'); t = wpdec2(img,2,'db4'); t2 = cfs2wpt('db4',size(img),tnodes(t),4); u = tnodes(t); = 1:length(u) x = read(t,'cfs',u(i)); write(t2,'cfs',u(i),x); end however when display t2, find terminal nodes contain no information except 0 matrics of appripriate sizes .. reason , how correct problem ?

android - Replaced Fragments are still active -

i writing android app using support version of fragments (android.support.v4.app.fragment). i have strange bug in code , dont know how fix it. when replace fragment other one, replaced 1 still active , receiving touch events. tap on location of button replaced fragment still fire onclick event. i dont know how fix this. can me? java code fragment newfragment = new loginactivityregisterfragment(); ... fragmenttransaction ft = getsupportfragmentmanager().begintransaction(); ft.settransition(fragmenttransaction.transit_fragment_fade); ft.replace(r.id.login_fragment, newfragment); ft.commit(); ... xml layout ... <fragment class="de.myapp.fragments.loginactivitymainfragment" android:layout_height="match_parent" android:layout_width="match_parent" android:id="@+id/login_fragment" /> ... you can replace fragments in container view only. means need container (not fragment itself). <framelayout

ruby on rails - calculate payments in different currencies -

i have table items wich have string "usd" or "eur". create in controller variable def index ... @currencydebt = currencyrate.find( :all, :conditions => ["created_at < ? , currency_id = ?", date.today, 2], :order => ["created_at desc"], :limit => 1 ) ... end witch find last currency usd ** in view** <% res in @items %> <% loc in @currencydebt %> <%= number_with_precision(((loc.rate.round(2) * res.payment)), 2) %> <% end %> <% end %> Аnd result showing paymant in currency usd. how can show result if have string usd in items payment result in usd, if have eur in items payment result in eur? my activerecord create_table "items", :force => true |t| t.string "name" t.string "currency" t.decimal "payment" ... end create_table "currency_rates", :force => true |t| t.integer

C++ non-type template parameters: Is typedef of an integral type an integral type? -

i know can function template template<int n> void f () {} . but template<std::size_t n> void f() {} ? a typedef alias given type. typedef of integral type integral type. , types don't more integral std::size_t .

java - null URL in testing with spring -

i testing method in spring controller , getting null pointer url when hits sendrequest method. test method follows: @test public void testshowform() { map<string, object> params = new hashmap<string, object>(); params.put("email", "testemail"); params.put("accesscode", keygenerator.getkey64()); string result = sendrequest("/userinfo.htm", get, usercontroller, params); assertnotnull(result); } my helper class: public class junitcontrollerhelper extends junithelper { @autowired protected junitdatahelper junitdatahelper; @autowired protected junitservicehelper junitservicehelper; @autowired protected applicationcontext applicationcontext; protected final string = "get"; protected final string post = "post"; protected mockhttpservletrequest request; protected mockhttpservletresponse response; protected handleradapter handleradapter; @before public void setup() { request = new mock

knockout.js - Math expressions with knockout through jquery.tmpl values? -

Image
doing math expressions in jquery.tmpl knockout viewmodels doesn't seem work. there way this? http://jsfiddle.net/z8f8r/ <p data-bind="text: number" /> <-- shows 10 expected <script id="numbertemplate" type="text/html"> ${number} <-- shows 10 expected ${number/2} <-- shows nan </script> the number value not actual value. it's function that, when called 0 arguments, returns expected value. when evaluate expression ${number / 2} you're doing same thing as (function(){}) / 2 which returns nan if change expression instead ${number() / 2} you expected value of 5 you can see actual contents of number if eval value. ${eval(number)} returns function function d(){ if(0<arguments.length) { if(!d.equalitycomparer||!d.equalitycomparer(c,arguments[0])) d.h(), c=arguments[0], d.g(); return } b.r.wa(d);

Split a vector into three vectors of unequal length in R -

a questions relative n00b: i’d split vector 3 vectors of different lengths, values assigned each vector @ random. example, i’d split vector of length 12 below vectors of length 2,3, , 7 i can 3 equal sized vectors using this: test<-1:12 split(test,sample(1:3)) any suggestions on how split test vectors of 2,3, , 7 instead of 3 vectors of length 4? you use rep create indices each group , split based on that split(1:12, rep(1:3, c(2, 3, 7))) if wanted items randomly assigned it's not first 2 items in first vector, next 3 items in second vector, ..., add call sample split(1:12, sample(rep(1:3, c(2, 3, 7)))) if don't have specific lengths (2,3,7) in mind don't want equal length vectors every time simono101's answer way go.

url - How to double encodeURIComponent in javascript? -

in web app, use mailto link open outlook 2007. insert url body. problem need whole url hyperlink. if there spaces, hyperlink breaks, or if there special characters if ends close parenthesizes character wont included in hyperlink, link breaks. what tried using encodeuricomponent on link, url encodes it, issue in outlook, automatically decode normal breaks link. need way double encode it. basically instead of doing " " -> "%20" (<-- encodeuricomponent ) i need " " -> "%2520" so in outlook, %25 gets decoded % , when combines 20 %20 keeping link encoded once , not broken. work me, don't know how function. does know how can double encode? thanks encode var encoded=escape(encodeuricomponent(' ')); decode var decoded=decodeuricomponent(unescape(encoded));

javascript - JQuery Commands Breaking Each Other -

i have code produce form based on selection. $(document).ready(function(){ $('#dealerform').hide(); $('#customerform').hide(); $('#select').change(function(){ $('#dealerform,#customerform').hide(); $($(this).find('option:selected').attr('value')).show(); }); }); $(document).ready(function(){ $("input[name='emailquest']").change(function(){ if (this.value != "1") { // <----i change this.checked $("input[name='email']").prop("disabled", true); } else { $("input[name='email']").prop("disabled", false); } }); }); well have added code try add datepicker code , breaks previous code , serves whole thing @ once , datepicker doesnt' work. know im doing wrong here , have possible datepicker solution? $(function(){ $("#datepicker").datepicker(); }

javascript - Second setInterval function is not invoked -

i had working script perform ajax calls , update multiple areas of page using jquery. worked on second set of code create script take string "2 days 19:20", split days, hours , minutes, use setinterval increment string minute minute. worked on own when there 1 setinterval function on page. now, i've added code main script, using unique variable , function names, , added setinterval function such $().ready looks this: $(document).ready (function() { setinterval(function() { communicate_server(); }, serverpollfrequency ); setinterval(function() { updatemyclock(); }, clockupdatefreq ); }); the functions this: function updatemyclock () { alert("called"); $('.showonline').each(function () { var cl = $(this).html(); cl=splittime(cl); $(this).html(cl); } function splittime (timestring) { ... } the alert added debug script. issue function communicate_serv

input - C++ using a member function from from one class in the main function? -

i have main , im setting input im using getters/setters use method inputhander main doing causing stack overflow there infinite loop going on. the warning get: warning c4717: 'key_callback' : recursive on control paths, function cause runtime stack overflow i have no other idea how call method other use getter , setter main.cpp #include <glfw3.h> #include <stdio.h> #include <iostream> #include "inputhandler.h" using namespace std; /* begin void prototyping */ void error_callback(int error, const char* description); void key_callback(glfwwindow* window, int key, int scancode, int action, int mods); int main(void) { glfwwindow* window; /* initializes error call-backs */ glfwseterrorcallback(error_callback); /* initialize library */ if (!glfwinit()) return -1; /* create windowed mode window , opengl context */ window = glfwcreatewindow(640, 480, "hello world", null, null); // fullscreen

objective c - Core Data store being deleted on launch -

i have rather odd issue can't work out, have non document based application on osx using core data storage mechanism. all fine until when started nuking core data information on launch. knowledge haven't changed of core data methods in intervening period. it's driving me absolutely nuts, can watch store file grow app runs, , stays when application quits, launch file drops in size , object removed. i think has when coredatamodel initialised, haven't managed pin down when it's removed , in method. has seen before/able offer pointers. happy post , code guys might think relevant. thanks gareth actually idiot factor, had implemented method in simperium checked whether needed start, , if not calling logout , remove data method, doh! apologies, stupid friday question . . . thanks gareth

defaultnetworkcredentials - C# Windows Service Invalid credentials -

i have c# windows service used pull files machine on same domain. when run windows service console application, pull files other computer. however, running windows service return : invalid credentials for: 192.168.100.53 (servernotfoundmipexception) i tried change service log on local service or network service no success. following onstart method: [permissionset(securityaction.demand, name = "fulltrust")] protected override void onstart(string[] args) in application properties, security section, checked enable clickonce security settings, full trust application. the credential type used is: case credentialtype.windows: { var nc = credentialcache.defaultnetworkcredentials; what missing windows failed pull files other computer ? i assume reading files windows share, \\computer2\share\path\file.ext . account under server runs must able to access network, authenticate domain controller able logon computer2 network (assigned via control pane

bash - How would I merge these 2 commands together? -

input: filepath filename probability classifierid hectorfiletype libmagicfiletype /mnt/hector/data/benign/binary/benign-pete/ 01d0cd964020a1f498c601f9801742c1 19 s040pdfv02 data.pdf pdf document /mnt/hector/data/benign/binary/benign-pete/ 0299a1771587043b232f760cbedbb5b7 0 s040pdfv02 data.pdf pdf document trying merge 2 commands together, split file , inside split files show file path , classifier id ($1,$2) awk '{ print >> $5.txt }' < output.txt awk -v ofs="," 'nr>1 {print $1,$2}' -thank this 1 perhaps: awk 'nr>1 {print $1 "," $2 >> $5 ".txt"}' < output.txt passing input awk < optional. pass file argument instead.

activerecord - Rails: Enumerable#group_by with Delegation makes too many DB calls -

here code: class video < activerecord::base delegate :name, :to => :video_type, :prefix => true, :allow_nil => true belongs_to :athlete, :class_name => "athlete" end class athlete < user has_many :videos end console: a = athlete.last a.videos.group_by(&:video_type_name) videotype load (0.8ms) select "video_types".* "video_types" "video_types"."id" = 12 limit 1 called from: app/models/video.rb:9:in `video_type_name' videotype load (0.9ms) select "video_types".* "video_types" "video_types"."id" = 14 limit 1 called from: app/models/video.rb:9:in `video_type_name' videotype load (0.8ms) select "video_types".* "video_types" "video_types"."id" = 1 limit 1 called from: app/models/video.rb:9:in `video_type_name' videotype load (0.7ms) select "video_types".* "video_types" "video_t

.net - Compile time errors while working with C++/CLI examples -

i trying read string 'number' file, , convert integer. following code, c++/cli int informationreader::getthreshold() { streamreader ^reader = gcnew streamreader("threshold.dat"); system::string ^thresholdstr = reader->readline(); int32 thresholdnum; boolean = int32::tryparse(thresholdstr,thresholdnum); return 0; } but, code executed, following error 1>informationreader.cpp(29): error c2065: 'int32' : undeclared identifier 1>informationreader.cpp(29): error c2146: syntax error : missing ';' before identifier 'thresholdnum' 1>informationreader.cpp(29): error c2065: 'thresholdnum' : undeclared identifier 1>informationreader.cpp(31): error c2065: 'boolean' : undeclared identifier 1>informationreader.cpp(31): error c2146: syntax error : missing ';' before identifier 'a' 1>informationreader.cpp(31): error c2065: 'a' : undeclared identifier 1>informationr

log4j configuration level error -

my log4j configuration follows log4j.rootlogger=info, ca, fa, da #console appender log4j.appender.ca=org.apache.log4j.consoleappender log4j.appender.ca.layout=org.apache.log4j.patternlayout log4j.appender.ca.layout.conversionpattern=%-4r [%t] %-5p %c %x - %m%n #file appender log4j.appender.fa=org.apache.log4j.fileappender log4j.appender.fa.file=/home/admin/logs/sysout.log log4j.appender.fa.layout=org.apache.log4j.patternlayout log4j.appender.fa.layout.conversionpattern=%-4r [%t] %-5p %c %x - %m%n log4j.appender.fa.threshold = warn #file appender 2 log4j.appender.da=org.apache.log4j.fileappender log4j.appender.da.file=/home/admin/logs/debug.log log4j.appender.da.layout=org.apache.log4j.patternlayout log4j.appender.da.layout.conversionpattern=%-4r [%t] %-5p %c %x - %m%n log4j.appender.da.threshold = trace my understading info logged console warn logged sysout.log trace logged debug.log but warn getting logged both debug.log , sysout.log. trace not logging in of file.

node.js - How to change the folder where socket.io is fetching the socket.io.js JavaScript file? -

the statement <script src="/socket.io/socket.io.js"></script> looks socket.io.js in 'public' folder instead of node_module. changing url ../node_module/socket.io/socket.io.js not work. how change default folder src looks into? socketio sever when receives request '/socket.io/socket.io.js' , dynamically builds content ( considering transports configured supported server ). the file neither served public / node modules.

python - queryset django relationship -

i have 2 models: class income(models.model): id = models.autofield('id', primary_key=true) date = models.datefield('date', blank=true, null=true) user = models.foreignkey(user, null=true, help_text="user income") class invoice(models.model): id = models.autofield('id', primary_key=true) income = models.foreignkey(income, null=true, blank=true, related_name='income') user = models.foreignkey(user, null=true, blank=true, related_name='user_invoice') and need "income" not associated "invoice". find no way see problem. thank :) filter using __isnull : normally, django automatically follows relationship fields using lowercased name of related model: income.objects.filter(invoice__isnull=true) here, you've specified related_name attribute, need use that: income.objects.filter(income__isnull=true) note reveals related name attribute income fk on invoice backwards.

c# - How to dynamically load Page from xaml file/resource? -

in codebehind, need load page object xaml resource, , explicitly need result instance of object of page class. have searched around , found solutions involving xamlreader , such, looked bit weird , complicated, hacks. there simple , "normal" way it? page p = (page)application.loadcomponent(new uri(@"relative/uri/to/xaml/file.xaml", urikind.relative)); see msdn reference page few more details

algorithm - Proving the Horner Function (Polynomial Evaluation) -

Image
i completed exercise 1-8 in the algorithm design manual , second edition, steven s. skiena: is convincing? typically in induction proofs separate steps each other. induction step implicit taste. i'd this: 1) n = 1 horner([a0], x) = a0 2) horner([a0,...,a(n+1)], x) = x * horner([a1,...,a(n+1)], x) + a0 = x * horner([b0,...,bn], x) + a0, bn = a(n+1) 3) having horner n, horner n+1 can calculated 2) your proof fine, i've said - induction step should accented - how solution n+1 follows solution n (m in case), in separate proof step.

osx - Does a NIC 'know' its MAC address? -

my understanding ethernet nic 'knows' mac address. when packets arrive on wire, nic checks see if destination mac matches mac, , if so, forwards packet network stack. alleviates operating system of having examine each , every packet arrives on wire. i'd know os driver functions support this. i've been looking @ ndis 5.1 reference, , have found this: http://msdn.microsoft.com/en-us/library/windows/hardware/ff557131%28v=vs.85%29.aspx , think i'm close, haven't hit jackpot yet. i'm preparing class materials , want tell class nic knows mac address, don't want teach unless can verify myself it's true. seeing os driver functions support satisfy doubt. i appreciate (and comment) community provide. packet filtering your understanding correct. nic fair amount of filtering in hardware, spare cpu excessive filtering. generally, typical ethernet nic have programmable packet filter allows packets if meet criteria, these: the destination

curl - Alternative options for communicating with external server in PHP -

i using free web hosting platform disables following php functions: allow_url_fopen, fsockopen, pfsockpen, getrusage, get_current_user, set_time_limit, getmyuid, getmypid, dl, leak, listen, chown, chgrp, realpath, link, exec, passthru, curl_init. these functions being disabled means can't use curl or fsockopen communicate external server. i have tried using file_get_contents mentioned here , following error message: file_get_contents(): unable find wrapper https - did forget enable when configured php? being i'm on free hosting plan, don't know can php configuration. there other options communicating external server? it looks either using free account , limitation of host non-paid accounts, or have not requested them enable outgoing communications on paid account. from awardspace.com faq : (bolded area of interest) 15, cannot use rss feeds or curl on website? the outgoing connections disabled default on accounts , they can enabled paid ac

sql - In MySQL does a UNIQUE varchar have to be a PRIMARY KEY as well? -

i have 2 unique values under 1 table in mysql. |id (pk)|varchar(255) unique| ----------------------------- | 1 | 1234abcde | | 2 | 5678fghij | | 3 | 9012klmno | do have set unique varchar pk or can still use auto_incremented id (int)? or bad practice? no not need primary key. additionally: cannot have more 1 'primary key' (different compound primary keys), , makes sense have auto-increment id field convention alone , frameworks (e.g. orm's hibernate , entity framework). to answer second question, there many business cases many enforce unique constraint on multiple columns without making them primary key - example may have unique, may need able edit/change them: i.e. email addresses usernames - forced unique, users need update them password salts (if generation sound unlikely require enforcement) random strings used generate one-time or time sensitive links (think bit.ly) so, point being done time.

javascript - Highlight links wwith background pane bigger than link-object without padding -

http://jsbin.com/okac/1/edit html: <ul> <li> <a class='active' href='#'>link</a></li> <li><a href='#'>link</a></li> </ul> css: .active { background:grey; border-radius:2px; padding:4px; } this basic example of im trying achieve - highlighting ordinary links effect bigger link-element itself. here use padding, breaks consistency of visual structure of page - highlighted link shifted relative regular one. possible solutions have in mind: add padding links. with js, switch active link absolute positioning current coordinates. is there other solutions? you can add negative margin remove space around link: a { padding: 4px; margin: -4px; } other way add outline instead of padding: a { outline: 4px solid grey; }

python - Received unregistered task using Celery with Django -

i have celery setup django project , can't seem task run properly. i'm using django 1.4.3, celery 3.0.1, django-celery 3.0.17 , python 2.7 on ubuntu 13.04. i have verified rabbitmq-server running: sudo service rabbitmq-server status status of node rabbit@fenster ... [{pid,1667}, {running_applications,[{rabbit,"rabbitmq","3.0.2"}, {os_mon,"cpo cxc 138 46","2.2.9"}, {mnesia,"mnesia cxc 138 12","4.7"}, {sasl,"sasl cxc 138 11","2.2.1"}, {stdlib,"erts cxc 138 10","1.18.1"}, {kernel,"erts cxc 138 10","2.15.1"}]}, {os,{unix,linux}}, {erlang_version,"erlang r15b01 (erts-5.9.1) [source] [64-bit] [smp:8:8] [async-threads:30] [kernel-poll:true]\n"}, {memory,[{total,28112760}, {connection_procs,93432}, {que

How to resolve Uncaught reference error when attempting to call a JavaScript function -

i have c# mvc web application , trying organize java script . since moving below javascript view , adding folder keep getting "uncaught reference error addartist" while debugging in firefox. scripts worked fine when included on web page. i reference jquery , script as: <head> <script src="/scripts/jquery-lib/jquery-1.10.2.js"></script> <script src="/scripts/addartist.js"></script> </head> then here script: (function() { $(function() { var addartist; return addartist = function() { var adddiv, artistval; adddiv = $("#artistname"); artistval = $("#artistinput").val(); $(" <div id=\"artistname2\"><label>" + artistval + "</label></div>").appendto(adddiv); return false; }; }); }).call(this); * and here html: *

c# - Visual Studio crashes on Microsoft.Build.ni.dll -

i running windows 7 pro x64, visual studio 2012 ultimate. installed telerik's openaccess platform project. working fine yesterday, today can't open project. websites open, can't build. i have gone previous system restore, still didn't work. uninstalled telerik, still didn't work. uninstalled visual studio, still didn't work. i'm guessing visual studio doesn't clean uninstall. suggestions on how can fix this? full/complete uninstall/reinstall (following these instructions ) make work? or should go system image have last week? details: problem signature: problem event name: appcrash application name: devenv.exe application version: 11.0.50727.1 application timestamp: 5011ecaa fault module name: microsoft.build.ni.dll fault module version: 4.0.30319.17929 fault module timestamp: 4ffa85ef exception code: 4000001e exception offset: 0015bb0b os version: 6.1.7601.2.1.0.256.48 locale id: 1033 additional information 1: 4573 add

Linking Existing C++ dll with Windows Phone Component Runtime -

i trying link c++ dll compiled x86 windows phone project. followed tips in: 1) http://www.be-init.nl/getmedia/1318adfa-cd4d-4390-a30d-817fd97e37da/using-native-code-in-your-windows-phone-8-applications-maarten-struys.pdf.aspx?ext=.pdf 2) http://www.silverlightshow.net/items/windows-phone-8-native-code-support.aspx 3) http://code.msdn.microsoft.com/wpapps/windows-runtime-component-fb644b34 my question whether can re-use native dll x86 under windows phone component runtime? if not, how port existing native c++ dll windows phone? for example, in sample project ( http://www.jarredcapellman.com/2012/11/3/how-to-get-c-winrt-in-a-windows-phone-8-application ) tried add opencv dll windows x86 , tried call opencv functions ( http://docs.opencv.org/doc/tutorials/introduction/windows_install/windows_install.html ). it compiles fine when run app, crashes error message module not found exception. the specified module not found. (exception hresult: 0x8007007e) windows phon

c# - Complex inheritance situation. Returning base object from derived class -

this question has answer here: specifying return type of abstract method base class according sub class 4 answers i have complex situation involving inheritance. have base dataobject class invoice class inherits from. want save invoice object using dataobject save method , return invoice object saved. public abstract class dataobject { public virtual dataobject save() { // save data return this; } } derived classes public class invoiceobject : dataobject { // base data class goes here } public class invoice : invoiceobject { public override dataobject save() { // somehow return invoice object here return base.save(); } } i want avoid using casts if possible. insight helpful. arguments sake structure must remain same. cannot remove invoiceobject object , save method must return entire invoice obj

garbage collection - JVM Heap and OS Memory allocation -

does jvm ever give memory os has allocated heap? for example, have jvm @ set -xmx5120m , have used of memory, doing stuff cause heap fill up. lets full gc happens, brings actual heap usage down significantly. drop cause total heap size reduced, presumably above actual usage levels, , "cleared" memory returned os? or memory allocated jvm remain @ high level though may not "actively" using of in heap now. slim down vs hoard guess. edit: i'm interested in sun/oracle jvm (i.e. 1.6.0_33, 1.7+ or like)

.net - Casting PSMethod object to Func`2 in Powershell? -

i'm trying make oauth 2.0 service account google drive example https://developers.google.com/drive/service-accounts work in powershell 2.0. $a= add-type -path "d:\google\oauth\system.web.mvc.dll" -passthru $b= add-type -path "d:\google\oauth\dotnetopenauth.dll" -passthru $c= add-type -path "d:\google\oauth\google.apis.authentication.oauth2.dll" -passthru $d= add-type -path "d:\google\oauth\newtonsoft.json.net35.dll" -passthru $e= add-type -path "d:\google\oauth\google.apis.dll" -passthru $service_account_email = "<my service account email>" $service_account_pkcs12_file_path = "<path certl>" $certificate = new-object system.security.cryptography.x509certificates.x509certificate2($service_account_pkcs12_file_path, "notasecret", [system.security.cryptography.x509certificates.x509keystorageflags]::exportable); $desc= [google.apis.authentication.oauth2.googleauthenticationserver]::descri

php - How do I re-render a chart in d3.js using an on click event (dashboard building)? -

i’m developing interactive school report card local nonprofit using bootstrap, php, mysql , d3.js. i have no problem getting d3 charts render ( example ) once user has selected school (3 separate bar charts render onscreen when user submits school selection form). executing queries, encoding them json in php/mysql, using php include function (on 3 separate occasions) reference 3 separate javascript files contain d3 code renders charts. reference data d3 pulling in populate graphs nested inside of php tags inside each of these javascript files. again, no issues here, charts render they’re supposed , good. the issue i’d users able able change options on 1 of charts , have chart re-render new data when button in form clicked. one of charts rendered of 4th grade math test score data state standardized test selected school. there other test subjects (english, science , social studies) within 4th grade i’d users able view; additionally, same 4 subjects tested in grades 3 , grad

mysql - Hibernate delete with joins without using IN -

i have following query works slow because using in: _session.createquery(@" delete orderitem oi oi in (select orderitem i.product.id = :productid , i.order.company.id = :companyid , i.order.campaign.id :campaignid , i.order.orderstatus = :orderstatus) ") .setparameter("productid", productid) .setparameter("companyid", companyid) .setparameter("campaignid", campaignid) .setparameter("orderstatus", orderstatus) .executeupdate(); is there way use native query can use joins deletion like: delete posts posts inner join projects on projects.project_id = posts.project_id projects.client_id = :client_id yes. use session.createsqlquery() , can use plain sql.

php - unable to select id mysqli -

i have query selects random rows table , trying select id along 3 rows when include id selected gives me error. if remove id query works fine. reason need id because need pass via url second page. missing? call member function execute() on non-object the query: $stmt = $mydb->prepare("select id, title, price, image_one products r1 join (select (rand() * (select max(id) products )) id) r2 r1.id >= r2.id , title != '' order r1.id asc limit 1 "); $stmt->execute(); you're missing error checking. every time prepare or execute query, should check result. function returns false if there's error. for example, if try running query, error: error 1052 (23000): column 'id' in field list ambiguous there 2 id columns in query: r1.id , r2.id . need qualify column it's unambiguous 1 mean query. select r1.id, title, ... but more important, check result return

apt get - Unable to Install Heroku toolbelt on Samsung ARM Chromebook? -

i have samsung series 3 chromebook arm processor. made crouton chroot , installed ubuntu cli. have node.js 0.10.15 installed , running. tried install heroku-toolbelt , won't run. below command: (precise)root@localhost:/# wget --no-check-certificate -o- https://toolbelt.heroku.com/install-ubuntu.sh | sh i used --no-check-certificate because when took quiet mode off learned causing install punt. after told me few times not verify certificates, did said: gpg: no valid openpgp data found. get:1 http://toolbelt.heroku.com ./ release.gpg [490 b] hit http://ports.ubuntu.com precise release.gpg hit http://ports.ubuntu.com precise-updates release.gpg hit http://ports.ubuntu.com precise-security release.gpg hit http://ports.ubuntu.com precise release hit http://ports.ubuntu.com precise-updates release get:2 http://toolbelt.heroku.com ./ release [1,673 b] ign http://toolbelt.heroku.com ./ release , whole lot more hit h

php : result of sum array values is wrong -

i have array: $test =array('49'=> '-0','51'=> '-0','50'=> '0','53'=> '-1.69','55'=> '0','57'=> '-2','59'=> '-6','60'=> '-12','65'=> '0','66'=> '0','67'=> '21.69','69'=> '0','70'=> '0','71'=> '0',); echo "\n".'===== first method ========'; echo "\n\n".print_r($test); echo "\n array_sum: ".array_sum($test); echo "\n\n".'===== second method ========'; $total = 0;foreach($test $value) $total += $value; echo "\n foreach:".$total."\n"; the result gd@gd:~/desktop$ php test.php ===== first method ========array ( [49] => -0 [51] => -0 [50] => 0 [53] => -1.69 [55] => 0 [57] => -2 [59] => -6 [60

ios - MVC 4 Disable Client Image Caching -

i working on mvc 4 app designed run on ios. have encountered problem app crashes when local cache exceeds 5mb (due high number of images on site). i trying disable local caching, have tried meta tags suggested in other posts , not work. have tried decorating controller actions [outputcache(duration = 1, location = outputcachelocation.none)] this doesn't work because use partial views , exception saying location parameter not supported on partial views. any advice? have tried defining response headers? more specifically, following header: cache-control - header must present in response server enable http caching client. value of header may include information max-age (how long cache response), , whether response may cached public or private access, or no-cache (not @ all). see cache-control section of rfc 2616 full details.

c# - Proper way to filter BlockBuffer.RecieveAsync -

good day. i have tpl dataflow mesh rpc calls it has 2 unkinked flows in simplified way looks this: output flow: blockbuffer store output actionblock send output server , produce sent id and input flow: while loop recieve data transformblock parse data blockbuffer save answer sentid there problem: when make calls separate threads can mess answers, need filter it. my rpc call: public async task<rpcanswer> performrpccall(call rpccall) { ... _outputrpccalls.post(rpccall); long uniqueid = getuniq(); // call unique id ... var sent = new tuple<long, long>(uniqueid, 0); while (_sentrpccalls.tryreceive(u => u.item1 == uniqueid, out sent)) ; // generated id send function return await _inputanswers.receiveasync(timespan.fromseconds(30)); } as can see have uniqueid can me determine answer call, but how can filter , await it? is way have array of buffers (writeonceblock maybe?) created in rpc call , linkedto filter?

Links embedded in text are not recognized by screenreader (i.e. to JAWS) in Flex 3 -

i'm working on making flex 3 application accessible (using jaws 14). after struggles, have working, 1 thing have not been able figure out how have link within body of text (label, textarea, etc) , have jaws recognize link. for example, private function setuplink():void { var str:string = ""; str = "my test link: favorite search: "; str += "<a href='event:http://www.google.com'><font color='#0000ff'><u>http://www.google.com</u></font></a>"; linktest.htmltext = str; } public function handlehyperlink(evt:textevent, win:string = "_blank"):void { navigatetourl(new urlrequest(evt.text), win); } <mx:text id="linktest" x="20" y="140" width="500" height="100%" enabled="true" link="handlehyperlink(event)" /> when tested jaws, entire text read ok, there no indication there link present, , no way acti

jquery - Accordion active don't work on first load -

when loads first time trying active first div makes div active except of first. here on jsfiddle. $(".accordion > span").click(function(){ $('.accordion > span').removeclass('active'); $(this).addclass('active'); if(false == $(this).next().is(':visible')) { $('.accordion > div').slideup(300); } $(this).next().slidetoggle(300); }); var animationisoff = $.fx.off; $.fx.off = true; $('.accordion > span:eq(0)').click() $.fx.off = animationisoff; here html <div class="accordion"> <span>accor 1</span> <div> content here </div> </div> <div class="accordion"> <span>accor 2</span> <div> content here </div> </div> <div class="accordion"> <span>accor 2</span> <div> content here </div> </div> any highly appreciated.

jquery - Javascript add class on click -

i trying add class link when clicked here code jquery(document).ready(function(){ jquery('#block-block-23 li a').click(function() { jquery('#block-block-23 li a').addclass("selected"); }); }); and problem class adding when clicking link when page loads automatically gets removed.i have tried toggleclass() function also there can 2 scenarios... the application multi-page. in case can hard code class in page. the application single-page , link decoration purpose. in case can prevent default behavior of link. jquery('#block-block-23 li a').click(function(event) { event.preventdefault(); jquery(this).addclass("selected"); });

javascript - get all data from one list item jquery mvc 4 -

i want click on 1 row , id posting db , name dsiplay user. with code have click on corresponding <li> (data-id or data-name) value. how both <li> ? hidden-fields, maybe? $(".ita").on("click", "li", function () { var div = $("#addeditems"); var itemtoadd = $(this).attr("data-id"); var name = $(this).attr("data-name"); alert(itemtoadd + name); var itemtoadd = ("<li class = " + itemtoadd + ">"+ name +"</li>"); alert(itemtoadd); $(itemtoadd).appendto(div); // div.html(itemtoadd); }); view @foreach (var item in model) { <ul> <li data-id = "@item.id"> @html.displayfor(modelitem => item.id) </li> <li data-name="@item.item_name"> @html.displayfor(modelitem => item.item_name) </li> <li> @html.displayfor(modelitem => item.item_

json - get value from function using python -

i have python function. def v(): response = urllib2.urlopen('https://api.gosquared.com/v2/concurrents?api_key=xxxxx&site_token=xxxx&presenter=old') data = json.load(response) print data and have firebase f = firebase('https://xxxxx.firebaseio.com/channel/1/status/viewers') r = f.update({'viewers': 'v()'}) i want value of key:value pair returned value v() function. i've tried 'v()', "v()", , v() no avail. what not understanding correctly? your function should return value. it's printing , not returning nything try this: def v(): response = urllib2.urlopen('https://api.gosquared.com/v2/concurrents?api_key=xxxxx&site_token=xxxx&presenter=old') data = json.load(response) #comment below line if don't want print data , want return print data return data update : if want store returned data variable then: returned_data = v()

Kill and free the memory of never ending threads from main in perl -

there main running , 2 threads running,the 2 threads infinite event loops waiting event, issue want wait event come finite amount of time , exit program but when exiting threads still running want free space occupied threads , exit script how fix this? how clean before exit how kill threads never ending process running script ends when script ends. operation system responsible free resource allocated process including threads. observe opposite? if so, fill bug report operation system.

android - Not able to start new activity on List item click? -

i working on application in not able start new activity on list item click.when click on list item app crashes , not find error. code activity is public class courieractivity extends activity { dbcontroller dbc=new dbcontroller(this); cursor c; simplecursoradapter sca; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.courierlist); final listview courierlists=(listview) findviewbyid(r.id.courierview); dbc.open(); c=dbc.getcouriername(); string [] ={"couriernames"}; int [] to={r.id.couriertext}; sca=new simplecursoradapter(this, r.layout.courierlistrow, c, from, to); courierlists.setadapter(sca); sca.notifydatasetchanged(); c.requery(); courierlists.setonitemclicklistener(new onitemclicklistener() { @override public void onitemclick(adapterview<?> arg0,

desktop applications bandwidth consumption, if there is such -

i'm confused why browser while loading pages buffers lot when i'm having quite few desktop applications running.do desktop applications ms word, excel, etc... consume bandwidth or affect in way? if memory tight , browser needs memory, memory pages allocated other applications might paged out. if cpu tight, browser competing time slices , on network, disk io. far bandwidth concerned, there no reason word or excel consume any, unless acquire data db or run web query (but know it)

c# - PowerTools for Xml Corrupts Document when using NormalizeXML -

i normalizing docx document using normalizexml function xml powertools 2.2 code: simplifymarkupsettings settings = new simplifymarkupsettings{ normalizexml = true, }; my goal search , replace variables, variables not in same "run property" , result not replaced. not want disable proofing in office. after running program docx file corrupt , complains styles when try open (and normalizexml function did not work or finish): the xml data invalid according schema. part:/word/styles.xml,line 1, column 0 i using openxml 2.0 since openxml 2.5 needs .net 4.5 i'm using office 2013. when use openxml 2.0 productivity tool picks error this: error node type : styles error part : /word/styles/xml error node path : /w:styles 1 description : ignorable attribute invalid - value 'w14 w15' contains invalid prefix not defined. here see when open styles.xml : <?xml version="1.0" encoding="utf-8"?><w:styles mc:ignorable=&q

javascript - Creating a nested object from parsed bb code -

i trying create object in javascript given string includes bbcode. var bbstr = 'text [url=http://somelink]links , [i]nested bb code[/i][/url].'; i need recursively iterate through object , transform above string this: var result = { children : [ { text : 'text ', type : 'text' }, { children: [ { text : 'links , ', type : 'text' }, { text : 'nested bb code', type : 'italic' } ], text : null, type : 'url', url : 'http://somelink' }, { text : '.', type : 'text' } ], type : null, text : null }; then send object rendering function recursively create canvas text it. can't head around, how form object. try simple stack-based parser: token = /(?:\[(\w+)(.*?)\])|(?:\[\/(\w+)\])|([^\[\]]+)/g root = {children:[]} stack = [root]