Posts

Showing posts from August, 2013

sql - Oracle - how to calculate sum of highest salary for each dept -

as far get, getting max sal of each dept: select ename, sal, deptno emp out sal = ( select max(sal) emp inside out.deptno=inside.deptno ); this returns 4 results, want sum of 4 results, how do that? seems not work: select ename, sum(sal), deptno emp out group deptno, sal, ename having sum(sal) = ( select max(sal) emp inside out.deptno=inside.deptno ); it returning same result first query. select sum(max_sal) total_sum ( select deptno, max(sal) max_sal emp group deptno ) x to highest salary every department can group department , use max() highest. use subquery sum these up.

vba - ms access form closing ask save yesnocancel -

i have put vba in unload form event in ms access 2010 private sub form_unload(cancel integer) dim strmsg string dim iresponse integer ' specify message display. strmsg = "do wish save changes?" & chr(10) strmsg = strmsg & "click yes save or no discard changes." ' display message box. iresponse = msgbox(strmsg, vbquestion + vbyesnocancel, "save record?") ' check user's response. if iresponse = vbyes ' undo change. docmd.runcommand accmdsave end if if iresponse = vbno ' undo change. docmd.runcommand accmdundo end if if iresponse = vbcancel ' undo change cancel = true end if end sub if data changed above code working fine, yes save & close, no undo & close , cancel cancel event , remain on form when data unchanged yes button working fine, no button not close form where m mistaking ? your question vague bec

android - App above all anothers -

Image
with functionality of android possible make app callable everywhere facebook messenger chat: you cannot have "full app" above others. however, can achieve convincing simulacrum trick. applications android.permission.system_alert_window (displayed "draw on other apps" in play store) can create windows service , show them on other content. there open source library called standout provides behavior in easy use manner. might want take @ it.

sublimetext2 - How to use multiple cursors efficiently in this case? -

Image
the stage set: i'm add 3 li s ul , think application of multiple cursors in st2. i'm not sure how this. at step 1. i'd able is: "open 2 new lines 2 new cursors". don't think possible instead tried opening 2 new lines manually (step 2) , applying multiple cursors using ctrl+shift+up except cursors end in not-so-ideal spot (step 3). even if hold cmd , click cursors end in same not-so-ideal spot (step 3). question how can efficiently apply multiple cursors situation? trying harpreet's technique doesn't seem work me: i think open-ended question. in first attempt, if replace 2 of enters ctrl+shift+d (duplicate_line), find when multi cursor (select_lines), give positioning wanted. the cause of problem original 3 empty lines aren't same (due whatever indentation mechanism). , best way of using multi-cursor using them on structurally identical lines. of course in practice, depends on cursor is. example if near other < li

node.js - WebSocket Streaming dual videos -

wanted clear few questions websocket. is possible stream videos server client , client server @ same time...something video calling? can server stream 2 videos single client @ time? regarding first question, yes can. there wrappers simplify task such binaryjs . as per second question, require little configuration. once bidirectional link between client , server established, client treat every incoming message part of same stream. separating or multiplexing 2 videos in same stream have carry mark client separate it. it better idea open new connection (with same server) stream second video.

php - How do I set whether a form redirects to a new page or not? -

so i'm trying create simple log in page php , html . it's pretty simple. first, user inputs username , password, clicks submit button. if username/password combo invalid, "invalid log in." printed, , user redirected log in page. if username/password combo valid, "logging in..." printed, , user redirected page. all post data must kept when redirecting . i can't figure out how change form's action. code snippet below. please past potential sql injections. deal them later. <form action="<?php echo htmlspecialchars($_server['php_self']); ?>" method="post" id="form"> user name:<input type="text" name="username" id="username"> password:<input type="password" name="password" id="password"> <input type="submit" name="submit" id="submit" value="submit"> <input type="reset

playframework - find a single document with play+reactivemongo -

function receives author object in request def login = action.async (parse.json) { request => request.body.validate[author].map { author => val query = json.obj("username" -> "222") val obj = collection.find(query).one[author] obj.map { author => ok("welcome").withsession ( "username" -> "ok") } }.getorelse(future.successful(badrequest("invalid json"))) } always results in bad request, hard coded username. what's wrong here? changed login post. seems working now. post /author/login @controllers.authors.login

arduino - Wire High&Low Address -

