Posts

Showing posts from April, 2010

java - How do I set a primitive private static final field in a class with private constructor using PowerMockito? -

i'm trying set private static final field in class private constructor junit test. when boil code down basics, following: public class foo { private static final boolean flag = false; private foo() { /* don't call me */ } public static boolean get() { return flag; } } my tests looks this: @runwith(powermockrunner.class) @prepareeverythingfortest // whitebox fails without line public class footest { @test public void testget() { whitebox.setinternalstate(foo.class, "flag", true); asserttrue(foo.get()); } } and here excerpt pom file: <junit.version>4.11</junit.version> <powermock.version>1.5.4</powermock.version> <mockito.version>1.9.5</mockito.version> when put breakpoint on return flag; , can see flag set true in intellij's debugger. yet test fails assertionerror . any ideas make work? update: using reflection doesn't seem work, either: @test public void te

jquery - How to make dataTable resized automatically after reloading data? -

Image
when there no data datatable looks : the last header has small width. after reloading , datatable has last header same width: but when inspect page last header has larger width : so how make datatable automatically adjusted in last photo after being reloaded ? you can added following code blog datatable.js $(window).on("resize", function () { table.columns.adjust() .responsive.recalc(); })

xaml - Font Manager missing in Blend for Visual Studio 2015? -

i'm trying use custom font ( roboto google ) in clients windows phone 8.1 (winrt, not silverlight) app. following tutorial have included .ttf , set "build action" "content" - unfortunately, not work. this answer suggests should use font manager in blend embed font, unfortunately can't seem find tool in latest version (blend visual studio 2015). has feature been moved / removed?

unity3d - Multitouch on GearVR? -

i understand it's possible gearvr distinguish between "tap" , "swipe". possible distinguish between 1 finger tap , 2 finger tap? no, because touchpad on gearvr presents touches via mouse input: input.getmousebuttondown(0) / input.getmousebuttonup(0)

Push element to existing array in ruby -

i have problem don't know how resolve: i have code pretty asks user date. problem have can't make array take var limit element whenever user puts new date. array resets whenever method 'new_date' ends. here code: def new_date puts "date please: " date1 = $stdin.gets.chomp d, m, y = date1.split('-').map{|x| x.to_i} limit = day_of_week(d, m, y) puts days_of_the_week[limit] $various_dates = [] $various_dates.push(limit) end you should not reset array of dates in: $various_dates = [] instead, like: $various_dates ||= [] what does, gets global variable $various_dates , if hasn't been initialized (which means nil), set empty array.

FullCalendar - Different minTime / maxTime for different days -

