Posts

Showing posts from July, 2013

java - The method createConnection() is undefined for the the class ConnectionFactory -

i have been trying learn activemq , jms. when compile following code above exception. although, have attached right jar files jms , activemq. eclipse asks me add cast connectionfactory object when try create connection (i.e. connectionfactory.createconnection()) using connectionfactory object. codes see everywhere on internet same have written. import javax.jms.connection; import javax.jms.connectionfactory; import javax.jms.deliverymode; import javax.jms.destination; import javax.jms.messageproducer; import javax.jms.session; import javax.jms.textmessage; import org.apache.activemq.activemqconnection; import org.apache.activemq.activemqconnectionfactory; public class jmsproducer { public static void main(string[] args) { try { // create connectionfactory connectionfactory connectionfactory=new activemqconnectionfactory("admin", "admin", activemqconnection.default_broker_url); // create connection connection co...

php - I want to fetch data from three tables every table is linked with id's -

Image
this question exact duplicate of: mysql join multiple tables 4 answers i have 3 tables name product, brand, product_info **product table** create table if not exists `product` ( `p_id` int(11) not null auto_increment, `product` varchar(50) not null, `flag` int(11) not null, primary key (`p_id`) ) engine=innodb default charset=latin1 auto_increment=5 ; insert `product` (`p_id`, `product`, `flag`) values (1, 'atta', 0), (2, 'oil', 0), (3, 'biscut', 0), (4, 'rice', 0); brand table create table if not exists `brand` ( `b_id` int(11) not null auto_increment, `p_id` int(11) not null, `brand` varchar(50) not null, `image` varchar(255) not null, primary key (`b_id`) ) engine=innodb default charset=latin1 auto_increment=8 ; insert `brand` (`b_id`, `p_id`, `brand`, `image`) values (...

java - Recursive Collision Detection for Rectangles not quite working -

i have bunch of variable sized rectangles, laid out randomly in area. i attempting (recursive) collision detection ensures not collide, shifting positions. but, still wrong (some of rectangles still collide), , can't figure out what.. inability recursion right. grateful if checked out. here's code, copy & paste & run it, , you'll see result instantly. requires javafx: import javafx.application.application; import javafx.geometry.point2d; import javafx.geometry.rectangle2d; import javafx.scene.scene; import javafx.scene.layout.pane; import javafx.scene.paint.color; import javafx.scene.shape.rectangle; import javafx.stage.stage; import java.util.*; public class example extends application { public static void main(string[] args) { launch(args); } private pane root = new pane(); @override public void start(stage stage) throws exception { scene scene = new scene(root, 800, 600); stage.settitle("collisio...

If statement to check Excel cells in a Macro -

i'm trying if statement checks if given cell exists (some merged) , has value different of '-', statement executed, in case query. in case conditions not met, query not executed cellstr = range("c3").text if cellstr <> "-" set rs = conn.execute("query") end if the code present works when cell has value '-' (the query not execute), not work when cell not exist (the query executes , returs 0) how can protect if statement against issue? check if cell exists (i.e. not covered merged cells) before check value/text in cell: sub test() dim c range set c = range("c3") 'set cell 'check if cell exists, i.e. not covered merged cells if c.mergearea.cells(1, 1).address = c.address 'check if cell text different "-" if c.text <> "-" 'execute msgbox "put statement here" end if end if end sub...

Sorting set of string numbers in java -

i need sort set of string's holds number. ex: [15, 13, 14, 11, 12, 3, 2, 1, 10, 7, 6, 5, 4, 9, 8] . need sort [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] . when use collections.sort(keylist); keylist set, reult obtained [1, 10, 11, 12, 13, 14, 15, 2, 3, 4, 5, 6, 7, 8, 9] . please help. write custom comparator , parse argument collections.sort(collection,comparator) . 1 solution parsing strings integers. collections.sort(keylist, new comparator<string>() { @override public int compare(string s1, string s2) { integer val1 = integer.parseint(s1); integer val2 = integer.parseint(s2); return val1.compareto(val2); } });

MATLAB: Filtering out part of an image -

i have image of deer behind fence , i'm trying remove fence can straight @ deer without fence in way. far i've, decent quality, segmented off (determined coordinates of) fence , trying replace colors of these coordinates nearby colors simulate removing fence. is there image processing function in matlab can me accomplish goal? have tried below code in try find nearest coordinate isn't part of fence, "~ismember([i_temp,j],[ii,jj])" doesn't work because i'm trying compare coordinates, instead seems comparing i_temp , j separate variables, i.e. i_temp not in ii or jj , j in ii or jj. %% 5. locate pixel locations of segmented image % fence has been segmented. locate pixel locations of % segmented image [ii,jj] = find(img_threshold2==1); n = length(ii); % count of number of coordinates rout = rin; gout = gin; bout = bin; %% 6. recolor areas of fence nearest color available k=1:n = ii(k); j = jj(k); keeplooping = true; i_add = 0; ...

gcc and llvm linux shutdown function from c code -

linux x86-64 compiling , statically linking gcc have: #include <sys/reboot.h> if (str[0] == 'r') reboot(0x1234567); but can't seem find equivalent function call shutdown. i'd know llvm function if different. from sys/reboot.h : /* perform hard reset now. */ #define rb_autoboot 0x01234567 [...] /* stop system , switch power off if possible. */ #define rb_power_off 0x4321fedc so reboot(0x4321fedc); or reboot(rb_power_off); should work.

c# - Process.Exited only fires when using Windows Applications -

i have been trying solve few days, program starts process (gui application such notepad or (metro) images) this: system.diagnostics.process execute = new system.diagnostics.process(); execute.startinfo.filename = (system.io.path.gettemppath() + @"{nr6t7yhygfdgy77fm74766jtf63ij78899dv884}\" + system.io.path.getfilenamewithoutextension(app.args[1])); execute.enableraisingevents = true; execute.exited += delegate { file.delete(system.io.path.gettemppath() + @"{nr6t7yhygfdgy77fm74766jtf63ij78899dv884}\" + system.io.path.getfilenamewithoutextension(app.args[1])); app.current.shutdown(); }; execute.start(); then calls this.hide() become equivalent of background process. problem is, if open file opens word, photos(metro) or other app can uninstalled execute.exited never fires . if open file opens notepad, paint or other app can't uninstalled execute.exited does fire.. have been able rule out potential problems: since execute.enableraisingeven...

java - JTextPane AttributeSet -

1 - first, can explain me difference between following methods inside class jtextpane because compile example , gave me same result : setcharacterattributes(attributeset attr, boolean replace) setparagraphattributes(attributeset attr, boolean replace) setlogicalstyle(style s) 2 - second, difference between following methods (always inside class jtextpane ) : getinputattributes() getlogicalstyle() getstyle(string nm) it great if give me example show real use of methods, because official documentations not explained. setcharacterattributes: things font , text color setparagraphattributes: should used set things line spacing... see if set line spacing attributes, shouldn't work setcharacterattributes setlogicalstyle: use style type given. has same effect setparagraphattributes, style logical style styleddocument (check out api styleddocument - addstyle)... concept "header 1" "header 2" in word getinputattributes: gets attributes as...

java - How to configure and where to put a servlet in NetBeans 7.4 accepting parameters from a .jsp page? -

i have worked tomcat don't know how configure , put servlet want accept parameters .jsp page further processing. indicating actual file system path in "action" tag results in "resource not available" or "not found" . how should configure servlet including "action" element in .jsp , web.xml , file system? thank you. a jsp servlet too, , hence forward servlet. (normally other way round, servlet controller, preparing data model request attribute , forwarding jsp view displaying data.) the servlet defined in web.xml servlet mapping. if use annotations instead mapping similar. <% request.setattribute("answer", "42"); requestdispatcher rd = request.getrequestdispatcher("/myservlet"); rd.forward(request, response); return; // no output jsp %> in above "/myservlet" correspond servlet mapping. forwarding not go browser, leaves servlet forwarded to. you may alternatively redir...

database - TADOTable - how to count specific records at once? -

my db table (customer) has field "active" (yesno). i'm using tadotable work table , have statistic in status bar of app saying how many customers active , how many not active. can read if current customer active writing this: bool isactive = customeradotable->fieldbyname("active")->asboolean; but, how check records @ once? or need use tadoquery , sql statements because of this? you're either going have run query, or loop through records in table , keep count of how many have active set true. the query going faster, unless you've got few records. , query right way(tm) it. it'll scale better.

excel vba - Application.Ontime giving inaccurate results -

when run code below (test1), varying results, around 2.5 sec - 3 secs. understand being higher 3 secs if computer occupied else, less 3 makes no sense. i've tried xl2003 , xl2010, similar results. hope can explain me. option explicit dim t double sub test1() debug.print application.ontime + timevalue("00:00:03"), "test2", , true ' t = timer end sub sub test2() debug.print ' debug.print timer - t end sub now() , timer seem update values asynchronously. in quick tests variance ranging approx 0 1 second. as have discovered should stick 1 source of time. aside, ontime can scheduled in increments of 1 second.

php - searching for results by name with dates -

this question has answer here: mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row() expects parameter 1 resource 33 answers i have been working on awhile now. trying search name , dates. show results. i need on part of coding. $sql = mysql_query("select * info patient_name '".$search."' date_of_service between '".$from."' , '".$to."'"); i message warning: mysql_fetch_assoc() expects parameter 1 resource, boolean given in c:\xampp\htdocs\xampp\prive_tc\testing2.php on line 40 my full code <?php mysql_connect('localhost', 'root', ''); mysql_select_db('prive_ts'); $search = $_get['search_box']; $from = $_get['from']; // or $from = $_get['from']; $to = $_get['to']; // or $to = $_get['to']; $sql = mysql_qu...

objective c - Blurry UI elements in ios8 iPhone6/6+ -

Image
i noticed lot of apps seem rather "blurry" on new iphone 6/6s. how optimize our code/storyboard when app runs on newer devices, doesn't upscaled? you need either include sized launch images or change project use launch nib file design launch view. select don't use asset catalog , create nib file instead. way launch view auto-layout , compatible device resolution.

javascript - jquery mobile tabs not to show on load? -

i have page tabs don't want div show when page loaded when clicked <div data-role="tabs" id="tabs" > <div data-role="navbar"> <ul> <li><a id="1" href="#one" data-ajax="false">1</a></li> <li><a id="2" href="#two" data-ajax="false">2</a></li> </ul> </div> i used hide tab: <script> $( document ).ready(function() { $("div#one").hide(); }); </script> the problem if try open first tab, nothing happens. think opened. (first tab works fine after click on #two ) there way set tabs don't show on load? edit: http://jsfiddle.net/b9bafuu4/6/ tab 1 show page load id non of them show when page load is you're trying achieve? see here -> jsfiddle js $(function(){ $('[href="#one"]').click(functio...

statistics - in the formula of the conditional probability, what would happen if the conditioning event be a null event? -

in formula of conditional probability, p(a|b)=p(ab)/p(b) what happen if conditioning event null event, i.e. p(b)=0 in formula? thanks. a non-existent event happens absolute certainty, probability 100%, thus p(a|b) = p(a) / 1 = p(a) p(a|b) in case means there no condition @ all. side note, can see 3 same in situation: p(a|b) = p(ab) = p(a)

html - Bootstrap dropdown RTL alignment -

recently in last release of bootstrap (3.2.0), realized cannot align dropdowns dir="rtl" or dir="ltr" have manually official blog says : (this feature added version 3.1.0) dropdowns have own alignment classes easier customization what class , how can make dropdown list right left? twitter bootstrap's new dropdown alignment quiet different after for. it changes position of absolute ly positioned dropdown menu. i.e. won't make dropdown appear in rtl (right left) mode. before v3.1.0 .pull-right had been used move dropdown right side of containing block. of v3.1.0 became deprecated in favor of .dropdown-menu-right / .dropdown-menu-left : deprecated .pull-right alignment as of v3.1.0, we've deprecated .pull-right on dropdown menus. right-align menu, use .dropdown-menu-right . right-aligned nav components in navbar use mixin version of class automatically align menu. override it, use .dropdown-menu-left . bu...

spring - How to excute JSTL code when we store in database -

i'm using spring , tiles i'm storing jstl code database. when user logs in, fetches time , stores session , puts session value in jsp page jstl tag not executed for ex. <c:foreach var="i" begin="1" end="5"> item <c:out value="${i}"/><p> </c:foreach> page output item 1 item 2 item 3 item 4 item 5 but output <c:foreach var="i" begin="1" end="5"> item <c:out value="${i}"/><p> </c:foreach> same problem wher explain , not possible jstl temple or directly string code in jsp page, once done if use jsp age create load time more current execution time, better way load using session every time , not store database value

javascript - preventDefault() not stopping regular form submit -

i'm trying code ajax contact form sends email. i'm following tutorial found here . i'm having trouble preventing browser navigating url indicated on form's action attribute. here's javascript code: $(function(){ var form = $('#ajaxmail'); var formsuccess = $('#successmail'); var formerror = $('#errormail'); $(form).submit(function(event){ event.preventdefault(); var formdata = $(form).serialize(); $.ajax({ type: 'post', url: $(form).attr('action'), data: formdata }) .done(function(response){ $(successmail).removeclass('standbymessage'); $(successmail).addclass('completedmessage'); $('#name').val(''); $('#email').val(''); $('#message').val(''); )} .fail(function(response){ ...

android - I can't make the textview right of the cell inside grid view -

Image
what have custom grid view , each row contains 5 columns , inside each cell have text view , want text view in right side of cell keeps showing on left side .. image : and here grid view xml file : <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".mainactivity" tools:ignore="mergerootframe" android:layout_gravity="right" > <gridview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/mygridview" android:layout_alignparenttop="true" android:layout_alignparentleft="true" android:gravity="right" android:layout_margintop=...

performance - JAVA Graph/DFS implementation -

i have small dilemma advised - i'm implementing graph (directed) , want make generic - graph t data in the node(vertex). add vertex graph - add(t t). graph wrap t vertex hold t inside. next run dfs on graph - here comes dilemma - should keep "visited" mark in vertex (as member) or initiate map while running dfs (map of vertex -> status)? keeping in vertex less generic (the vertex shouldn't familiar dfs algo , implementation). creating map (vertex -> status) space consuming. what think? thanks lot! if need run algorithms, more complex ones, find have associate kinds of data vertices. having generic way store data graph items idea , of course access time reading , writing data should o(1), ideally. simple implementations use hashmap, have o(1) acess time cases, factor relatively high. for yfiles graph drawing library added mechanism data stored @ elements themselves, can allocate many data slots like. similar managing object[] each eleme...

bitnami - how to redirect my domain to my magento's index.php? -

i have godaddy domain www.example.com. , have forwarded aws(amazon web services) elastic ip. domain getting forwarded bitnami's congratulation page instead of magento application. want redirect domain magento's application instead of bitnami's congratulations page. please me out. you'll find default bitnami apache configuration forcefully rewriting requests welcome page. bitnami ami's designed in way need set application using tools/web interface, exposed @ specific url context (i.e. http://domain.com/myapp/ ) if want around this, can try modifying files in apache config directory (/etc/httpd/conf.d/*), or use ami isn't preconfigured toolset such amazon linux or ubuntu.

node.js - PhpStorm and JavaScript: I'm getting "Cannot find declaration to go to" -

i'm playing simple nodejs project in phpstorm , control-click navigation stopped working. when click on required file path, message cannot find declaration go to . example: var controller = require('./lib/controller'); the file there program runs without problems. , if control-click global function or object (like "require" itself), navigation works, definition of function/object opened. it affects nodejs/javascript projects. possible disabled kind of code analysis? i have upgraded phpstorm 7 eap (to grunt support) , 8.0.1. problem appeared somewhere during upgrades. can't tell when. the problem nodejs plugin disabled , in case marked "incompatible" current phpstorm version. apparently, nodejs necessary navigation through require statements. it wasn't possible update plugin reason, reinstalled , problem fixed.

Kill all sessions when are multiple sessions ASP.NET -

i'm looking method kill session of site when user has site in multiple tabs. tried set online=1 in database , after when user wants login again check if online=1 , kill sessions, doesn't work always. know method this? you have put code in final code or when want user logout session.clear();

fetch yahoo email details using OAuth c# -

in windows form application,trying fetch details of yahoo email such sender,date,subject,body text & attachments. i'm using oauthbase.cs class request , access token. issue fetch users e## heading ##mail details. contact details used : "https://social.yahooapis.com/v1/user/"+ yahoo_guid +"/contacts?format=xml"); from above got contacts of user email. couldn't find request url email's details. kind of helpful me. thank in advance.

java - How to stub method returning Long in Spock? -

i have been trying stub method returning long null. there way this? interface clock { long currenttimemillis(); } def "stub method returning long"() { clock clock = mock(clock) clock.currenttimemillis() >> 1 when: long currenttime = clock.currenttimemillis() then: currenttime == 1 1 * clock.currenttimemillis() } def "mock method returning longs"() { clock clock = mock(clock) clock.currenttimemillis() >>> [1, 2, 3] when: long currenttime = clock.currenttimemillis() then: currenttime == 1 1 * clock.currenttimemillis() } in both tests i'm getting following error: condition not satisfied: currenttime == 1 | | null false when both mock , record behavior, should defined below. here's how works: @grab('org.spockframework:spock-core:0.7-groovy-2.0') @grab('cglib:cglib-nodep:3.1') import spock.lang.* class test extends spe...

c# - Cannot find stored procedure -

i have many stored procedure calls in c# code, 1 keeps failing. i'm running vs 2012 , sql server 2008 r2. connection string same stored procedures , have same permissions on of them. i error could not find stored procedure 'stp_map_preload @bldg, @linepos, @startd, @lineno, @pgrm, @appos, @sessionid'. system.exception {system.data.sqlclient.sqlexception} on line: sqldatareader dr = cmd.executereader();: i have tried creating new stored procedure same code, setting permissions, fails too. public arraylist detailpreload(string bldg, string linepos, datetime startd, string lineno, string pgrm, int appos, string sessionid) { string strsql = "stp_map_preload @bldg, @linepos, @startd, @lineno, @pgrm, @appos, @sessionid"; arraylist list = new arraylist(); using (sqlconnection constr = new sqlconnection(connm)) { using (sqlcommand cmd = new sqlcommand()) { cmd.commandtype = commandtype.storedprocedure; ...

css @keyframes animation not working in Safari for Windows -

i made carousel script can either fade, slide or both transition. can set changing class name of parent container (#modulecarousel_12). [fiddle: http://jsfiddle.net/6jx8ufwg/11/ ] in chrome works fine. in safari (for win) however: the fade works if parent has "slide left" in class name. strange, since adds second animation (left-positioning). .modulecarousel.fade > div.active { z-index: 3; opacity: 1; -webkit-animation-name: fade; animation-name: fade; } .modulecarousel.slide.left.fade > div.active { -webkit-animation-name: slide-left, fade; animation-name: slide-left, fade; } /* chrome, safari, opera */ @-webkit-keyframes fade { 0% {opacity: 0; -moz-opacity: 0;} 100% {opacity: 1; -moz-opacity: 1;} } /* standard syntax */ @keyframes fade { 0% {opacity: 0; -moz-opacity: 0;} 100% {opacity: 1; -moz-opacity: 1;} } @-webkit-keyframes slide-left { 0% {left: 100%;} 100% {left: 0%;} } ...

Compile time vs. run time in Chef recipes -

i have following (simplified) recipe called java, install java of course. file recipes/default.rb include_recipe "install_java" file recipes/install_java.rb # install rpm yum repo via yum_install library function yum_install("jdk1.7.0_51") # list directories in /usr/java jdk_dir = `ls -ld /usr/java/jdk1.* | sort | tail -1` if jdk_dir.empty? raise "missing jdk installation" end when run recipe "chef-client -o recipe[java]" synchronizing cookbooks: - java compiling cookbooks... ls: /usr/java/jdk1.*: no such file or directory =========================================================================== recipe compile error in /var/chef/cache/cookbooks/java/recipes/default.rb =========================================================================== runtimeerror ------------ missing jdk installation it seems yum_install() function not being called. however, if modify install_java.rb recipe have # install rpm yum repo v...

windows - Meaning of !chkimg errors for a crash dump -

i have strange crash dump of app cannot figure out crash reason. noticed !chkimg command reveals errors in dump: 0:013> !chkimg 824985 errors : @eip (77230010-7731016b) the address range 77230010-7731016b belongs ntdll.dll module. definite sign of malware affected program? can somehow confirm or eliminate hypothesis? edit: additions based on blabb's answer: the range size 917851 out of 824985 altered in ntdll (by default !chkimg not check writable sections output seesm suspicous i executed command in latest version of windbg , found 8219 not 824985 errors. you cannot assume machine malwared based on possibly corrupt dump my app consists of several different processes/executables , have dumps each of them. , !chkimg returns same errors of them. the dumpwrite path can have problems during bsod , corrupt dump written all dumps user mode not kernel. also following warning while reloading symbols: * warning: symbols timestamp wrong 0x521ea8e7 0...

AngularJS : Can a directive template contain a form element? -

is possible use form element inside angular directive template? e.g. might want generate form save on repetitive coding - html shows data, directive auto-generates editing. find useful edit pages repeat lot: <div data-editable="true"> <span>{{item.name}}</span> </div> and directive: .directive('editable',function(){ return { restrict: 'ae', require: '^form', transclude:true, scope: {}, // set after... template:'<div><form name="someform"><span>form</span></form></div>', link: function(scope,elm,attrs,controller) { //nothing here quite yet... } }; }); yet when run it, output not transclude, , form element stripped out: <div data-editable="true" class="ng-isolate-scope"><div><span>form</span><ng-transclude></ng-transclude></div...

Safari/Chrome bxSlider infinite loop issue/bug -

i'm using bxslider create gallery of beers @ url: crystalspringsbrewing.com/ourbeers.php you click on logo beer , description provided beneath slider. i'm doing code: $(document).ready(function() { $('.beer-text:nth-of-type(1)').show(); $('.beer-type').click(function(event) { var beername = $(this).data('beer'); $('.beer-text').hide(); $('#' + beername).show(); }); }); i have set infinite loop in bxslider. problem this: if press once beginning , click on last beer in slider (wuerzburger) description provided, other slides (13, summertime ale, butch) not display descriptions when click on them. nothing happens. error occurs 50% of time in chrome , safari. enough annoying. works fine on firefox, imagine it's bug in browser or bxslider. ideas? try refreshing few times if bug doesn't occur first time page loads. basically what's going on when you're getting end of list, jquery plugin you...

java - how to make prunsvr work from NSIS script -

i have nsis script responsible creating out installer. installer copies files our java application uses prunsvr install windows service. when run targeting exe file built using launch j, works. want able respond wsm messages in application perform cleanup / logging. nsis script creates service so: execwait '"$instdir\prunsrv.exe" "//is//${project}" --displayname="ipti ${project}" --install="$instdir\prunsrv.exe" --classpath="$instdir\host interface.jar" --startmode="java" --startclass="com.ipti.ptl.hostinterfaceservice.hostinterfaceservice" --stopmode="java" --stopclass="com.ipti.ptl.hostinterfaceservice.hostinterfaceservice" --startup="auto" --startpath="$instdir"' execwait 'net start "ipti ${project}"' the method above fails create service run method works fine (targeting exe) execwait '"$instdir\prunsrv.exe" "//is//${pro...

PHP Unix to Date -

when var_dump particular variable, get: 'date' => int 1410307200 when var_dump date('f j y', strtotime($start_date)) , get: string 'january 1 1970' (length=14) i same output when don't use strtotime . why keep returning epoch time? you're calling strtotime() on unix timestamp. that's redundant , error: echo date('f j y', $start_date)

Tell SQL Server 2008 R2 to use user name a password to avoid error 18452 using Access 2010 VBA and linked tables -

i working sql server 2008 r2 , ms access 2010. have .accdb linked tables , use login , password instead of windows authentication because have several remote users. have no trouble using login , password using ssms or access .adp project. i have created dsn-less connection tables using code doug steele’s site http://www.accessmvp.com/djsteele/dsnlesslinks.html having trouble creating cached connection ms office blogs http://blogs.office.com/2011/04/08/power-tip-improve-the-security-of-database-connections/ . i continue following error: connection failed: sqlstate ;28000', server error 18452, login untrusted domain , cannot used windows authentication. this @ point code tries pass test query sql: set rst = dbcurrent.openrecordset(strtable, dbopensnapshot) and when click ok, sql server login screen use trusted connection checked (which don't want) , login id auto-filled not id supplied via code. so, number one, why access/sql continually trying connect ...

Clojure: How to Hook into Defrecord Constructor -

the title of question may on specify implementation, idea simple, want create , record, or similar, map type declared deftype, etc... want create object string id , int age, want convert id uuid , age int if not already. how do idiomatically? so far have this: (let [item (my.model/map->item { :id (uuid/fromstring "62c36092-82a1-3a00-93d1-46196ee77204") :age (int 6)})]) but dont want both of operations every time create item, want logic in 1 place. make auxiliary function this, there built in support in deftype or defrecord? it's easiest use function takes input map , constructs item that. (defn make-item [{:keys [id age] :as input}] {:pre [(string? id) (number? age)]} (-> input (update-in [:id] #(uuid/fromstring %)) (update-in [:age] int) my.model/map->item)) this scale nicely need more keys or stricter constraints, , adapts other record types.

How to start a docker container (ubuntu image) -

how stat docker container. had created using docker run -d -p -v /users/bsr:/usr/local/users --name test ubuntu have virtual box guest addition installed, , mounting works. but, not sure why can't keep shell running. bsr[~/tmp/web] $ docker ps -a container id image command created status ports names cf620ff6c36a ubuntu:latest "/bin/bash" 2 hours ago exited (0) 2 minutes ago test 8213c8d49842 nginx:latest "nginx" 3 hours ago hour 0.0.0.0:49154->80/tcp web bsr[~/tmp/web] $ docker start test test bsr[~/tmp/web] $ docker ps -a container id image command created status ports names cf620ff6c36a ubuntu:latest "/bin/bash" 2 hours ag...

jquery - How to decrement a font-size percentage with .css() -

i have jsfiddle here - http://jsfiddle.net/pbkt3nrx/1/ - want decrease font-size of html element 5% each time "shrink" button clicked. first click reduces font-size 62.5% (10px) 5px. there way this? thanks $(function(){ $('button#shrink').mousedown(function() { $('html').css('font-size', '-=5%'); }); }); try this $(function(){ $('button#shrink').mousedown(function() { font = parseint($("html").css("font-size")); //get current font-size font = font-1; //decrease font-size 1 $('html').css('font-size', font); //apply new font-size current font-size }); }); jsfiddle

c# - Error reading excel cell with line break into Dataset -

Image
i have peculiar issue trying read values excel dataset in c#. some of excel cell contains line break this. (press alt+ enter in cell include line break within cell) while reading excel in program through fill command. line break read "_". how address scenario? either want clean escape sequence before importing excel.

email - PHP send mail function is not working on other webpages -

this question has answer here: php mail function doesn't complete sending of e-mail 24 answers something wrong codes? <?php $rand_2 = "abcdefghijklmnopqeabcdefghijklmnopqrstuvwxyz1234567890"; $rand_key = substr(str_shuffle($rand_2), 0, 30); $to = "meanlinsey@gmail.com"; $subject = "account validation"; $body = "good day! "."mary ann linsey"."\n\n copy validation code below confirm registration in portal \n\n".$rand_key; $header = "from: portal"; if(mail($to, $subject, $body, $header)){ echo 'message has been sent to: <strong>'.$to.'</strong>'; }else{ echo 'something went wrong'; } ?> some of send email program working piece of codes not dont why configure php.ini , send_mail.ini. <?php $rand_2 = "abcdefghijk...

javascript - Disabling login button in openerp -

how disable login button in openerp? want disable login button in openerp login page. can please me out on how disable button in javascript? disable login button , or hide login button using js self.$el.find('button').hide(); in start function of instance.web.login

c# - Insert Custom value at top of Databound ComboBOX -

i want insert default value @ top of combobox. please tell me proper way so. what tried my code: using (var salaryslipentities = new salary_slipentities()) { employee emp = new employee(); cmbemployeename.datasource = salaryslipentities.employees.tolist(); cmbemployeename.items.insert(0, "select employee"); } error items collection cannot modified when datasource property set. you can using system.reflection. check code sample below. write common method add default item. private void additem(ilist list, type type, string valuemember,string displaymember, string displaytext) { //creates instance of specified type //using constructor best matches specified parameters. object obj = activator.createinstance(type); // gets display property information propertyinfo displayproperty = type.getproperty(displ...

Rails controller if else statement -

i'm working on messaging system in rails web app @ moment should give users capability see sent , received messages. sent , received messages defined in model 'to_messages' , 'from_messages'. stands, i'm able display appropriate messages both inbox , outbox. when user goes inbox , clicks on received message, show action displays content. however, not working sent messages in outbox. when user clicks on sent messages in outbox, error, suspect i'm getting because in messages controller, i'm calling to_messages(received messages). know need if/else statement in controller, i'm not sure how go writing out. apologies newbie question, have ideas? thanks! messages_controller.rb class messagescontroller < applicationcontroller def index @messages = current_user.to_messages end def outbox type = (params[:type] && params[:type] == "sent" ) ? "from_messages" : "to_messages" @messages = current...

python - Defining setter in a shorter way -

currently when want define setter , leave getter alone this: @property def my_property(self): return self._my_property @my_property.setter def my_property(self, value): value.do_some_magic() self._my_property = value is there way make shorter? i'd skip part same: @property def my_property(self): return self._my_property you can make decorator auto-creates getter, following underscores convention: def setter(fn): def _get(self): return getattr(self, '_' + fn.__name__) def _set(self, val): return fn(self, val) return property(_get, _set) or more concisely, if style more: def setter(fn): return property( lambda self: getattr(self, '_' + fn.__name__), fn) usage: class x(object): @setter def my_property(self, value): self._my_property = value + 1 x = x() x.my_property = 42 print x.my_property # 43

java.lang.IllegalArgumentException: parameter [timezone] =, org.apache.oozie.servlet.XServletException: E1003: -

caused by: java.lang.illegalargumentexception: parameter [timezone] = [gmt+9] must valid tz. parsing error invalid timezone: gmt+9 @ org.apache.oozie.util.paramchecker.checktimezone(paramchecker.java:301) @ org.apache.oozie.command.coord.coordsubmitxcommand.resolveinitial(coordsubmitxcommand.java:693) @ org.apache.oozie.command.coord.coordsubmitxcommand.basicresolveandincludeds(coordsubmitxcommand.java:581) @ org.apache.oozie.command.coord.coordsubmitxcommand.submit(coordsubmitxcommand.java:221) org.apache.oozie.servlet.xservletexception: e1003: invalid coordinator application attributes, parameter [timezone] = [gmt+9] must valid tz. parsing error invalid timezone: gmt+9 @ org.apache.oozie.servlet.v1jobsservlet.submitcoordinatorjob(v1jobsservlet.java:232) @ org.apache.oozie.servlet.v1jobsservlet.submitjob(v1jobsservlet.java:91) @ org.apache.oozie.servlet.basejobsservlet.dopost(basejobss...