with regards arduino eeprom when writing , reading eeprom devices asks transmission of following format: wire.begintransmission(addr); wire.write(highaddr); wire.write(lowaddr); wire.write(data); wire.endtransmission(); what high address , low address mean? why can not tell write byte @ address 4. why need prove high , low? it looks me using i2c, going make assumption , base answer off of it. perhaps should clarify eeprom using. the way i2c works can have 1 master (your arduino) communicate multiple slaves (your eeprom example) on same i2c bus. since possible have multiple slaves connected on same bus, i2c protocol requires specify slave device communicating with. wire.begintransmission(addr) does. selecting device wants initiate communication with. if want communicate eeprom need send address of eeprom (you should able find address in eeprom datasheet). next, need specify memory location inside eeprom want access. done using 2 bytes highaddr , lowaddr. if instan

sql - MySQL functions COUNT/MIN/MAX issue -

i run following queries sum same answer sql 1 :: select l_partkey,sum(l_linenumber) lineitem inner join orders on orders.o_orderkey = lineitem.l_orderkey o_weekday='tuesday' group l_partkey sql 2 :: select sum(if(orders.o_weekday='tuesday',l_linenumber, 0)) 'tuesday' lineitem inner join orders on orders.o_orderkey = lineitem.l_orderkey group lineitem.l_partkey but when run above queries avg/count/min/max function instead of sum both queries gives different output. say have following data: monday 1 tuesday 2 tuesday 3 your first query looks @ last 2 rows. sum 5, average 2.5, number of lines 2. your second query looks @ rows. first row, replaces number 1 0. sum still 5, average 5/3, , number of lines 3. for sum, rows value of 0 not matter. rows 0 influence other aggregates count, min, max , avg.

laravel sentry and login with 2 different computers -

i'm using sentry many reasons 1 of them feature log out user while login 2 different computer m using local host how can activate feature? or make sure active right now? you need 2 computer test login 2 different computer . first computer need create web-server , second computer access first computer web-server(localhost). , can test login 2 different computer . if don't know how access localhost computer can see @ here . note : way. there many others way test login 2 different computer . can find more.

c# - Crystal Reports 13.0.2 (VS2012), Dynamic Image Loading -

the images should load in picture object(insert -> picture -> selected 1.jpg) dynamically not showing in report. instead default image selected shows up.(1.jpg) what i've done change "graphic location" "pic/"+{picid}+".jpg", plus same syntax in hyperlink section. when click on image(hyperlink), shows in browser not in report. i've searched alot , added handlers in web.config, checked other images, used ole paintbrush image, added "aspnet_client(2.0 , 4.0)" folder root, checked folder permissions of images , still same image shows up. any appriciated <?xml version="1.0" encoding="utf-8"?> <xs:schema id="rptappsettings" targetnamespace="http://tempuri.org/appsettings.xsd" xmlns:mstns="http://tempuri.org/appsettings.xsd" xmlns="http://tempuri.org /appsettings.xsd" xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:msdata="urn:schema

c# - is it bad for design using nested derived classes -

i reading code written other programmer, made design application, application classes derived each other that: public interface iabase { } class bbase : iabase { } class cdesktop : bbase { } class report : cdesktop { } class sample : report { } this kind of design anti pattern? have tell first, realy hard understand relationship of class , logic of application, 2 cents. else can say? there's bit of general advice floating around prefer composition on inheritance. advantage touted it's more flexible, , discourages tight coupling more. (see where-does-this-concept-of-favor-composition-over-inheritance-come-from , deepclasshierarchies , deep-class-inheritance-hierarchy-bad-idea , long-inheritance-hierarchy amongst many others discussions on matter). specifically c#, it's worth noting composition can require considerable boilerplate - after all, if want expose of functionality of component/base-class, you'll need manually expose that; inheritan

python - Ensure a Method is Overridden -

i want ensure class derived class overrides methods. if not overridden want raise notimplementederror possible after compiling begins, rather when 1 of methods called. i've found can metaclass so: class metabaseclass(type): # list of method names should overridden to_override = ['method_a', 'method_b'] def __init__(cls, name, bases, dct): methodname in cls.to_override: if methodname not in dct: raise notimplementederror('{0} must override {1} method'.format(name, methodname)) super(metabaseclass, cls).__init__(name, bases, dct) class baseclass(object): __metaclass__ = metabaseclass def method_a(self): pass def method_b(self): pass this raise error @ class definition time if method_a or method_b aren't overridden class derived baseclass. is there better way this? why not use abstractmethod. from abc import abstractmethod, abcmeta class basecl

ruby on rails - Boolean checkbox needs to be accepted all the time even when checked -

