Posts

Showing posts from August, 2015

html - Why letter M or W indent are different than other letters? -

Image
looking example: html <input type="checkbox" name="jour_semaine[]" id="lundi" value="lundi"/> <label class="checkbox-inline weekday" for="lundi" >l</label> <input type="checkbox" name="jour_semaine[]" id="mardi" value="mardi"/> <label class="checkbox-inline weekday" for="mardi" >m</label> <input type="checkbox" name="jour_semaine[]" id="mercredi" value="mercredi"/> <label class="checkbox-inline weekday" for="mercredi" >w</label> <input type="checkbox" name="jour_semaine[]" id="jeudi" value="jeudi"/> <label class="checkbox-inline weekday" for="jeudi" >j</label> <input type="checkbox" name="jour_semaine[]" id="vendredi" value="vendr...

Programmatically setting MAVEN_OPTS from groovy script -

i trying write build script in groovy , want ensure maven_opts set based on build scripts configuration. what have is: def process = ['export maven_opts=\"-xmx' + config.buildenvironment.maxmemory + ' -xx:maxpermsize=' + config.buildenvironment.maxpermsize + '\"'].execute() process.in.eachline { line -> println(line) } config.buildenvironment.maxmemory resolves 1024m while config.buildenvironment.maxpermsize resolves 512m the output is: caught: java.io.ioexception: cannot run program "export maven_opts="-xmx1024m -xx:maxpermsize=512m"": error=2, no such file or directory java.io.ioexception: cannot run program "export maven_opts="-xmx1024m -xx:maxpermsize=512m"": error=2, no such file or directory @ mavenutils.setmavendefaultopts(mavenutils.groovy:23) @ mavenutils$setmavendefaultopts.call(unknown source) @ build.run(build.groovy:19) cau...

c# - Unable to find and add an ASP.NET 5 Class Library project to a solution -

Image
i created new asp.net 5 web app , standard c# class library find out asp.net 5 web app can't reference. did research , saw there asp.net 5 class library can't find anywhere in updated vs2015 enterprise. is called class library (package) or class library (portable)? yes, class library (package). in fact, can add project.json file minimum content , reference that add solution right clicking on solution , selecting add > existing project... . vs create xproj file reference (which needed vs). then, can reference below: { "version": "1.0.0", "dependencies": { "3-class-lib": "" }, "frameworks": { "dnx451": {}, "dnxcore50": { "dependencies": { "system.console": "4.0.0-beta-23516" } } } } in case, 3-class-lib name of class library folder ends being name. can ...

javascript - How to resize charts to fit the parent container with Google API -

