Posts

Showing posts from April, 2014

sql - Display employee name,total salary of each employee(total salary=salary+commission) -

display employee name, total salary of each employee. conditions: if commission not null total salary=(salary + commission) else total salary = salary ; here table: table name: myemp columns: empno [primary key], name, salary, commission, deptno create table myemp ( empno number primary key, name varchar2(20), salary number, commission number, deptno number ); query: select name, salary, commission, (salary + ((salary*commission) / 100)) "total_salary" myemp; this query give incorrect result. when commission null , total_salary = 0 . should total_salay=salary ; how fix this? my table below: sql> select * emp; empno ename job mgr hiredate sal comm deptno 7369 smith clerk 7902 17-dec-80 800 20 7499 allen salesman 7698 20-feb-81 1600 300 30 7521 ward salesman 7698 22-

NoSuchBeanDefinitionException : 'o.s.b.a.MessageSourceAutoConfiguration' is defined when started spring boot -

i have application consisting of 2 modules: 1/logic: spring-core, spring-data-neo4j 2/presentation: spring-boot the declartion of spring beans in first module done through xml file. file imported file context of second module. below setup: @configuration @propertysource("classpath:application.properties") @componentscan @enableautoconfiguration @importresource(value = "application-context-presentation-all.xml") public class application { public static void main(string[] args) { springapplication.run(application.class, args); } } application-context-presentation-all.xml <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.spri

python - matplotlib changing barplot xtick labels and sorting the order of bars -