i've put validation in checkbox tos_agreements, now, if it's checked, still gives me error "tos agreements need accepted". what have is: 1.) i've added :tos_agreements devise permitted params in application controller 2.) i've validated this: validates_acceptance_of :tos_agreement, :allow_nil => false, :accept => true any idea? thanks! i attr_accessor( of course in model of user ): attr_accessor :tos_agreement validates :tos_agreement, acceptance: true this validate checkbox tos_agreement checked, regards

c++ - Invalid template instantation and the metaprogram compiles fine? -

i working on simple solution common "conditional on ill-formed types" problem (like this yesterday question). in codebase have template hold uninstanced templates , instance them later. this: template<template<typename...> class f> struct lazy {}; namespace impl { template<typename l , typename... args> struct lazy_instance; template<template<typename...> class f , typename... args> struct lazy_instance<lazy<f>,args...> : public identity<f<args...>> {}; } template<typename l , typename... args> using lazy_instance = typename impl::lazy_instance<l,args...>::type; where identity identity metafunction. used follows: using vector = lazy<std::vector>; using int_vector = lazy_instance<vector,int>; so solution comes mind wrap 2 targets of conditional on way, , instantiate result of conditional, selected template instanced. purpose, have modified lazy , impl::lazy_i

python - matplotlib two different colors in the same annotate -

