Posts

Showing posts from January, 2014

c# - DateTime cannot resolve ToShortTimeString() -

i have windows phone app have been using toshorttimestring method on datetime attributes. i using code in windows 8 store app , getting errors toshorttimestring cannot resolved. when check available on datetime object see smaller list of options available - date few missing options (one of ' toshorttimestring '. have done dumb here? am missing namespace? using 'system' although resharper telling me not required. toshorttimestring isn't supported in windows 8 store apps. can see when check "version information" in the documentation . doesn't mention windows 8 store apps. but that's not problem. can create method yourself: public static class datetimeextensions { public static string toshorttimestring(this datetime datetime) { return datetime.tostring("t", datetimeformatinfo.currentinfo); } }

php - Making first character of all sentences upper case -

i have function suppose make first character of sentences uppercase, reason, it's not doing first character of first sentence. why happening, , how fix it? <?php function ucall($str) { $str = preg_replace_callback('/([.!?])\s*(\w)/', create_function('$matches', 'return strtoupper($matches[0]);'), $str); return $str; } //end of function ucall($str) $str = ucall("first.second.third"); echo $str; ?> result: first.second.third expected result: first.second.third it not uppercase first word because regular expression requires there 1 of . , ! or ? in-front of it. first word not have 1 of characters in-front of it. this it: function ucall($str) { return preg_replace_callback('/(?<=^|[\.\?!])[^\.]/', function ($match) { return strtoupper($match[0]); }, $str); } it uses positive look-behind make sure 1 of . , ! , ? , or start of line, in-front of matched string.

java - Redirect activity to Frontpage activtiy after facebook login -

i trying accomplish redirection frontpage activity after facebook login,i have tried given code didnt workout yes tried link didn't work out code login activity. public class login extends fragmentactivity { private boolean ismainlobbystarted = false; callbackmanager callbackmanager; private loginbutton loginbutton; private loginresult loginresult; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); facebooksdk.sdkinitialize(this.getapplicationcontext()); setcontentview(r.layout.activity_login); public void onsuccess(loginresult loginresult) { system.out.println("onsuccess"); intent mainlobby = new intent(login.this, frontpage.class); if(!ismainlobbystarted) { startactivity(mainlobby); ismainlobbeystarted = true; } } @override protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(reques...

ecmascript 6 - Javascript Multiple Extended Signature Test(1)(2)(3) or Test(1)(2,3) -

is possible create function in javascript allow me below: test(1,2,3) test(1)(2,3) test(1)(2)(3) i thinking of below: unsure called. function test(a) { return function(b,c) { return a+b+c; } } i looking fat arrow function , nothing mentioned this. unsure if new es6 or es7 function.

regex - JavaScript RegExp including flags in pattern -

var str = 'test, string'; var regex = new regexp('^(.*)('+str+')(.*)$/i'); console.log(regex); output /^(.*)(test, string)(.*)$\/i/ but need following output: /^(.*)(test, string)(.*)$\/i the flags should second parameter regexp constructor. new regexp('^(.*)(' + str + ')(.*)$', 'i'); ^ ^^^ the syntax of regexp constructor is new regexp(pattern[, flags])

sms gateway - Java SMPP client implementation -

i want implement simple client application in java connect , send messages using sms gateway. service provider has configured gateway , have it's ip, port, username & password. have downloaded smpp api. question there no enough documentation. there examples or documentation..? thank you. hello there pdf documentation can use @ bottom scope document defines version 3.4 of smpp protocol , specifies command , response format used when implementing smpp v3.4 protocol interface. intended designers , implementers of smpp v3.4 interface between smsc , external short message entity (esme), illustrated in following diagram. figure 1-1: context of smpp in mobile network http://opensmpp.org/specs/smppv34_gsmumts_ig_v10.pdf

Barcodescanner Camera Auto Focus Exception in Android -

can know why device through exception when camera on following exception through use barcodescanner. works fine after trying auto focus 2 3 times runtimeexception: autofocus failed: fatal exception: java.lang.runtimeexception: autofocus failed @ android.hardware.camera.native_autofocus(camera.java) @ android.hardware.camera.autofocus(camera.java:1126) @ com.maruticourier.android.zbarscanneractivity$1.run(zbarscanneractivity.java:175) @ android.os.handler.handlecallback(handler.java:800) @ android.os.handler.dispatchmessage(handler.java:100) @ android.os.looper.loop(looper.java:194) @ android.app.activitythread.main(activitythread.java:5391) @ java.lang.reflect.method.invokenative(method.java) @ java.lang.reflect.method.invoke(method.java:525) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:833) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:600) @ dalvik.system.nativestart.main(nativestart.java)

python - PyQt4, prevent app.exec_() from hanging the main thread -