Image
so created combo chart using visualization api google, im having problems resizing said chart fit parent container that's how looks on website, parent container's width 1 hovered. , want chart fill entire parent's width. i have panel system, in each tab have different chart. first 1 works charm, dont have problem 1 fills parent's container width correctly, second 1 one im having problems with. here's html <div class="tab-pane fade in active" id="anuales"> <div id ="anual-bar-chart" height ="500px" ></div> </div> <div class="tab-pane fade in" id="semestre-1"> <div id ="semester-1-chart" height="500px"></div> </div> and here's js file draw charts google.load("visualization", "1", {packages:["corechart", 'bar']}); google.setonloadcallback(drawchart); function drawchart() { ...

ascii - Modifying VB.NET NumericKeyPress event code to C++ -

can modify me? private sub numerickeypress(byval sender system.object, byval e system.windows.forms.keypresseventargs) handles textbox1.keypress if e.keychar = chr(keys.back) else if not char.isdigit(e.keychar) e.handled = true beep() else if len(textbox1.text) > 0 if val(textbox1.text) > 105097565 e.handled = true beep() end if end if end if end if end sub or tell me how is: 1.numerickeypress event? 2.how e.keychar? 3.how isdigit? 4.how chr(ascii number)? 5.how handle e.key? 6.how system beep? i tried: private: system::void textbox1_keypress( object^ sender, system::windows::forms::keypresseventargs^ e ) { if(e->keychar == (char)8) {} else { ...

using diff/patch in windows, aka, "can't find file to patch at input line 4" -

i using cvs , win7. need copy changes trunk branch, thought use "diff -run" put changes file, , use "patch -i" apply them branch. so saw this page , , this page . had cygwin diff, got gnu patch here . made 2 files \test\mydir1\afile.txt \test\mydir2\afile.txt which have minor differences. type cd test diff -run mydir1 mydir2 >test.patch patch --dry-run -i test.patch and result is can't find file patch @ input line 4 perhaps should have used -p or --strip option? so tried patch --dry-run --verbose -p1 -i test.patch and same error. tried lot of other things long time no success. why hard? ok here 2 things needed know, not documented anywhere diff output uses unix format, patch requires dos format the default "strip" in patch not -p0 might expect. -p1. this works... diff -run mydir1 mydir2 | unix2dos > test.patch patch -p0 -i test.patch you must convert dos line endings, , must specify -p0. otherwise defa...

encode and decode data in angularjs -

i trying view data backend (services) encrpted. trying use base64 decode , base64 encode view service data , send data. base64 has encoding , decoding data contains these tokens."abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789+/=". backend data has other tokens. there encode , decode methods? vanilla javascript can in browsers @ point. use base64 methods provided, btoa() , atob() . may not supported in older versions of browsers, may have simple algorithm converting. don't think angularjs has implemented this, because it's handled.

symfony - How I can Iterate into SUM result from doctrine query -

i need iterate on result in doctrine. code query: $consulta = $em->createquery(' select bcr, sum(bcr.volumenalmacenado) vol, sum(bcr.pesoalmacenado) pes residuobundle:bodegacontieneresiduo bcr bcr.fechaingreso between :fechap , :fechaa , bcr.fecharetiro null group bcr.idresiduo '); $consulta->setparameter('fechaa', $fechaactual); $consulta->setparameter('fechap', $fechapasada); return $consulta->getresult(); when run in mysql return without problem. in symfony results. now, when tried loop in twig can't do, think agregate functions in query. hope can me clue or this. grettings you should added extension of mysql function sum can use sum function in doctrine query way can direct execute query or native query of doctrine try following query can result $consulta = $em->executequery('select bcr, sum(bcr.volumenalmacenado) vol, sum(bcr.pesoalmacenado) pes residuobundle:bodegacontieneresiduo bcr bc...

c++ - Vectors of lock_guards -

i'm working multithreaded code (working concurrent data structures), , part of requires lock set of mutexes. implementation utilizing vector of lock_guards, since don't know how many mutexes i'm going need lock, , may run exception conditions force me unlock of mutexes , restart. hence reason vector. the code i'm trying use boils down this: #include <mutex> #include <vector> using namespace std; int main( int argc, char** argv ) { vector<recursive_mutex> vec(10); vector<lock_guard<recursive_mutex>> lgv; for( auto = vec.begin(); != vec.end(); ++it ) { lgv.emplace_back( *it ); } return 0; } when try compile (g++ 5.3.1 using --std=c++11), following error (somewhat distilled): in file included foo.cpp:1:0: /usr/include/c++/5.3.1/mutex:385:7: note: declared here lock_guard(const lock_guard&) = delete; based upon understanding of emplace_back, library should not attempting use copy construct...

python namespace: __main__.Class not isinstance of package.Class -

consider have 2 python files defined below. 1 general package ( class2 ), , other 1 specific overrides , serves executable ( class1 ). class1.py: #!/usr/bin/python class test(object): pass class verificator(): def check(self, myobject): if not isinstance( myobject, test ): print "%s no instance of %s" % (type(myobject),test) else: print "ok!" if __name__ == '__main__': class2 import gettest v = verificator() t = test() v.check(t) s = gettest() v.check(s) class2.py: from class1 import test def gettest(): return test() what happens first check ok, second fails. reason t __main__.test whereas s class1.test , v.check() checks __main__.test , @ end of day same class, right? is there way write v.check() such accepts class1.test objects, or other way solve this? if plan import class1.py elsewhere, move top-level code ( if __name__ == '__main__': ....

c++ - Returning by reference -

sorry if question basic. program 1: #include <iostream> using namespace std; int max(int &a) { +=100; return a; } int main ( int argc, char ** argv) { int x=20; int y; y = max(x); cout <<"x , y value "<<x<<"and"<<y<<endl; } output: x, y value 120and120 program 2: #include <iostream> using namespace std; int & max(int &a) { +=100; return a; } int main ( int argc, char ** argv) { int x=20; int y; y = max(x); cout <<"x , y value "<<x<<"and"<<y<<endl; } output: x, y value 120and120 the difference between program1 , program2 second program returns reference. difference? program1 : copies referenced variable when returning that, program2 : returns reference referenced variable (the same reference, actually?). there no difference in output since value copied variable 'y' either way. ho...

email - php mail with while loop -

i need send job recommendation mail jobseekers skill week , timesjob template, 10 recommended jobs skill, write code below , can 10 jobs 10 emails not in same email , wrong code? can 1 me? <?php $today_date=date("y-m-d"); /* jobs key_skills id postdate reference_no company_id designation locations qualification industry job_type job_timing expr_min min_expmon expr_max max_expmon compensation_lacs compensation_thousand description cr_dt status interview_date intw_time intw_exptime t_status website */ // , j.key_skills '%".$get_singlekeyskill[$i_key]."%' "select j.id, j.user_id, j.first_name, j.last_name, j.mobile_no, j.experience_years, j.experience_months, j.annual_salary_lacs, j.annual_salary_thousan, j.functional_type, j.key_skills, j.prefered_cityname, j.basic_qualificatio...

Need Oracle sql to list records where for a key, specific value is paired with other values -

i have data in table tab : dept role ------------- 100 sell 101 admin 102 admin 102 staff 103 admin 103 staff 103 sell 104 frq 104 staff 104 sell 105 admin 105 int 105 sell i need list depts admin appearing @ least 1 other role not admin alone or not other dept admin not present. example : 102, 103,105 desired results 100,101,104 filtered out. could please assist me in ? thanks in advance. select distinct yt.dept your_table yt join your_table adm on adm.dept = yt.dept adm.role = 'admin' , yt.role != 'admin' basically used inner join filter depts having no 'admin' roles , filtered 'admin' roles resultset.

c++ - Randomize blocks of code -

i pretty new c++ , need . there library or easy way randomize blocks of code each time compiling app ? example struct{ float getnotes() { return something; } float getname() { return smth; } float getage() { return smths; } }students; into struct{ float getage() { return smths; } float getname() { return smth; } float getnotes() { return something; } }students; and randomized everytime compiling . !! in structure define functions can use them many works. note there isn't ordering functions. if want works random, can use switch - case , create random number rand() function switch number. example : srand(time(null)); int choice = (rand() % 10) + 1; // create random number between 1 , 10 s...

node.js - How to throw a 502 to nginx? -

i have nginx/nodejs stack. my nginx configured serve static 502 error page when nodejs process down. now, want have nodejs run normally, , throws 502 nginx, trigger static 502 page on user requests. how do that? i tried throw errors in node process without catching them, results in error stack being passed directly client browser. add proxy config: proxy_intercept_errors on; as per the manual : determines whether proxied responses codes greater or equal 300 should passed client or redirected nginx processing error_page directive. default off

android - TabLayout: How to load all the tabs or only swipe refresh occur -

i have activity , implement android tablayout recyclerview. implemented 3 fragments 3 tabs of tablayout. the default load behavior of tablayout load , cache neighbor tab not 1 loaded. let's fragment a, b , c correspond tab 1, 2 , 3 respectively. when users visit tab 1 ---> fragment , b loaded when users visit tab 2 ---> fragment c loaded but when users visit tab 1 again --> fragment load again. what want when activity start, want 3 tabs load once, can load tab through refresh mechanism such swipe refresh. are there way can change load behavior of tablayout? thanks, the viewpager default have .setoffscreenpagelimit(1); this way tab's fragment a, b , c correspond tab 1, 2 , 3 respectively. when users visit tab 1, fragments , b loaded, c isn't loaded because tabs adjacent tab 1 loaded. when go tab2, no tab reloaded because adjacent tab2. instead, if go tab 3 tab 1, reloaded. so must set viewpager.setoffscreenpagelimit(2); this w...

java - How to turn off shapes in YIntervalRenderer? -

found no way t turn off shapes accessing renderer itself. renderer.setseriesshape(0, null); disables series shape, causes shapes supplier come. renderer.setautopopulateseriesshape(false); disables supplier, causes default shape draw. renderer.setbaseshape(null); causes exception since null not allowed here parameter. so turn shapes off? may in plot or chart object? can't find. you can supply empty shape series: yintervalrenderer r = new yintervalrenderer(); r.setseriesshape(0, new rectangle());

javascript - If HTML5 local browser database entries exceed its fixed size -

i have html5 local browser database 2mb in size. suppose entries inserting 1 one or in loop, happen if entries crossed limit of fixed size, 2mb? it true size not exceed automatically if limit crossed top entries first entered automatically removed adjust new entries or new entries stop insert? if exceed storage throw “quota_exceeded_err” exception. can catch exception , manage storage manually

java - What's the best way of rendering component specific error messages? -

i need general way of rendering component specific error message right next component caused it. i've used feedback panel, isn't ideal if page contains multiple components, requiring user scroll down page. also, if place multiple feedback panels on page, display same message. there general way of rendering localised error messages near specific component? there excellent blog post on subject few years back. details how have error messages show next component reported error. http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket

arrays - Python convert string repr of byte data into float data -

i have 12 bytes being sent on web socket used represent 3 float values. other program this: float m_floatarray[3]; ... serial.write((byte*) m_floatarray, 12); //12 b/c 3 floats @ 4 bytes each the data receive in python program looks this: #the data printed from: received = ser.read(12) received = '\xe4c\x82\xbd-\xe4-\xbe&\x00\x12\xc0' i want in python program: x = getfirstfloat(received) y = getsecondfloat(received) z = getthirdfloat(received) how can parse data? thank you. a short example: >>> a,b,c = [random.random()*10 in range(3)] >>> 0.9446191909332258 >>> b 7.578277797297625 >>> c 8.061585451293366 >>> recieved = struct.pack('fff', a, b, c) >>> recieved '\x90\xd2q?@\x81\xf2@a\xfc\x00a' >>> x,y,z = struct.unpack('fff', recieved) >>> x 0.9446191787719727 >>> 0.9446191909332258 >>> b 7.578277797297625 >>> y 7.57827758789...

WCF HTTP Post: How to bind Json data to C# Model -

i creating http post method existing wcf application. method take c# object argument: [operationcontract] [webinvoke(method = "post", uritemplate = "updatedetails", bodystyle = webmessagebodystyle.bare, requestformat = webmessageformat.json, responseformat = webmessageformat.json)] public void updatedetails(myobject myobject) { // logic } public class myobject { public string title { get; set; } public string details { get; set; } } if json data has properties called 'title' , 'details', mapped argument. i'd handle scenarios when json properties changed. example, if sender decide change 'title' 'event_title', there way map 'event_title' 'title' field of myobject class? can done data annotations? use [datacontract] , [datamember(name = "name_as_it_will_appear_in_json")] [datacontract] public class myobject { [datamember(name = "event_title")] public string tit...

java - Scala Play WS.put Array[Bytes] setting negative bytes to 0b111111 -

i doing http put of array[byte] using play's web service client. reason, setting negative bytes 63 (0b111111). sent same byte stream using java's http stuff , sent on byte array properly. hints? here example: //play web service send bytes val bytes = array[byte](0, -3, 2, ...) ws.url(httpservice).put(bytes) //java send bytes val j = new url(httpservice) val con = j.openconnection().asinstanceof[httpurlconnection] con.setdooutput(true) con.setrequestmethod("put") val out = con.getoutputstream.asinstanceof[bytearrayoutputstream] out.write(bytes) out.close() val input = con.getinputstream while (input.available() > 0) input.read() input.close() con.disconnect() i had set character set iso-8859-1 . in general better use base64 send byte array on line; however, couldn't in context of problem. below example of solution. note, setting content type application/octet-stream before , didn...

javascript - basic touch gesture not working, using hammer.js -

im beginning learn javascript can implement touch gestures, using hammer.js library, simple piece of code doesnt seem work, know if im missing obvious? i including hammer.js correctly (have tested putting in path in browser) , have included code in head... <script type="text/javascript"> var element = document.getelementbyid('tapdiv'); var hammertime = hammer(element).on("tap", function(event) { alert('hello!'); }); </script> and html... <div id="tapdiv"> <img src="files/tabdiv.jpg" /> </div> edit: im receiving error in console hammer.js ... typeerror: el null [break on error] if(!css_props || !el.style) { it appears javascript attempting access object in dom doesn't exist yet -- make sure execute javascript after dom ready: <script type="text/javascript"> window.addeventlistener('load', function() { var element = documen...

optimization - oracle - same query but different plan in 11g and 12c -

Image
this question relative this question . code try use in 12c select * dmprogdate_00001 1=1 , progressoid in ( select p.oid ( select oid ( select a.oid, rownum seqnum ( select oid dmprogress_00001 1=1 , project = 'moho' , phase = 'procurement' , displine = 'q340' order actcode ) rownum <= 20 ) seqnum > 0 ) p ); result 11g : under 1 sec 12c : on 8 sec this query plan in 11g this query plan in 12c when take out pagination code (like below). query in 12c fast enough 11g need pagination query. select * dmprogdate_00001 1=1 , progressoid in ( select p.oid ( select oid dmprogress_00001 1=1 , project = 'moho' , phase = 'procurement' , displine = 'q340' order actcode ) p ); this query (without pagination) p...

r - ggplot multiple panels, multiple curves -

Image
this code makea plot, scatter of 2 variables factored city , grade: ggplot(e,aes(x=pre_c,y=post_c,col=grade))+geom_point()+facet_grid(grade~city) can suggest how add second set of black dots in picture, scatter of pair of variables? first set control , second treated group in example.

c# - How do I get rid of this goto? -

i started position , @ end of workday wait out traffic reading through our codebase. came across bit , after fair amount of time @ whiteboard still can't think of way extract goto . there way excise jump? public void myupdate(mytype foo) { /*prep code loops*/ foreach (thing bar in something) { foreach (collection item in bar.stuff) { data datarx = item.first; if (datarx != null && datarx.id.equals(globalnonsense.id)) { // update data latest changes datarx.foobuddy = foo; goto exitloops; } } } exitloops: ; } since label exitloops @ end of method, can use return exit method this: if (datarx != null && datarx.id.equals(globalnonsense.id)) { // update data latest changes datarx.foobuddy = foo; return; } another approach use flag this: bool done = false; foreach (thing bar in something) ...

c# - Issue in emulating System Center Orchestrator Console's Functionality? -

i trying re-reimplement system center orchestrators silverlight based console in asp.net, various obscure reasons dont know:) .. kidding. existing console not helpful in validating user inputs starting runbooks. i know console user orchestrator webservice feteching infomration running runbooks , jobs etc. how renders current status of teh runbook overlaying image of runbook tick mark. although able image of runbook via webservice c#, how can imitate functionality of getting current status of runbook using runbook image , active activity indeicated tick mark. p.s whole thing might not make sense without knowing orchestrator , orchestrator webservice. sorry that.

automation - how to use serial communication to change the slides of powerpoint presentation? -

i have arduino uno kit. 'll giving signals .these signals should able navigate slides of powerpoint. these signals coming thru serial port . hence there software allows me directly required slide change ?or should writing code same ? if in language iam quite new type of stuffs! this same question one: what best way access serial port vba? the answer refers here: http://www.thescarms.com/vbasic/commio.aspx

c++ - G++ error:/usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory -

i'm studying qt on platform fedora linux, threw g++ error below while make sample cpp g++ error:/usr/lib/rpm/redhat/redhat-hardened-cc1: no such file or directory would indicate how me please? you need install redhat-rpm-config required of qt switches, probably: sudo dnf install redhat-rpm-config from askfedora .

c# - ValidationSummary does not exist in WPF? -

i'm trying style wpf datagrid. copied control template here , resource dictionary. can't compile, because says, "validationsummary not exist in xml namespace" i have presentationcore , presentationframework assemblies referenced in project. i think might need "system.windows.controls.data.input.dll" can't find it. i think part of silverlight toolkit . cannot use in wpf. have find wpf counter part same class.

file - Unix command sort by number of occurances of a specific character -

i have file format: key value:value:value:value key value:value key value key value:value:value where there key @ first column , in second list of values delimited :. there command can sort file based on number of occurances of : in value list i.e. values least e.g. previous example this: key value:value:value:value key value:value:value key value:value key value quick , dirty: awk -f: '{$0=nf"#"$0}1' file|sort -nr|sed 's/.*#//' test example: kent$ echo "key value:value:value:value key value:value key value key value:value:value"|awk -f: '{$0=nf"#"$0}1'|sort -nr|sed 's/.*#//' key value:value:value:value key value:value:value key value:value key value edit the sort tool on linux/unix box powerful. sorts against column/fields, not based on calculation. requirement needs calculation first , sort against on result. so add new column, count of : , sort sort command, @ end remove column. awk adds...

JavaFX: Exception => java.lang.NoClassDefFoundError -

Image
i'm new in building , deploying java applications. developed application should create pdf-document. purpose use pdfbox-library apache . building application use ant. if run application on ide(luna 4.4) no errors . after building , running .jar on pc or pc, following exception: exception in thread "javafx application thread" java.lang.noclassdeffounderror: org/apache/pdfbox/encoding/ encodingmanager @ helper.myhelper.getspecialcharacter(unknown source) @ helper.myhelper.formatstring(unknown source) @ controller.invoicec.fillview(unknown source) @ controller.invoicec$mytablistener.changed(unknown source) @ controller.invoicec$mytablistener.changed(unknown source) @ com.sun.javafx.binding.expressionhelper$generic.firevaluechangedevent(expressionhelper.java:361) @ com.sun.javafx.binding.expressionhelper.firevaluechangedevent(expressionhelper.java:81) @ ...

whiptail - If statement goes else every time - bash -

i new here, apologize mistakes, , sorry lack of knowledge (i'm beginner). here is, doing little script in bash li , have if statement, here #!/bin/bash something=$(whiptail --inputbox "enter text" 10 30 3>&1 1>&2 2>&3) if [ $something ?? 'you' ]; echo "$something" else echo "nope" fi to specific want - enter word/sentence/whatever whiptail, , if contains of of string prints it, every times goes else ;_;.please help. edit works, need check if string contains word. if [[ $string =~ .*my.* ]] doesn't seem work i don't @ all, losing hope , searching web i've encontered on #!/bin/bash option=$(whiptail –title “menu dialog” –menu “choose option” 15 60 4 \ “1” “grilled ham” \ “2” “swiss cheese” \ “3” “charcoal cooked chicken thighs” \ “4” “baked potatos” 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; echo “your chosen option:” $option else echo “you chose ca...

c++ - Why is my model taking my skybox's texture? -

i have been looking @ problem days , can't figure out why model takes skybox's texture. has been bugging me forever. here looks like. this model looks after skybox loaded in. what model looks before skybox loaded scene. core.cpp main loop while (!m_window.closed()) { m_window.varupdate(); m_window.do_movement(); glclearcolor(0.1f, 0.1f, 0.1f, 1.0f); m_window.clear(); m_modelshader.enable(); glm::mat4 model; model = glm::scale(model, glm::vec3(0.2f)); //model = glm::translate(model, glm::vec3(5.0f)); glm::mat4 view = m_window.m_camera.getviewmatrix(); glm::mat4 projection = glm::perspective(m_window.m_camera.zoom, (float)m_window.getwindowx() / (float)m_window.getwindowy(), 0.1f, 100.0f); gluniformmatrix4fv(glgetuniformlocation(m_modelshader.m_programid, "model"), 1, gl_false, glm::value_ptr(model)); gluniformmatrix4fv(glgetuniformlocation(m_modelshader.m_programid, "view"), 1, gl_false, glm::value_...

java - How do I convert a Unix epoch timestamp into a human readable date/time in Excel? -

i have excel documents containing unix epoch timestamps java application. i'd see translate , represent them human readable dates inside of excel. for example, following long: 1362161251894 should evaluate readable like: 01 mar 2013 11:07:31,894 i'm assuming can create formula this, i'm not sure how. thanks! yes, can create formula you. java , unix/linux count number of milliseconds since 1/1/1970 while microsoft excel starting on 1/1/1900 windows , 1/1/1904 mac os x. need following convert: for gmt time on windows =((x/1000)/86400)+(datevalue("1-1-1970") - datevalue("1-1-1900")) for gmt time on mac os x =((x/1000)/86400)+(datevalue("1-1-1970") - datevalue("1-1-1904")) for local time on windows (replace t current offset gmt) =(((x/1000)-(t*3600))/86400)+(datevalue("1-1-1970") - datevalue("1-1-1900")) for local time on mac os x (replace t current offset gmt) =(((x/1000)-(t*3600))/8...

asp classic - Loop through SQL results and do a IF, ELSE -

i have select, like: select item, group, paid table group=120 the result be: item group paid 120 1 b 120 1 c 120 1 d 120 0 i need loop through result , check if itens have paid = 1 something, instead, thing. thanks. this have: <% set lista= mssql.execute("select item, group, paid table group=120") while not lista.eof paid= lista("paid") if paid= 1 response.write "1" else response.write "0" end if loop %> try this: set lista= mssql.execute("select item, group, paid table group=120") lista.filter = "paid = 0" if (lista.eof) response.write("0") else response.write("1") end if

javascript - Meteor cordova upload image from gallery? -

i trying upload file gallery of device using image picker plugin cordova returns images location on device. when try access image on phone receive not allowed load local resource: file:///users/camron/library/developer/coresimulator/devices/f762f636-5357-4a67-904d-10009737bae6/data/containers/data/application/573d203d-3c34-4451-90cd-6e469cff4c0f/tmp/cdv_photo_022.jpg //after adding mdg:camera package var cameraoptions = { quality: 80, correctorientation: true, sourcetype: camera.picturesourcetype.photolibrary } meteorcamera.getpicture(cameraoptions, function(error, localdata){ // stuff })

html - Bootstrap Glyphicons/Navigation Icons -

i cannot figure out how text in p tags fit inside navigation icons (using bootstrap glyphicons). here how using it: <div class="wrapper"> <div class="header"> <span class="glyphicon glyphicon-chevron-left"></span> <span class="glyphicon glyphicon-chevron-right"></span> <p>january, 2016</p> </div><!--this ends header div--> january, 2016 appears below navigation icons instead of in between left , right arrows. can suggest solution? try this <div class="wrapper"> <div class="header"> <p> <span class="glyphicon glyphicon-chevron-left"></span> <span>january, 2016</span> <span class="glyphicon glyphicon-chevron-right"></span> </p> </div><!--this ends header div-->

c# - How to display a user control source code on an .aspx page? -

i trying build aspx page displays user control along code , code behind user control. there way code user control page , display it? you this: fileinfo mycontrol = new fileinfo(server.mappath(@"~\test.aspx.cs")); streamreader mycontrolsource = mycontrol.opentext(); string mycontrolsourcehtml = server.htmlencode(mycontrolsource.readtoend()); put in method , point file source code html , use css style see fit.

c++ - Random Number Generator with Beta Distribution -

i need c or c++ source code of function betarand(a,b) produces random number beta distribution . know can use boost library i'm going port cuda architecture need code. can me? meantime have betapdf (beta probability density function). don't know how use creating random numbers :). the c++11 random number library doesn't provide beta distribution. however, beta distribution can modelled in terms of 2 gamma distributions, library does provide. i've implemented beta_distribution in terms of std::gamma_distribution you. far can tell, conforms requirements random number distribution. #include <iostream> #include <sstream> #include <string> #include <random> namespace sftrabbit { template <typename realtype = double> class beta_distribution { public: typedef realtype result_type; class param_type { public: typedef beta_distribution distribution_type; explicit param_t...

c++ - DAO code for Microsoft access works in Visual Studio 2008 but not in Visual Studio 2012 -

i have following line of code in example project downloaded , opened in visual studio 2008 _bstr_t bstrconnect = "path mdb file"; int _tmain(int argc, _tchar* argv[]){ hresult hr = coinitialize(null); if (failed(hr)) { cout<<dam<<": failed coinitialize() com."<<endl; return hr; } dao::_dbengine* pengine = null; hr = cocreateinstance( __uuidof(dao::dbengine), null, clsctx_all, iid_idispatch, (lpvoid*)&pengine); if (succeeded(hr) && pengine) { try { dao::databaseptr pdbptr = null; pdbptr = pengine->opendatabase(bstrconnect); this code works. put similar code in visual studio 2012 project _bstr_t bstrconnect = "path mdb file"; int _tmain(int argc, _tchar* argv[]) { hresult hr = coinitializeex(null, coinit_multithreaded); if (failed(hr)) { cout<<"failed coinitialize() com."<<endl; cout << _com_error(hr).errormessage() <<...

How to add multiple values inside the same tag of xml generated using xml.etree.ElementTree in Python? -

i generating xml file using xml.etree.elementtree in python . there 1 tag in have add multiple values iterating through loop. currently single value getting added tag. tag display information of software installed on system getting using import wmi . the script follows: ##here starts populating elements inside xml file top = element('my_practice_document') comment = comment('details') top.append(comment) child = subelement(top, 'my_information') childs = subelement(child,'my_name') childs.text = str(options.my_name) child = subelement(top, 'sys_info') #following section retrieving list of software installed on system import wmi w = wmi.wmi() p in w.win32_product(): if (p.version not none) , (p.caption not none): print p.caption + " version "+ p.version child.text = p.caption + " version "+ p.version so, in above script can h...

jquery set div to toggle checkbox breaks clicking the checkbox itself -

i have check box: <div class="outerdiv"> <div class="innerdiv"> <input type="checkbox" name="tie" value="tie">error in tie score<br> </div> </div> i have jquery toggle checkbox: $(document).ready(function() { $('.outerdiv').click(function() { if ($(this).find('input:checkbox').is(':checked')) { $(this).find('input:checkbox').attr('checked',false); } else { $(this).find('input:checkbox').attr('checked',true); } }); }); this seems work, toggling checkbox when clicking on div. when click checkbox itself, nothing happens , not toggle. you need stop propagation of event bubbling checkbox using event.stoppropagation() $('input[type=checkbox]').click(function(e){ e.stoppropagation(); });

angularjs - Angular UI - grid always show in edit mode -

how make angular ui grid show columns in edit mode? tried setting celltemplate editablecelltemplate did not work.. idea here thanks, lokesh i came problem year later... solution mimic edit template in celltemplate: <script type="text/ng-template" id="ui-grid/celltitlevalidator"> <div class="ui-grid-cell-contents" title="{{grid.validate.gettitleformattederrors(row.entity,col.coldef)}}"> <div class="form-editor"> <input ng-class="{'ng-invalid' : grid.validate.isinvalid(row.entity,col.coldef)}" value="{{col_field custom_filters}}" placeholder="{{'platform.placeholders.n-a' | translate}}" readonly="readonly" /> </div> </div> </script>

How to Limit the Maximum Size of Kernel CoreDump? -

i running centos 6. the system got kernel panic , rebooted. i have enabled coredump generation, hence generated kernel core dump of size 500mb. what maximum size of kernel core dump in worst case scenario? is there way limit size of kernel core dump. ulimit -c limits kernel core dump size also? is there configuration available makedumpfile utility truncate kernel core dump if value greater 300mb?

python - flask optional url parameter not working -

@mod.route('/participate/<survey_id>/', defaults = {'work_id':none}, methods = ['get','post']) @mod.route('/pariicipate/<survey_id>/<work_id>', methods = ['get', 'post']) def participate(survey_id, work_id): /* do_something .. */ i can access http://localhost:5000/participate/512dc365fe8974149091be1f or http://localhost:5000/participate/512dc365fe8974149091be1f/ , if fire debugger can see work_id = none . if try http://localhost:5000/participate/512dc365fe8974149091be1f/512dc365fe8974149091be1f or http://localhost:5000/participate/512dc365fe8974149091be1f/512dc365fe8974149091be1f/ 404. why happening? there i've done wrong routing rules? your second route has typo in :) @mod.route('/pariicipate/<survey_id>/<work_id>', methods = ['get', 'post']) should be @mod.route('/participate/<survey_id>/<work_id>', methods = ['get...

eclipse - does exist convenience manner to import project without .project exist in eclispe -

eclipse mars checked out svn project without .project exist, when import project , hints no projects found import so exist convenience manner import project ? typically not people having eclipse .settings/ , .project , .classpath version control system. especially, when i'm using maven , there mvn eclipse:eclipse command...

ubuntu - ubunutu commands to upload sql file to database -

there database file in path : /var/www/db.sql in our server. size of .sql file 800mb. we have upload sql file database name : "age" username : root, password : pass , database password : dbpass i trying command . not working. mysql -u root -ppass age db.sql please give correct command or missing path of sql file? please guide me this. you can use code: mysql -uroot -ppass age < /var/www/db.sql or better is: mysql -uroot -p age < /var/www/db.sql passing password mysql argument unsecure.

javascript - How to use ng-disabled to prevent user from resubmitting form -

i'm trying prevent user resubmitting login form code below <button class="submit" ng-disabled="form_login.$submitted" type="submit"></button> but disable submit button long button clicked, when user submit invalid data. right way stop submit button after valid information submitted? you can use ng-required attribute( directive ) check dirty state of element. try this: var app = angular.module('plunker', []); app.controller('mainctrl', function($scope) {}); <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <!doctype html> <html ng-app="plunker"> <head> <meta charset="utf-8" /> <title>angularjs plunker</title> <script> document.write('<base href="' + document.location + '" />'); </script> <link rel="...

custom module of magento not working on live -

i have created custom module from: https://magento.stackexchange.com/questions/14163/adding-custom-attribute-to-customer . , working on local not working on live: config.xml (app/code/local/your/customattribute/etc/config.xml) <?xml version="1.0"?> <config> <modules> <your_customattribute> <version>0.1.0</version> </your_customattribute> </modules> <global> <resources> <your_customattribute_setup> <setup> <module>your_customattribute</module> <class>mage_customer_model_entity_setup</class> </setup> <connection> <use>core_setup</use> </connection> </your_customattribute_setup> <your_customattribute_write> <connec...

javascript - How can i import the psd file and generate layers in framerjs -

i using windows , have psd file.i want create interactive prototype using framerjs. have atom text editor , have downloaded framerjs http://framerjs.com/static/downloads/framer.zip now how import design file , generate layers using framer generator in windows? from experience framer studio, think need photoshop running psd file open. found below text on framer github - https://github.com/koenbok/framer framer generator sketch or photoshop file open, open framer generator , click import. layer groups imported; single layers ignored. hierarchy of layer groups respected. can safely move things around in sketch or photoshop , re-import. generator update images , changes in hierarchy, leave code intact. see our documentation more. access layer group name groups within groups become sublayers groups vector masks become clipped layers group names should unique (otherwise, they'll renamed)

jquery - How to set disable/reaonly Kendo UI controls -

i have form various controls such numeric boxes, comboboxes , datepickers. there way how disable/make them readonly @ once? jquery mobile set attribute , call refresh() method. you can use kendo's widgetinstance method. $("[data-role]").each(function (index, el) { var widget = kendo.widgetinstance($(el)); if (widget.enable) { widget.enable(false); } });

osx - Install Qt 4.8.6 on Mac OS X El Capitan failed -

i using qt 4.8.6 on mac os x yosemite before. have upgraded el capitan cannot open qt project qt 4.8.6 kit. tried remove , reinstall qt 4.8.6. don't know why qt 4.6.6 cannot installed on new mac os x el capitan. how you? can verify me qt 4.8.6 cannot installed on mac os x el capitan? thank much! //edit: seems there same problem: https://forum.qt.io/topic/60173/install-qt-4-8-7-on-a-mac-running-os-x-10-11-el-capitan/6 it seems though there apis used qt 4.8 removed release of os x 10.11. current version 4.8.7 (planned be) last of 4.8 family according 4.8.7 release notes , you'll need patch , compile qt discussed in macports trac . the convenient alternative installing via homebrew or macports. i've told homebrew build qt 4.8.7 me , works fine. apart advised upgrade qt 5.x due support 4.x running out - if you're not bound external constraints me. ;) (source: release notes post)

Removing special format numeric values in sql server -

the record looks likes this current value - 1. chair - 2. table - 8 port switch - 3. cable .... desired value chair table 8 port switch cable ..... i have tried expression substring([column], patindex('%[a-z]%', [column]), len([column])) and works fine removing numeric values start of record want skip numeric 8 port switch record. thanks the following expression worked out me.... replace([column],left([column],charindex('.',[column],-1)),'') thanks

c# - How to bind to all elements in a BindingList? -

i have bindinglist consisting of objects of class implements inotifypropertychanged . public myclass : inotifypropertychanged { // ... } var element1 = new myclass(); var element2 = new myclass(); var mybindinglist = new bindinglist<myclass> {element1, element2}; i'd notified every time 1 of elements in list changed , run method. how can bind elements in list? i have solved following way: foreach (myclass myclass in mybindinglist) { myclass.propertychanged += myclassonpropertychanged; } private void myclassonpropertychanged(object sender, propertychangedeventargs propertychangedeventargs) { // ... }

serializing and submitting a form with jQuery POST and php -

i'm trying send form's data using jquery. however, data not reach server. can please tell me i'm doing wrong? // form <form id="contactform" name="contactform" method="post"> <input type="text" name="nume" size="40" placeholder="nume"> <input type="text" name="telefon" size="40" placeholder="telefon"> <input type="text" name="email" size="40" placeholder="email"> <textarea name="comentarii" cols="36" rows="5" placeholder="message"> </textarea> <input id="submitbtn" type="submit" name="submit" value="trimite"> </form> javascript: javascript code in same page form: <script type="text/javascript"> $(document).ready(function(e) { ...

ruby - Sinatra's way to render multiple .erb files -

i have web project render html file, based on various .erb files. i'm not sure best way, this, since each .erb file need specific information, such cookie content. currently have used concept: i have directory of .erb files, rendered using: erb.new(template).result the rendered html returned main .erb template, again rendered sinatra, using: erb :main the result pretty good, don't have chance include content session based cookies, since .erb can not access them i pretty sure, sinatra framework provides better way this. way be... require 'sinatra' enable :sessions "/" content1 = erb :template1, :locals => { :cookie => session[:cookie] } content2 = erb :template2, :locals => { :cookie => session[:cookie] } erb :maintemplate, :locals => { :content => [content1, content2] } end ... but, unfortunately doesn't work easy :( does has better idea? here did mine: get '/login' verbose = params['verbose...