Posts

Showing posts from April, 2014

javascript - What would be the best practice for retaining a state on refresh in React/Flux? -

this typically solved using local storage or cookies in angular. i'm assuming similar process appropriate in flux. use localstorage within store retain state? or make fresh set of requests on refresh? pointers appreciated. local storage or cookies work fine, yes. in store, can use local storage or firebase keep data -- , cache in javascript object. way, when asked data, store can check see if has data in memory and, if not, check against more permanent storage mechanism of local storage, firebase -- or going server if need be.

go - What does lexical file name order mean? -

in package initialization part of go specification, "lexical file name order" mean? to ensure reproducible initialization behavior, build systems encouraged present multiple files belonging same package in lexical file name order compiler. from wikipedia : lexical order generalization of way alphabetical order of words based on alphabetical order of component letters. in practice means files names compared strings, using character codes decide order. order of character codes of english alphabet follow natural order of letters, character code order important if non-letters part of file name (e.g. digits , other characters '-' ). this convention define (arbitrary) order of source files if package contains multiple source files, order remains same if package recompiled (and of course files not renamed). the purpose source files processed in same order, , therefore package init() functions executed in same order, , observe same behavio

sprintf in C (pointer to an array of char elements) -

i newbie in c, , want like uint8_t message[12]; message[0] = 0x00; message[1] = 0x00; message[2] = 0x00; message[3] = 0x00; message[4] = 0x00; message[5] = 0x00; message[6] = 0x00; message[7] = 0x00; message[8] = 0x00; message[9] = 0x00; message[10] = 0x00; message[11] = 0x00; sprintf(_smess,"at$ss=%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", message[0], message[1], message[2], message[3], message[4], message[5], message[6], message[7], message[8], message[9], message[10], message[11]); but don't know how declare variable _smess, i've tried char *_smess or uint8_t _smess[12] got error anyway if declare char _smess[43]; got error: multiple markers @ line - incompatible implicit declaration of built-in function 'sprintf' [enabled default] - implicit declaration of function 'spr

javascript - JQuery Sortable Drag and Drop issue -