Image
i trying create figure in python , make same annonate text have 2 colors, half of annonate blue , other half red. i think code explain itself. have 3 lines 1 green green annonate, 1 blue blue annonate. the 3rd red summation of plot 1 , plot 2, , want have half annonate blue , half green. ipython -pylab x=arange(0,4,0.1) exp1 = e**(-x/5) exp2 = e**(-x/1) exp3 = e**(-x/5) +e**(-x/1) figure() plot(x,exp1) plot(x,exp2) plot(x,exp1+exp2) title('exponential decay') annotate(r'$e^{-x/5}$', xy=(x[10], exp1[10]), xytext=(-20,-35), textcoords='offset points', ha='center', va='bottom',color='blue', bbox=dict(boxstyle='round,pad=0.2', fc='yellow', alpha=0.3), arrowprops=dict(arrowstyle='->', connectionstyle='arc3,rad=0.95', color='b')) annotate(r'$e^{-x/1}$', xy=(x[10], exp2[10]), xytext=(-5,20), textcoords='of

java - Converting a Spring Boot JAR Application to a WAR -

i have tried run "converting spring boot jar application war" application converting war package instructed...and since mentioned void main() no longer needed,i removed , tried build using gradle throws error unable find main class. the content of class after modification below application.java @configuration @enableautoconfiguration @componentscan public class application { } what mistake making? if don't want executable war remove spring boot plugin. if do, leave in, , keep main().

node.js - Socket IO, in which directory should i save my static javascript files -

i trying include jquery in socket io served file served - app.get('/:file', function(req, res){ res.set('content-type', 'text/html'); res.sendfile('shrib.html'); }); now in shrib.html when try send - <script type="text/javascript" src="/jquery-1.11.0.min.js"></script> or <script type="text/javascript" src="jquery-1.11.0.min.js"></script> i error of jquery not found, when try use cdn version of jquery runs fine. in directory structure have jquery-1.11.0.min.js in both main directory , in node_modules directory yet don't see , error - uncaught syntaxerror: unexpected token < jquery-1.11.0.min.js:1 uncaught referenceerror: $ not defined did mistaken socket.io express? because problem looks related express, not socketio, , see no sockets here... if yes, should set static files this: app.use('/js', express.static(__dirname + '/js'))

swift - Scope and method passing -

i have defined within class: class tableviewcontroller: uitableviewcontroller { let sections = ["design", "development", "mobile"] var blogpost1 = ["title" : "stackoverflow", "author" : "john doe"] var blogpost2 = ["getting started" : "title", "john" : "author"] var posts = [blogpost1, blogpost2] override func viewdidload() { super.viewdidload() var blogposts = [blogpost1, blogpost2] } } i dont understand why able create blogposts variable within viewdidload not inside class under blogpost2? if try, xcode won't autocomplete , return error says viewcontroller doesn't have member named "blogpost1". can create within viewdidload() not know how use within other functions. second issue: i have tableviewcontroller. within cellforrowatindexpath, trying send message: var posts = blogposts.objectatindex(indexp

xamarin.android - Is there a way for Xamarin Studio to remember the keystore path and credentials? -

Image
every time project->publish android application, xamarin studio (v5.0.878) prompts for: keystore location password alias key password is there way save information don't have enter every time? select android project from menu select project -> project options under build section android package signing hope helps!

Extract cross sections from a plot of multiple spheres in Matlab -

i know locations of spheres (center , radius) in box. want extract cross sections. able plot spheres placed in cube using following matlab code: [x,y,z] = sphere; spnum = 1:numspheres surf( x*radius(spnum)+center(spnum,1), y*radius(spnum)+center(spnum,2), z*radius(spnum)+center(spnum,3), ... 'facecolor','r' ); %shading interp; hold on; end axis tight; daspect([1 1 1]); in above code, each sphere have different radius , not overlap (so centers different). the above code not generate cross sections. want extract cross sections similar x-ray ct data: series of images in z-direction. think 'interp2/interp3' , 'slice' functions relevant functions, not sure how use them generate cross sections. appreciate if give pointers or provide sample code problem? -- in advance. update: i tried using meshgrid generate grid points followed function f(x,y,z) follows: [x,y,z] = meshgrid(1:100,1:100,1:100); f = zeros(size(x),'uint8'); spnum

java - xuggle-xuggler 5.4 NullPointerException when encoding audio -

today working xuggler library , tried capturing screen worked flawless. wanted add audio microphone video file captured. not easy had expected, , i'm stuck strange nullpointerexception. this code (abbreviated): audioformat format = new audioformat(8000.0f, 16, 1, true, false); writer.addaudiostream(1, 0, 1, (int) format.getsamplerate()); targetdataline line = gettargetdatalineforrecord(format); final int framesizeinbytes = format.getframesize(); final int bufferlengthinframes = line.getbuffersize() / 8; final int bufferlengthinbytes = bufferlengthinframes * framesizeinbytes; final byte[] buf = new byte[bufferlengthinbytes]; final long starttime = system.nanotime(); ... while (recording) { int numbytesread = 0; numbytesread = line.read(buf, 0, bufferlengthinbytes); int numsamplesread = numbytesread / 2; short[] audiosamples = new short[numsamplesread]; if (format.isbigendian()) { (int = 0; < numsamplesread; i++) { audiosamples[i] =

c++ - Return string read from buffer and function without dynamic allocation? -

how go returning string built buffer within function without dynamically allocating memory? currently have function consider: // reads null-terminated string buffer in instance of buffer class. // uint16 :: unsigned short // ubyte :: unsigned char ubyte* readstr( void ) { ubyte* result = new ubyte[](); for( uint16 = 0; < bytesize; ++ ) { result[ ] = buffer[ byteindex ]; byteindex ++; if ( buffer[ byteindex - 1 ] == ubyte( 0 ) ) { byteindex ++; break; }; }; return result; }; while can return built string, can't without dynamic allocation. becomes problem if consider following usage: // instance of buffer class "buffer" calling readstr(): cout << buffer.readstr() << endl; // or... ubyte string[] = buffer.string(); usages similar call result in same memory leak data not being deleted via delete . don&#

javascript - iframe doesn't getting hidden using JQuery -

in page have div div , iframe shown below. <div class="v_dissc_tab" id="tabs-1"> <div id="publicevent"> <div class="crtraone" style="margin-left:800px;"> <button onclick="addpublic()">add new</button> </div> <div> <table width="100%"> <tr> <td><b>programme</b></td> <td><b>scheduled start time</b></td> <td><b>scheduled end time</b></td> <td><b>amount</b></td> <td><b>status</b></td> <td></td> </tr> <tr> <?php if($publicnum>0) { } else { ?>

c# - system.argumentoufofrange exception :lenght cannot be less than 0 (line 32) overflow exception( Line 29) -

sup people im creating program listen incoming string works...well have coded far works problem if send string program throws argument out of range exception using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.net.sockets; namespace stringlistener { class program { static void main(string[] args) { tcplistener serversocket = new tcplistener(my port number); int requestcount = 0; tcpclient clientsocket = default(tcpclient); serversocket.start(); console.writeline(" >> server started"); clientsocket = serversocket.accepttcpclient(); console.writeline(" >> accept connection client"); requestcount = 0; while ((true)) { try { requestcount = requestcount + 1; networkstream network

php - Codeigniter & PHPMailer -

so i've been trying day or 2 now. @ first, tried built in codeigniter smtp mail class, no luck. in hope of fixing problem, turned phpmailer. , disappointment, there still no luck. i'm details correct. i've tried multiple smtp servers, of include gmail , mandrill. here's code using (i have tried many different modified versions of this, i'll give 1 i'm using) <?php class thankyou extends ci_controller { function index() { $this->load->model('index'); $header = array( 'title' => 'please confirm', 'navigation' => $this->index->loadnavigation(), ); $this->load->view('header', $header); $this->load->library('my_phpmailer'); $mail = new phpmailer(); $mail->issmtp(); // set mailer use smtp $mail->host = 'smtp.mandrillapp.com'; // specify main , backup server

java - Unable to build this Complex JSON Structure -

i have inter-related maps representing below data . { "soft drinks": { "tin": [ { "lean apple": [ { "name": "1 litre" }, { "name": "2 litre" } ] }, { "clear": [ { "name": "7 litre" }, { "name": "10 litre" } ] } ], "bottled": [ ] } } this code representing above json data in form of java code package test; import java.util.linkedhashmap; i

mysql - Filter register from two tables -

i new here , php/mysql programming. need next consult in database. i have 2 tables: -the first of relations between users friends have value "2" columns like: id | username1 | username2 | relation -the seconds messages post users columns like: id | username | message the id "primary key" auto increment property. (in both) i want show message of friends of 1 user order of post (most first) so need select max value id user1 , user2 friends, need select max value of "messages table" , check if friends in "relations table" i know next not syntax need this: select message message_table max(id) , ( relations ( ( user1="randomuser" or user2="randomuser") , relation="2") ) order id desc i know wrong... need 2 filters show friend message in posting order.. how can show

java - check whether a library has already been loaded with System.load(...) -

in java program, loaded library built native code by: system.load(path_to_lib_file); i wondering in java, how check whether specific library has been loaded before execute above code? you have few options, load in singleton . can take advantage of single instance-ness of singleton ensure library loaded once. similarly, have boolean flag , check (default false ) - if it's true library has been loaded, otherwise load library , set flag true . there other options, none elegant (imo). example, place load call in static initializer block in class, long don't serialize instances of class should ensure library loaded once.

c# - How to handle an exception without closing application? -

i have try catch sending email through wpf c# application followed: try { smtpmail.send(message); } catch (exception err) { throw new customexception("error contacting server.", err); } however, don't want application stop running/crash if error hit. rather, change error error message textbox have set within application...or related not crashing application , rather informing user try again later (or if problem persists: contact so-and-so). edit: expectation: error logged, user sees this, errormsg.text = "error contacting server. try again later, or if problem persists contact billy bob boo"; how go implementing this? update: apologies unclear question. needed on how go logging error display friendly error message user...but asked poorly. using comments , answer provided, researched bit more answered own question below. thanks, everyone! :) why catching exception , throwing again? doesn't seem effective. you use mes

c# - How to inject dependencies into an asmx webservice webmethod? -

i have asmx webserice method [webmethod] double getbookprice(int bookid) { //instantiates discountservice,deliveryservice , couple of other services //uses various methods of these services calculate price //e.g. discountservice.calculatediscount(book) } there 4 services dependencies of method. how test method? need inject these dependencies? or should ? client sending int check price. thanks if getbookprice method doing taking int , passing along method, returning results, i'd testing service method of dubious value. doesn't hurt test it, , have value if want expand functionality in getbookprice method down line. in general, though, if wanted test service, you'd standard ioc via constructor injection , constructor chaining: public class foowebservice { private readonly isomedependency dependency; public foowebservice(isomedependency dependency) { //this call during testing this.dependency = dependency;

Neo4jclient query gives me error -

what wrong query var result = neo4jcontroller.m_graphclient.cypher .match("(a:" + objworld.getlabel() + " { name : {name} })") .create("(a)-[r:" + rel_world.world_country + "]->(b:" + objcountry.getlabel() + "{ objcountry }") .withparams(new { name = objworld.name, objcountry = objcountry }) .return((b, r) => new { countrycount = b.count(), relationcount = r.count() }) .results .single(); i getting error message=syntaxexception: invalid input 'r': expected whitespace, comment or ')' (line 3, column 1) "return count(b) countrycount, count(r) relationcount" i using neo4jclient interact neo4j forgot add ')' in query field.

scala - How to access application.context property from Play 2.2 application? -

i access application.context property (which set in application.conf file) within play application. it's useful know property e.g. pass javascript, addresses in script can context independent. i have looked in scala api, haven't found way obtain property. in template file call javascript code: @import play.api.play.current <script type="application/javascript"> var context = @play.api.play.configuration.getstring("application.context").getorelse("") </script>

php - Wordpress URL and wp_get_attachment_image_src - http vs https -

in wordpress settings, wordpress url (which used lot of resource urls) requires hardcode either http:// or https:// in url. results in issues insecure parts being loaded on secure site or vice versa. how handle this? example: //the wordpress url setting (in settings->general) http://example.net //an image source (this http://example.net/images/myimage.png) $imagesource = wp_get_attachment_image_src( get_post_thumbnail_id( $post->id ), "myimage" ); ?><img src="<?php echo $imagesource; ?>" .?<?php ... ?> if user visiting https://example.net , image still loaded non-secure "http". how fix site in https loads (not wp_get_attachment_image_src ) in https , vice-versa? you have replace http in url string. $imagesource = wp_get_attachment_image_src( get_post_thumbnail_id( $post->id ), "myimage" ); $output = preg_replace( "^http:", "https:", $imagesource ); echo $output; you add

ruby on rails - Simple form as date not getting input -

i'm making contact form site using simple_form , mail_form. here's code on views: f.input :start_date, as: :date, start_year: date.today.year, order: [:month, :year], label: false however, not getting input :start_date, when made :start_date required field, keep getting "can't blank" no matter put. it works when remove as: :date, , start_date included in email sent mail_form. rails date format 'yyyy-mm-dd' . that being said, @acacia correct. if sort of datepicker, in javascript, might want specify date-format like format: 'yyyy-mm-dd' so, if using jquery datepicker be: $(function() { $( "#datepicker" ).datepicker({ format: "yyyy-mm-dd" }); });

javascript - Merge 2 objects values when key is same -

i have 2 objects: {'1': {'a': 1, 'b': 2, 'c': 3}}, {'1': {'d': 4, 'e': 5, 'f': 6}, '2': {'g': 7}}. is there function in native javascript (underscore being used in project) can put in both objects , out? {'1': {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6}, '2': {'g': 7}} [ updated ] use following merging without affecting original objects: var isobject = function(o) { return object.prototype.tostring.call(o) == '[object object]'; }; var isarray = function(o) { return object.prototype.tostring.call(o) == '[object array]'; }; function extend(a, b) { (var prop in b) { if (isobject(b[prop])) { extend(a[prop]||(a[prop] = {}), b[prop]); } else if (isarray(b[prop])) { a[prop] = (a[prop]||[]).concat(b[prop]); } else { a[prop] = b[prop]; } } return a; } fun

regex - javascript replace all occurrences ",\S" with ", \S" -

i want have spaces separating items in csv string. "123,456,789" => "123, 456, 789". have tried, been unable construct regexp this. read postings , thought trick, no dice. text = text.replace(new regexp(",\s", "g"), ", "); could show me doing wrong? you have 2 problems: backslashes pain in the, um, backslash; because have many meanings (e.g. let put quote-mark inside string), end needing escape backslash backslash, need ",\\s" instead of ",\s" . the \s matches a character other whitespace , character gets removed , replaced along comma. easiest way deal "capture" (by putting in parentheses), , put in again in replacement (with $1 ). so end this: text = text.replace(new regexp(',(\\s)', "g"), ", $1"); however, there neater way of writing this, because javascript lets write regex without having string, putting between slashes. conveniently, does

vb.net - Using a string to represent a control property and a project resource in Visual Basic -

can please me 2 issues? want able use string represent control property in code this. dim txtname string = "textbox" txtname.text = "whatever" if process different project resources, can tell me how? want string represent name image in project resources sort of this. dim imagename string = "image" picbox.image = my.resources.image i looked directcast , ctype, couldn't find helped me. lot of code didn't work , didn't make sense. i'm looking simplified can guys me? you arent trying use string represent control property, actual control object. cant convert string variable control object. 2 different things. one way can use string find control use name of in controls collection: dim tb textbox = me.controls.find("textbox name find", true) ' if found, tb refers textbox note: true param find tells form search child container controls tabs , panels , since control looking may exist in 1 of other

excel - Modify .xls file with python -

im coding script in python reads excel file, makes change on cell , copy excel file , save it. for example have example.xls , generate example_copy.xls . everuthing same, problem is, formulas on sheet gone, when makes copy keeps text want copy formulas too. i'm using xlutils this. part of code: def write_frecuencias(self): book = xlrd.open_workbook('examen.xls', formatting_info=true) book_copy = copy(book) sheet = book_copy.get_sheet(0) frecuencies = self.get_frecuencias() row = 1 f in frecuencies: sheet.write(row, 1, str(f[0])) row += 1 book_copy.save('examen.xls')

About the facebook javascript sdk -

i newbie in coding. when called below function post on wall. encouunter error occured alert box. have search web few days still cannot find result , fix. facebook documentation bad. please help. call fb.ui, or fb.getloginstatus no problem. have problem of calling fb.api. function posttowall() { var body = 'reading js sdk documentation'; fb.api('/me/feed', 'post', { message: body }, function(response) { if (!response || response.error) { // alert('error occured'); } else { // alert('post id: ' + response.id); } }); fb.api('/me', function(response) { // console.log(response); }); } the error message is- an active access token must used query information current user. the error quite straight-forward. no user logged-in application. must call, fb.login first before making api calls further. after login, user in session , wont see error again.

ios - Sqlite File Location Core Data -

typically, sqlite store file core data apps located in library>application support>iphone simulator>7.1(or whichever version using)>applications>(whichever folder contains app)>documents folder, can't find in ios 8. assume add 8.0 folder inside iphone simulator folder, it's not there. has been able locate it? i managed locate sqlite file, , in path now: library/developer/coresimulator/devices/(numbers , letters)/data/containers/data/application/(numbers , letters)/documents/ (numbers , letters) stands folder unique app/computer, this: 779ae2245-f8w2-57a9-8c6d-98643b1cf01a i able find going appdelegate.m, scrolling down - (nsurl *)applicationdocumentsdirectory method, , nslogging return path, this: // returns url application's documents directory. - (nsurl *)applicationdocumentsdirectory { nslog(@"%@",[[[nsfilemanager defaultmanager] urlsfordirectory:nsdocumentdirectory indomains:nsuserdomainmask] lasto

php - codeigniter calendar template not working -

thanks in advance.. i unable load template in codeingniter calendar. here comes code $prefs['template'] = ' {table_open}<table class="calendar_widget_table" >{/table_open} {heading_row_start}<tr>{/heading_row_start} {heading_previous_cell}<th><a href="{previous_url}">&lt;&lt;</a></th>{/heading_previous_cell} {heading_title_cell}<th colspan="{colspan}">{heading}</th>{/heading_title_cell} {heading_next_cell}<th><a href="{next_url}">&gt;&gt;</a></th>{/heading_next_cell} {heading_row_end}</tr>{/heading_row_end} {week_row_start}<tr>{/week_row_start} {week_day_cell}<td>{week_day}</td>{/week_day_cell} {week_row_end}</tr>{/week_row_end} {cal_row_start}<tr>{/cal_row_start} {cal_cell_start}<td>{/cal_cell_start} {cal_c

rest - Ambiguous handler methods mapped for HTTP path -

i have 2 methods clashing 1. @requestmapping(value = { "/{name}" }, method = requestmethod.get) void foo1(@pathvariable("name") final string name) 2. @requestmapping(value = { "/{email}" }, method = requestmethod.get) void gettemplateversionsbysenderforclient(@pathvariable("email") final string email, @requestparam(value = "timestamp", required = true) final long timestamp) how avoid this? you can change uri templates else. can change "email" uri template use regular expression, path looks email address processed second method. see http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/mvc.html , under "uri template patterns regular expressions": @requestmapping("/spring-web/{symbolicname:[a-z-]+}-{version:\\d\\.\\d\\.\\d}{extension:\\.[a-z]+}") public void handle(@pathvariable string version, @pathvariable string extension) { // ... }

android - How to load a JAR from Assets folder at runtime -

how load jar file assets folder of android application during run time. loading assets folder requirement. there way this. please .. i got answer.i adding answer here. because may helpful others searching. there steps accomplish this. you have make copy of jar file private internal storage of aplication. using dx tool inside android folder, have generate classes.dex file associated jar file. dx tool @ location /android-sdks/build-tools/19.0.1 (this file needed dalvik vm, jar can not read dalvik vm)) using aapt tool command inside same location, have add classes.dex jar file. this jar file loaded dynamically using dexclassloader. if making jar 1 own library, have steps (1-4) every time when there change in library source code. can automate steps creating shell script(in mac/linux/ubuntu) or batch scripts(in windows). can refere link understand how write shell scripts. note : 1 situation implementing method is, when impossible add jar files directly build

android - Facebook Session is already opened -

i have updated facebook sdk code used work no longer works. i getting following exception: 06-10 10:37:58.146: e/androidruntime(28184): java.lang.unsupportedoperationexception: session: attempt made open opened session. 06-10 10:37:58.146: e/androidruntime(28184): @ com.facebook.session.open(session.java:985) 06-10 10:37:58.146: e/androidruntime(28184): @ com.facebook.session.openforread(session.java:388) and have following code open session: session session = session.getactivesession(); if (session == null) { session = new session(dealactivity.this); } //session.isopened() apparently false! if (!session.isopened()) { session.openrequest openrequest = null; openrequest = new session.openrequest(this); openrequest.setpermissions(facebookmanager.read_permissions); openrequest.setloginbehavior(sessionloginbehavior.sso_with_fallback); openrequest.setcallback(cal

byte - How to extract values between specific sequence in java -

this file reading how specific value file. i want data starting form 2000 466 character , starting 4000 550(it can there or ellse empty) , data 6000 328 characters. ie line 1 : starts character 2000 466 characters line 2 : starts character 4000 550 characters line 3 : starts character 4000 550 characters line 4 : starts character 6000 328 characters and ignore remaining part file header , file footer. what did far is update stringbuilder sb = new stringbuilder(); newsize = in.readline(buffer); system.out.println("newsize-------------"+newsize); while (newsize > 0) { string str = buffer.tostring(); sb.append(str); sb.append("\n"); newsize = in.readline(buffer); } string s = sb.tostring(); /* * differentiating header,body , footer */ if(s.length() >0){ string header = sb.tostring().substring(0,466); system.out.println("header-------------------"+header); //unable body part } how body part? you can by:

android - why does SKMap crash when loading map? -

i'm trying integrate skobbler maps sdk in android app. app crashes when try start map. logs seem ok until there sigsegv signal code segv_maperr 06-10 11:51:35.073: d/skmaps(13187): skpreparemaptexturethread----preparemaptexture - copy time 671 06-10 11:51:35.073: d/dalvikvm(13187): trying load lib /data/data/com.kolobee.mini/lib/libngnative.so 0x41550098 06-10 11:51:37.053: d/dalvikvm(13187): added shared lib /data/data/com.kolobee.mini/lib/libngnative.so 0x41550098 06-10 11:51:41.173: d/dalvikvm(13187): gc_concurrent freed 477k, 14% free 9126k/10503k, paused 11ms+2ms, total 105ms 06-10 11:52:02.403: d/skmaps(13187): skmapinitsettings---- map style [/storage/sdcard0/android/data/com.kolobee.mini/files/skmapsdaystyle/ , daystyle.json ,-1] 06-10 11:52:02.423: d/skmaps(13187): skmaps---- initialize sk maps settings 06-10 11:52:02.423: d/skmaps(13187): skmaps----versionfilename = version2_public_sdk_android_2_0.txt 06-10 11:52:02.433: d/skmaps(13187): skutils----return calcu

Solaris 10 sudo configuration Issue -

i using sunos 5.10 generic_147441-24 i86pc i386 i86pc if run which sudo i below /opt/sfw/bin when run "sudo -l" below user localuser may run following commands on host: (root) nopasswd: /sbin/ifconfig for "visudo" visudo -bash: visudo: command not found also /etc/sudoers file not exist in box. please me configure sudo, how possible out sudoers file. i've never seen sudo binary exist in /opt, first thought visudo binary not in path, or sudo package installed not contain visudo binary. either way may consider downloading sudo package again , reinstalling. to see if visudo binary exists anywhere: find / -name visudo -print if find nothing, remember not explicitly need visudo use sudo -- it's there checkpoint making sure not save , exit sudoers file has errors, possibly compromising ability edit again or break sudo users on host. also note /etc/sudoers can start off empty, fill in sudo rules. e

jquery - Replace standard javascript confirm with Twitter Bootstrap's modal - who triggered it? -

i'm trying replace standard javascript confirm twitter bootstrap modal window. working (the modal shown confirm text), i'm stuck trying catch caller href, need bind "ok" button. here's code (almost working example: http://jsfiddle.net/k5udw/ ): jquery.altconfirm = function (options) { var box = '<div class="modal fade static" id="confirm" data-backdrop="static" tabindex="-1" role="dialog">'; box += '<div class="modal-dialog">'; box += '<div class="modal-content">'; box += '<div class="modal-body"> </div>'; box += '<div class="modal-footer">'; box += '<button type="button" class="btn btn-default" data-dismiss="modal">no</button>'; box += '<butt