Posts

Showing posts from May, 2010

javascript - Set a trigger to run function the last hour of each month -

in google scripts know there triggers run date, don't think work because month's have different amounts of days. wondering if there's way set trigger run @ 11pm on last night of each month, no matter if that's 30 or 31. thanks first create trigger project resources > current project's trigger or register programmatically run every day @ 11 pm. scriptapp.newtrigger("mytriggerfunction") .timebased() .athour(23) .everydays(1) .create(); then in trigger handler, check if today last day of month, work. function mytriggrfunction() { var today = new date(); var lastdayofmonth = new date(today.getfullyear(), today.getmonth()+1, 0); if(today.getdate() == lastdayofmonth.getdate() ) { // work done } }

ios - TableView showing wrong data after segue -

this project simple car's dictionary, using core data, .csv file uploaded server. when select word in first tableview trigger second page read definition in tableview, there problem showing incorrect word , definition. you ignoring section number in index path tableview.indexpathforselectedrow . sectioned table, need translate section/row combination data reference. a standard way of doing array of arrays (e.g. dictionaryitems:[[dictionary]] ). way, can array of items using index path section on outer array , specific item using index path row on array section reference returns. --- update methods need code changes in dictionarytableviewcontroller override func numberofsectionsintableview(tableview: uitableview) -> int { // assume single section after search return (searchcontroller.active) ? 1 : sectiontitles.count } // create standard way dictionary index path func itemforindexpath(indexpath: nsindexpath) -> dictionary? { var result: dic...

Java String array created inside loop -

i have question regarding differences of following codes: vector v = new vector(); string [] str_arr = new string[3]; for(int i=0; i<3; i++) { str_arr[0] = "a"; str_arr[1] = "b"; str_arr[2] = "c"; v.add(str_arr); } system.out.println(v.size()); //answer 3 versus vector v = new vector(); for(int i=0; i<3; i++) { string [] str_arr = new string[3]; str_arr[0] = "a"; str_arr[1] = "b"; str_arr[2] = "c"; v.add(str_arr); } system.out.println(v.size()); //answer 3 the difference between both codes is, second one, string array created inside loop. both codes produce same result, want know difference between these two. the 2 snippets don't produce same result. first snippet adds same array object 3 times vector. second snippet adds 3 different array objects vector. the results may seem same, since 3 arrays in second snippet contain same values...

clojure - How to prevent messy windows after error in emac-live -

i'm trying familiar emacs , clojure , working out pretty well.. it's everytime clojure error, close emacs-window except 1 error occured , instead show me giant empty window of " popwin-dummy ". can't quite see how that's supposed me fixing bug... can tell me how disable behaviour? have nice day! as general protection against "emacs messed window configuration" occurrences, add following init file: (winner-mode 1) you can toggle current session m-x winner-mode then whenever window configuration unexpectedly changed, use c-c <left> call winner-undo (which can repeatedly if necessary). c-c <right> takes recent configuration (immediately, rather step-by-step).

c# - WPF InkCanvas - can't change color -

