Posts

Showing posts from July, 2013

jquery selected options from one to another -

in following multiple select box when clicked on change button want populate selected items in id="p_prod " display in id="s_prod" , remove them in p_prod , on click of revert want them removed s_prod , repopulate them in p_prod in same order earlier ..how this <select size="10" multiple="multiple" id="p_prod"> <option value="1">prod1</option> <option value="2">prod2</option> <option value="3">prod3</option> <option value="4">prod4</option> </select> <select mulitple="multiple" id="s_prod"> </select> <input type="button" id="change" value="change" onclick="val();"/> <input type="button" id="revert" value="revert" onclick="val();"/> function val() { $('#p_prod...

c# - Get checksum of files contained in a MSI package -

is possible programmaticaly (c#) obtain hashsum of files contained in msi package using microsoft.deployment.windowsinstaller or microsoft.deployment.windowsinstaller.package dlls? i getting files using method: how can resolve msi paths in c#? and not extract files onto fs, hashsum of files using c# code. is possible? windows installer contains msifilehash table . gets populated @ build time 128-bit hashes of files in file table. installpackage files property brings dictionary of of installpathmap objects. keys of collection have file key file table , can used query msifilehash hash. if need calculate hash of installed file comparison against stored hash, installer class found in microsoft.deployment.windowsinstaller has getfilehash method class underlying msigetfilehash function .

c# - Restore value in NumericUpDown -

i have numericupdown. when user changes value, show messagebox confirm. if user selected yes, well. if user selected no, want restore original value. i have run 2 problems: q1. how original value. store in private member variable, updated when user selects yes. know if there better way. q2. changing value original value again triggers event handler. have put if condition handle that. here current code: if (mnumericupdownvalue != mreactantnumericupdown.value) { bool change = !mismodified; if (mismodified && reportchangewarning()) { change = true; } if (change) { mreactantgroup = (int)mreactantnumericupdown.value; clearuservalues(); updatecontrols(); } else { mreactantnumericupdown.value = mnumericupdownvalue; } } if binding value prevent changing number @ until user confirms. write property this: private int _testnumber; public int testnumber { { retur...

grails - Spring Security Reauthentication with Persistent Logins -

i using grails spring security core persistent logins. thus, login information of user stored in database. problem following case: a user logged in , username change x y. means have reauthenticate user with: springsecurityservice.reauthenticate y remembermeservices.loginsuccess(request, response, springsecurityservice.authentication) in database username persistent token remains x. how can set new entry persistent token new username y? you should find existing database entry user. can done username. can set new database entry persistent token remembermeservices.loginsuccess. finally, have reauthenticate user.

java - How can read text file from position -

i'm trying develop application can read files. don't know how can change position of reader pointer, please? for(int i=0; i<tab.length; i++){ char cbuf[] = new char[tab[i]]; try { inputstream ips=new fileinputstream(fichier); inputstreamreader ipsr=new inputstreamreader(ips); bufferedreader br=new bufferedreader(ipsr); //i need change position of pointer here br.read(cbuf, 0, tab[i]); tabs[i] = new string(cbuf); system.out.println(tabs[i]); br.close(); } catch (exception e){ system.out.println(e.tostring()); } } the read command lets take in next character. use loop take in characters // reads , prints bufferedreader int alength = 10; int array[] = new int [alength]; int value = 0; int index = 0; while((value = br.read()) != -1 && index < alength) { array[index++] = value; }

c++ - Qt, Dynamic allocation of memory -

i have little question: made little program every time user click on qpushbuton new object created pointer, here code: ajoute *az = new ajoute; qvboxlayout *layoutprincipal = new qvboxlayout; the problem every object have been created have same name if want delete object there have error ? p.s : sorry bad english, i'm french the problem every object have been created have same name if want delete object there have error? it seems creating group of dynamically allocated objects , don't know how store pointers. simplest way use qvector<ajoute*> , store dynamically allocated objects: qvector<ajoute*> v; now whenever create ajoute do: v.push_back( new ajoute ); that add pointer @ end of vector (container). can access them in order doing: v[0]; // first v[1]; // second v[2]; // third and can delete them as: delete v[0]; // example just remember delete pointer inside vector well: v.remove(0);

ios - Labels not appearing after clicking cell -

i'm still new programming. i'm doing final project ios dev class , build basic app. i've been trying figure out how complete few days , it's 1 problem after other. pressed time since due tomorrow. app supposed show list of chevy cars , picture next each car name. takes place in table view controller. problem lies when click cell. labels information of car blank. example, have label says "horsepower," , next it, supposed display actual horsepower of car. instead of displaying actual horsepower, displays blank label. there missing? there way can show guys code used? have '1" reputation. any appreciated. this tableviewcontroller: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cartablecell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath]; cell.textlabel.t...

Image Hyperlink in ASP.NET - MVC 4 -

i try create project first time in asp.net (mvc4). and try create image hyperlink go index page. i have search lot of things , shows simple that. but can´t understand why doesn´t work me. someone can give hand? code: <a href="<%= url.action("index","home")%><img src="~/content/imagens/nav-arrow-back.png"/></a> the action "index" in controller calls home. first up, noted you're missing closing quote on href . second, mvc 4 doesn't use <% %> syntax, @ least not default; should using razor v2 uses @ , code should this: <a href="@url.action("index","home")"><img src="~/content/imagens/nav-arrow-back.png"/></a> if use old syntax assume try handle actual text <%= url.action("index","home")%> url, won't work.

python - Confused about self in derived class and relation to base class member variables -

in code sample below using self.number in derived class, b, , number defined in (the base class). if data member defined in way in base class, accessible derived class? i using python 2.7. correct way refer base object member variables? class a(object): def __init__(self, number): self.number = number print "a __init__ called number=", number def printme(self): print self.number class b(a): def __init__(self, fruit): super(b, self).__init__(1) self.fruit = fruit print "b __init__ called fruit=", fruit def printme(self): print self.number cl1 = a(1) cl1.printme() cl2 = b("apple") cl2.printme() unless in subclass eliminate it, yes. attributes assigned python objects added object's __dict__ (except relatively rare cases slots used or __setattr__ overridden non-standard), , implicit first argument bound member method going same methods originating child or...

tsql - multiple rows in one row -

so have table, looks this: id | parentid | name | typeid --------------------------------------- 1 | 2 | thing1 | 1 2 | 4 | region1 | 0 3 | 4 | region2 | 0 4 | null | region3 | 0 5 | 3 | foo1 | 2 5 | 3 | foo2 | 2 6 | 3 | bar1 | 3 what need, output this: id | region | thing | foo | bar -------------------------------------------- 1 | region1 | thing1 | null | null 2 | region2 | null | foo1 | bar1 3 | region2 | null | foo2 | null 4 | region3 | null | null | null with this select id, (case when [typeid] = 0 [name] end) region, (case when [typeid] = 1 [name] end) thing, (case when [typeid] = 3 [name] end) foo, (case when [typeid] = 5 [name] end) bar [my].[dbo].[foobarthingtable] type = 0 or type = 1 or type = 3 or type = 5 i (logically): id | region | thing | foo | bar -----------------...

asp.net mvc - custom validator MVC + validation client side -

i create custom validateur in mvc 4: public class firstnamevalidator : validationattribute { private iregistrationconfiguration _registrationconfiguration; public string category { get; set; } public bool islocal { get; set; } public firstnamevalidator() { _registrationconfiguration = dependencyresolver.current.getservice<iregistrationconfiguration>(); } public firstnamevalidator(iregistrationconfiguration registrationconfiguration) { _registrationconfiguration = registrationconfiguration; } protected override validationresult isvalid(object value, validationcontext validationcontext) { if (value == null) { return new validationresult("le prénom ne doit pas être vide"); } else { if(string.isnullorempty(value.tostring())) return new validationresult("le prénom ne doit pas être vide"); else if(va...

javascript - jquery custom data attribute not working inside div tag -

i using div code <div data-role="page" data-last-value="43" data-hidden="true" data-options='{"name":"john"}'></div> and trying print values japp.init = function () { console.log($("div").data("role")); console.log($("div").data("lastvalue")); console.log($("div").data("hidden")); console.log($("div").data("options").name); }); this works fine if put above div tag directly inside body put div tag inside other div tag not work , says undefined. <div class="page"> <div data-role="page" data-last-value="43" data-hidden="true" data- options='{"name":"john"}'></div> </div> console prints undefined above html. please let me know if not clear when getting data jquery returns data first element matching selector...

php - Assign an individual checkbox value as an array -

is there way of assigning value of checkbox array. i have load of checkboxes, 1 of option. set value of array? i have tried creating array of ints (ids) array of objects using simple loop , using print_r in value (i know bit ugly , can see why wouldn't work can't seem find correct syntax). $arrallid = array(); foreach ($availablegroups $objasrdcallbackgroup) { $arrallid[] = $objasrdcallbackgroup->m_igroupid; } <input id="group-name" value="<?php print_r($arrallid) ?>" name="selectedgroups[]" type="checkbox">all also design around , retrieval of collection when form posted checking if selected or know how can now.. any received. thanks you can use html5 data attribute store array of values. i'm not familiar php, data attribute render on client, , if checkbox clicked, can loop through array in data attribute , whatever need send data server. <input id="group-name" data-allid=...

multiprocessing - What is the difference between stream and pipe in C -

in inter process communication(ipc), communicate each process "pipe" os provides should needed. , transmit data input unit program or program output unit "stream" os provides should needed. here questions. are there differences between pipe , stream?? if different, because functions similar isn't more useful using "pipe" or "stream" transmit data?? a pipe communication channel between 2 processes. has writing end , reading end. when on open 1 of these 2 end, 1 (writing or reading) stream. in first approximation there stream @ each end of pipe. so set ipc, should create pipe using function pipe . return 2 int s identifying 2 ends of pipes; usually fork 2 processes; open each end of pipe (usually in different process after forking) , 2 corresponding streams. see http://www.gnu.org/software/libc/manual/html_node/creating-a-pipe.html

asp.net - getting data from repeater controls -

i have repeater contains different controls textbox, dropdownlist,etc... values of these controls populated in itemdatabound of repeater. want values these controls, when click on button. repeater in page has masterpage. the button code follows protected void butedit_click(object sender, eventargs e) { location loc = new location(); dictionary<string, dictionary<int, string>> ret = dbcommon.fillinterface(loc); foreach (repeateritem repeated in repedit.items) { dropdownlist drp = (dropdownlist)repeated.findcontrol("drpdown"); textbox txt = (textbox)repeated.findcontrol("txt"); checkbox chk = (checkbox)repeated.findcontrol("chk"); if (drp != null && !string.isnullorempty(drp.attributes["id"])) { loc.gettype().getproperty(drp.attributes["id"].split('#...

struts2 - Spring DI : session vise object creation using aop proxy for inherited class -

in project have used struts2 , spring. spring used di. having actions created sessions , model beans via spring di. want use inheritance class generated through aop based proxy , per session. coding goes below. <bean id="common.eshopdefaultaction" class="com.common.actions.eshopdefaultaction" scope="session" > <property name="site" ref="master.site" /> <property name="menu" ref="master.menu" /> <property name="indexdao" ref="common.indexdao" /> <property name="categorydao" ref="master.categorydao" /> <property name="productdao" ref="master.productdao" /> </bean> <bean id="common.indexaction" parent="common.eshopdefaultaction" class="com.common.actions.indexaction" scope="session"> <property name="indexinfo" ref="common.i...

math - python: code optimisation by precalculation of constant therms -

i write flexible simulation program. flexibe because user should able customize calculations via python code. customisation begins defining "constants" (constants in sense can never change value). can use constants , few known predefined variables define python calculation code. code later processed in fixed program code. here simplified example: # begin user input width = 20.0 # user defined constants cond = 10.0 calc_code = "cond*width*x" # x known changing variable # end user input # begin hidden fixed program code code = compile( ''' def calc(x): # function executes user code return ''' + calc_code , '<string>', 'exec') exec(code) # python 2.x remove brackets x in range(10): print(calc(x)) # python 2.x remove brackets # end hidden fixed program code the problem user code executed , slows down calculation significantly. possible somehow automaticaly find , precalculate constant terms in code...

jquery - Changing an image when clicking a thumbnail, with multiple instances on one page -

i trying create page has several instances of large images smaller thumbnails. i want make when user clicks on thumbnail large image in parent div of thumbnail large version of thumbnail. i know how make happen if there 1 instance of on page, i'm having trouble multiple instances. here code have far: html <div> <img src="upload/1374000286_large.jpg" /> <div class="thumbnails" > <img src="upload/1374000286_small.jpg" /> <img src="upload/1374000773_small.jpg" /> </div> </div> jquery $('.thumbnails').click(function(){ $(this).attr('src',$(this).attr('src').replace('small','large')); }) }); this bind function on onclick event of each image src attribute contains string small , proceed change of large image's source, sibling of the parent div , when thumbnail clicked: javascript/jquery $.each($(...

java - Android : manually streaming audio effeciently using AudioTrack and Socket -

the basic idea create application can record audio 1 device , send on wlan using sockets device play it. in nutshell lan voice chat program. i recording live audio mic using audiorecord object , read recorded data byte array ,then write byte array tcp socket. receiving device reads byte array socket , writes buffer of audiotrack object. its like audio record-->byte array-->socket--->lan--->socket-->byte array-->audiotrack the process repeated using while loops. although audio playing there lagging between frames. i.e when hello receiver hears he--ll--o. although audio complete there lag between buffer blocks. as far know lag due delay in lan transmission how improve it? approach should use smooth in commercial online chat applications skype , gtalk? sounds need longer buffer somewhere deal variance of audio transmission on lan. deal create intermediary buffer between socket byte array , audio track. buffer can x times size of buffer used in...

asp.net mvc - Preferred method of adding records to custom tables in Umbraco? -

i've finished creating custom surface controller sends out emails after user has filled in details of contact form. however i'm trying store these records in custom table i'm not sure available methods have of doing this? in previous versions of umbraco ie. < 4.8 i'd create linq 2 sql classes , save records using datacontext object. now umbraco 6 has moved mvc i'm little unsure how should proceed. i've been looking using entity framework add custom records i've seen this article , wonder if there's simpler way of adding these new records database? is able point me in right direction here? optimal way of adding records custom tables in umbraco 6? thanks! there 2 answers question: use framework/solution ef; use contour if haven't looked @ it, contour umbraco plugin need. see here more information contour . however, more control use petapoco or more npoco (via nuget) , autofac inject database (analogous datacontext) con...

css - Center overflowing element inside other element -

i have iframe inside div this: <section> <div> <iframe></iframe> </div> </section> the iframe contains youtube video in flash won't matter in case. i'm building mosaic , therfore trying use div crop iframe appropriate size. this done by .section {height: 251px; width: 198px; overflow: hidden} works great center video aswell. images, add them background-images , use background-size: cover to center them. neat because automatically rescale maximum possible size. doesn't work video. settle centering iframe vertically , horizontally, if possible. will adding css help? works if div bigger section. section div { margin-top:-50%; margin-left:-50%; } http://jsfiddle.net/hvcxm/

java - android-why I can't get device orientation? -

i want make app shows device orientation on 3 axises while user clicks on button, result 0.0|0.0|0.0 (no rotation) , why? package com.example.newp; import android.app.activity; import android.hardware.sensormanager; import android.os.bundle; import android.view.view; import android.widget.toast; public class fullscreenactivity extends activity { @override public void oncreate(bundle icicle) { super.oncreate(icicle); setcontentview(r.layout.activity_fullscreen); } public void onbuttonclick(view view) { float[] mgravs = new float[3]; float[] mgeomags = new float[3]; float[] mrotationm = new float[9]; float[] minclinationm = new float[9]; float[] morientation = new float[3]; sensormanager.getrotationmatrix(mrotationm, minclinationm, mgravs, mgeomags); sensormanager.getorientation(mrotationm, morientation); toast.maketext( this, string.valueof(morientation[0]) + "|" + ...

sql - Simple psql count query -

i new postgresql , generate summary data our table we have simple message board - table name messages has element ctg_uid . each ctg_uid corresponds category name in table categories . here categories select * categories order ctg_uid asc; ctg_uid | ctg_category | ctg_creator_uid ---------+--------------------+----------------- 1 | general | 1 2 | faults | 1 3 | computing | 1 4 | teaching | 2 5 | qis-feedback | 3 6 | qis-phys-feedback | 3 7 | sop-?-change | 3 8 | agenda items | 7 10 | acq & process | 2 12 | physics-jobs | 3 13 | tech meeting items | 12 16 | incident-forms | 3 17 | errors | 3 19 | files ...

CSS Mozilla center alignment -

i have page, after rendering should return cloud tags. , works fine. alignment of tags not in center in mozilla. tags in center in chrome , i7, in mozilla on left side. my .html: {% extends "base.html" %} {% block title %} tag cloud {% endblock %} {% block head %} tag cloud {% endblock %} {% block content %} <div id="tag-cloud"> {% tag in tags %} <a href="/tag/{{tag.name|urlencode}}/" class="tag-cloud-{{tag.weight}}">{{ tag.name|escape }}</a> {% endfor %} </div> {% endblock %} my .css: #nav { float:right; } input { display:block; } ul.tags, ul.tags li { list-style: none; margin: 0; padding: 0; color: blue; display: inline; } #tag-cloud { text-align:center; } #tag-cloud { margin: 0 0.2em; } .tag-cloud-0 { font-sie:100; } .tag-cloud-1 { font-sie:120; } .tag-cloud-2 { font-sie:140; } .tag-cloud-3 { font-sie:160; } .tag-cloud-4 { font-sie:...

javascript - Css Hover on touch enabled devices using touchstart and touchend -

i have simple website has few :hover effects in it, placed on div's, not links. need make these effects visible on ipad. i using 'touchstart' in header: <script> document.addeventlistener("touchstart", function(){}, true); </script> which job... on ipad, when touch div, mouse on (hover) effect displayed. when touch anywhere outside of div, effect reversed (mouse out). however, need effect reverse if tap on same div again... anyone able help? thanks! m

oracle - SQL to get Latest Objects -

i have oracle table has pk of object_id, , field called system_id. system_id can occur multiple times , acts master associate multiple versions of object. what need retrieve latest object_id each system_id in table. can assume largest object_id latest, can use max function. problem doing each system_id. maybe need write pl/sql instead of basic sql query? thoughts? thanks in advance! well, use max , group ? select max(object_id) maxobjectid --, system_id table group system_id

twitter bootstrap - Highcharts Pie chart not centered on container -

good morning. i'm trying display various charts on bootstrap's carousel. problem when change second item of carousel it's not displayed centered on div. when open firebug on ff or developer tools on chrome gets centered. tried set width of div width:100% , centered content didn't worked. idea workaround? here's fiddle http://jsfiddle.net/l4aj9/ . thanks in advance

Java library for finding executables -

i using the processbuilder class execute executables on windows , linux. is there easy way find these executables without knowing directory path executable. e.g. //which command functionality string executable = which("executable_name"); list<string> command = new arraylist<string>(); command.add(executable); processbuilder builder = new processbuilder(command); .. .. it great if there function command on linux? any ideas or have loop on , parse path environment variables using system.getenv("path"); use where command on windows. where [/r dir] [/q] [/f] [/t] pattern if not specify search directory using /r , searches current directory , in paths specified path environment variable. here's sample code finds 2 locations notepad.exe resides on windows. string searchcmd; if (system.getproperty("os.name").contains("windows")) { searchcmd = "where"; } else { // i'm assuming linux her...

html - jQuery Fancybox working locally but not on webhost -

my jquery fancybox works on local computer, doesn't work website live on 000webhost. cannot find answers why! my website : sarahmeasom.com i appreciate take @ me, because baffled! basically, on portfolio of work click on bring image, itstead loading image , taking page! thanks help! this code im using create boxes: work. <ul class="cols clearfix"> <li> <div class="clearfix"> <h2 class="floatleft">circle cover</h2> <a href="./" class="more floatleft">website</a> </div> <a href="./tmp/circlecover_2.jpg" class="thumb"> <span class="zoom"></span> <img src="./tmp/circlecover_1.jpg" ...

google cloud storage - Enforcing object max size and content/mime type within signed upload URLs -

in order generate expiring upload urls using cloud storage signed urls . now, need restrict maximum file size (i.e. 32mb) , accepted content-types - image files valid. there built-in mechanism within gcs allow enforce upload policies? you can restrict content-type, option part of string when creating signed url . google cloud storage return when http requests made objects. it's possible specify policy document when preparing signed post request, including requirements expected content-type , content-length-range minimum , maximum size. for cases values supported policy document not enough, can use object change notification implement custom validation on uploads, including limiting size. if upload didn't meet rules, delete immediately.

sql server - Ensure that one and only one default is defined for a set -

i have customer table has 1 many relationship address table. want constrain database customer with addresses have 1 (and one) default address. i can quite add constraint ensure there ever 1 default address each customer. struggling on how apply constraint ensures address marked default. to summarize: a customer not required have addresses. if customer has addresses there must default address. there must 1 default address per customer. here example of problem , 'unit' tests. using link table join customers , addresses. create table customer ( id int primary key, name varchar(100) not null ) create table [address] ( id int primary key, address varchar(500) not null ) create table custaddress ( customerid int, addressid int, [default] bit not null, foreign key (customerid) references customer(id), foreign key (addressid) references [address](id) ) insert customer values (1, 'mr greedy') insert [address] values (1, ...

php - Select boxes auto populated by JSON sometimes need a refresh before displaying -

i have json file being used autopopulate select boxes. every , (i can't recreate fault, appears random) items in drop down not display until refresh page. i've checked console , log etc, file loading fine, no errors appearing , i'm little @ loss. any ideas? example of json , script reads below. thanks. "radabsorbed" : [ { "value" : "rad", "name" : "rad(rd)" }, { "value" : "millirad", "name" : "millirad(mrd)" }] and script: <script> // json: // key class identifier, temp, area etc etc // value being used both id , value when list being populated $.getjson('json/conversionjson.json', function(data){ console.log(data); //for testing output var list = $("<ul />"); $.each(data, function (key, conversions) { console.log(key + ...

ios - setIsAccessibilityElement not working in Custom TableViewCell? -

i using custom tableviewcell. want disable accessibility cell , unchecked accessibility in custom tableview cell xib. , in implementation file, trying set setisaccessibilityelement no. [self setisaccessibilityelement:no]; and have set accessibilityelement no subviews inside tableviewcell. still find accessibility enabled when run application. can please suggest other alternative way disable accessibility custom tableviewcell ? try self.accessibilityelementshidden = yes;

perl - Why does adding a character class to the end of a regex fail to match hex numbers? -

perl accepts: my @resultado = $texto =~ /[^g-zg-z]$re{num}{real}{-base=>16}/g but doesn't accept: my @resultado = $texto =~ /[^g-zg-z]$re{num}{real}{-base=>16}[^g-zg-z]/g i add [^g-zg-z] @ end; @ beginning works not @ end. why? want print hexadecimal numbers but, example, in cases there word 'call' should not 'ca' hexadecimal number. the character class [^g-zg-z] matches single character not in range g through z. not want matching hexadecimal digit. example, if hex number occurs @ end of string (that is, nothing follows it), match fail. you did not provide sample data. pattern such as my @resultado = $texto =~ /\b([0-9a-fa-f]+)\b/g; may give want. \b matches @ word b oundary, , constrains hex digits occur within single “word.” in regexp::common terms, above line expressed as my @resultado = $texto =~ /\b($re{num}{int}{-base => 16})\b/g;

Rails strong parameters incremental addition -

does know, if strong_parameters gem, can incrementally add attributes below: def user_params params[:user].permit(:name, :email) if current_user.admin? params[:user].permit(:is_admin) end end here incrementally asking code permit :is_admin parameter if current user admin. shouldn't add permitted list of parameters ( :name , :email )? they way have done put params in class strong-parameters railscast.. this way have this class permittedparams < struct.new(:params,:admin) def administrator_attributes allowed = [:email, :name, :password, :password_confirmation, :password_digest] if admin.has_any_role? :realm_admin, :system_admin allowed << :active << :roles end allowed end .... other models .... def method_missing(method,*args,&block) attributes_name = method.to_s + '_attributes' if respond_to? attributes_name, false params.require(method).send(:permit, *method(attrib...

tsql - T-SQL Query not returning proper results -

i have query want capture sales parts. expecting full results parts table , if there no sales part in timeframe, want see 0 in sales column. not seeing that. getting parts had sales. select part, sum(sales) dbo.parts left outer join dbo.salesdata on part = part salesdate > '2011-12-31' group part order part what doing wrong? i believe because where clause removing parts don't have sales because won't have salesdate. try:- select part, sum(sales) dbo.parts left outer join dbo.salesdata on part = part , salesdate > '2011-12-31' group part order part

knockout.js - ko.validation with multi-step wizard style models -

i trying convert this answer use ko.validation. i stuck @ getting next button enable when model state valid, code below not evaluating correctly: self.modelisvalid = function() { self.currentstep().model().isvalid(); }; i stuck , appreciate fresh eyes take look. model validate ok (with error messages shown) final step validate each model modelisvalid controls next button. a jsfiddle here , , code below. ko.validation.configure({ insertmessages: false, decorateelement: true, errorelementclass: 'error' }); function step(id, name, template, model) { var self = this; self.id = id; self.name = ko.observable(name); self.template = template; self.model = ko.observable(model); self.gettemplate = function() { return self.template; }; } function viewmodel(model) { var self = this; self.namemodel = ko.observable(new namemodel(model)); self.addressmodel = ko.observable(new addressmodel(model)); ...

java - How do enable cut, copy in JPasswordField? -

i noticed unable cut , copy in jpasswordfield ? how copy/cut selected part of password clipboard? there methods this? simple, use method jpasswordfield jt=new jpasswordfield(20); // put client property jt.putclientproperty("jpasswordfield.cutcopyallowed",true); add(jt); by default, password in jpasswordfield not allowed cut/copied. need enable them. as per comment on disabling paste didn't find property, have achieved using this, (i dont recommend way) jt.getactionmap().put("a",null); jt.getinputmap(jcomponent.when_focused).put(keystroke.getkeystroke("ctrl v"),"a"); another way, override paste() (i recommend way) while declaring jpasswordfield jt=new jpasswordfield(20){ public void paste(){} }; update: misunderstood comment. above disabling paste. disable 1 of copy/cut/paste, better if required method disabled overrided no implementation in it. if there better way...

avr - why is the clock of my atmega16 not working correctly, has anything to be configured? -

i haven't connected oscillator circuit in atmega16. doesn't have work on it's default clocks? please answer me, if other configurations required or settings have done in dumper program itself? using code vision avr , generates codes itself, tried avrstudio code, didn't work! beginner trying make digital clock on 16x2 lcd, lcd stuff okay! timer has problem, it's not showing correct resolution! hw issues, ensure have @ least 100nf folium capacitor between power , gnd on atmega16. have it? should have larger electrolytic filtering capacitor 100uf whole project. have high enough voltage run clock frequncy? check datasheet required voltage. read fuses determine if have internal oscilator configured , determine internal clock frequency should have, review code if makes more sense. there link checking fuses directly code vision

c++ - Reconcile two lists -

so have 2 different lists, different formats , structure need reconciled. essentially, set b needs match what's in set a, want preserve state of existing items in set b , not overwrite them what's in set a. for reference, list doesn't mean list. "lists" come in couple of different forms straight arrays maps. use standard iterators access elements. the way typically handle so... for item in lista if listb contains item mark item in list b visited else add item list b item in listb if visited true continue else add item removelist item in removelist remove item list b this works , real way can think of it. don't how many iterations have though, having 3 loops back feels wrong. however, since i'm using iterators can't remove lists while i'm checking them , instead have add them third remove list. in potential answers please keep in mind speed , memory footprint more important me how easy wri...

php - How to Check for PEAR Mail SMTP Authentication Failure -

i'm constructing smtp e-mail framework have default username , password sending e-mails (using php's pear mail), want have functionality provide alternate e-mail account credentials sending e-mail. so, debugging need able determine why e-mail unable sent. know of easy determine failure due authentication issue? i ran test case invalid password. check errors: if (pear::iserror($mail)) { echo("<p>" . $mail->getmessage() . "</p>"); } else { echo("<p>message sent!</p>"); } with error message being: authentication failure [smtp: invalid response code received server (code: 535, response: 5.7.3 authentication unsuccessful)] so, parse string , determine "authentication failure", if i'm confident response when there authentication failure. question is, can expect message returned if there authentication failure, or know of easier solution verifying login credentials before or after attempt...

shell - Raspberry Pi escape character -

i trying create shell script in automatically run video fullscreen. has no way quit unless shut down raspberry pi. what small script can use bind "!" quit application? i searched google 'omxplayer exit fullscreen' , found answer, posted dom on raspberrypi forum: changing tv modes lose content on them (e.g. console framebuffer). you can provoke console framebuffer recreated with: fbset -depth 8 && fbset -depth 16 add end of script launches omxplayer. (for points read depth before launching omxplayer , set original value afterwards) you might want check issue report on omxplayer's github .

php - chat room displaying for two users -

i making chat room.and code works can see each other has chatted.i want restrict able seen 2 people chatting. this chat.php <?php include_once("chat.funct.php"); if(isset($_post['send'])){ if(send_msg($_post['sender'],$_post['message'])){ echo "message sent..."; } else{ echo ("message sending failed"); } } ?> <div id="messages"> <?php $messages = get_msg(); foreach($messages $value) { echo '<strong>'.$value['sender'].' sent</strong><br />'; echo $value['message'].'<br /><br />'; } ?> <form method="post" > <label>enter name:<input type="text" name="sender"/></label> <label>enter message:<textarea name="message" rows="8" cols="70"></textarea></label> ...

php - What to do after transaction rollback -

i need advise. what best thing when there rollback after starting transaction? execute rest of website kill complete website, , display error message. thanks! it depends on want do. however: you don't want put raw error message in front of user, should meaningful. the meaningful message, should have same , feel of rest of page, , not white page black writing. it should include kind of navigation, user can recover error. if form, user presumably re-try data possible should still in form not duplicate work.

c# - Keep object alive during unmanaged asynchronous operation -

i'm working unmanaged function takes pointer unmanaged memory. function returns when called , asynchronously operates on memory in background. takes additional intptr passes managed code when operation completes. it's possible have multiple such operations running @ same time. i'm encapsulating pointer unmanaged memory in custom safebuffer instance i'd when asynchronous operation completes. safebuffer ensures memory gets released when there no references it. problem memory, of course, shouldn't released while it's still in use unmanaged function. how can achieve this? unmanaged function called billions of times, performance critical. i allocate gchandle whenever call function, use safebuffer when operation completes, , free it. however, allocating handles seems expensive , performance decreases on time. i allocate gchandle once, unmanaged memory not released when memory not in use unmanaged function , there no references safebuffer. any ideas? ...

Inheritance for durandal (HotTowel) viewmodels? -

simple question, pretty sure it's complicated answer :) is possible implement form of inheritance viewmodels in durandal? so if have viewmodel this: define(['durandal/app', 'services/datacontext', 'durandal/plugins/router', 'services/logger'], function (app, datacontext, router, logger) { var somevariable = ko.observable(); var issaving = ko.observable(false); var vm = { activate: activate, somevariable : somevariable, refresh: refresh, cancel: function () { router.navigateback(); }, haschanges: ko.computed(function () { return datacontext.haschanges(); }), cansave: ko.computed(function () { return datacontext.haschanges() && !issaving(); }), goback: function () { router.navigateback(); }, save: function() { issaving(true); return datacontext.savechanges().fin(function () { issa...

javascript - jQuery serialize() leaves out textarea -

when submit form using jquery's serialize() method, gets submitted except textarea in form. common issue? can't figure out. form works except textarea stays undefined??? <textarea form="new_note_form" id="note_text" name="note_text" required="required"></textarea> it not work until add name attribute textarea. <textarea id="slifestyle3content" name="slifestyle3content" placeholder="html allowed"> <apex:outputtext value="{!slifestyle3content}" /> </textarea>

c# - Saving Photos (CameraCaptureTask) to Isolated Storage - OutOfMemoryException -

i save photo, taken within app(using cameracapturetask), isolated storage. current problem consumption of ram, leads outofmemoryexception . happens when loading picture image-control. my app should able take 10 pictures, save them isolated storage, show them in image control , if necessary delete picture good. lowering resolution of pictures logically fixed exception, that's not way wanted go. maybe can give me hint. here code: private cameracapturetask cctask = new cameracapturetask(); writeablebitmap[] imglist = new writeablebitmap[10]; random rnd = new random(); private void addpicture_button_click(object sender, eventargs e) { cctask.show(); cctask.completed += cctask_completed; } void cctask_completed(object sender, photoresult e) { if (e.taskresult == taskresult.ok) { writeablebitmap writeablebitmap = new writeablebitmap(1600,1200); writeablebitmap.loadjpeg(e.chosenphoto); string imagefolder = ...

php - Making sure expected methods are callable -

so testing class , expecting call method dependency: $usermock = mockery::mock('user'); $usermock->shouldreceive('updatetimestamps')->once()->andreturn($usermock); sure test passed, problem didn't realize updatetimestamps private method! if test passed fail if try manually. there way make sure methods give expectations callable? the php reflection class allow test this.

Simple way to get multiple related objects in Parse.com with Javascript? -

i have player class. players can have x number of trophies. have player objectid , need list of of trophies. in parse.com data browser, player object has column labeled: trophies relation<trophy> (view relations) this seems should simple i'm having issues it. i have parseobject 'player' in memory: var query = new parse.query("trophy"); query.equalto("trophies", player); query.find({ /throws error- find field has invalid type array. i've tried relational queries: var relation = new parse.relation(player, "trophies"); relation.query().find({ //also throws error- substring being required. this has common task, can't figure out proper way this. anyone know how in javscript cloudcode? many thanks! edit-- i can relational queries on user fine: var user = parse.user.current(); var relation = user.relation("trophies"); relation.query().find({ i don't understand why same bit of code breaks ...