i have simple code loads google.com pyqt4 library. code: import sys pyqt4.qtgui import qapplication pyqt4.qtcore import qurl pyqt4.qtwebkit import qwebview class browser(qwebview): def __init__(self): qwebview.__init__(self) self.loadfinished.connect(self._result_available) def _result_available(self, ok): frame = self.page().mainframe() #print(frame.tohtml()) app.exit() if __name__ == '__main__': app = qapplication(sys.argv) view = browser() view.load(qurl('http://www.google.com')) print('start') app.exec_()#hangs main thread print('end') my problem code app.exec_() hangs main thread while, between print start , print end. there way scrape website in pyqt4 without making main thread hang while. resume main thread's normal execution of code after app.exec_() . it's taking time download content web. app.exec_() runs application basically. if indeed ha...

plsql - Aliasing in Bulk Collect giving error of unimplemented feature -

the problem statement: user specify name based on have pull names of 2 tables table , extract values tables.i have created pl/sql procedure , since select query can return n number of rows i'm using bulk collect. have created , object based on fields want extract. problem columns common in both tables, if don't use alias ambiguous column error , if use error of unimplemented feature. here's code: create or replace type recon_obj_vib object (recon_table_key number(19) ,recon_chglogattr_idxlst varchar2(1000 char)); create or replace type recon_tab_vib table of recon_obj_vib; create or replace procedure nomatchreport_proc(tabledesc in varchar2) l_recon_tab_vib recon_tab_vib := recon_tab_vib(); n integer :=0; out varchar2(2000); tablename1 varchar2(25); tablename2 varchar2(25); tabledesc_without_space varchar2(25); tabledesc_ra varchar2(25); begin tabledesc_without_space:=regexp_replace(tabledesc,'\s'); tabledesc_ra:=upper('ra_' || tabledesc_wit...

jsf - reset primefaces calendar date to system date -

i designing page technology using jsf 2.0 , primefaces. in page insert prime faces calendar. when user click on calendar change default date, warning message shown dialog box containing 2 command button. trying when user click on cancel command button, date should changed default date populated first time page when page loaded. wrote java script not working. <label>date<label> <p:calendar readonlyinput="true" widgetvar="caldate" yearrange="c-20:c+20" navigator="true" id="b1incomeeffectfrom#{incmstatus.index}" value="#{userdate.effectivefrom}" pattern="dd/mm/yyyy"> <p:ajax event="dateselect" oncomplete="checkfordefault(this);" global="false"/> </p:calendar> <p:dialog rendered="#{user.lock}" widgetvar="dlg1" header="warning" modal="true"> <h:panelgroup layout="block" styleclass="modal-d...

java - ArrayList vs. Array. Why is one working and one isn't? -