Image
i have dataset i'm trying plot, how plot it: in range(0,5): plt.subplot2grid((1,5),(0,i)) df.survived[df.sibsp == i].value_counts().plot(kind='bar') title(str(i)) the values in x (survived) 0 or 1 , i'm plotting value count of them. i'm trying change xsticks "survived"\"not survived", how can it? and i'm trying sort xsticks @ graphs @ same way (as can see in pic default sort according ycount, causing x's 0-1 @ first graph , 1-0 @ second graph) i not sure how data looks like, assume 1 means survived , 0 means dead, , there no other values other 0 , 1. if so, need few small changes: for in range(0,5): plt.subplot2grid((1,5),(0,i)) ax=df.survived[df.sibsp == i].value_counts().ix[[0,1]].plot(kind='bar') ax.set_xticklabels(['alive', 'dead']) title(str(i)) and should ready go.

Unexpected JavaScript infinite loop when checking for body tag -

i going asap script checks if body tag loaded, causes whole page freeze. here is: while (!document.body) if (document.body) console.log('loaded'); this of course wouldn't work in cases, i'm puzzled why becomes infinite loop , freezes page. javascript single-threaded. while loop running, nothing else runs, body can't loaded. there's nothing in body of loop changes value of document.body , if it's not set when start, never be.

php - How to protect an url video streaming using flumotion? -

this scenario: have localhost website logged in users can visit. stored on mysql database. server side running php. inside website have video player plays video localhost flumotion video streaming server. i want protect video streaming url in order registered users can access it. if copy video url, won't able play outside website. how can it? edit: mean "video url" url this: 192.168.1.221/myvideo.mp4 (my flumotion video streaming running on localhost) url html5 video player get. , want protect copy , paste in browser tab. because if it, can play without need website. you check if user logged in, checking if session set depending on how login system works. function is_logged_in(){ if (!isset($_session['you_session_name']))//user not logged in.. return false; return true; } then in video page check if user logged in, , if it's not redirect him on page: if (!is_logged_in()) header("location: http://redirectsite.com/p

stl - Inserting values into a global C++ set from a recursion -

first time questioner. realized morning knew how perform task of interest simple recursive call. trouble global set not changed of calls s.insert(n) put in. expect there straightforward way rewrite fill set numbers found. so, question is, how that? here function wrote it, fragment calls later, , relevant part of output. entirely happy lines cerr command, matter of getting values (first , third in each line) stl set. first guess on how part not enough. .............................................................. void insert_primitive_reps(unsigned int a, unsigned int h, unsigned int b, unsigned int m, set<unsigned int> s) { cerr << setw(12) << << setw(12) << h << setw(12) << b << " insert_primitive_reps" << endl; if ( <= m ) { s.insert(a); if ( b <= m ) { s.insert(b); if ( <= m - b && h <= m - - b) { if( <= m - - h ) insert_primitive_reps

html - Javascript in separate file not working -

i'm starting out in javascript, , i'm trying put scripts in separate file. work fine when they're in html file, move them own separate file stops working. here's html file: <!doctype html> <head> <meta lang = "en"> <link rel="stylesheet" type="text/css" href="css/mainstyle.css"> <script src="js/script1.js"></script> <title>web dev practice</title> </head> <body> <h1>first javascript example</h1> <button type="button" onclick="changetext()">clickme!</button> <p id="demo">this test.</p> </br> </br> <h1>second javascript example</h1> <img id="lightbulb" onclick="changeimage()" src="res/img/pic_bulboff.gif" width="100" height="180">

codeigniter - how to display the content before exit() in php? -

i'm using codeigniter. , in 1 of admin controller, after admin logged in, wanted create switch check admin level. if level below number, cannot view page. , instead, restriction notice page loaded , page stop loading. function add_user() { $this->set_admin_level(9); // stuffs } private function set_admin_level($level){ if ($this->session->userdata('admin_level') < $level ) { $this->load->view("admin/restriction"); exit(); } } i tried exit() , die(), both of them killed entire page without displaying anything. know can if , redirect method, wanted know if can previous way. try this: private function set_admin_level($level){ if ($this->session->userdata('admin_level') < $level ) { return $this->load->view("admin/restriction"); } }

sql - PersistenceException: ERROR executing DML bindLog when Updating an Object -

good day! have 2 objects: tag , relatedtag . tag can have many relatedtag s (which tag ). saving tag related tags works fine. when update tag , has error saying [persistenceexception: error executing dml bindlog[] error[unique index or primary key violation: "primary key on public.related_tag(id)"; sql statement:\n insert related_tag (id, tag_id, relationship, related_notes) values (?,?,?,?) [23505-172]]] here tag model: package models; import java.util.*; import javax.persistence.*; import javax.validation.*; import play.data.form; import play.data.validation.constraints.*; import play.db.ebean.*; import play.db.ebean.model.finder; import scala.int; @entity public class tag extends model{ @id private int id; @required @maxlength(value=100) private string name; @maxlength(value=200) private string notes; @onetomany(cascade=cascadetype.all) public list<relatedtag> relatedtags = new arraylist<relatedtag>();

breeze - Get Access Token with BreezeSharp -

i need use entityquery in breezesharp access token breeze webapi i have class called tokenresponsemodel deserializing json server follows: using newtonsoft.json; namespace cmis.integration.common { class tokenresponsemodel { [jsonproperty("access_token")] public string accesstoken { get; set; } [jsonproperty("token_type")] public string tokentype { get; set; } [jsonproperty("expires_in")] public int expiresin { get; set; } [jsonproperty("username")] public string username { get; set; } [jsonproperty(".issued")] public string issuedat { get; set; } [jsonproperty(".expires")] public string expiresat { get; set; } } } i have following code run: entityquery query=entityquery.from("token",new tokenresponsemodel()). withparameters(new dictionary<string,object>{{"grant_type","pas

python - Push all zeros to one side of the list -

this question has answer here: move zeroes beginning of list in python 3 answers hello i'm trying push zeros in list 1 side without altering rest of it: [0,2,0,0,9] -> [0,0,0,2,9] [3,4,0,1,0] -> [0,0,3,4,1] my solution: def getnonzeros(self, tup): in tup: if != 0: yield i; def pushzeros(self, tup, side): if side==side.end: return [i in self.getnonzeros(tup)] + [0]*tup.count(0); else: return [0]*tup.count(0) + [i in self.getnonzeros(tup)]; and error in ipython: error: internal python error in inspect module. below traceback internal error. traceback (most recent call last): file "/usr/lib/python2.7/site-packages/ipython/core/ultratb.py", line 760, in structured_traceback records = _fixed_getinnerframes(etb, context, tb_offset) file "/usr/lib/python2.7/site-packages/ipytho

screenshot - How to capture a specific area on the sketch in Processing -

i want take screenshot of specific area in sketch (in processing). save(); , saveframe(); references can't because capture whole area, need smaller specific capture. how properly? check processing reference. there's function called get may called on pimages or drawing screen itself. don't mention whether want capture weird shape or rectangle, i'll assume standard rectangle. according documentation , want is: syntax : get(x, y, w, h) parameters : x int: x-coordinate of pixel y int: y-coordinate of pixel w int: width of pixel rectangle get h int: height of pixel rectangle get

MySQL JOIN returning unrelated rows when combined with LEFT JOIN, WHERE and OR -

i have following table structure. idea users have permissions forum either class or specific user overrides. ('action' in both cases enum values 'read' & 'write') user (id, class) forum (id, name) forum_permissions (forum_id, class_id, action) forum_user_permissions (forum_id, user_id, action) with following query, i'm getting results based on rows in forum_permissions don't expect. mean every row on forum_permissions forum_id = 3 returned though class_id not match. select forum.id forum_id, forum.name forum join forum_permissions on forum_permissions.forum_id = forum.id left join forum_user_permissions on ( forum_user_permissions.forum_id = forum.id , forum_user_permissions.user_id = 3 ) (( forum_permissions.class_id = 1 , forum_permissions.action = 'read' ) or ( forum_user_permissions.action = 'read' )) e.g. this: forum_id name 1 chat 2

android - sending image via intent -

refer page permission part. i have first app has following : file imagepath = new file(getapplicationcontext().getfilesdir(), "images"); file newfile = new file(imagepath, "earth.jpg"); uri contenturi = fileprovider.geturiforfile(getapplicationcontext(), "com.android.provider.datasharing", newfile); getapplicationcontext().granturipermission("com.android.datasharing_2.app", contenturi, intent.flag_grant_read_uri_permission); intent = new intent(); i.setaction(intent.action_send); i.putextra(intent.extra_stream, contenturi); i.settype("image/jpg"); startactivity(i); in manifest : <provider android:name="android.support.v4.content.fileprovider" android:authorities="com.android.provider.datasharing" android:exported="false" android:granturipermissions="true"> <meta-data android:name="android.supp

How to remove the entire line of a word doc using vba -

the following line of code insert text bookmark range in word document. objdoc.bookmarks("donoraddress").range.text = "6200 main st." how remove entire line containing address bookmark if don't have address data? by 'deleting line' believe mean 'delete paragraph'. if in way: '2 steps delete- rather not recommended objdoc.bookmarks("donoraddress").range.paragraphs(1).range.select selection.delete or in 1 step: objdoc.bookmarks("donoraddress").range.paragraphs(1).range.delete

Powershell - How to use a variable to define columns to output in a select-object -

i'm trying cut down output of table following columns $tcolumns = "jobname,vmname,sunday 08-06-2014,saturday 07-06-2014" $report = $table | select $tcolumns | convertto-html -head $style outputs table has 1 empty column if i $report = $table | select jobname,vmname,"sunday 08-06-2014","saturday 07-06-2014" | convertto-html -head $style it outputs fine. any idea on how can use variable define table columns return? output of $table | get-member output of $table | get-member typename: system.data.datarow name membertype definition ---- ---------- ---------- acceptchanges method void acceptchanges() beginedit method void beginedit() canceledit method void canceledit() clearerrors method void clearerrors() delete method void delete() endedit method v

windows 7 - Trying to reset forgotten MySql Root Password -

i installed mysql, promptly forgot password. i followed tutorial on mysql website. when enter c:> c:\program files\mysql\mysql server 5.6\bin\mysqld --init->file=c:\users\brian\mydocuments\mysql-init.txt in cmd, message: a required privilege not held client i tried different ways of entering prompt, , considered perhaps because don't have right administrator privileges in windows, when changed settings, received same message in cmd. confused. did wrong? everything? thank you. gfb you have run command prompt administrator.

Spray json marshalling -

i'm on quest create json api of models nicely generalized. i'm newbie in spray, started out spike on simplified example. however can't figure out going on bellow code... i have imported both my custom implicits and spray.httpx.sprayjsonsupport._ as understand have in order have implicit in scope can convert jsonformat marshaller. compiler error: testservice.scala:15: not find implicit value parameter um: spray.httpx.unmarshalling.fromrequestunmarshaller[my.company.test[my.company.x]] code: package my.company import spray.routing.httpservice import spray.json.{jsvalue, jsobject, jsonformat, defaultjsonprotocol} trait testservice extends httpservice { import my.company.testimplicits._ import spray.httpx.sprayjsonsupport._ val test = path("test") { post { entity(as[test[x]]) { test => { complete(s"type: ${test.common}") } } } } } trait common { de

javascript - How to change scope data in controller? -

i real newbie @ angular. created let me retrieve , add items via angular , get/put them in mongodb. use express , mongoose in app the question is, how can modify data before reaches dom in controller. in example have created way retrieve data, , stored in mongodb. field store 1 or 0 in database, shown text. if mongo has value 1 "the value in mongo 1" , when field has value of 0 "the value zero". (just example, other texts, illustrate want) i post controller, html , current output. appreciated. controller function getguests($scope, $http) { $scope.formdata = {}; $http.get('/api/guests') .success(function(data) { $scope.x = data; }) .error(function(data) { console.log('error: ' + data); }); } html <div ng-controller="getguests"> <div ng-repeat="guest in x"> {{ guest.voornaam }} {{ guest.aanwezig }} </div> </div>

php - Is it possible to get empty array value via $_GET? -

is possible empty array(array 0 items) value via $_get ? is possible direct value setting? count($_get['param'])==0 you need empty value url = myform.php?param=&param2= in form let value blank: <input type='text' name='param' value ='' /> for empty array : url: myform.php?param[]=&param2[some_key]= in form: <input type='text' name='param[]' value ='' /> from ajax: (i remember anti-intuitive , hard search for): ajax{ ... data: {'params[]':'','params2[some_key]':''} } workaround : edit back-end , if there no data params or not array (null, empty whatever ..) assign empty string it: $param = (isset($_get['param']) && is_array($_get['param']))? $_get['param'] : array(); update: did few tests , seems there no way put "nothing" in request ussing form or ajax. 0 , '' , null valid valu

java - JHipster executable war not executable in combination with Atmosphere -

when generating fresh application atmosphere enabled seems work fine. when packaging application in executable war (as mentioned on jhipster homepage) application not load properly. it starts complaining atmosphere annotation scanning not able scan annotations atmosphere.jar within executable jar malformedurlexception: [warn] org.atmosphere.cpr.defaultannotationprocessor - unable scan annotation java.net.malformedurlexception: illegal character in opaque part @ index 11: jar:file:c:\development\test\target\test-0.1-snapshot.war!/web-inf/lib/atmosphere-runtime-2.1.0.jar!/org/atmosphere/annota tion/ i have generated fresh project atmosphere enablef, packaged , tried run executable war. doing wrong or missing something? thanks the problem fixed update atmosphere 2.2.2. requiresunpack not necessary , further information take @ issue @ jhipster-generator: https://github.com/jhipster/generator-jhipster/issues/471

ruby - How can I decrypt strings encrypted with the Java code? -

i not sure if can ask kind of question. if doesn't fit here, apologize. i need decrypt data encrypted following java code. installed aes gem , struggled 2 hours couldn't it. i know ruby java knowledge limited. other guy gave me code doesn't know ruby. need help. need decrypt function. i changed key security reason. import javax.crypto.cipher; import javax.crypto.spec.secretkeyspec; import org.apache.commons.codec.decoderexception; import org.apache.commons.codec.binary.hex; import sun.misc.base64decoder; import sun.misc.base64encoder; public class aestest { private static string skeystring = "29c4e20e74dce74f44464e814529203a"; private static secretkeyspec skeyspec = null; static { try { skeyspec = new secretkeyspec(hex.decodehex(skeystring.tochararray()), "aes"); } catch (decoderexception e) {

solr - Nutch (2.2.1) Inject Urls Hangs -

i'm running ubuntu 14.04, i'm tying basic nutch web crawl running no avail. following this tutorial set following building blocks: ubuntu 14.04 hbase 0.90.4 nutch 2.2.1 solr 4.3.1 i confirm both hbase , solr running, populate urls/seed.txt file. when call; bin/nutch inject urls i'm presented following output , seems nutch hangs. injectorjob: starting @ 2014-06-09 23:38:49 injectorjob: injecting urldir: urls/seed.txt this stackoverflow question seems similar mine, not behind proxy answer not applicable. any in resolving issue appreciated. ubuntu defaults loopback ip address in hosts 127.0.1.1. hbase (according this page ) requires loopback ip address 127.0.0.1. the ubuntu /etc/hosts file default contains (with mycomputername being computer name): 127.0.0.1 localhost 127.0.1.1 mycomputername use sudo gedit /etc/hosts update hosts file follow: 127.0.0.1 localhost 127.0.0.1 mycomputername reboot ubuntu. nutch should no long

python - Django - Admin Site - how to protect it? -

i'm wondering if ppl hide admin site? put under different domain? run on different server main application? is safe have /admin/ can find it, given protected login screen , permissions test? don't think it's protected simple brute force attacks, correct me if i'm wrong. how django admin site protected? , best practices protect it? i found similar question way back, , accepted answer talks different apache settings or using vpn, how in cloud heroku or aws? what can think of: make sure staff members have difficult password (against brute force mentioned). moving subdomain such sessions aren't shared , need authenticate separately little, in case (stupid) leaves session logged in on public computer. having separate apache password (as in question linked) alternative this. use https. if share sessions main site, need use https on main site too. idea anyway. using vpn work if want restrict ips, require quite work on part , on part of staff mem

c++ - Why can't a specialized template function accept both a type and it's constant version? -

if t type, why can normal function accept both t , const t specialized template function cannot? mean programmer has type more code defeats purpose of using templates? struct s { void func(const char *buf) { cout << "func(const char *)" << endl; } void func(const wchar_t *buf) { cout << "func(const wchar_t *)" << endl; } }; output: 2 different functions called t , const t when t char*/wchar_t* func(const char *) func(const wchar_t *) func(const char *) func(const wchar_t *) the same templates: struct ss { template<typename t> void func (t t) { cout << "func (t)" << endl; } template<> void func (const char *buf) { cout << "func (const char *)" << endl; } template<> void func(const wchar_t *buf) { cout << "func (const wchar_t *)" << e

javascript - possible to do params in backbone routes -

i looking @ routes in backbone , wondering if can following: routes: { '': 'posts', 'posts?page=:page': 'posts' } this allow me plain index of posts , add pagination index of posts. is ok or there better way this? is using query parameter requirement? if not, can use router's param functionality: routes: { '': 'posts', "page/:page": "posts" // #page/n }

asp.net mvc - Calling an action method on predefined time -

i have action method inside controller class , sync . user can manually call action method, clicking on button view. but question whether can create job or bath runs on host server let each 1 hour , call action method. currently using form authentication, , hosting asp.net mvc web application on iis 7 thanks there few ways of doing this. refactor code out of mvc , put inside wcf service, configure service make use of http://quarts.net/ , setup schedule run. service can hosted inside iis. you can create windows service (nt service) makes use of quartz.net. service can installed on production server. you can create batch file , use windows task fire off exe run job.

javascript - How to get Var inside onclick function? -

i have 2 variables outside. want display 2 variable values inside onclick event.. cant able value using below code.. please me solve issue. have fix issue in 3 hours. var mycode = "12345"; var mycount = "5" $('.cols2.continue').html('<a href="#" onclick="test.element=&#39;mycode, mycount &#39;;test.elemname=+mycode +;">browse</a>'); now, m getting variable name in place of value. thanks your jquery var mycode = "12345"; var mycount = "5" $('.continue').html('<a href="#" onclick="test.element=&#39;'+mycode+', '+mycount+' &#39;;test.elemname='+mycode+ ';">browse</a>'); jsfiddel

c - X86 32b assembly - using atoll -

under ubuntu 12.04., , using x86 32 bit assembly possibly c libraries, need use number n 2^31 - 1 < n <= 2^63 -1 on system, c ints 32 bit; , long longs 64 bit. know how proceed after having number, stuck on getting number ready. my planned approach follows: - store n string in .data segment - use atoll (pushl $n_str, call atoll) - retrieve converted value, , store in 2 consecutive int-sized storage locations (taking note of little-endian storage) as usual 32 bit return value convention through %eax cannot apply (or possibly through pointer, have checked seems not case (%eax points inaccessible memory after)), assumed value might in (%eax, %ebx). checked permutations of high/low assuming case, doesn't seem (if is, , messed up, kindly point out proper way). man (and man 3) page atoll doesn't help. how retrieve converted integer? if approach impossible (strtoll has same issue), suggestions alternatives? it se

button - automatic press key in Python -

im trying make auto-clicker , auto-button presser. this code until now. new=2; url="www.google.com"; webbrowser.open(url,new=new); time.sleep(25) def click(x,y): win32api.setcursorpos((x,y)) win32api.mouse_event(win32con.mouseeventf_leftdown,x,y,0,0) win32api.mouse_event(win32con.mouseeventf_leftup,x,y,0,0) click(700,300) time.sleep(3) and after time.sleep(3) want spacebar pressed automatic (with 3sec sleep in between) 100 times. have tried sendkeys, cant find download place. sorry bad english, hope can help. this question or this one might out, should search these things , check if similar questions exist before posting.

c# - How do you get T4ReferencePath to work? -

i've beat head against wall couple of days on one. no amount of googling or messing around seems yield answer. i want run t4 template @ build time. in it, need access types in assembly i've built before project. need msbuild able build it, , msbuild doesn't play nice vs variables, need use means load assembly. i've read in lot of places t4referencepath answer setting place load custom assembly from. however, cannot work. when specify this: <t4referencepath include="$(targetdir)" /> i when either try load project in vs or run msbuild: d:\users\250894\documents\visual studio 2013\projects\testt4\testt4.csproj(90,22): error msb4066: attribute "include" in element <t4referencepath> unrecognized. i have "visual studio visualization , modeling sdk" installed. i apologize lack of brevity, i'm including entire .csproj file of test project in case glaringly obvious i've missed. i'm not including .tt f

Executing regex statements over object-array with Javascript/jQuery -

i'm looking use regex form manipulation based on user's credit card input (note: front-end validation sake of ux, service , api handles actual credit card validation). i'd create $watch statement or equivalent match user's input in credit card field against several regex statements ascribed different card types. so, question in nutshell is: what's best pattern implement can match against multiple regent statements without degrading performance many watchers? first thought write multiple if or switch statements, seems problem extensibility , complicated bit of logic isn't best solution. thanks everyone! here's have far: var defaultformat = /(\d{1,4})/g; $scope.cards = [{ type: 'maestro', pattern: /^(5018|5020|5038|6304|6759|676[1-3])/, format: defaultformat, length: [12, 13, 14, 15, 16, 17, 18, 19], cvclength: [3], luhn: true }, { type: 'dinersclub', p

sql - SSIS, Importing multiple datasets from one CSV file -

i have been given set of csv files 2 datasets, neither of fixed length. can suggest how extract datasets file import them seperate tables in sql. file format 17 lines of header information word "summary" col headers section one section 1 * many rows blank line word "detail" col headers section two section 2 * many rows edited if wants experiment, assuming file this: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah summary headers1 s1l1 s1l2 s1l3 detail headers2 s2l1 s2l2 s2l3 this script if can use awk : awk 'begin{out=""}/summary/{out="1.csv";next}/detail/{out="2.csv";next}/^$/{out="";next} length(out){print > out}' file at start sets output filename nothing. then, if sees word "summary" sets output filename "1.csv". if sees word "detail" sets output filename "2.csv". on other lines, che

android - how to make 9patch button for this button -

Image
i want make button cant because when convert 9patch lines of button scaling. want repeat , full button lines original image want looks :( create bitmap resource , repeat texture. <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/ab_texture_tile_apptheme" android:tilemode="repeat" />

gridview - Adding images to grid view dynamically in android -

i developing app, in want load images remote database, based on search query. now, not sure how many results returned, cannot fix size of container. size keep on increasing user swipes down screen. me how can achieved, or redirect me example ? note: images have click listeners also. thanks, vishal

regex - How to find if a string contains "ONLY" Special characters in java -

suppose define string as: string splchrs = "/-@#$%^&_-+=()" ; string inputstring = getinputstring(); //gets string end user i want check if string " inputstring " contains only special characters contained in string " splchrs " i.e. want set boolean flag true if inputstring contained characters present in " splchrs " eg: string inputstring = "#######@"; //set boolean flag=true and boolean flag set false if contained letters did not contain in " splchrs " eg: string inputstring = "######abc"; //set boolean flag=false you can use: string splchrs = "-/@#$%^&_+=()" ; boolean found = inputstring.matches("[" + splchrs + "]+"); ps: have rearranged characters in splchrs variable make sure hyphen @ starting avoid escaping. removed redundant (and problematic) hyphen middle of string otherwise give different meaning character class (denoted range)

.net - how to write into someone else google calendar -

currently our companies calendars managed google account. possible insert entry employees calendars? i have looked https://developers.google.com/google-apps/calendar/ but can't find anything thanks there domain setting let service account access accounts in domain: https://developers.google.com/drive/web/delegation answered in cannot access token google calendar api v3 for retrieving users in domain can use google admin sdk https://developers.google.com/admin-sdk/directory/v1/reference/users/list

File Group Restore Failed in SQL Server -

i trying restore database using file groups concept in sql server. i trying take backup "fgtest_stg" db , restore in "fgtest_prod" db.both database exists in sql server . restore query: restore database fgtest_prod filegroup = 'primary' disk = 'e:\sqldata\fgtest_stg_2014.06.10.165900.bak' move 'fgtest_stg' 'e:\databases\fgtest_prod_2014_06_10_171410.mdf' ,move 'fgtest_stg_log' 'e:\dblogs\fgtest_prod_2014_06_10_171410.ldf' ,replace but when restore getting below error. <code>the backup set holds backup of database other existing 'fgtest_prod' database. msg 3013, level 16, state 1, line 4 restore database terminating abnormally</code>

javascript - Changing an array value also changes value in another assigned array -

i learning javascript , in w3 schools' code editor try following code : <!doctype html> <html> <body> <p id="demo"></p> <script> var cars = ["saab", "volvo", "bmw"]; var newcars = []; newcars = cars; newcars[0] = "benz" document.getelementbyid("demo").innerhtml = cars[0]; </script> </body> </html> i expected value : "saab" since made no changes cars array , change newcars array, yet output : "benz". could please explain happening? thanks the value of variable "cars" contains "reference array" not "the array value". so, when go "var newcars = cars" copying reference only, means "cars" , "newcars" pointing same array. need make copy of array "cars" points , let "newcars" reference new copy. can clone array in different ways, done using libraries

excel - vba sort worksheets: why capital / non-capital? -

Image
i have code sorts worksheets sheet 9 until last sheet. found works perfectly. thing not understand: code somehow sorts capitals first , after that, sheets names not start capitals follow. why that? this sort code: sub sortsheets() application.screenupdating = false dim integer, j integer = 9 sheets.count j = + 1 sheets.count if sheets(j).name < sheets(i).name worksheets(j).move before:=worksheets(i) end if next j next end sub it sorts right worksheets first, worksheets name starts capital sorted, , after that, sheets names start non-capital sorted. while code provided simoco fixes sorting - reason why capital letters sorted first because have lower ascii values . here's table reference. you can ascii value of string in vba using asc(mystring) function.

php - facebook and github login HWIOAuthBundle and FOSUserBundle in Symfony2.1 -

i have followed tutotial http://m2mdas.github.io/blog/2013/11/21/integrate-hwioauthbundle-with-fosuserbundle/ make github login work, seems working when clicked login land on github login page, , see 1 user registered on github application in github dashboard. not authencated in symfony. on symfony tool bar on bottom still says anonymous user, plus new row not added table fos_user. for facebook login, when click on generator login link facebook, gives me error "given url not permitted application configuration.: 1 or more of given urls not allowed app's settings. must match website url or canvas url, or domain must subdomain of 1 of app's domains." another doubt had in tutorial, in routing.yml says put, hwi_github_login: pattern: /secure_area/login/check-github as there no controller or resource specified, supposed put here controller action path or resource? config.yml fos_user: db_driver: orm # other valid values '

android - Error when I add a view to a AlertDialog? -

i make new dialog allow users input name , password login. have added snippets here: layoutinflater flater = layoutinflater.from(context); final view view = flater.inflate(r.layout.login, null); spinner spinner=(spinner)view.findviewbyid(r.id.safequestion_spinner); arrayadapter<string> adapter=new arrayadapter<string>(context,android.r.layout.simple_dropdown_item_1line,safequestion); spinner.setadapter(adapter); spinner.setonitemselectedlistener(new adapterview.onitemselectedlistener() { @override public void onitemselected(adapterview<?> adapterview, view view, int i, long l) { questionid=""+i; if(i!=0) ((edittext)view.findviewbyid(r.id.answear_edittext)).setvisibility(0); } @override public void onnothingselected(adapterview<?> adapterview) { questionid=""+0;