this absolutely ridiculous! i'm trying change color of inkcanvas through code doesn't work. saw lot of tutorials , don't work me. though they're straightforward. i'm new wpf still - should no-brainer. *note: can set color through xaml that's one-time operation , not want. my code: using system.windows; using system.windows.controls; using system.windows.ink; using system.windows.media; namespace wpfapplication1 { public partial class mainwindow : window { inkcanvas inkcanvas = new inkcanvas(); public mainwindow() { initializecomponent(); this.loaded += new routedeventhandler(setcolor); } // doesn't work private void setcolor(object sender, routedeventargs e) { inkcanvas.defaultdrawingattributes.color = colors.red; } // doesn't work either private void button_click(object sender, routedeventargs e) { ...

javascript - How do I make stacked area chart in plotly.js with correct values? -

Image
there example of stacked area chart: var stacksdiv = document.getelementbyid("mydiv"); var traces = [ {x: [1,2,3], y: [2,1,4], fill: 'tozeroy'}, {x: [1,2,3], y: [1,1,2], fill: 'tonexty'}, {x: [1,2,3], y: [3,0,2], fill: 'tonexty'} ]; function stackedarea(traces) { for(var i=1; i<traces.length; i++) { for(var j=0; j<(math.min(traces[i]['y'].length, traces[i-1]['y'].length)); j++) { traces[i]['y'][j] += traces[i-1]['y'][j]; } } return traces; } plotly.newplot(stacksdiv, stackedarea(traces), {title: 'stacked , filled line chart'}); but stacking done manually, values not correct: when mouse on first vertical line, see values 2, 3 , 6. if in source code, correct values 2, 1 , 3. is there way stacking area charts correct values? the original values can used text labels hover info, prior values being summed stacked chart. var stacksd...

ios - NSString stringWithFormat less parameters -

this question exact duplicate of: multiple arguments in stringwithformat: “n$” positional specifiers 1 answer we need format string, localisations won't output parameters. seems doesn't work output less parameters passed: nsstring *string = [nsstring stringwithformat: @"%2$@", @"<1111>", @"<22222>"]; nslog(@"string = %@", string); outputs string = <1111> although output second parameter. bug or feature? according related industrial standard, ieee specification : when numbered argument specifications used, specifying nth argument requires leading arguments , first (n-1)th, are specified in format string. which means in other words, must use first %1$@ parameter in string formatter somewhere before address use second 1 – so, not bug @ all.

php - How to get all cache entries with a tag on Laravel -

i'm building login throttling system using laravel, use save every failed login on cache database. (i use redis). the code: class failedlogins { const num_failures_to_lock = 30, time_range = 10; // in minutes public function add($email, $ip = null) { if (is_null($ip)) $ip = request()->ip(); $index = md5($email . $ip); cache::tags('failed.logins')->put($index, 1, self::time_range); } public function hastoomany() { $numfailedlogins = count(cache::tags('failed.logins')->get()); return ($numfailedlogins >= self::num_failures_to_lock); } } the issue on hastoomany method, have provide key parameter on get method. trying on line: cache::tags('failed.logins')->get() entries failed.logins tag, can count how many there are. well, not working, because can't that. recommend me use can solve it? if it's redis solutions that's fine t...

magento - Getting Invalid XML in Customer List SOAP Response -

i getting weird issue in magento xml response soap call. using magento 1.8.1. when list of customers via customercustomerlist call receive following invalid xml in response(see below) this behavior random , occurs 1 or 2 times in day, other same api call works of time. sometime seems invalid xml due password hash , sometime below(invalid or incomplete xml node(s)): request: <?xml version="1.0" encoding="utf-8" standalone="no" ?> <soapenv:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:magento" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"> <soapenv:header/> <soapenv:body> <urn:customercustomerlist soapenv:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"> <sessionid xmlns:xs="http://www.w3.org/2000/x...

java - Avoid deleting the data from database on clicking 'clear data' button in the app settings on android device -

i using database store data . when user go apps setting s , press 'clear data' button in app settings, data in databases gets deleted how can avoid this. can make 'clear data' button app in apps settings not enabled or other suggestions.... there no direct way avoid app data being cleared know. however, store data on external storage (sd card) in file , @ every app launch check if file there , merge it's contents database. of course not work if user manually deletes backup file sd, inserts sd, removes sd or connects device mounted drive computer , launches app.

vba - Word 2007: Get a list of building blocks? -

i'm wordering if there way (directly or using vba) list of building blocks appear in building blocks organizer, is, names of building blocks, gallery, category, template, behavior, etc. don't want extract auto text parts or that. want able , print complete list of bilding blocks , rest of info dispayed in building blocks organizer. thanks lot! d building block entries stored within several word template files. if want iterate on available building blocks, must therefore iterate on loaded word templates. can using following macro: sub listbuildingblocks() dim otemplate template dim obuildingblock buildingblock dim integer each otemplate in application.templates = 1 otemplate.buildingblockentries.count set obuildingblock = otemplate.buildingblockentries.item(i) debug.print obuildingblock.name + vbtab _ + obuildingblock.type.name + vbtab _ + obuildingblock.category.name + vbtab _ ...

Erlang version 18.0 and ejabberd nodename conflict -

i wanted install latest ejabberd https://github.com/processone/ejabberd . this, erlang/otp 18 required. too, have manually installed https://github.com/erlang/otp . then, need start ejabberd server command ejabberdctl start . there error in that. mnesia node name akash@akash-latitude-3450 , ejabberd nodename akash@localhost . due this, server not getting started. how resolve conflict ? log -> 2016-01-07 18:38:20.410 [critical] <0.39.0>@ejabberd_app:db_init:125 node name mismatch: i'm [ejabberd@localhost], database owned ['ejabberd@akash-latitude-3450'] 2016-01-07 18:38:20.410 [critical] <0.39.0>@ejabberd_app:db_init:127 either set erlang_node in ejabberdctl.cfg or change node name in mnesia 2016-01-07 18:38:20.410 [error] <0.38.0> crash report process <0.38.0> 0 neighbours exited reason: node_name_mismatch in ejabberd_app:db_init/0 line 129 in application_master:init/4 line 134 you have 2 options: name erlang ...

java - Spring security switch to Ldap authentication and database authorities -

Image
i implemented database authentication web page , web service. work both, have add ldap authentication. have authenticate through remote ldap server (using username , password) , if user exists have use database user roles (in database username same username of ldap). have switch actual code ldap , database authentication above explained. code is: securityconfig class @configuration @enablewebsecurity @enableglobalmethodsecurity(securedenabled = true, prepostenabled = true, proxytargetclass = true) public class securityconfig extends websecurityconfigureradapter { @autowired @qualifier("userdetailsservice") userdetailsservice userdetailsservice; @autowired public void configureglobal(authenticationmanagerbuilder auth) throws exception { auth.userdetailsservice(userdetailsservice).passwordencoder(passwordencoder()); } @bean public passwordencoder passwordencoder(){ passwordencoder encoder = new bcryptpasswordencoder(); ...

c# - Remote Webdriver Chrome throws a "path to the driver executable" error -

hi when use following code iwebdriver _webdriver = new remotewebdriver(new uri("http://127.0.0.1:4444/wd/hub"), desiredcapabilities.chrome()); i follwing error system.invalidoperationexception : path driver executable must set webdriver.chrome.driver system property; more information, see http://code.google.com/p/selenium/wiki/chromedriver . latest version can downloaded http://code.google.com/p/chromedriver/downloads/list teardown : system.nullreferenceexception : object reference not set instance of object. @ openqa.selenium.remote.remotewebdriver.unpackandthrowonerror(response errorresponse) @ openqa.selenium.remote.remotewebdriver.execute(string drivercommandtoexecute, dictionary`2 parameters) @ openqa.selenium.remote.remotewebdriver..ctor(icommandexecutor commandexecutor, icapabilities desiredcapabilities) @ testframework.browser.remotegoto(string browser, string url) in browser.cs: line 86 @ testframework.commonac...

excel - Find values in range and print to column -

Image
how can generate excel in image below via macro? briefly make: numbers between a1 , b1 print d column; numbers between a2 , b2 print e column; numbers between a3 , b3 print f column. columns , b have thousands of values. only because puzzles: sub u5758() dim x long dim long dim oarr() variant dim arr() long dim rng range dim ws worksheet application.screenupdating = false set ws = activesheet x = 4 ws oarr = .range(.cells(1, 1), .cells(.rows.count, 2).end(xlup)).value j = lbound(oarr, 1) ubound(oarr, 1) redim arr(oarr(j, 1) oarr(j, 2)) = lbound(arr) ubound(arr) arr(i) = next .cells(1, x).resize(ubound(arr) - lbound(arr) + 1).value = application.transpose(arr) x = x + 1 next j end application.screenupdating = true end sub

Vdbench 50404rc2 beta code - sparse file creation -

can please let me know pointers create sparse files(holey files) in latest vdbench 50404rc2. seems latest supported feature. link more info: https://community.oracle.com/thread/3759500?start=0&tstart=0 the answer given henk, on oracle vdbench forum posting excerpt it,also below link forum post. this experimental, work now, once feedback , decide experiment successful change instructions activate it. means '-d86' info below no longer work. activate truncate, add '-d86' execution parameter, or, add 'debug=86' @ top of parameter file. (for experiments adding other 'debug=' parameter easier fiddling vdbench parameter parser. if decide make permanently available i'll worry adding more 'official' parameter.) uses unix 'ftruncate()' , similar windows function during file creation. create sparse files during format, not 1 block of data written until further vdbench workloads run against these files. the ...

How do I attach file in mail that sharepoint send when I invite/give access to user on sharepoint online? -

in share point online 2013, when add user , send email invitation checked, send user email invitation , url of site. how send/attach file(word document) when give user access sharepoint site , share point send email user on email address ? the way reference document publicly available. can share document in sharepoint online tenant via guest link. just make sure message doesn't exceed 255 characters.

php - JavaScript does not fire after appending -

this question has answer here: event binding on dynamically created elements? 19 answers i'm trying create form allows user edit input through new window. php process input append new input new values. apparently, when try edit appended input, javascript won't fire. please enlighten me on did wrong. html code: <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script> $(document).ready(function(){ $('.races').click(function(e){ console.log("inside testing"); e.preventdefault(); var currid = this.id; var content = '<form id="theform" action="ct.php" method="post"> race: <input type="text" id="race" name="race">...

node.js - react-native run-android Could not resolve all dependencies for configuration ':classpath' -

i learing react-native,i got error when used command 'react-native run-android' on windows 10 failure: build failed exception. * went wrong: problem occurred configuring root project 'demo'. > not resolve dependencies configuration ':classpath'. > not download gradle-core.jar (com.android.tools.build:gradle-core:1.3.1) > not resource 'https://jcenter.bintray.com/com/android/tools/build/gradle-core/1.3.1/gradle-core-1.3.1.jar'. > not 'https://jcenter.bintray.com/com/android/tools/build/gradle-core/1.3.1/gradle-core-1.3.1.jar'. > peer not authenticated * try: run --stacktrace option stack trace. run --info or --debug option more log output. i'm tired,i'll appreciate helping me!

javascript - Badge color doesn't change, in firefox, using crossrider API (setBadgeText)? -

i'm using crossrider, , want change badge color of browser button here's code (in background.js) appapi.ready(function() { appapi.browseraction.setbadgetext('0', [255, 127, 127, 125]); // grey color }); the code works in chrome. in firefox, cannot change badge color color other "red" ! it's red despite change in array values in background code ! how change color ? have tried setting icon first using setresourceicon stated in docs? (for more information, see appapi.browseraction ) i used following code , works expected: appapi.ready(function() { // make sure have image in resources folder appapi.browseraction.setresourceicon('images/icon.png'); appapi.browseraction.setbadgetext('icon'); appapi.browseraction.setbadgebackgroundcolor([0,0,255,100]); });

c# - Using async/await: await returns too early -

i have simly windows forms app button , progressbar on it. then have code: private async void buttonstart_click(object sender, eventargs e) { progressbar.minimum = 0; progressbar.maximum = 5; progressbar.step = 1; progressbar.value = 0; await convertfiles(); messagebox.show("ok"); } private async task convertfiles() { await task.run(() => { (int = 1; <= 5; i++) { system.threading.thread.sleep(1000); invoke(new action(() => progressbar.performstep())); } }); } the await convertfiles(); returns early, ok messagebox appears @ 80% progress. what doing wrong? the problem experiencing not related async/await , use correctly. await not returning early, progress bar updates late. in other words, progress bar control specific problem described in several threads - disabling .net progressbar animation when changing value? , disable winforms progressbar animation , the ...

vba - What's the error number for "'The database engine could not lock table"? -

what's error number "the database engine not lock table..." in access? have intermittent fault it's hard reproduce (it occurs when 2 people open database @ exactly same time) want build in error handling, can't find error number listed anywhere. sounds error 3211 you can double-check message template error in immediate window: ? accesserror(3211) database engine not lock table '|' because in use person or process.

javascript node.js Server with html -

i have problem node.js server. want host html document there 1 problem typeerror. cann't find mistake. can me? var express = require("express"); var mysql = require('mysql'); var app = express(); var fs = require("fs"); var pool = mysql.createpool({ connectionlimit : 100, //important host : 'localhost', user : 'root', password : '', database : 'test', debug : false }); app.get('/', function(req, res) { fs.readfile('index.html', 'utf-8',function (err, data){ res.writehead(200, {'content-type': 'text/html'}); res.write(data); res.end(); }); }); app.listen(3000); console.log("server running @ port 3000........"); here log: "c:\program files (x86)\jetbrains\webstorm 11.0.2\bin\runnerw.exe" "c:\program files\nodejs\node.exe" server.js server ...

c# - WPF DataGrid wrapped by Grid won't scroll horizontally -

i'm trying make datagrid scroll horizontally when window small display of columns. i'm using grids control positioning of elements. can explain why scrollbar isn't appearing , how can fix it? prefer xaml solution if possible. here complete code. feel free critique weird see because i'm new wpf. <window x:class="fblam.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:fblam" mc:ignorable="d" title="mainwindow" width="800" height="600"> <grid> <grid.rowdefinitions> <rowdefinition height="auto" /> <rowdefinition height="*" /> <...

javascript - Dynamic create cascade select option with ng-repeat angular -

Image
i have following problem , not know how solve it: i have list of items in ng-repeat each item need add combobox cascade, example: item 1 have first combobox category 1, when select category should appear subcategories of combobox 1(category 1), creating of combobox should dinamic, without know quantity of combobox go create eatch items of ng-repeat. this: this answer might you, have make sure of nested items named same. recursion in angular directives and example json object { name: 'parent1', children: [{name: 'child1', children: [{ name: 'child1a'}]}, {name: 'child2', children: []}] }, { name: 'parent2', children: [] } then make recursion on children property array

repository - Using git on a single server, i.e. no truly remote origin -

this seems dumb, can't figure out. tons of instructions out there cloning or adding remote server, or pushing cloned repository. i'm trying figure out how set git repository in shared directory on server, , let other people collaborate clones in personal directories. this i've tried: abalter@u1:~$ mkdir mainrepo abalter@u1:~$ cd mainrepo/ abalter@u1:~/mainrepo$ echo "inital entry" > text.txt abalter@u1:~/mainrepo$ git init initialized empty git repository in /home/abalter/mainrepo/.git/ abalter@u1:~/mainrepo$ git add text.txt abalter@u1:~/mainrepo$ git commit -m "initial commit" [master (root-commit) fb829d6] initial commit 1 file changed, 1 insertion(+) create mode 100644 text.txt abalter@u1:~/mainrepo$ cd .. abalter@u1:~$ git clone mainrepo/ userrepo cloning 'userrepo'... done. abalter@u1:~$ cd userrepo/ abalter@u1:~/userrepo$ echo "users addition" >> text.txt abalter@u1:~/userrepo$ git commit -am "users addi...

jquery - How to read json from url in javascript? -

i working on json server in javascript. i used pure javascript, jquery getting status 0. $(document).ready(function() { $("#btn").click(function(event){ $.getjson('http://myhost/myapp/data.json', function(jd) { alert(jd); }); }); }); <body> <input type="button" id="btn" value="load data" /> </body> getjson() block not called. can me? check if allow cors on host or if response empty ! you might try use $.ajax() . $.ajax("http://myhost/myapp/data.json", function (data) { console.log(data); }

asp.net - How Can disable and enable RequiredFieldValidator for controls with jquery -

in page have 2 radio-button based which-one selected show controls in page using classes called 'person' , 'organization'. moreover, want check user enter correct data in input-text controls. how can validta data in clientside? example: <input runat="server" id="txtnationalid" maxlength="10" name="txtnationalid" class='person ltr glow-onfocus customercode required number' dir="ltr" /> <asp:requiredfieldvalidator display="dynamic" runat="server" id="txtcodecv1" errormessage="it can not null" controltovalidate="txtnationalid" ></asp:requiredfieldvalidator> <asp:regularexpressionvalidator validationexpression="[0-9]{10}" display="dynamic" runat="server" id="txtcodev2" errormessage="it's not in correct format" controltovalidate="txtnationalid" ></asp:regularexpressionvali...

php - Find days in a certain date -

hi i'm trying echo days in "31-10-15" isn't working. $inpdate = "31-10-2015"; echo "inpdate " . $inpdate . "<br>"; $inpdate1 = strtotime($inpdate); $inpdate1 = date('d-m-y',$inpdate1); echo "inpdate1 " . $inpdate1 . "<br>"; $days = date('d', $inpdate1); echo "days " . $days . "<br>"; $inpdate1 not valid string format date , change line: $days = date('d', $inpdate1); to: $days = date('d', strtotime($inpdate1));

javascript - React Native Android change scene navigator -

Image
i'm trying build tabview , can't find out how change , render scenes. main view 1 (app.js) : <view style={{flex: 1}}> <tabview ref="tabs" ontab={(tab) => { this.setstate({tab}); }} tabs={[ { component: list, name: 'découvrir', icon: require('../assets/img/tabs/icons/home.png') }, { component: friends, name: 'amis', icon: require('../assets/img/tabs/icons/friend.png'), pastille: this.state.friendspastille < 10 ? this.state.friendspastille : '9+' }, { component: recostep1, icon: require('../assets/img/tabs/icons/add.png'), hasshared: mestore.getstate().me.has_shared }, { component: notifs, name: 'notifs', icon: require('../assets/img/tabs/icons/notif.png'), pastille: this.state.notifspastille < 10 ? this.sta...

jsp - How to display Bean properties from ArrayList of Bean objects? -

i using struts 1.3. in action class accessing data db , setting values in bean class objects (one object each row). adding objects in arraylist object. in jsp need display data(bean property values). did using scriptlets, working fine. want use tags only(as recommended in standard way). 1 provide idea how use <logic:iterate> or <nested:iterate> whatever may work fine? here jsp code: <% appform fm; %> <% iterator itr; int i=0; arraylist al=(arraylist)request.getattribute("data"); system.out.println("arraylist size is..."+al.size()); if(al!=null) { for(itr=al.iterator(); itr.hasnext();i++) { fm=(appform)itr.next(); %> <tr id=i onclick="toggle(this)" bgcolor="pink"> <td align="center"> <%= fm.getregid() %> </td> <td align="center"> <%= fm.geteid() ...

symfony - When does Doctrine's postPersist event be called? -

from doctrine2 documentation: postpersist - postpersist event occurs entity after entity has been made persistent. invoked after database insert operations. generated primary key values available in postpersist event. i'm still in doubt transactions, have 5 persist operations in transaction, postpersist event called after every persist or after transaction commit? it called every entity inserted in database. even new entities persisted because of cascade operation (set in association cascade={"persist"} ) postpersist event fired. the event triggered here in executeinserts method in doctrine\orm\unitofwork , literally inserts.

github - Git diff origin/master..master does not show in difference but there are difference -

i have pushed project github, not folders committed github. if git origin/master..master not show difference there difference many folders not committed github. doing wrong while git push -u origin master how correct situation enter image description here pfa.. enter image description here git diff shows difference between 2 repository's commits. if have other files (git doesn't care folders) ensure they're committed: git add . git commit -m "something meaningful" git diff origin/master..master if on git add . see files not tracked should be, adjust .gitignore file in local directory.

google maps api 3 - Drawing polyline similar to drawing of polyline in DrawingManager -

this how draw polyline click first point , polyline drawn after click second point on map canvas: sample google.maps.polyline this how polyline drawn drawingmanager: sample drawing manager i'd draw regular polyline same way drawn drawingmanager line continued show move mouse across map canvas. thanks, this works me, 1 important detail specifying clickable: false when constructing polyline, otherwise didn't register click event on map. <!doctype html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <title>complex polylines</title> <style> html, body { height: 100%; margin: 0; padding: 0; } #map { height: 100%; } </style> </head> <body> <div id="map"></div> <script> var poly; var map; va...

java - How to get Row count for sql select query taht not return any record and add that in ArraryList -

i have 1 problem in java programme when select record database,i need records not retrun sql query database. suppose have 5 record in table , give 8 record in condition in java programme need 3 record in arraylist programme did not retrun values.. my sample programme below:- import java.sql.*; import java.util.arraylist; public class database { static final string jdbc_driver = "oracle.jdbc.driver.oracledriver"; static final string db_url = "jdbc:oracle:thin:@localhost:1521:orcl"; static final string user = "asiftest"; static final string pass = "asif"; public static void main(string[] args) { connection conn = null; statement stmt = null; try{ class.forname("oracle.jdbc.driver.oracledriver"); conn = drivermanager.getconnection(db_url,user,pass); arraylist ar =new arraylist(); system.out.println("creating statement..."); stmt = conn.createstatement();...

android - Prevent the user from deleting the folder or file in sdcard -

i saving folder in location android/data/package-name/files/ want restrict user delete folder. how that? note: since working on expansion files extracted data saved in location when user uninstalls app folder gets automatically deleted. that not possible. not can user delete folder, can other app on device has write_external_storage permission.

osx - Runtime Error 13 on Mac but not PC -

thank helps me this. i have written vba on pc, copywriters use mac , macros not work. run time error 13 on following code: if range("home_epic_flag_count").value = 0 is gets highlighted yellow when debug private sub worksheet_calculate() ' epic flag conditional testing macros if range("home_epic_flag_count").value = 0 me.shapes("home_epic_flag").visible = false else me.shapes("home_epic_flag").visible = true end if if range("rooms_epic_flag_count").value = 0 me.shapes("rooms_epic_flag").visible = false else me.shapes("rooms_epic_flag").visible = true end if if range("dining_epic_flag_count").value = 0 me.shapes("dining_epic_flag").visible = false else me.shapes("dining_epic_flag").visible = true end if if range("spa_epic_flag_count").value = 0 me.shapes("spa_epic_flag").visible = false ...

java - Extract string between characters -

i'd extract 2 arguments given string using regex. example: c:\users "c:\program files" c:\mytext.txt mytext2.txt output c:\users , c:\program files c:\mytext.txt , mytext2.txt if string between " " can contain white spaces, otherwise has without them. far managed extract arguments between " " , can't figure out how extract them when 1 argument has " " , other 1 doesn't (like in example above). pattern p = pattern.compile("\"(.*?)\""); matcher m = p.matcher(string); while(m.find()){ system.out.println(m.group(1)); } you can use regex matching: pattern p = pattern.compile("\"[^\"]*\"|\\s+"); regex demo

php - How to use PDO prepare more than oncee in a class -

class dbconnection { function connect(){ try{ $this->db_conn = new pdo("mysql:host=$this->db_host;dbname=$this->db_name", $this->db_user, $this->db_pass); return $this->db_conn; } catch(pdoexception $e) { return $e->getmessage(); } } } class student{ public $link; public function __construct(){ $db_connection = new dbconnection(); $this->link = $db_connection->connect(); return $this->link; } public function checklogin($username,$password){ $query = $this->link->prepare("select * studentprofiles username = :uname , logpassword = (select md5(:upassword));"); $query->execute(array(':uname' => $username, ':upassword' => $password)); $count = $query->rowcount(); if($count === 1){ $this->setsession($username); } return $count; ...

c# - Entity Framework proxycreation misery -

ive seen quite few solutions on problems similar mine. none of them satisfied needs specifically. i have following setup: public class user { public int32 id { get; set; } public string name { get; set; } public virtual list<phonebook> phonebooks { get; set; } } public class phonebook { public int32 id { get; set; } public virtual int32 userid { get; set; } public virtual user user { get; set; } public string title { get; set; } public virtual list<phonenumber> number { get; set; } } public class phonenumber { public int32 id { get; set; } public string num { get; set; } public virtual int32 phonebookid { get; set; } public virtual phonebook phonebook { get; set; } } now can query fine. problem circular referencing. let's want select every phonebook thats user id = 1 query context.phonebook.where(x=>x.userid == 1) load user , every phonenumber well. turn off proxying , nothing phonebook ( no numbers, no ...

node.js - Using babel with node cluster -

i have simple program developed es6 , transpiled babel. import kue 'kue'; import cluster 'cluster'; const queue = kue.createqueue(); const clusterworkersize = require('os').cpus().length; if (cluster.ismaster) { kue.app.listen(3000); (var = 0; < clusterworkersize; i++) { cluster.fork(); } } else { queue.process('email', 10, function(job, done){ ... }); } the problem comes when run program $ babel-node --presets es2015 program.js the master process run without problem children crash with: import kue 'kue'; syntaxerror: unexpected reserved word any idea of how run children babel? note: 1 option generate dist/ folder code transpiled es5, leave last. the problem here child processes run under node , not babel-node . try use babel require hook instead of cli.

error: cannot find symbol. Running java class with packages through cmd -

i have java application test . inside have 2 java files. a.java : import javax.servlet.genericservlet; public class { genericservlet inter; } to compile used: javac -cp servlet-api.jar a.java it compiled successfully. java file b.java : import javax.servlet.genericservlet; public class b { genericservlet inter; a = new a(); } when try use: javac -cp servlet-api.jar b.java i following error: error: cannot find symbol. a = new a(); ^ symbol: class location: class b p.s: please ignore name of classes & jar files involved demo purpose only. use javac -cp x.jar;. b.java to include current directory in classpath, should work.

Intellij Messages tool window not available -

i'm working on gradle project in intellij 14 ... 'messages' tool window not available view | tool windows can't jump around among errors. why 'messages' tool window not available me?? thanks lot! sl the messages toolwindow appears when build project (build | make project), , shows result of build. if never run build, toolwindow not appear.

report - Filtering dates in Access queries? -

i'm building report client. report not complicated, shows bunch of stuff requested clients. 1 of things i'm stuck on is... need able search transaction took place between today , 6 months back. when user click on transaction report, shows last 6 months today. have idea? i'm trying build query criteria, have no idea how should be. another part of report lets client choose dates report (from & to) , that's not bad because i'm passing these values blank form , using them in report. however, here i'm having hard time figuring out. =dateadd("m", -6, date()) fulfills requirements in application

javascript - Binding data with angular. (Calling method into a view) -

i want bind data angular, made example , works i'm having problems integrate stuff app. this controller of app angular.module('app', ['dcafe.navigation','ui.bootstrap']) .controller('headlinereportcontroller', function($scope, $http, $interpolate, $filter, datafactory, d3factory, $timeout){ //code $scope.senddata = function(){ $http.post('http://localhost:8080/xxx/xxx/', data, config) .success(function (data, status, headers, config) { $scope.postdataresponse = data; console.log("success"); console.log("status code: " + status); }) .error(function (data, status, header, config) { //$scope.responsedetails = "data: " + data + console.log("error"); console.log("status: " + status); console.log("headers: " + header); }); }; ...

swift2 - core data: save different types as the same attribute -

i have core data entity has attribute can represent different types of values (int, double, date, string). would lead problems (e.g. loss of precision) somewhere down line if convert these values string , back? @nsmanaged var storedtype : int @nsmanaged var storedvalue : string var value: any? { { set { switch newvalue { case int: self.storedvalue = string(newvalue) self.storedtype = 0 ... case string self.storedvalue = newvalue self.storedtype = 5 } } { switch newvalue { case 0: return int(self.storedvalue) ... case 5: return self.storedvalue } } } } while think long , hard architecture first agree there may case functionality , else should question asked*. one option use transformable property type. type allows coredata store object nscoding compliant (nsarray, nsdictionary etc.) , nsstring , nsnumber believe. thus can retrieve object generic type (id in objective-c, don't know equivalent in swift) , que...

jQuery form validation function/plugin -

emaili building function validate forms, can use upcoming projects. little bit stuck @ moment, need find way add background red if inputs of form empty. far: $(document).ready(function() { $('label').click(function() { var haserror = false, emailreg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/, form = $('form'), radio_check = $('.tick .test'), input = $('input:not(.submit)'), emailaddressval = $("#email").val(), email = $('#email'); if(email.val() === ''){ email.css('background-color', 'red'); } else if(!emailreg.test(emailaddressval)) { email.css('background-color', '#faa'); haserror = true; } if(haserror == true) { return false; } }); }); full code so far it's checking if email input empty , if there wrong email form...

MongoDB logging all queries -

the question basic simple... how log queries in "tail"able log file in mongodb? i have tried: setting profiling level setting slow ms parameter starting mongod -vv option the /var/log/mongodb/mongodb.log keeps showing current number of active connections... you can log queries: $ mongo mongodb shell version: 2.4.9 connecting to: test > use mydb switched db mydb > db.getprofilinglevel() 0 > db.setprofilinglevel(2) { "was" : 0, "slowms" : 1, "ok" : 1 } > db.getprofilinglevel() 2 > db.system.profile.find().pretty() source: http://docs.mongodb.org/manual/reference/method/db.setprofilinglevel/ db.setprofilinglevel(2) means log operations.

jquery, replace multiple elements recursively -

i got stuck following issue. i'm explaining content footnotes. footnotes e.g. [10] have format <sup>[10]</sup> . screenshot of content footnotes i'm trying replace <sup>[10]</sup> <a href="#m10" data-toggle="modal"><sup>[10]</sup></a> using following jquery: <script type='text/javascript'> $(window).on('load', function() { $(function(){ var s = $('sup').html().slice(1, -1); $("sup").replacewith('<a href="#m'+s+'" data-toggle="modal"><sup>['+s+']</sup></a>'); }); }); </script> unfortunately code replaces footnotes same/first found footnote - in case, footnotes replaced "10" (see screenshot). want recursively replace each footnote. i don't know how solve problem got stuck several days. perhaps of guys or girls can me. many in advance. iter...

ios - iphone, xcode, valid architectures importance -

i know thew importance of setting valid architectues ( armv7, armvs ) in xcode projects? @ level of sdk become important? coredata? caching issue? not trying diminish understand reason exists. according xcode buid setting reference specifies architectures binary may built. during build, list intersected value of archs build setting; resulting list specifies architectures binary can run on. if resulting architecture list empty, target generates no binary.