is there way set different mintime / maxtime different days? eg: mon, starttime: 09:00, endtime: 19:00 tue, starttime: 10:00, endtime: 20:00 ... sat, starttime: 09:00, endtime: 13:00 i realise bit old now, able achieve setting mintime , maxtime options after initialisation based on events. believe feature came available in later release (i'm using v3.1.0). in scenario, when user clicks on day, set start time , end time based on day of week is. created map/dict of open , close times each day: // create map of iso day , start , end times // eg. 1 = monday, 2 = tuesday etc var openclosetimes = { // monday 1: { starttime: '09:00:00', endtime: '17:00:00' }, // tuesday 2: { starttime: '09:00:00', endtime: '17:00:00' }, // wednesday 3: { starttime: '09:00:00', endtime: '17:00:00' }, // thursday 4: { starttime: '09:00

image - Parse pending external resources in javascript at the runtime of a html page? -

question: how count totalnumber of pending resources being made page in javascript? getentriesbytype here's quick snippit of page images , http requests: <div id="results"></div> <img src="http://placekitten.com/g/200/100" alt=""/> //resource 1 <img src="http://placekitten.com/g/240/500" alt=""/> //resource 2 <img src="http://placekitten.com/g/210/300" alt=""/> //resource 3 <img src="http://placekitten.com/g/500/300" alt=""/> //resource 4 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js"></script> //resource 5 <script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.min.js"></script> //resource 6 <script> var results = document.getelementbyid('results'); var r = new xmlhttprequest(); r.open("get", "http://www

c++ - Opencv 3.0 features2d.hpp error : unknown AlgorithmInfo -

i'm developing project using opencv3.0 module found in opencv_contrib github. im using xcode 7.0, yosemite 10.10. have done setting in xcode header search path : /users/kimloonghew/documents/opencv/opencv-3.0.0/build/include /usr/local/cellar/libiomp/20150401/include/libiomp/omp.h /usr/local/include library search path : /users/kimloonghew/documents/opencv/opencv-3.0.0/build/lib /usr/local/lib other linker flag : -lopencv_calib3d -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_shape -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videoio -lopencv_videostab -lopencv_nonfree -lopencv_ml -lopencv_xfeatures2d here code below: #include <stdio.h> #include <stdlib.h> #include <iostream> #include <fstream> #include <dirent.h> #include <string> #include <unistd.h> #include <sys/stat.h> #include &

How do I sanitize a time stamp for use in a conditional index in a rails migration? -

i have rails migration need create conditional index. condition includes timestamp so: class indexcreatedatonnotes < activerecord::migration def change add_index :notes, :created_at, where: "state = 'active' , created_at >= #{200.days.ago}" end end however not put timestamp straight string query in rails, instead do: note.where("created_at >= ?", 200.days.ago) things escaped right way timezones , everything. how do in migration? when use #{value} value called to_s on converted string thing miss here surround date single quotes , to_s called on date don't want to_s want calling .to_formatted_s(:db) : add_index :notes, :created_at, where: "state = 'active' , created_at >= '#{200.days.ago.to_formatted_s(:db)}'"

ios - No such module "Armchair" -

this problem driving me insane. whatever do, problem "no such module 'armchair'" when archive. works when build when archive xcode messes me. see xcode archiving/compiling armchair. i have added $(project_dir)/appname/external/armchair/build/release-iphoneos framework search paths . i have added framework in embedded binaries i have added framework in linked frameworks , libraries i have tried adding framework copy frameworks in build phases i have tried adding armchair framework workspace instead , added & coping framework there. i think have tried raindance, sure. keeps refusing work when archiving, works normal building , running on device. i have read , tried these related questions: no such module 'pffacebookutils' "no such module" on xcode 7 beta 2 cannot install alamofire in new xcode project. "no such module alamofire" getting error "no such module" using xcode, framework there running xcode 7

sql - Crystal reports - last day of previous month -

i given formula in program, it's giving me first of current month. need last day of previous month, report runs 3rd day of current month want previous month data. tonumber(totext(year(currentdate), 0, "") + totext(month(currentdate), "00") + '01') you use {datefield} in lastfullmonth or if need last day date(year(currentdate),month(currentdate),1)-1

c# - iTextSharp target=_blank in PDF -

i generating pdf in c# using itextsharp dll. need have links, linked external pdfs/docs. is there way facilitate target=_blank mode? links result in pdf being rendered within original pdf browser window. i use following c# code: anchor tool = new anchor(new phrase("some text",fonthead3)); tool.reference = "http://www.google.com", false); this concept doesn't exist in pdf. exists when viewing pdf in standalone viewer (such adobe reader) can have option open pdf in new pdf viewer window (not browser window), when view pdf in browser plugin, can't tell browser open new window. pdf doesn't have access browser functionality. this isn't problem limited itextsharp; it's problem pdf in general.

css - Can I generate Kendo Funnel Chart horizontally? -

i'm trying generate funnel chart horizontally. got demo , running, vertical. there other options available ? got option other library: http://www.zingchart.com/gallery/chart/#!horizontal-funnel-styled-guides but client wants use kendo , overkill include other library funnel chart just taking shot @ anyways, kendo bar graphs can generated both horizontally , vertically. need mess type var in js. bar-types generated horizontally $("#yourchart").kendochart({ seriesdefaults: { //generate horizontal bar graph type: "bar" } }); my guess have set column-type var this: column-types generated vertically $("#yourchart").kendochart({ seriesdefaults: { //generate vertical graph type: "column" } }); kendo funnel charts can not configured horizontally. however can put chart in div , tell div flip sideways. same labels, etc.. , reposition everything. it's bit of hack

c++ - An error in the LinkList code -

.cpp file #include "stdafx.h" #include "linkx.h" #include<iostream> #include<string.h> using namespace std; linkx::linkx(int pid,char *pname) { id=pid; strcpy(name,pname); next=null; } void linkx::displaylink() { cout<<id<<endl; cout<<name<<endl; } the above code gets error : error 3 error c2511: 'linkx::linkx(int,char *)' : overloaded member function not found in 'linkx' private: system::void button1_click(system::object^ sender, system::eventargs^ e) { linkx *l1=new linkx(10,"charvi"); linkx *l2=new linkx(20,"vin"); l1->next=l2; delete l1; delete l2; } }; this code gets errors: error 1 :error c2664: 'linkx::linkx(int,char)' : cannot convert parameter 2 'const char [7]' 'char' error 2 :error c2664: 'linkx::linkx(int,char)

vb.net - Email line breaks not working -

i trying force line breaks inside body of automatic email. i have referenced many examples, such "adding multiple lines body of smtp email vb.net" . i've tried many different ways make line breaks: stringbuilder.appendline dim sb new stringbuilder sb.appendline("for security purposes, password provided within email.") sb.appendline("thank , have wonderful day.") system.environment.newline strbody = strbody & "thank , have wonderful day. " & system.environment.newline strbody = strbody & "password: " & dsa.tables(0).rows(0).item(2) & system.environment.newline & system.environment.newline vbnewline strbody = strbody & "thank , have wonderful day. " & vbnewline vbcrlf strbody = strbody & "thank , have wonderful day. " & vbcrlf environment.newline strbody = strbody & "thank , have wonderful day. " & environment.newline and on, eve

node.js - Installing gulp to windows 10 -

i've installed gulp npm install --global gulp and set envidoment variable: - variable: gulp_home - value: c:\users\myaccount\appdata\roaming\npm\node_modules\gulp (..\gulp folder) in environment variables , try run "gulp". message in cmd: c:\myaccount\workspace\todoparrot>gulp [09:47:24] local gulp not found in c:\myaccount\workspace\todoparrot how set gulp work? you must locally install gulp folder. use following command. npm install gulp this fixed problem

c# - SMTP SendEmail hung without any error our response -

i using smtpclient send email attachment. send email method below public static void sendemail(string subject, string messagebody, string toemailid, list<string> attachments=null, list<string> cc = null, bool isbodyhtml = false) { try { var fromaddress = new mailaddress("email@email.com"); var toaddress = new mailaddress(toemailid); const string frompassword = "password"; var smtp = new smtpclient { host = "smtp.gmail.com", port = 587, enablessl = true, deliverymethod = smtpdeliverymethod.network, usedefaultcredentials = false, credentials = new networkcredential(fromaddress.address, frompassword), timeout= 1000 * 60 }; using (var message = new mailmessage(fromaddress, toaddress) { subject =

Use `for` in `print()` will give a generator on Python 3.x? -

why , how works? example i'm writing list comprehension this: >>> = (10, 30, 20) >>> print([q q in a]) [10, 30, 20] at now, if remove [] , work, but: >>> = (10, 30, 20) >>> print(q q in a) <generator object <genexpr> @ 0x7fe527d1dca8> does python make generator here? , if without print() : >>> = (10, 30, 20) >>> b = q q in file "<input>", line 1 b = q q in ^ syntaxerror: invalid syntax i'm thinking because (q q in a) make generator, that's impossible, i'm not using 2 pair of () like: >>> = (10, 30, 20) >>> print((q q in a)) # here 2 pair of `()` <generator object <genexpr> @ 0x7fe527d1dca8> does python make generator here? yes. quoting official documentation of generator expressions , the parentheses can omitted on calls 1 argument. note exception actual syntax generator_expression ::= "("

frameworks - Ruby on Rails separate front & back -

i've been using ruby on rails since little more 1 year , i've in casual way, mean, in 1 place (front & back), using standard .html.erb file populated associated controller method. otherwise, today in our project, have need separate front , end multiples reasons (code maintainability / clarity, better architecture, more reactivity, etc...). i've done plenty of researches , watch conferences ( 1 , 2 , 3 ), didn't find solution yet. looks question comes often, best practice/tools separate backend , frontend of ruby on rails app? i don't feel need (yet) huge js framework react/emberjs/angular/etc... first thinking middleman / jekyll , make communication via json , api calls, seems it's not solution dynamic website. so there frontend framework works rails api , maintainable , upgradable (add feature/extension gems)? thanks insights. i have similar setup 1 of commenters on question. i'm using rails project structure, define page la

delphi - How can i define typed constant and use it in functions argument -

when defined typed constant can't use in default value of functions argument, example: const defc :char = ','; function fun(delimiter :char=defc); when run code compiler show error : [dcc32 error] : e2026 constant expression expected if not defined type, compiler set type ansichar , bad code, how can use way or way can compiler use char , not use ansichar character constants? you seem rely little bit on tool-tip information. info not produced actual compiler, , not worth place bets on. anyway, character , string literals context sensitive. means compiler (actual code generator) create appropriate code depending on how literal used. consider these 2 consts (as alternatives): const defc = ','; // tool-tip shows system.ansichar defc = #$0298; // tool-tip shows system.ansichar here too! this shows tool-tip can't relied on here, because doesn't know in context const used. then consider following 2 functions: f

angularjs - Controller is loaded but Templaturl (View) doesn't load -

note: please don't mark duplicate. i'm putting note on first line, because know question has been asked lot of times on so. have gone through of them without finding solution. here state configuration of app.js: .config(function($stateprovider, $urlrouterprovider) { // ionic uses angularui router uses concept of states // learn more here: https://github.com/angular-ui/ui-router // set various states app can in. // each state's controller can found in controllers.js $stateprovider .state('intro', { url: "/intro", templateurl: "intro.html", controller: 'introctrl' }) .state('accedituser', { url: '/user', //templateurl : 'templates/followersliding.html', templateurl: 'tab-account.html', controller: 'edituserctrl' }) .state('welcome', { url: "/welcome", templateurl: "partials/welcome.html&q

ios - build developer guide for iPhone application -

is there standard way build developer, making developers understand code after delivering, if have sample it's better if want know how make code better, need read solid , other object-oriented design patterns.

directory - Create folders based on second column in text file and then move files into their folders accordingly -

i have thousands of files received cnc machine sorted. have index lists files , categories. column separated tab character. here example of content of index file: 111.maz aaa fgh 222.maz bbb iyu 333.eia cccdfew 444.maz aaawer bb bbba 555.eia aaa 123 666.m6m ddd234 777.pbd aaa ....... ..... thus, need following: create folders based on second column (successful), using excel separate column, batch create folder using following command: for /f %d in (list.txt) md %d transfer files folders accordingly (?) i'm not sure how second task. can point me in right direction? after hundred times of running , failing, finally, have sorted of them respective folders @stephan , @josefz. tweaked code little bit create ones file exists. for /f "tokens=1,*" %%g in (index.txt) ( if exist %%g ( md "%%~h" 2^>nul move "%%~g" "%%~h" ) ) have nice day! no need exc

Index Error: list index out of range in python -

i have project in internet security class. partner started project , wrote python code , have continue stopped. don't know python , planning learn running code , checking how works. when executing code error "indexerror: list index out of range". import os # deauthenticate devices os.system("python2 ~/downloads/de_auth.py -s 00:22:b0:07:58:d4 -d & sleep 30; kill $!") # renew dhcp on linux "sudo dhclient -v -r & sudo dhclient -v" # capture dhcp packet os.system("tcpdump -lenx -s 1500 port bootps or port bootpc -v > dhcp.txt & sleep 20; kill $!") # read packet txt file dhcp_packet = open("dhcp.txt", "r") # info txt file of saved packet line1 = dhcp_packet.readline() line1 = line1.split() sourcemac = line1[1] destmac = line1[3] ttl = line1[12] length = line1[8] #parse packet line = dhcp_packet.readline() while "0x0100" not in line: line = dhcp_packet.readline() packet = line + dhcp_pac

update xcode 6 to 7 (code doesn't work swift) -

i have project swift webview ( i'm using wkwebview ) , worked without probles. made update of xcode 7.1 version , none of webview work. have no error have nothing in screen. if has idea thanks (sorry english) class actu: uiviewcontroller, wknavigationdelegate { /**** variable declaration , iboutlet *****/ @iboutlet weak var contact: uibarbuttonitem! var backbuttonitem:uibarbuttonitem! var rightplaybarbuttonitem:uibarbuttonitem! var refreshpagebutton:uibarbuttonitem! var webview: wkwebview var varintermediate = string() let urlcontainer = streamplayer.sharedinstance.url /**** javascript insertion *****/ required init?(coder adecoder: nscoder){ let config = wkwebviewconfiguration() let scripturl = nsbundle.mainbundle().pathforresource("hidesectionsactu", oftype: "js") let scriptcontent = try? string(contentsoffile:scripturl!, encoding:nsutf8stringencoding) let script = wkuserscript(source: scriptcontent!,

ios - In swift I need to reposition the cursor in a textfield if the user enters data that does not conform to preset criterion -

if user enters data in textfield not conform criterion such numeric data entered want clear field , position cursor in textfield user forced make correct entry. verifyinput[tagcas].becomefirstresponder() sorry being dim.

api - How to Set/Start HostedNetwork without using Netsh command? -

the question clear, need set/start hosted network without using netsh command maybe using wmi classes or else? edit: found can use native wifi start hosted network calling functions wlanhostednetworkstartusing , wlanhostednetworkforcestart , or wlanhostednetworkinitsettings , can set security key calling wlanhostednetworkrefreshsecuritysettings function. don't know how call , use native wifi trying find out , read native wifi looks more complicated knowledge. how use native wifi start hosted network?

mysql - MariaDB grant privilege by using Wildcard host is not working -

i using 5.5.35-mariadb server openstack keystone installation. below 2 commands used insert privileges user keystone: grant privileges on keystone.* 'keystone'@'%' identified 'keystone'; grant privileges on keystone.* 'keystone'@'localhost' identified 'keystone'; flush privileges; but met access deny issue when specify hostname, written in /etc/hosts file. while access using 'localhost' working fine. [root@controller mariadb]# mysql -ukeystone -pkeystone -hcontroller error 1045 (28000): access denied user 'keystone'@'controller' (using password: yes) [root@controller mariadb]# mysql -ukeystone -pkeystone -hlocalhost welcome mariadb monitor. commands end ; or \g. mariadb connection id 98 server version: 5.5.35-mariadb mariadb server the workaround me grant privileges host name explicitly, working: grant privileges on keystone.* 'keystone'@'controller' identified 'keystone';

php - Save zip file in a different directory than the level at which code file is present -

i have written code zip content of given directory, code runs want save zip file in different directory calling function. code: $source = realpath('application'); $address = realpath('backup'); $destination = $address . directory_separator . 'download.zip'; if (file_exists($destination)) { echo "the file $filename exists"; } else { echo "the file $filename not exist"; } zip($source, $destination); function zip($source, $destination) { if (!extension_loaded('zip') || !file_exists($source)) { return false; } $zip = new ziparchive(); if (!$zip->open($destination, ziparchive::create)) { return false; } $source = str_replace('\\', '/', realpath($source)); if (is_dir($source) === true) { $files = new recursiveiteratoriterator(new recursivedirectoryiterator($source), recursiveiteratoriterator::self_first); foreach ($files $file)

input - Python changing filenames of multiple files in a folder -

i'm trying make script rename files in folder , code have, doesn't work. have 200 images in folder , want change filename1_ filename1 , on files. transformation dog_1 doggy1; or whatever, new name of file can anything. me out? i'm still new python code have right might nothing. import os directoryname="c:\\users\\ineke\\documents\\python scripts\\images" lijstmetfiles = os.listdir(directoryname) in range(len(lijstmetfiles)): os.rename(str(lijstmetfiles[i]), str("doggy"+str(i)) i ran code , here 2 main problems: the first being, not closing bracket on os.rename line. you have this: os.rename(str(lijstmetfiles[i]), str("doggy"+str(i)) you missing parentheses, should be: os.rename(str(lijstmetfiles[i]), str("doggy"+str(i))) however, edit issue copying code on in post. secondly, , importantly, not specifying path want rename on, giving 2 filenames, getting file not found error. you need

javascript - I cannot reference a function defined in a js file -

there js file called datetime.lib.js created , attached page. here content : /** * convertir le format de la date yyyy-mm-dd en dd-mm-yyyy * @access public **/ function convertdateformat($str,$ch) { var $tmp=""; if($str=="") $tmp=""; else{ $tmp=$str; var $y=$tmp.substr(0,4); var $m=$tmp.substr(5,2); var $d=$tmp.substr(8,2); $tmp=$d+$ch+$m+$ch+$y; } return $tmp.trim(); } /** * formatter une datetime mysql "yyyy-mm-dd hh:mi:ss" en "dd/mm/yyyy hh:mi" **/ function convertdateformat2($str,$ch) { var $tmp=""; if($str=="") $tmp=""; else{ $tmp=$str; var $y=$tmp.substr(0,4); var $m=$tmp.substr(5,2); var $d=$tmp.substr(8,2); var $h=$tmp.substr(11,2); var $m=$tmp.substr(14,2);

node.js - Passport.js error Unknown authentication strategy "local" -

i use passport methods in code also, example in registration in controller use req.login(). , works - user created without errors. when try login username , password of user, call passport , error. router: router.post('/login', passport.authenticate('local', { successredirect: '/', failureredirect: '/login', failureflash: true })); the error in terminal: error: unknown authentication strategy "local" @ attempt (/home/proj/node_modules/passport/lib/middleware/authenticate.js:166:37) @ object.authenticate [as handle] (/home/proj/node_modules/passport/lib/middleware/authenticate.js:342:7) @ next_layer (/home/projs/node_modules/express/lib/router/route.js:103:13) @ route.dispatch (/home/proj/node_modules/express/lib/router/route.js:107:5) @ c (/home/proj/node_modules/express/lib/router/index.js:195:24) @ functi

vb.net - OpenFileDialog set complete path -

dim streamf system.io.stream dim stringf string stringf = openfiledialog1.filename.tostring() streamf = openfiledialog1.openfile() i have file screenshot.png attached on application installation path means if user run .exe file desktop store screenshot.png on desktop , on. now need full path screenshot.png file sent in fax dim srcbt byte() dim encodedbase64 string dim filereader new io.filestream(stringf, io.filemode.open) redim srcbt(filereader.length) filereader.read(srcbt, 0, filereader.length) filereader.close() encodedbase64 = system.convert.tobase64string(srcbt) so problem part how can put location of file stringf ? because example have force user locate file using openfiledialog , have predefined file this should convert (relative) path absolut path: dim stringf_info new system.io.fileinfo(stringf) stringf = stringf_info.fullname

sorting - How to sort and subset a python dictionary with compound key? -

i got python dictionary compound key (pri_key, sec_key) , value: (123, 456): 45 (123, 457): 90 (124, 234): 70 (125, 87): 3 (125, 103): 56 (125, 897): 34 how sort value in descending order on each "pri_key", , list corresponding "sec_key" accordingly? expected result: 123: 457 456 124: 234 125: 103 897 83 the key here original sort. after that, can groupby on primary key. construct sort, can key off tuple of (<primary-key>, -<value>) (the negative sort values have same primary key in descending order): from itertools import groupby operator import itemgetter sorted_keys = sorted(original_dict, key=lambda key: (key[0], -original_dict[key])) primary_key, key_group in groupby(sorted_keys, key=itemgetter(0)): print(primary_key, [key[1] key in key_group]) and, of course, if can print keys, can use construct dictionary (or other datastructure) using results :-). here's demo terminal: >>> original_dict = { ... (12

bash - CGI script skipping source command -

i trying write cgi write html file don't have run script every time want see information. #!/bin/bash echo "content-type: text/html" echo "" echo "<html>" echo "<head><title>status</title></head>" echo "<body>" ./auto.sh > ../secure/status.html echo "redirecting..." echo "<script language="javascript">window.location.href="../secure/status.html";</script>" echo "</body></html>" however, when direct browser page, page source shows this, didn't run redirect command, , doesn't redirect... <html> <head><title>status</title></head> <body> redirecting... <script language=javascript>window.location.href = ../secure/status.html;</script> </body></html> what doing wrong? thanks!! edit: auto.sh #!/bin/bash echo "<html><head><t

Android white background EditText that act as button -

Image
i'm trying style edittext 1 in above picture. tried setting background result not @ excpected could point me right direction? use xml background fro edittext : <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <solid android:color="#cabbbbbb"/> <corners android:radius="2dp" /> </shape> </item> <item android:left="0dp" android:right="0dp" android:top="0dp" android:bottom="2dp"> <shape android:shape="rectangle"> <solid android:color="@android:color/white"/> <corners android:radius="2dp" /> </shape> </item> </layer-list>

javascript - Jquery elements only work after page refresh -

i building reacts based application, have few jquery elements on page such jqueryui date picker , bootstraps tooltip. the problem these elects not work until reload page. so jquery scripts not loaded first time around. i have looked through console , cannot see errors related jquery/javascript. any appreciated. here index.html page <!doctype html> <html class="no-js" lang=""> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="description" content=""> <meta name="viewport" content="width=device-width"> <title>icetea</title> <!-- latest compiled , minified javascript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <script src="https://code.jquery.com/jq

cruisecontrol.net - Exception of sending email doesn't show in the CC.net Dashboard -

all, succeed config email publisher in ccnet.config. , works fine. task build, unittest, merge result, etc completed successfully. reason. mistake smtp authentication user name cause exception when run build. way. set notifications always. <publishers> <statistics /> <merge> <files> <file>testresult\unittestresults.trx</file> </files> </merge> <buildpublisher> <sourcedir>e:\study\cc.net\test\kmih\backupfolder\source</sourcedir> <publishdir>e:\study\cc.net\test\kmih\backupfolder\publish</publishdir> <uselabelsubdirectory>true</uselabelsubdirectory> <alwayspublish>true</alwayspublish> </buildpublisher> <email mailport="25" mailhostusername="xxxxxx" mailhostpa

javascript - magento order status automatically update trigger or event -

i want set these: 1. when order not paid in 48 hours, automatically updated [cancelled] state. 2. when our paypal received chargeback, claim or dispute, automatically updated [on hold] state. 3. .....any trigger or event these. idea or tip okay me. use cron job. create controller action can check order status , order placed time , based on change status. use url hit action in cronjob .

error handling - How does the either function work and is used appropriately in Haskell? -

i trying learn haskell learning haskell data analysis @ moment (i read other things learn haskell... before though). there listing parse , modify csv data not work way book proposes, ie. throughs error. unfortunately, not enough able correct listing. somehow not work don't know how correct version like. did not realy found expressive examples use either function see if can derive correct version it module learningdataanalysis02 import data.list import data.either import text.csv -- compute average of list values average' :: fractional => [a] -> average' xs = sum xs / genericlength xs readcolumn :: [string] -> [double] readcolumn xs = map read xs getcolumnincsv :: csv -> string -> either string integer getcolumnincsv csv columnname = case lookupresponse of nothing -> left "the column not exist in csv file." x -> right (fromintegral x) lookupresponse = findindex (== columnname) (head csv) applytocolumnincsv :: ([strin

angularjs - angular.isObject() method not working -

angular provided angular.isobject method not working on angular template file. have used function in template can see below : <div class="row no-padding" ng-if="angular.isstring(student)"> {{student}} </div> please in advance. i have made simple solution need. function myctrl($scope) { $scope.student = "dharmendra"; $scope.isthisanobject = function(input) { return angular.isstring(input); }; } <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular.min.js"></script> <div ng-app ng-controller="myctrl"> <div class="row no-padding" ng-if="isthisanobject(student)"> {{student}} </div> </div>

javascript - Password field is not working while dragging mouse using angular.js -

i have issue.i have password filed eye icon.when user click on eye icon whatever password has typed displayed text , mouse again displayed password.in case happening when user dragging mouse up/down after click on eye icon typed password showing text should not happen.i explaining code below. <div class="input-group bmargindiv1 col-md-12"> <span style="position:absolute; right:5px; margin-top:6px;"><button class="btn btn-xs btn-success"ng-mousedown="hideshowpassword();" ng-mouseup="hideshowpassword();" ><i class="fa fa-eye"></i></button></span> <span class="input-group-addon ndrftextwidth text-right" style="width:180px">password :</span> <input type="{{inputtype}}" name="itemname" id="contactno" class="form-control" placeholder="password" ng-model="password" > </div> the rela

android programming: how to deal with multiple strings.xml in android studio(error:duplicate resources!) -

this question has answer here: android studio - mergedebugresources exception 14 answers well problem want create 2 strings.xml each contaniing different text , want read these texts different activities getting 1 error(help me please).by way tried create new resourse file named strings2.xml...here error: error:execution failed task ':app:mergedebugresources'. [string/action_settings] c:\users\dell\androidstudioprojects\testscrollview\app\src\main\res\values\strings.xml [string/action_settings] c:\users\dell\androidstudioprojects\testscrollview\app\src\main\res\values\strings2.xml: error: duplicate resources [string/app_name] c:\users\dell\androidstudioprojects\testscrollview\app\src\main\res\values\strings.xml [string/app_name] c:\users\dell\androidstudioprojects\testscrollview\app\src\main\res\values\strings2.xml: error: duplicate resources

javascript - HighChart Chart displaying incorrect data when switched to StockChart -

Image
i'm using highcharts render highstock chart. reason when switch highstock chart changes labels random data. when change chart_650422 = new highcharts.chart({ into chart_650422 = new highcharts.stockchart({ the xaxis labels changed random data. here demo: http://jsfiddle.net/14we85px/ in short: highstock doesn't support categorized xaxis, see api - options type or categories not listed. however, don't have switch highstock - if have highstock.js file included, can create highcharts chart enabled features highstock, see demo: http://jsfiddle.net/14we85px/3/ ( changes: removed scroolbar (?) , added scrollbar.enabled = true ).

html - Input Validation for PHP form -

i wonder why gender option reseting blank if click create button invalid input. must same value 1 selected before , after validation. see codes here: http://pastebin.com/gklews3h for first name , gender ones working. thank helping im still learning. while marius' answer right; fact variables case-sensitive , you'll either have use $gender over, or $gender on - can choose yourself, stick one. in php-standards, typically variable-names start lowercase letters, works either way (as long keep same name same variable). you have redundancy in code (like else -statements nothing). i'd suggest this. makes easier reading, , long use proper names variables, works too. <select class="form-control" id="inputgender" name="gender" > <option></option> <option value="male" <?php if ($gender == 'male') echo 'selected'; ?>>male</option> <option value="female&q

java - Generated WSDL has nillable="true" for @RequestWrapper -

my question is : how can setup cxf system service method signature same client signature? when using @requestwrapper? see question beeing asked 2 years ago: old question when using @requestwrapper on @webmethod results in nillable="true" in generated wsdl. wsdl generate java maven (cxf-codegen-plugin) , when nillable set arguments of method wrapped. @webmethod(action = "getavailablemoments") @requestwrapper(classname = "webservice.wrappers.getavailablemomentswrapper") public list<moment> getavailablemoments(localdate selecteddate) { } the wrapper looks this: @xmlaccessortype(xmlaccesstype.field) public class getavailablemomentswrapper implements serializable { private static final long serialversionuid = 1l; @xmlelement(required = true) @xmljavatypeadapter(value = localdateadapter.class, type = localdate.class) @xmlschematype(name = "date") private localdate selecteddate; } then part of wsdl looks this:

swift2 - NSManagedObject.setValue(value: AnyObject?, forKey key: String) causes error in Swift 2.0 -

i have piece of code working ok in xcode6 (swift 1.2) not swift 2: class func findorcreate<t: nsmanagedobject>(type: t.type, attribute: string, value: anyobject?) -> t { if let object = t.mr_findfirstbyattribute(attribute, withvalue: value) as? t { return object } else { let object = t.mr_createentity() as! t if let value:anyobject = value { object.setvalue(value, forkey: attribute) } return object } } error shows on line containing object.setvalue message: ambiguous use of 'setvalue(_:forkey:)' i think not recognise object of nsmanagedobject type i'm not 100% sure, clue why happens appreciated. i've posted same question on apple forum , got answer workaround problem: let object = t.mr_createentity() as! nsmanagedobject if let value:anyobject = value { object.setvalue(value, forkey: attribute) } return object as! t this works exp

Composer: eonasdan/bootstrap-datetimepicker installed into components -

this question has answer here: composer installs jquery components in wrong directory 1 answer for cakephp application, i'm trying install eonasdan/bootstrap-datetimepicker via composer. but, unlike other packages, , dependencies installed components , not vendor/components : $ composer require eonasdan/bootstrap-datetimepicker using version dev-master eonasdan/bootstrap-datetimepicker ./composer.json has been updated loading composer repositories package information updating dependencies (including require-dev) - installing symfony/process (v2.7.5) loading cache - installing kriswallsmith/assetic (v1.3.0) loading cache - installing robloach/component-installer (0.2.3) loading cache - installing moment/moment (2.10.6) loading cache - installing eonasdan/bootstrap-datetimepicker (dev-master fd8bd86) cloning fd8bd86dd78f789fb

Android wear notification icon is getting replaced by handheld app launcher icon -

just playing bit android wear stuff, there way of having different notification icon android wear , handheld app icon? icon displayed in watch launcher icon of handheld app. if change launcher icons in wear module or small icon property of notification, in android wear notification still showing handheld device launcher icons. when put icon in .setsmallicon(r.drawable.ic_wear) shown small icon there in notification of handheld device not reflected wear notification. there similar questions asked in not find appropriate solution. there way change them?

string formatting - Python 3 format method - tuple index out of range -

i have problem format method in python 3.4.2. shows me following error: traceback (most recent call last): python shell, prompt 2, line 3 builtins.indexerror: tuple index out of range the code: a = "{0}={1}" b = ("str", "string") c = a.format(b) print (c) the tuple contains 2 strings indexes 0 , 1 , error should not displayed. according docs should passing in arguments positional arguments, not tuple. if want use values in tuple, use * operator. str.format(*args, **kwargs) perform string formatting operation. string on method called can contain literal text or replacement fields delimited braces {}. each replacement field contains either numeric index of positional argument, or name of keyword argument. returns copy of string each replacement field replaced string value of corresponding argument. "the sum of 1 + 2 {0}".format(1+2) 'the sum of 1 + 2 3' more specifically, you'd want followi

java - Transforming int to char with input (edited) -

my program should transform letter letter 2 letter away it. c, b d. , can use first 10 letters in english alphabet. ('i' go 'a' , 'j' go 'b' cuz can use 10 letters. import java.util.scanner; public class part6 { public static void main(string[] args) { scanner keyboard=new scanner(system.in); system.out.println("please enter 4 letter word uses first 10 letter on english alphabet(a,b,c,d,e,f,g,h,i,j): "); scanner keyboard=new scanner(system.in); string s1 = keyboard.next(); string s2 = "z1"; s2=s1.tolowercase(); if (s1.length() !=4) system.out.println("please enter word 4 letters"); char c1= s2.charat(0); char c2= s2.charat(1); char c3= s2.charat(2); char c4= s2.charat(3); int i1 =(int) c1; int i2= (int) c2; int i3= (int) c3; int i4= (int) c4; if(i1>96 && i1<107) // = 97 , j = 106 system.out.println(s2); else if (i2>96 && i2<107) system.out.println(s2);