i've been trying switch older assignment on array arraylist , whatever reason find method not working when modify use arraylist .. seems returning -1 . this part of large class don't want include unless necessary, did include declarations in case important: public class switch { private switchentry[] camtable; private int numentries; private int maxentries; public switch() { camtable = new switchentry[100]; // default value numentries = 0; maxentries = 100; } public switch(int maxentries) { camtable = new switchentry[maxentries]; numentries = 0; this.maxentries = maxentries; } original: public int find (macaddress source) { int found = -1; (int i=0; < numentries; i++) if (source.isequal (camtable[i].getaddress())){ found = i; break; } return found; } modified: public int find (macaddress source) { int found = -1; (int i=0; < numentries; i++) ...

webview - How to handle Oauth2 redirect (custom URL scheme) in android -

i want start new activity or execute code when user redirected successful login in android. using webview provide login page, redirect custom url scheme such myapp://something . using intent filter identify redirection. webview displays page not found in android version 4.3 , net: err_unknown_url_scheme in 5. because of url scheme bug or else? (i not using actual redirection yet, have tried anchor tag , javascript window.location ) how can achieve this? without using shouldoverrideurlloading in webview client. want accept custom url scheme since end can not changed.

javascript - Angularjs in sharepoint 365 -

i trying set variable callback tried $apply got error $apply conflicting, after research found out should use $timeout instead of $apply. changed code shown below. myapp.controller('dynamicctrl', ['$scope', '$timeout', function ($scope, $timeout) { var jsonobj = []; jsonobj.push({ "type": "text", "model": "text", "label": "text", "placeholder": "text" }); //$scope.stdformtemplate = jsonobj; var ctx = new sp.clientcontext.get_current(); var web = ctx.get_web(); var list = web.get_lists().getbytitle('title'); var listfields = list.get_fields(); clientcontext.load(listfields); ctx.load(listfields); ctx.executequeryasync(function () { onlistfieldsquerysucceeded(setjsondata); }, function (sender, args) { console.log(args); }); function onlistfieldsquerysuc...

android - Tried everything, ADB is not detecting my nexus on windows 7 -

i'm trying add external device(nexus 5) test. that 1) have installed google usb drivers 2) set environment variables android_home & path 3) set android:debugger="true" in manifest, same in gradle. 4) if list devices connected adb in command prompt, gets no devices. 5) driver nexus 5 uptodate have checked device manager of windows 7. 6) enabled usb debugging on phone in developer options. it seems nothing working on way here, how can test camera/bluetooth app on nexus 5? please, help. did trychanging usb cable? did trick moto x when trying connect debugging purposes. did not work usb cable came phone worked cable bought.

php - Unable to get "inbetween" records if year is different -

i having unique bug table : tbl id | title | iscancel | sold_dt id: uid title : varchar iscancel : 0/1 sold_dt : timestamp select * tbl iscancel = 0 , date_format(sold_dt,"%m/%d/%y") between "06/01/2015" , "03/01/2016" group day(sold_dt) order (sold_dt) asc (note year different) 0 records returned but if do select * tbl iscancel = 0 , date_format(sold_dt,"%m/%d/%y") between "06/01/2015" , "12/01/2015" group day(sold_dt) order (sold_dt) asc or select * tbl iscancel = 0 , date_format(sold_dt,"%m/%d/%y") between "01/01/2016" , "03/01/2016" group day(sold_dt) order (sold_dt) asc (note year same) -i'll records *used date_format because calendar giving me mm/dd/yyyy (i can not change since might affect other areas) what doing wrong? instead of converting stored value format try changing parameter correct format. if cant on website can in query well sold...

networking - In iOS, how can we increase HTTP connection limit per host? -

using xcode networking tool, analyzed able establish 4 tcp connections per host @ time. seems ios has default tcp connection limit of 4 per host. how can increase limit? edit : stated op has changed in ios 8: see apple's documentation. original post : this limit in ios cannot change it. see : on ios url connection parallelism , thread pools

arrays - JAVA REFLECTION : java.lang.IllegalArgumentException: argument type mismatch -

am using java reflection , here using object org.openqa.selenium.remote.remotewebelement, call method called sendkeys. method accept charactersequence array parameter type, passing charactersequence[] parameter . using classname.getmethod(sendkeys, charactersequence[]) can methodname. when method innvoked in runtime passing array of charactersequences[] argument throws java.lang.illegalargumentexception: argument type mismatch @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:497) @ com.thbs.manager.reflections.callseleniumcommand(reflections.java:115) @ com.google.manager.testing.dotestexecution(testing.java:105) @ com.google.manager.testing.main(testing.java:22) could not post entire code,but posted code throws error objtocallwith = org.openqa.sele...

css - web site style is off center in IE -

i've been spinning head 2 days trying find out why site looks messy in ie8, , 9. looks fine in chrome , firefox. need help, can't find css issue... http://tytonsound.com/ web site. in ie, there's scripts aren't being noticed. (like nav bar). in addition, nav bar off center, , shifts down little. please let me know if notice causing site off center. you're missing doctype causing ie render site in quirks mode . if you're using html5 should place <!doctype html> @ top of file (make sure nothing precedes this, not white space) otherwise use xhtml or html 4 doctype.

ios - How to convert UTF8String to JSON based NSDictionary? -

i getting 1 of web-service response in json. here utf8string base responsestring: "{\"applicationid\":1,\"currentposition\":0,\"endoffile\":false,\"media\":{\"active\":true,\"description\":\"this video demonstrates quick overview of bentley learn server.\",\"locationid\":1,\"mp4url\":\"http:\\/\\/cdnllnw.bentley.com\\/s\\/learnvideo\\/welcome.mp4?s=1380034262&e=1380077462&h=c2641922fd862ffe5c5a05e94786359a\",\"mediaid\":5003235,\"mediaurl\":\"http:\\/\\/cdnllnw.bentley.com\\/s\\/learnvideo\\/welcome.mp4?s=1380034262&e=1380077462&h=c2641922fd862ffe5c5a05e94786359a\",\"streamserver\":null,\"title\":\"welcome\",\"transferstatus\":0,\"filesize\":9094429},\"mediaduration\":0,\"skippedcurrentposition\":0,\"userbp\":8011512,\"viewedtime\":0}" ...

java - Sorting ArrayList using MyComparator Class -

i have hashmap copy arraylist , want sort entries in list according bandwidth of each entry, higher bandwidth first should come in list here tried main class arraylist<signal> messages = new arraylist<signal>(); messages.addall(map.values()); collections.sort(messages, new mycomparator()); my comparator class public class mycomparator implements comparator<signal>{ @override public int compare(signal s1, signal s2) { if (s1.getbandwidth() > s2.getbandwidth() ) { return -1; } else if (s1.getbandwidth() < s2.getbandwidth()) { return 1; } return 0; } } it not sort signal objects according bandwidth ? what doing wrong problem solved actually not setting bandwidth before sorting it here code hope 1 public void createsortedset(hashmap<string, signal> map, final bufferedwriter buffwriter, long totalsize) { try { messages.addall(map.values()); (signal signal : mess...

c# - Wait until Worksheet.Calculate has finished -

can force saving myworkbook.saveas to wait until myworksheet.calculate() has finished recalculate formulas? there event called myworksheet1.oncalculate but don't know how use

c# - Multiple WCF Service References -

i have wcf service being referenced in 2 projects interact each other. have class defined in service needs used in both projects because of different namespaces not recognized same class. instance, in 1 class project1.myservicereference.myclass , in project2.myservicereference.myclass. i don't have lot of experience wcf , wanted know how others deal situation? you should able put class in common assembly , share type between server , clients. take @ this: http://blog.walteralmeida.com/2010/08/wcf-tips-and-tricks-share-types-between-server-and-client.html

javascript - adding an onclick or a button to an image -

i have following code: <a onclick="change('img1');" href="#"><img src="../name_footer/alexis-name.png" /></a> when alexis-name image clicked, calls image, 'img1' when img1 called, have button display on img1 screen, don't know how this. here js change() function change(v) { var confirm = document.getelementbyid("target"); if (v == "imga") {target.classname = "cast1";} else if (v == "imgb") {target.classname = "cast2";} else if (v == "imgc") {target.classname = "cast3";} else if (v == "imgd") {target.classname = "cast4";} else if (v == "imge") {target.classname = "question";} else if (v == "img1") {target.classname = "bio1";} else if (v == "img2") {target.classname = ...

c# - Working with local ViewModel in MVVM WPF application -

i having trouble accessing viewmodel when working view. i have project named bankmanagerapplication . within have various files associated new wpf application. have created 3 seperate folders model , viewmodel , view . at moment there usermodel class in model folder following fields; namespace bankmanagerapplication.model { public class usermodel { public string firstname { get; set; } public string lastname { get; set; } public double accountballance { get; set; } } } a blank view in view folder grid inside; <window x:class="bankmanagerapplication.view.mainwindowview" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindowview" height="300" width="300"> <grid> </grid> </window> and blank viewmodel in viewmodel folder; namespace bankman...

iphone - IOS 7 link between Xcode and Xamarin not working correctly -

Image
i started new project app. app support ios 7 , started create first view controller in new xcode. when run app xamarin studio(i'm on beta channel) app launches without errors. when app loaded on simulator / on device ui differed design in xcode. xcode: ios 7 simulator / device: i have note first time i'm using ios 7 in combination xamarin studio. noticed if create push segue in xcode on button not work. looks button disabled in simulator / on device reason. it looks it's caused view background color, , alpha (transparency) property of background , light-blue parts. so, in xcode ib check background color (the 1 set, or 1 default), put value (say white), , make sure alpha set 1

java - How can I disable warnings on package level in Eclipse? -

i have folder of source files (say src/main/java ), contains 2 super-packages: com.blah.generated com.blah.software the com.blah.generated code generated tool cannot run @ every compilation , checked in version control. never change it, re-generated when there's new dependency on new release. the generated code has 100s of warnings, want rid of. don't have access generator code, nor can relocate package different folder. obviously have source folder pointing src/main/java . tried exclude com.blah.generated package, com.blah.software using fails compile. i tried adding second source folder pointing same folder, , excluding com.blah.software can turn on "ignore optional compile problems", eclipse complains (however there's no overlapping between 2 folders): build path contains duplicate entry: 'src/main/java' project 'blah' i tried filtering problems view to include selected element , children except com.blah.genera...

oracle11g - Is the distributed lock timeout value in oracle modifiable -

in link here it says modifiable:no range of values 1 unlimited. if not modifiable, mean have range? the section modifiable indicates whether value of parameter can changed dynamically (take effect immediately) current session(for duration of session) using alter session statement or sessions, using alter system statement . if parameter not modifiable value can changed in server parameter file ( scope=spfile option only) , take effect after instance restarted.

android - Universal Image Loader - Network is unreachable -

i'm using universal image loader library in order load images urls, i'm testing possible connection exceptions. in specific situation interrupted internet connection while loading images , result series of errors messages (in console, app doesn't crash) "connect failed: enetunreach (network unreachable)". how can handle this? you can configure uil show image default , on error. have @ displayoptions displayimageoptions options = new displayimageoptions.builder() .showimageonloading(r.drawable.ic_stub) // resource or drawable .showimageforemptyuri(r.drawable.ic_empty) // resource or drawable .showimageonfail(r.drawable.ic_error) // resource or drawable futher more in loading listener have callback when loading fails here

javascript - Chevron Icon pointing up or down depending on accordion position -

i've got accordion i've built using jquery ui. need chevron icons point or down depending on if section open or closed. problem jquery. @ least is. i'm seeing both chevrons on load , once clicked chevron doesn't change @ all. jquery $(function() { $(".section a").click(function() { $(".chevron").removeclass("chevron").addclass("up"); }); }); css .chevron { background: url("images/down.png") no-repeat; } .up { background: url("images/up.png"); } html <div class="section"> <a href="#"><div class="tab active"> <span class="chevron"></span><h3>section 1</h3> </div></a> <!-- tab --> you need reference this toggles element clicking on (not of them @ once). once have $(this) , can use .find search chevron within link. finally, can use toggleclass switch betw...

html - position image in center square and fill the remaining space with colour -

i want position image center square , fill in remaining space colour. below code though, image on top , text "test" right below image. want text outside 120x120 square. i tried below code: css (included in head): .img-container { width: 120px; height: 120px; display: inline-block; overflow: hidden; background-color:#000; } .img-container img { width: 100%; height: 100%; } html: <a class="img-container" href="http://google.com"><img src="http://couponcoupon.biz/image/logo/landmsupply.com.jpg" /> test </a> look @ article: http://coding.smashingmagazine.com/2013/08/09/absolute-horizontal-vertical-centering-css/ has great breakdown of absoulte center: .absolute-center { margin: auto; position: absolute; top: 0; left: 0; bottom: 0; right: 0; } a fiddle applied example: http://jsfiddle.net/bhlaird/xgnxa/ moved text down negative bottom: setting. i'm ...

c# - Initialize windows form object dynamically -

how can dynamically initialize win form. in application having numerous forms, more 50 , below code repeated many times.. so want create function , job. how can create new () instance of particular form. appreciated. private void showform(object frm) { if (frm == null || frm.isdisposed) { frm = new <<here class name>> { mdiparent = }; frm.show(); frm.windowstate = formwindowstate.maximized; } else { frm.activate(); } } if know type use, can use activator.createinstance : private void showform(form form, type type) { if (form == null || form.isdisposed) { form = (form) activator.createinstance(type); form.mdiparent = this; form.show(); form.windowstate = formwindowstate.maximized; } else { form.activate(); } } or if you're calling different places , know @ compile-time type use: private void showform<t>(t form) t : fo...

.htaccess - CakePHP: How to control access to downloadable files -

we're running cakephp 2.3... we need control access pdf files. example, need users able view/download own pdf not others. admins can view them all. etc. the first question these files should live within cakephp's directory structure. we experimented /webroot/files/... appears these publically accessible (ie, can navigate directly file if know full path: www.example.com/files/private.pdf once files stored in secure location, second question best way handle authorization proper users can access proper files. it feels cakephp has built in support this, can't find documentation it. you'll need add .htaccess file in folder wherever keep pdfs deny access them through normal means. deny direct access folder , file htaccess doesn't particularly matter put pdfs, though recommend somewhere in webroot folder, , in own folder. then, you'll need add function in 1 of controllers display pdf, rather linking it. in cakephp < 2.3, can mediaview cl...

Can Amazon Elastic Transcoder concatenate two videos -

that is, take foo.mp4 , bar.mp4 , produce foobar.mp4, foo.mp4 followed bar.mp4? (for credit, if can this, can combine foo.mp4 , bar.mov?) i might want other transcoding things, right concern concatenation question. thanks! the answer seems "no", @ least (sept 2013) -- https://forums.aws.amazon.com/thread.jspa?messageid=490206&#490206

jquery - add and remove class in query after click -

i writing jquery function website. when user click of element add css class , after if click element remove class. here code: <body> <dl> <dt>what's name</dt> <dd>my name name</dd> <dt>what occupation</dt> <dd>i web developer</dd> <dt>what like</dt> <dd>i programming</dd> </dl> <script src="../jquery-1.10.2.js"></script> <script> $(document).ready(function(){ $("dd").hide(); $("dl").on("click", "dt", function(){ var $this = $(this); $this.addclass("back") .next() .slidedown() .siblings("dd") .slideup() }); }); </script> </body> use following: $("dl").on("click", "dt", function() {...

sql - TSQL Find Missing Values -

i have 2 tables: tablea calendar of possible weeks should have sales data per company. tableb has financial data sales per company per week have been reported. tablea columns [cmp_code, year, week] tableb columns [cmp_code, year, week, sales] query criteria: 1) list weeks missing tableb current year , previous year companies 2) list previous year sales value company , week if exists. (example cmp 1234 missing week 13, 2013, show value of week in 2012) i've tried joins either 0 values returned or millions of values returned. don't know start. i'm new sql , appreciate offered. in advance. this 1 way: select tablea.*, bprev.sales tablea left outer join tableb on tablea.cmp_code = tableb.cmp_code , tablea.[year] = tableb.[year] , tablea.[week] = tableb.[week] left outer join tableb bprev on tablea.cmp_code = bprev.cmp_code , tablea.[year] = bprev.[year]+1 , tablea.[week] = bprev.[week] tableb.cmp_code null

Groovy - How to Build a Jar -

i've written groovy script has dependency on sql server driver (sqljdbc4.jar). can use groovywrapper (link below) compile jar, how can dependencies jar? i'm looking "best practice" sort of thing. http://groovy.codehaus.org/wrappinggroovyscript both of replies below have been helpful, how can signed jar files? instance: exception in thread "main" java.lang.securityexception: invalid signature file d igest manifest main attributes in groovy wrapper script, you'll see line near bottom: // add more jars here that's can add dependencies. if jar file in same directory you're building from, add line this: zipgroupfileset( dir: '.', includes: 'sqljdbc4.jar' ) then rerun script , jar include classes sqljdbc4.jar . edit: if jar file depend on signed , need maintain signature, you'll have keep external jar. can't include jar files inside of other jar files without using custom classloader. can, ho...

highcharts download not working from html page with iframe in IE -

i trying chart download work in ie9 html file having iframe element shown below . <iframe frameborder="0" width="500" height="425" scrolling="no" src="http://www.highcharts.com/demo/bar-basic"></iframe> however works fine if iframe placed inside jsfiddle .i impression due html elements missing in html file .please me out on issue. thanks, bimal i have tested line in ie9 , seems working fine. on server or opening html file broswer?

javascript - Whats the difference between these 2 script If Statements and why 1 of them Wont work -

Image
code 1 (don't care other value expet one, value don't want continue) if (!optval == "select report") code 2 (checking options of dropdown way) if (optval == "lpr-standard lease report" || optval == "open acreage summary report" || optval == "capital ownership report") { following this, theres other code runs functionality. i check value of optval before going if statement chromes built in developer tools . value comes in definatly not select report . you can see here there not equal , next line not 234, end of if statement below. code1 seems doesn't matter optval , considered (!optval == "select report") code2 runs perfect. i wonder if in javascript (!variable) not permitted have (!variable = value )?? it's order of operations issue, add paren's: if (!(optval == "select report")) or use if(optval != "select report")

Regex related to * and + in python -

i new python. didnt understand behaviour of these program in python. import re sub="dear" pat="[aeiou]+" m=re.search(pat,sub) print(m.group()) this prints "ea" import re sub="dear" pat="[aeiou]*" m=re.search(pat,sub) print(m.group()) this doesnt prints anything. i know + matches 1 or more occurences , * matches 0 or more occurrences. expecting print "ea" in both program.but doesn't. why happens? this doesnt prints anything. not exactly. prints empty string of course didn't notice, it's not visible. try using code instead: l = re.findall(pat, sub) print l this print: ['', 'ea', '', ''] why behaviour? this because when use * quantifier - [aeiou]* , regex pattern matches empty string before every non-matching string , empty string @ end. so, string dear , matches this: *d*ea*r* // * pattern matches. all *'s denote position of matches...

Seeing numbers in Ruby with r attached to the number -

when come across numbers in ruby code, mean? 1r or 1.0r tested in ruby 1.8.6 2.0.0 , fails. this: >> 1r syntaxerror: unexpected tidentifier, expecting end-of-input and >> 1.0r syntaxerror: unexpected tidentifier, expecting end-of-input probably downvoted not searching, or something, or not enough examples. clarifies. ruby code, doesn't have anywhere, has there. that new feature decimal/rational literals in ruby 2.1. see here: http://rkh.im/ruby-2.1 (search "decimal literals") 0.1r #=> (1/10) 0.1r * 3 #=> (3/10)

algorithm - Winner of a given game -

alice , bob playing game. have been given n (<50) numbers lie between 1-1000. in 1 turn can either of following 1.decrement number 1. 2.erase 2 numbers , write sum. number when reached 0 automatically erased. player loses if cannot make of 2 moves. given alice plays first how can tell win game if both play optimally? can question done if 1 not know game theory algorithms? i haven't fleshed out full solution, i'm pretty sure can solution without game theory algorithms, reasoning. here useful bits hope on way: suppose numbers @ start of game x 1 , x 2 , x 3 , ..., x n . note move 1 ever changes total sum of n numbers. therefore, know in beginning how many times alice , bob make move 1 in total. however, number of times make move 2 not constant. analyze how many times occur, note move 2 , erasure of 0 terms things decrease how many numbers written. thus, 2 of them occur total of n times between them, , @ least 1 0 must erased (when last decrement done). ...

ProcessBuilder - Java program - Running Batch programs -

i have requirement create 1 java utility 1 of process in our team automated. existing process calls executable , business processing in sequence. wrote small program fileinputstream fstream; try { string [] cmd = new string[3]; if(system.getproperty("os.name").tolowercase().contains("win")){ cmd[0] = "cmd.exe"; cmd[1] = "/c"; } else{ cmd[0] = "/bin/sh"; cmd[1] = "-c"; } fstream = new fileinputstream("c:\\javaprogram.txt"); bufferedreader br = new bufferedreader(new inputstreamreader(fstream)); string fileline,fileline1; //read file line line while ((fileline = br.readline()) != null) { cmd[2]=fileline; processbuilder proc = new processbuilder(cmd); process p = null; proc.redirecterrorstream(true); sy...

servlets - Map with @WebServlet url pattern annotation in JSP -

when trying make simple webservlet stumble upon problem: if use name includes /../ won't find resource. this have works: controller.java @webservlet(urlpatterns = {"/controller"}) public class controller extends httpservlet{ ... } and jsp-page: <form action="controller"> ... </form> however, try specify name folder, work more structured. code struggle , doesn't work: @webservlet(urlpatterns = {"/servletcontroller/controller"}) public class controller extends httpservlet{ ... } jsp-page: <form action="/servletcontroller/controller"> ... </form> and tried numerous variations. question, how use folder-structure urlpatters-annotation, or not possible? it's caused leading slash specified in <form action> . makes specified url domain-relative. i.e. it's resolved relative domain root in url see in browser's address bar, instead of requested path (folder) in url see in bro...

node.js - Forever-monitor throwing ENOENT and not working -

so have: var forever = require('forever-monitor'); var monitor = forever.monitor; var child = new monitor('clusters.js', { max: 10, silent: false, killtree: true, logfile: './logs/forever.log', outfile: './logs/app.log', errfile: './logs/error.log' }); child.on('exit', function (err) { console.log('server exitted'); }); child.start(); and throw same error: events.js:72 throw er; // unhandled 'error' event with: error: spawn enoent @ errnoexception (child_process.js:980:11) @ process.childprocess._handle.onexit (child_process.js:771:34) npm err! weird error 8 npm err! not ok code 0 does know going on , how fix it? im on windows 7 with: "express": "3.3.5", "forever-monitor": "~1.2.2" https://github.com/blai/grunt-express/issues/12 apparently problem forever-monitor 1.2, downgraded 1.1 , worked. got there dont seem doing either...

excel - Count number of blank cells in row between last cell and next non-blank cell -

Image
is possible (with formula preferably) count number of blank cells in row, counting starts @ given column , counts going backward (e.g. right left) number of blank cells until non-blank cell found? in example below, counting begins @ column h , proceeds leftward. using counta or countif seem reasonable tools use, unsure on how terminate counting once non-blank cell found. you can use if values in table text: =countblank(indirect(char(97+match("zzzz",b2:h2))&row()&":h"&row())) match("zzzz",b2:h2) returns column number in last non-blank cell is. char(97+ column number) returns letter of column. append row number give reference countblank has start &row() &":h"&row()) gives reference of last cell, h plus row number. indirect turns concatenated text range excel can evaluate.

java - OutOfMemoryException thrown due to ImageCache Memory Leak on Android -

so think i've found source of memory leak. based on article: http://android-developers.blogspot.ca/2009/01/avoiding-memory-leaks.html it's bad have static bitmap drawable , set on imageview. because, once set (imageview.setimagebitmap(bitmap)) imageview set callback on bitmap. hence, on rotate, bitmap, since it's static, remains , still contains callback previous imageview, has reference previous activity. hence previous activity not destroyed! i believe have similar issue, it's not due static variable, singleton imagecache class. imagecache alive while app running , called using getinstance(context context). each bitmap stored in gets set on imageview @ point. the memory leak: when screen rotated, bitmap, still in memory, has callback previous image view. hence, previous activity not destroyed. don't, however, want recycle , destroy bitmap it's used elsewhere in app. think need remove specific imageview being destroyed bitmaps callback set. h...

bash - Confusion Regarding ! Character in Sed -

these 2 sed commands appear behave identically: $ sed "s/^replace=*/replace=mytest/g" test.txt $ sed " s!^replace=*!replace=mytest!g " test.txt why this? can ! character used instead of / ? not see explanation of ! character in sed documentation. you should read man-pages more closely :) info sed : 3.5 s command the syntax of s (as in substitute) command ‘s/regexp/replacement/flags’. / characters may uniformly replaced other single character within given s command. / character (or whatever other character used in stead) can appear in regexp or replacement if preceded \ character. tl;dr as mentioned in these man-pages, can use single character separator sed regexp , replacement . edit: evil otto crystal clearing :)

php - How to refer main domain directory from sub domain wed address -

consider domain www.example.com i if use path /images/sample.jpg in php/html file, refers www.example.com/images/sample.jpg similarly if same www.subdomain.example.com /images/sample.jpg --> refers www. subdomain .example.com/images/sample.jpg but want refer image main domain without giving full web address in sub domain web page. my main domain files ketp @ : root/www/ my subdomain files kept in : root/public_html/admin/ i may change web address later.. don't want hard code full web address in code. if can use php or asp can use variable (or constant) placeholder host name want use. set variable in global configuration file it's accessible everywhere. here php example using constant: <?php define( 'host', 'www.example.com' ); ?> then use this: <img src="<?php echo host ;?>/images/sample.jpg"> then can change preferred host name whenever want , have update constant.

php - How to find in html (from url) tag attributte -

<?php $html = file_get_contents('https://vine.co/v/h5pzjxyihra/card'); //$videosrc = ?; ?> with function file_get_contents() i html content of url. i need in html find tag <source src="https://v.cdn.vine.co/r/videos/xxxxx.mp4 " type="video/mp4"> how source attribute src ? theres few ways this. 1. php dom - http://us1.php.net/dom this doo-hickey make xml/xhtml object given source code supply. it's kind of tree structure can traverse through. 2. php xml - http://php.net/manual/en/book.xml.php just #1 older xml parser. 3. string literal searching - http://php.net/manual/en/function.strpos.php this oldey goody. use strpos() find source tag start, again find src tag , grab string. require tags perfect , doesn't leave lot of flexibility. $source = strpos($html, '<source '); if($source!==false) { $src_loc = strpos($html, 'src="', $source); if($src_loc!==false)...

c# - What is and how to fix System.TypeInitializationException error? -

private static void main(string[] args) { string str = null; logger.inituserlogwithrotation(); // <--- error occur ... } when build project, has no error. when execute it, aborted. i tried debug project , system.typeinitializationexception error occurred @ first line. i've tried googling , yet found no solution. it seems variable initialize code wrong , can't find it. please me. i'm new c#. thanks. ※ here logger class code public class logger { private static int hdlog_priority_debug = 4; private static int hdlog_priority_error = 1; private static int hdlog_priority_fatal = 0; private static int hdlog_priority_info = 3; private static int hdlog_priority_warning = 2; public static int log_level_debug = 4; public static int log_level_error = 2; public static int log_level_fatal = 1; public static int log_level_info = 5; public static int log_level_warning = 3; private static string s_bs...

c# - kendo ui scheduler: Creating Complex Event Templates -

we trying looking flexibilities of kendo ui razor. we using mvc4 razor view jqxwidgets , kendo scheduler on custom event template want add jqx controls dropdownlist, text boxes, calender controls etc. need in how can use defined resources , bind them jqx control this scheduler: @(html.kendo().scheduler() .name("ascheduler") .date(new datetime(2013, 6, 13)) .starttime(new datetime(2013, 6, 13, 7, 00, 00)) .height(600) .editable(editable => { editable.templateid("updatetemplate"); }) .views(views => { views.dayview(); views.weekview(); views.monthview(monthview => monthview.selected(true)); }) .timezone("etc/utc") .resources(resource => { resource.add(m => m.reasonid) .title("reason") .datatextfield("text") .bindto(new[] { new { text = "john", value = 1, color = "#f8a398" } ,...

How to decrease the size of the <tabview> buttons when are orientation:"left", using PrimeFaces -

<p:tabview orientation="left" dynamic="false" cache="false" style="font-size: 70% !important; **wight:300px**; border: none;"> <p:tab title="mainboard" id="mainboard" style="font-size: 70% !important; width:200px"> <p:scrollpanel style="width:800px;height: 600px;border: none;" mode="native"> <ui:include src="/mainboard.xhtml" /> </p:scrollpanel> </p:tab> <p:tab title="secboard" id="secboard" style="font-size: 70% !important; width:200px"> <p:scrollpanel style="width:800px;height: 600px;border: none;" mode="native"> <ui:include src="/secboard.xhtml" /> </p:scrollpanel> </p:tab> </p:tabview> * * wight:300px tabview * * - doesn't work. you need include separate cs...

c++ - How to convert an integer to a string -

this question has answer here: easiest way convert int string in c++ 20 answers i want convert integer string. tried way didn't work void foo() { int y = 1; string x = static_cast<string>(y); } the std::to_string function should it: string x = std::to_string(y); for opposite, it's std::stoi : int z = std::stoi(y, nullptr, 10);

Add nav menu to separate site in wordpress -

i'm attempting "weave" 2 websites together. know not ideal. in wordpress there options add additional navigation menus settings adding existing pages within cms. i'd add pages external site , have them appear menu. without editing code, know of means add custom navigation menu links external site?

Qt C++ How to use QList< >::const_iterator? -

i iterating through list , want use const_iterator. don't know how that! until used iterator , implemented function way. can me use const_iterator? void mainwindow::populate(const qlist<vehicle> &vehicles) { int j = 0; qlistiterator<vehicle> iter(vehicles); while(iter.hasnext()){ vehicle car = iter.next(); //set car qstring makeandmodel = car.getgeneraldata().getmake() + car.getgeneraldata().getmodel(); qstandarditem *mandm = new qstandarditem(qstring(makeandmodel)); mandm->seteditable(false); model->setitem(j,0,mandm); //set type qstandarditem *type = new qstandarditem(qstring(car.getgeneraldata().gettype())); type->seteditable(false); model->setitem(j,1,type); //set mileage qstring mileagestring = qstring::number(car.getgeneraldata().getmileage()); qstandarditem *mileage = new qstandarditem(qstring(mileagestring)); mileage->seteditable(false); model->setitem(j,2,mileage); ...