Image
i've implemented jquery drag , drop functionality , i've found slight bug. can drag element smallest amount , it'll still assigned when decide drop because don't want drag element anymore. how check element above table want drop selected element into? how drag , drop works @ moment (only have drag slightly) how should work (don't want able drag) sortable code: $(document).ready(function () { $("#assign tbody").sortable( { connectwith: "#assign tbody", scroll: false, cursor: 'move', stop: function (event, info) { alert("done assign"); } }).disableselection(); $("#remove tbody").sortable( { connectwith: "#remove tbody", scroll: false, cursor: 'move', stop: function (event, info) { alert("done remove"); } }).disableselection(); }); js fiddle example: http://jsfiddle.net/lhk941tc/

java - I received javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake -

when tried make ajax call httpclient 4.4.1 hit web service located in other site, , i'm seeing following problem: javax.net.ssl.sslhandshakeexception: remote host closed connection during handshake @ sun.security.ssl.sslsocketimpl.readrecord(unknown source) @ sun.security.ssl.sslsocketimpl.performinitialhandshake(unknown source) @ sun.security.ssl.sslsocketimpl.starthandshake(unknown source) @ sun.security.ssl.sslsocketimpl.starthandshake(unknown source) @ org.apache.http.conn.ssl.sslconnectionsocketfactory.createlayeredsocket(sslconnectionsocketfactory.java:394) @ org.apache.http.impl.conn.defaulthttpclientconnectionoperator.upgrade(defaulthttpclientconnectionoperator.java:185) @ org.apache.http.impl.conn.poolinghttpclientconnectionmanager.upgrade(poolinghttpclientconnectionmanager.java:369) @ org.apache.http.impl.execchain.mainclientexec.establishroute(mainclientexec.java:415) @ org.apache.http.impl.execchain.mainclientexec.execute(mainclientexec.java:236) @ org.apache.http

All possible subsets of a set using bit manipulations in Java -

how can generate possible subsets of set using bit manipulations in java? example, if have int array [1, 2, 3] , possible subsets are: [ [3], [1], [2], [1,2,3], [1,3], [2,3], [1,2], [] ] count 0 (2 set.size() - 1) (inclusive). retrieve elements corresponding 1 bits in current count. set have ordered retrieve elements index, of course. the tricky part pulling out elements corresponding 1 bits in current count. here's pseudocode 1 way that: for (int pos = 0, mask = 1; mask <= currentcount; mask <<= 1; ++pos) { if ((currentcount & mask) != 0) { include element @ pos in current subset } } note assumes original set size no more number of bits available whatever integer type using count , mask.

How to use environment variables in Jenkins by the Java? -

Image
i trying access environment variables in jenkins through java: public static webdriver getjenkinsdriver() throws malformedurlexception { desiredcapabilities caps = new desiredcapabilities(); string url = ""; map<string, string> env = system.getenv(); (string envname : env.keyset()) { system.out.format("%s=%s%n", envname, env.get(envname)); } if (system.getenv("selenium_service").equalsignorecase("saucelabs")) { caps.setbrowsername(system.getenv("selenium_browser")); caps.setversion(system.getenv("selenium_version")); caps.setcapability(capabilitytype.platform, system.getenv("selenium_platform")); url = "http://ricardo...saucelabs.com:80/wd/hub"; ... } } output of command for: path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/

javascript - How to append selected item of several ASP.NetRadioButtonList and display within a html Div using Jquery? -

i have situation have 3 4 radiobuttonlist on web form , want display each selected items these radiobuttonlist within html div in format "a/b/c/d" . here a item of radiobuttonlist1, b of radiobuttonlist2, c of radiobuttonlist3 , d of radiobuttonlist4. i able display selected items within html div, problem want display selected item on every click event of radiobuttonlist. i.e. when select item radiobuttonlist1 "a" gets displayed within div, when select "b" item radiobuttonlist2 "a/b" gets displayed when select "c" radiobuttonlist3 "a/b/c" gets displayed. please guide me how can achieve this- my aspx page- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script type="text/javascript"> $(function () { var $radbtn = $('#<%= radiobuttonlist1.clientid %> input:radio&

Java: Replace String (with brackets!) -

i'm working on small program that: reads excel document (.xlsx, using smartxls) , saves content in long string (a new line each cell) reads config file , converts substrings in long string (replaceall) and/or adds prefix, according examples in config file outputs final string txt file example conversion: b c (with tab in between each of parts), e.g. "its[ ]bracket" -> "itsabracket" with tagname [ ] in config file ("[ ]" gets replaced "a"). tag tells me, columns converted, b original substring , c string b has converted into. the problem is: know brackets (round, curly , square) going used in config file don't know, if it's going single 1 or maybe longer phrases (with letters, digits,..) in between brackets. string s = s.replaceall(convert[i].original, convert[i].new); for "[ ]" -> "a" writes [a] output file , if following first, when it's reading config file , saves in "convert&

javascript - BrowserSync throws a TypeError on init -

browsersync throws typeerror when initalizes: [12:02:53] typeerror: undefined not function @ object.init (/users/conti/dev/foodjournal-web/node_modules/browser-sync/lib/public/init.js:25:25) @ gulp.<anonymous> (/users/conti/dev/foodjournal-web/gulpfile.js:39:15) @ module.exports (/users/conti/dev/foodjournal-web/node_modules/gulp/node_modules/orchestrator/lib/runtask.js:34:7) @ gulp.orchestrator._runtask (/users/conti/dev/foodjournal-web/node_modules/gulp/node_modules/orchestrator/index.js:273:3) @ gulp.orchestrator._runstep (/users/conti/dev/foodjournal-web/node_modules/gulp/node_modules/orchestrator/index.js:214:10) @ gulp.orchestrator.start (/users/conti/dev/foodjournal-web/node_modules/gulp/node_modules/orchestrator/index.js:134:8) @ gulp.<anonymous> (/users/conti/dev/foodjournal-web/node_modules/gulp/index.js:36:18) @ gaze.<anonymous> (/users/conti/dev/foodjournal-web/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob

sql server - SQL view with dynamic count of columns -

i know impossible directly, maybe of sql functions possible create view dynamic column count? want - create view which's columns username (first table's values), date (second table's values), , multiple columns properties (each third table's row column).user table structure - id , username, date table structure - id , datetime, property table structure - id, property name, property value, fk user id (plus 1 table relate tables). result should (columns): |username| date | property 1|....|property n| can show simple sample ? this not possible in standard sql, nor in version of sql familiar (sql server, oracle, mysql, access sql). tables, expressions , views in sql have fixed column-set, design. i.e., it's intentionally restricted way. afaik, in versions of sql, stored procedures objects can return variable column-set.

Implement something like an extendible enum in Java -

to attain type substitutability on multiple enums in java can have them implement interface. using object of interface in switch-case challenging. i cannot use interface object directly in switch statement. switch statment accepts enum, char, byte, short, int, , string. i can switch on object.getuniqueid() getuniqueid member of interface, in case have hard-code values of case statements. imo, ugly , impossible refactor. what needed implementation can used in switch-case statement, satisfying above 2 issues. be type substitutable. any pointer helpful. you should either use single enum has possible enum values or need check type before switch. myinterface value = ... if (value instanceof enymtype1) { switch((enumtype1) value) { case ... } } else if (value instanceof enumtype2) { switch((enumtype2) value) { case ... } } instead of using switch can have map<myinterface, consumer<myinterface>> extensible dyna

rust - How to fold using a HashMap as an accumulator? -

this code works: let stdin = std::io::stdin(); let mut rdr = csv::reader::from_reader(stdin); let mut hmap = hashmap::<string, u64>::new(); rdr.records() .map(|r| r.unwrap()) .fold((), |_, item| { // todo: there way not have copy item[col] every time? let counter = hmap.entry(item[col].to_string()).or_insert(0); *counter += 1; }); this code fails message: "cannot move out of acc because borrowed" let stdin = std::io::stdin(); let mut rdr = csv::reader::from_reader(stdin); let hmap = rdr.records() .map(|r| r.unwrap()) .fold(hashmap::<string, u64>::new(), |mut acc, item| { // todo: there way not have copy item[col] every time? let counter = acc.entry(item[col].to_string()).or_insert(0); *counter += 1; acc }); you cannot return acc closure because have mutable borrow still exists ( counter ). you can introduce new scope constrain mutable borrow: use std::collecti

windows phone 8.1 - onenote api started returning Internal Server Error -

i'm author of windows phone app "pinmore onenote". noticed app has developed bug (no changes app) , calls onenote api returning internal server error. i've run example code provided here https://github.com/onenotedev/onenoteapisamplewinuniversal and returning internal server error. this has been happening few days now. nothing has changed on app, has been working months, , expect example code work. this set of response headers when trying run universal app example @ https://github.com/onenotedev/onenoteapisamplewinuniversal + headers {cache-control: no-cache pragma: no-cache server: microsoft-iis/8.5 x-correlationid: ab1c9cdd-3db8-4dc1-afba-48774441ffba x-usersessionid: ab1c9cdd-3db8-4dc1-afba-48774441ffba x-officefe: onenoteservicefrontend_in_0 x-officeversion: 16.0.6023.1561 x-officecluster: neu-www.onenote.com p3p: cp="cao dsp cor adma dev coni teli cur psa psd tai ivdi our sami bus dem nav sta uni com int phy onl fin pur" x-content

java - FasterXML Jackson Smile vs json -

i going through online resources , found jackson can used serialization , deserialization java objects , json string respectively. @ same time found called smile . below doubts: is jackson json library serializes text based byte stream json representation is smile serializes non text i.e. binary byte stream same binary representation if above assumptions correct byte available jackson json library can deserialized other libraries understand json (like python, ruby json serialization/deserialization library). same not possible smile may have specific binary representation of java object. correct? if incorrect please guide me answer. thanks. as new computer science field, apology if question fits stack overflow standard. the major difference between normal json markup , smile smile binary markup version of json. since smile more compact, has less overhead when deserializing , better option large , complex payloads. when use each markup: json/xml - when want e

python - Filtering on month value doesn't return objects -

i have newsitem object in datebase. want filter newsitem objects based on year , month values. first of all, here model: class newsitem(models.model): maintitle = models.charfield(max_length=500) publish_start = models.datetimefield() when call object on shell, output is: in[15]: nitem[0].publish_start out[15]: datetime.datetime(2015, 7, 27, 10, 57, 50, tzinfo=<utc>) the problem is, when filter newsitem objects based on month, can't object. filtering on year works fine. newsitem.objects.all().filter(publish_start__year=2015) returns object but newsitem.objects.all().filter(publish_start__month=7) or newsitem.objects.all().filter(publish_start__day=27) doesn't returns object. according django docs , if use use_tz = true, datetime objects converted current time zone. filtering on timezone aware objects requires time zone definitions in database.

database - PostgreSQL find activity in particular point of time -

i using postgresql 9.4. how can find queries running or logged in 2 hous ago in postgresql? also, there other postgres forums can ask question? select * pg_stat_activity shows sessions (and queries). real time only. can cron saving stat other table, or enable logging level save statements , connections logs. pg not that...

c# - How do I avoid having my Rich Text Box, "scroll bar," freeze up? -

my issue in .net framework using c# create simple form application contains rich text box (rtb) control. briefly issue experiencing when trying clear contents (.text) of rtb, scroll bar doesn't go away. know if there inherently wrong way using rtb. apologize, site not allow me post images yet. if there misunderstanding regarding "doesn't go away" means, please ask! so first, write data box using following code snippet: // append new message this.rtb_receive_0.text += message; this.rtb_receive_0.selectionstart = this.rtb_receive_0.text.length; this.rtb_receive_0.scrolltocaret(); later on, clear rtb contents (rtb.text) following code: this.rtb_receive_0.text = string.empty; this.rtb_receive_0.refresh(); in above code have attempted fix problem the, "refresh," method. not seem doing job. when clear rtb contents, scroll bar not go away... noticed if grab window , drag on top of application, frozen scroll bar disappears. also, can minimize ap

java - write object to file from servlet -

i'm trying write file servlet , i'm not sure if path gave in xml file wrong or else private list<user> getuserslist() throws ioexception, classnotfoundexception{ list<user> users=new arraylist<user>(); fileinputstream fis=new fileinputstream(f); objectinputstream ois=new objectinputstream(fis); user u; while(true){ if((u=(user) ois.readobject())==null) break; else{ users.add(u); } } ois.close(); return users; } that's method use read file where private final string usersfile; private arraylist<user> users; private file f; public usersservice(string filename) throws classnotfoundexception, ioexception { super(); usersfile=filename; f=new file(this.usersfile); if(!f.exists()){ f.createnewfile(); } users= (arraylist<user>) this.getuserslist(); } and xml param <context-param> <param-name>userslist</para

sorting - Find the two largest numbers passed on the stack and multiply them, return DX:AX pair -

i have assignment passed 4 values on stack (v1, v2, v3, v4), find 2 largest values out of four, , multiply them return dx:ax pair. this code have come far, comparing values 1 , storing highest value in ax , second highest value in bx. problem code hangs when tested in dosbox, , i'm not sure causing it. edit: finished , working! ;--------------------------------------- ; ; code segment ; ;--------------------------------------- _linkhll: push bp ; saves caller's bp mov bp,sp ; loads bp sp mov ax,[bp+4] ;load v1 ax mov bx,[bp+6] ;load v2 bx ;--------------------------------------- ; find first largest number ;--------------------------------------- cmp ax,bx ;compare value 1 , 2 je doubles cmp ax,bx ja l2 ;ax > bx, goto l2 mov ax,bx ;make v2 largest number l2:mov bx,[bp+8] ;load v3 bx cmp ax,bx ;compare value ax , v3 je doubles cmp ax,bx ja l

How to run this script on Chrome? -

chrome.webrequest.onheadersreceived.addlistener(function (details) { (i = 0; < details.responseheaders.length; i++) { if (details.responseheaders[i].name.touppercase() == "x-webkit-csp") { details.responseheaders[i].value = "default-src *;script-src https://*.feedhound.co https://*.facebook.com http://*.facebook.com https://*.fbcdn.net http://*.fbcdn.net *.facebook.net *.google-analytics.com *.virtualearth.net *.google.com 127.0.0.1:* *.spotilocal.com:* chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl 'unsafe-inline' 'unsafe-eval' https://*.akamaihd.net http://*.akamaihd.net;style-src * 'unsafe-inline';connect-src https://*.facebook.com http://*.facebook.com https://*.fbcdn.net http://*.fbcdn.net *.facebook.net *.spotilocal.com:* https://*.akamaihd.net ws://*.facebook.com:* http://*.akamaihd.net https://*.feedhound.co"; } } return { responseheaders : details.responseheaders }; }, { urls : ["*://*.facebook.c

underscore.js - How do I ask AngularJS to recalculate the value of a complex function? -

i have angularjs controller following function: $scope.getexamplevalue = function(exampleid) { // calculate value using underscore's _.where() // clause against 2 json arrays on $scope // , exampleid parameter passed in return computedvalue; } the function's parameter ( exampleid ) rendered server, resulting html looks this: <div ng-controller="examplecontroller"> ... <span>{{ getexamplevalue(3) }}</span> <span>{{ getexamplevalue(4) }}</span> <span>{{ getexamplevalue(5) }}</span> ... </div> the problem have angularjs doesn't know call getexamplevalue() again when json arrays used in function have changed: they're 2 simple json arrays, new json items can added or removed, or properties of existing json items in either array can modified affect result. i've looked @ $scope.watch() , $scope.watchcollection() i'm unsure how can use them without changing approach bind agains

entity framework - Mapping same collection with two Navigation Properties -

i have following model public class locale { public int id { get; set; } public icollection<localization<locale>> localizations { get; set; } } public class localization<t> { public int id { get; set; } public locale locale { get; set; } public string displayname { get; set; } public t entity { get; set; } } in case, want able localize entity, include localization (ie: places show available languages in users language ). i have working in nhibernate, need move ef. issue arises when want use fluent api map follows. modelbuilder.entity<locale>() .hasmany(x => x.localizations) .withrequired(x => x.locale) .map(x => x.mapkey("localeid")); this works, need map entity itself. doing overrides previous map. modelbuilder.entity<locale>() .hasmany(x => x.localizations) .withrequired(x => x.entity) .map(x => x.mapkey("enti

c++ - Prevent double click on MFC-Dialog button -

i'm developing autocad/bricscad-dialogs in mfc c++. know detected bigger problem. there dialog sets metadata 'special' drawing objects. update data of every 'special' drawing object dialog (in loop). if have ten 'special' drawing objects, same dialog open ten times (successively). have problem user make double click on "ok"-button. if double click fast enough, "ok"-button of next instance of dialog clicked automatically. tried lot (for example disabling button if clicked) nothing solved problem. maybe of have idea. best regards, simon when open new dialog can flush message queue of mouse click messages before going normal message loop, e.g.: msg msg; while (peekmessage(&msg, hwnddlg, wm_lbuttondown, wm_lbuttondown, pm_remove));

mongodb - Inserting file into mongo DB using Meteor -

i want insert imges mongo db using meteor frame work . have written code create file object . 'change .inputfile': function(event, template) { fs.utility.eachfile(event,function(file){ var file=fs.file(file) alert("file :"+file) }) when tried create file object showing error: typeerror: self.attachdata not function. look @ line: var file = fs.file(file) this can't work. in moment define file new var file in right-hand-side undefined. try this: 'change .inputfile': function(event, template) { fs.utility.eachfile(event,function(file){ var fileobj = fs.file(file) alert("file :", fileobj) }) })

sql - Is there a way to speed up this MySQL delete query? -

i’m using mysql 5.5.37. i’m trying figure out faster way write below query. have 2 tables, access_code , classroom. “classroom” table has foreign key constraint (access_code_id) primary key of access_code table. i’m trying delete records in access_code table have no link classroom table , have particular type id. i’m running … delete access_code id in (select q.* (select a.id access_code left join lyc_classroom c on a.id = c.access_code_id a.access_code_type = 2 , c.access_code_id null) q); which taking long time. there faster way execute above query? you don't need subqueries. use delete ... join syntax delete access_code left join lyc_classroom c on a.id = c.access_code_id a.access_code_type = 2 , c.access_code_id null

How can I find position of matched regex of a single string in Perl? -

this question has answer here: how can find location of regex match in perl? 5 answers let's my $string = "xxxxxtpxxxxtpxxxxtp"; if want match: $string =~ /tp/; multiple times , return position each, how so? i have tried $-[0] , $-[1] , $-[2] position $-[0] . edit: have tried global modifier //g , still not work. $-[1] position of text captured first capture. pattern has no captures. by calling //g in scalar context, next match found, allowing grab position of match. until you've found matches. while ($string =~ /tp/g) { $-[0]; } of course, store them in variable. my @positions; while ($string =~ /tp/g) { push @positions, $-[0]; }

c# - Array out of bounds exception in neural network code -

i know there large number of these questions asked problem code specific. reason, don't know how make relevant large number of people. i practicing iteration in preparation creating first neural network (trying understand possible structure write it). program aims go through , assign weights in similar way neural network might. not use math, iteration purposes only. if there possible suggestions/ recommendations how best write grateful. main question: the first out of bounds can see. however, 1 towards bottom cannot see or understand have gone wrong. using system; namespace layers { class program { private static random rand = new random(); public static void main(string[] args) { // note: first hidden layer (0) input layer. // initialize layers. console.writeline("how many layers?"); int[][] hiddenlayers = new int[convert.toint32(console.readline())][]; (int hlcount

javascript - menu wont show or work -

my menu on page not work, not @ visible. set on codepen works fine when have tried implement it, failed work. it? still new coding appreciate help. html: <body> <nav class="menu-opener"> <div class="menu-opener-inner"></div> </nav> <nav class="menu"> <ul class="menu-inner"> <a href="#" class="menu-link"> <li>home.</li> </a> <a href="#" class="menu-link"> <li>portfolio.</li> </a> <a href="#" class="menu-link"> <li>about.</li> </a> <a href="#" class="menu-link"> <li>contact.</li> </a> </ul> </nav> <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script type="text/javascript"> $

xcode - How to wait for a background function to finish before calling another one in swift? -

i try explain briefly situation is. building quiz app , wanted work using internet, work while when user disconnected. older code using made synchronous queries, taking more time expected. decided reformulate it. situation projected following: when user selects subject app synchronously 1 question each subsubject in order ready user click , faster. after getting first question, app 4 (or how needed complete 5) each of subsubjects asynchronously , while user occupied answering first question presented him. finally, app save objects in local datastore, user can answer 5 questions each subsubject when not connected. here code: func getquestionsremotelyandsave (subsubject:string?, subject:string?, arrayofsubsubjects:[string]?) { self.getfromuserdefaults() if reachability.isconnectedtonetwork() == true { if self.needstogetquestions == true { let user = pfuser.currentuser() var query = pfquery(classname: "question

ruby on rails - Edit email views in shoppe -

i can't seem find shoppe tag in stackoverflow. i'm using shoppe gem rails. i want know if there way edit views emails being sent when order placed in shoppe. i add attachment email when accept order. thanks! it seems can re-define shoppe's mailer method: module shoppe class ordermailer < actionmailer::base def received(order) @order = order attachment(content_type: 'image/jpeg', body: file.read('image.jpg')) mail :from => shoppe.settings.outbound_email_address, :to => order.email_address, :subject => i18n.t('shoppe.order_mailer.received.subject', :default => "order confirmation") end end end puts somewhere app/initializers . remember set content-type properly.

c# - WPF app : Inter-Process Communication for a multiple instance application -

i've developped wpf composite application installed through msi in c:\program files\wpfapp1 on windows server 2008. due targeted system environment constraint, several local windows account users launched main .exe file (and start each 1 instance of wpf app) remote machine .rdp link. each windows user known wpf application user (user access rights). i develop .net component share data between users , provide messenger-like feature : can achieve using wcf service named pipes please? thanks reply, it possible, far ideal solution. have used named pipes inter-process communication, time signalling 2 processes had synchronized. not reliable , had weaknesses. named pipes communication requires additional threads running time listening messages , other processes have know name key use communicate particular process. basically, far better off creating client/server architecture using wcf , have clients send messages server distributed other clients. use duplex chan

c# - Required Field Validator in ASP.NET not catching Inital Value in DropDownList when set in Codebehind -

i started populating dropdownlist's items table in database. ever since removed hard-coded items , started using auto-populated items requiredfieldvalidator doesn't seem notice initalvalue still selected when press submit. i'm placing initial value "select genre" after pull items table. here dropdownlist , validator: <strong>genre:</strong> <asp:dropdownlist id="ddlgenres" runat="server"></asp:dropdownlist> <asp:requiredfieldvalidator id="rfvgenres" runat="server" controltovalidate="ddlgenres" initialvalue="select genre" errormessage="you must pick genre." forecolor="red"></asp:requiredfieldvalidator> here code code behind i'm using populate dropdownlist: //code outside of method static string connstring = system.configuration.configurationmanager.connectionstrings["defaultconnection"].connectionstring; sqlconnection conn

javascript - Why inline script > External stylesheet is faster than External stylesheet > Script? -

1. stylesheet > script http://stevesouders.com/cuzillion/?c0=hc1hfff2_0_f&c1=hc1hfff2_0_f&c2=hb0wfff0_0_f&c3=hb0wfff0_0_f&c4=bi1hfff2_0_f&c5=bi1hfff2_0_f&t=1438003196394 2. script > stylesheet http://stevesouders.com/cuzillion/?c0=hb0wfff0_0_f&c1=hb0wfff0_0_f&c2=hc1hfff2_0_f&c3=hc1hfff2_0_f&c4=bi1hfff2_0_f&c5=bi1hfff2_0_f&t=1438003184842 my understanding scripts block parsing. having script before stylesheet slow down page load. in above instance when have inline script before css files page load faster? can explain why? i seeing difference on 2 events 'domcontentloaded' , 'load' difference between load event in 2 case approx 5-15ms ( second 1 faster ) difference between domcontentloaded 2.5s ( second 1 faster ). not sure, reason behind should script parsed before css starts downloading network.

c# - WPF ContextMenu incorrect position -

Image
i have been trying add context menu notify icon (system tray icon). own custom wpf wrapper around native shell_notifyicon function. i have been using following code show context menu: contextmenu.placement = placementmode.absolutepoint; contextmenu.horizontaloffset = args.x; contextmenu.verticaloffset = args.y; contextmenu.isopen = true; the args.x , args.y absolute screen coordinates of mouse @ time notify icon clicked (i have verified contains correct mouse position). for reason, context menu shows 5-7 pixels , left of mouse position: the context menus of other icons on system tray display mouse is. i searched available properties of contextmenu , nothing seemed fix it. missing something? manually adjust 7 or pixels if there better way i'd rather whatever way may be. i'm not sure why behaves way absolutepoint. if want place context menu @ tip of mouse pointer, have tried contextmenu.placement = placementmode.mousepoint; contextmenu.horizontaloff

jquery - Affect different element in parent div on hover -

when hover on <h3> within <div> , expands <ul> elements in <div> elements class. i'm bit confused on how affect only <ul> within <div> hovering on <h3> ? i have html structured this: jquery(document).ready(function() { jquery("div.sidemenugroup h3").hover(function() { jquery("div.sidemenugroup ul").slidedown() }, function() { jquery("div.sidemenugroup ul").slideup(); }); }); div.sidemenugroup ul { display: none; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="sidemenugroup"> <h3>some text</h3> <ul> <li>list item 1</li> <li>list item 2</div> </ul> </div> <div class="sidemenugroup"> <h3>some other text</h3> <ul> <li2nd>list item 1</li> &l

facebook - Some js file and social media plugin did not load when changing pages using jQuery Mobile Sliding Panel -

i using jquery mobile's panel feature navigate between pages. of pages have jssor plugin , social media plugins facebook , twitter. plug ins not work through panel item when selected. this current page: http://191armyband.com/contact.html i clicked menu , go home page, home page should load twitter feeds, facebook plug in , jssor plugin. these not work if navigate here panel. i assuming if turn off ajax feature jquery mobile, might make work... $.mobile.ajaxenabled = false; is correct code use? how should integrate in code? here code of current page: http://jsfiddle.net/humorean/n7x4mv9k/ try put stop ajax script right before jquery mobile js: <script type="text/javascript"> $(document).bind("mobileinit", function () { $.mobile.ajaxenabled = false; }); </script> <script src="js/jquery.mobile-1.4.5.min.js"></script> put script in landing pages pages work plugins.