Posts

Showing posts from June, 2014

java - Allow loading of my own website into iframe -

there way disable security validation: load denied x-frame-options: http://localhost:8080/mywebsite/page/1 not permit framing. this occuring because trying add own url iframe on app. i tried in page responds in url above: <% response.addheader("x-frame-options", "allow-from: localhost"); %> <% response.addheader("x-frame-options", "allow"); %> <% response.addheader("x-frame-options", "same-origin"); %> none of them worked! the follow code solved question: @requestmapping(value="/page/{id}", method=requestmethod.get) public @responsebody modelandview load(@pathvariable string id, httpservletresponse response) { response.setheader("x-frame-options", "sameorigin"); map<string,object> parameters = new hashmap<string,object>(); ... return new modelandview("page", parameters); }

android - Galaxy Tab 3, turning on USB Debugging crashes USB driver -

can't device drivers working 100% galaxy tab 3. the driver install seems complete normally. initially, tablet appears discovered normally, , appears ok in 'file system', can browse through tablet's folders in usual way. however, 'adb devices' can't see tablet. but driver crashes after turn on usb debugging tablet . i have minimum system requirements, though pc rather old (2007). win xp, sp3, windows media player 10, directx 9. brand new galaxy tab 3, model sm-t210r, android 4.1.2. fresh download of eclipse-based developer's kit. i have been using guide: http://developer.android.com/training/basics/firstapp/running-app.html i have tried 3 different drivers, , show same misbehavior: kies (bloated tool) samsung usb driver mobile phones 1.5.14 samsung usb driver mobile phones 1.3.15 pretty frustrating. appreciated....

Mongodb + AngularJS: _id empty in update via resourceProvider -

i using mongodb (rails 3 + mongoid) , angular js. in db, have collection users holds array of objects addresses . trying update fields on address in array, when send update request (using angular's resourceprovider ), _id angular sends server " {} " (i.e. empty), end duplication instead of modification. $scope.user.addresses holds non-blank ids , looks this: [{_id:{$oid:"123431413243"}, text:"123 fake", cat:1},{_id:{$oid:"789789078907890}, text:"789 test", cat:7},...] the put request body holds empty ids , looks this: {"_id":{}, "user":{"addresses_attributes":[{"_id":{}, "text":"123 fake", "cat":"1"},{"_id":{}, "text":"789 test", "cat":"7"},...]}} angular js code myapp.factory('users', ['$resource', function ($resource) { return $resource( '/users/:id.json', {id:

How to insert data into SQL Server database to a datagridview using vb.net -

i want retrieve data sql server 2012 database datagridview in vb. created connection class connecting each every form db. created method call getdata execute sql statement , fill data dataset. code data getdata button private sub btngetdata_click(sender object, e eventargs) handles btngetdata.click dim tmpds dataset try rowindex integer = 0 datagridview1.rows.count - 1 dim objcon new clscon objcon.getdata("select * stockmf") if objcon.ds.tables(0).rows.count > 0 tmpds = objcon.ds datagridview1.rows(0).cells(0).value = tmpds.tables(0).rows(0).item("stockid") datagridview1.rows(0).cells(1).value = tmpds.tables(0).rows(0).item("itemno") datagridview1.rows(0).cells(2).value = tmpds.tables(0).rows(0).item("itemnm") datagridview1.rows(0).cells(3).value = tmpds.tables(0).rows(0).item("unitprice")

asp.net mvc - Adding data- attribute to an ASP MVC @Html.RouteLink -

i use javascript library hits data- attribute in link have created. @model ienumerable<string> @foreach (var link in model) { @html.routelink( link, new { controller = "product", action = "list", category = link, page = 1 }, new { @class = link == viewbag.selectedcategory ? "selected" : null, id= link.replace(" ","") } ) } i able add class , id when try add data-filter returns , error @class = link == viewbag.selectedcategory ? "selected" : null, data-filter = link.replace(" ","") invalid annonymous type @class = link == viewbag.selectedcategory ? "selected" : null, data_filter = link.replace(" ","") as d.r. has pointed out, mvc has option of turning underscores in dashes.

events - How can I check if there is a collision? -

in game, have ball , ground. ball falling , collides ground. but how can check if ball has collided? i've added script ball, , got following code: void oncollisionenter (collision collisioninfo) { print ("collision!"); destroy(this); } problem nothing happens, using wrong event? want trigger animation. your code work if using 3d colliders. however, since you're using 2d, there's separate event called oncollisionenter2d , change event this: void oncollisionenter2d (collision2d collisioninfo) { print ("collision!"); destroy(this); }

ios - UIDynamics and Autolayout -

recently used uidynamics animate image view place. however, because autolayout y-pos constraint set off-screen, when navigating away screen , returning it, image view being placed off-screen again. animation took 3 seconds, after 3 seconds reset constraint. feels little hacky. so question this: proper way handle autolayout , uidynamics @ same time? this not dynamics problem. autolayout incompatible any view animation, or any manual setting of frame: when layout comes along, constraints obeyed. you, if move view manually in any way, update constraints match new position/size/whatever. having said that: uikit dynamics, when animation ends, animator pause, , animator's delegate notified: https://developer.apple.com/library/ios/documentation/uikit/reference/uidynamicanimatordelegate_protocol/reference/reference.html#//apple_ref/occ/intfm/uidynamicanimatordelegate/dynamicanimatordidpause : so moment update constraints.

C#/VB.Net - Enumerate Path -

Image
how can path variable clear in enumeration appdata, temp , winddir? tried this: but enumeration wont allow me use non-constant expression still have folders clean , structured listed in enumeration, workarrounds problem? you aren't going able enum, class: public class myfolder { public static string windows {get {return system.environment.getenvironmentvariable("windir");}} public static string appdata {get {return system.environment.getenvironmentvariable("appdata");}} public static string temp {get {return system.environment.getenvironmentvariable("temp");}} } i made static access enum (ie myfolder.windows ).

linux - How do I redirect input typed in a terminal running 'tail -f' and 'grep'? -

i have device uses serial line interface user, accepting input , printing traces in return. however, these traces verbose , of time i'm watching them through terminal running commands tail -f serial.log | grep <myfilter> however, when need input data, have switch terminal reading (and logging) serial output comes device. is there way in same terminal? want type "grepped" terminal , have characters reach device. you can run tail command in background: { tail --pid=$! -f serial.log | grep <myfilter>; } & this tail log , print matches terminal, still able type commands in usual (to ps1 prompt back, press return). stop command, run: kill -9 $! as long have not started other background tasks! if have other background tasks run, can store value of $! after starting tail command, , use later kill it.

How to execute off-site javascript that's dynamically inserted with jquery -

i'm trying dynamically change source of embedded script, having trouble. here example of html: <div id="inner"> <script src='http://affiliate-website/1'></script> </div> when page loads this, works perfectly. but i'm trying dynamically change script's source based on user location. when visits location b, want script source change to: http://affiliate-website/2 so after browsing around, found snippet did wanted: var script = document.createelement( "script" ); script.type = "text/javascript"; script.src = "http://affiliate-website/2"; $("div#inner").append(script); that produces following html: <div id="inner"> <script src='http://affiliate-website/2'></script> </div> the problem is, script tag present, it's not executing script when put straight html. think has loading (as in when it's in html file, it's l

html5 - Sendmail PHP not working - Go Daddy Hosting -

i think straightforward, reason it's not working. see problem code? if not, i'm guessing it's hosting that's issue. here's code: html <form action="sendmail.php" name="form1" method="post"> <input name="hidsubmit" type="hidden" value="true" id="hidsubmit" /> <input type="text" placeholder="your name" name="txtname" required><br> <input type="email" placeholder="email address" name="txtemail" required><br> <input type="number" placeholder="phone number" name="txtphone"><br> <button type="submit" value="submit" class="butt"><strong>submit</strong></button> </form> php <?php //check whether submission made if(isset($_post["hidsubmit"])){ //msg body $txtmsg = "e

c# - How can i remotely access the windows services of a remote host in workgroup computers? -

i writing application used manipulate windows services. computer in workgroup. couldn't access machine. i've tried impersonation using logonuser(). not working. able manipulate using remote desktop connection, couldn't access programatically. impersonateuser impersonateduser = new impersonateuser(); impersonateduser.impersonate(domain, username, password); servicecontroller sc = new servicecontroller("servicename", host_name); console.writeline("success."); //impersonation. public class impersonateuser { [dllimport("advapi32.dll", setlasterror = true)] public static extern bool logonuser( string lpszusername, string lpszdomain, string lpszpassword, int dwlogontype, int dwlogonprovider, ref intptr phtoken); [dllimport("kernel32.dll", charset = charset.auto)] public extern static bool closehandle(intptr handle); private static intptr tokenhandle = new intptr(0);

mysql - Create a virtual column to verify if data exists on anothers -

mt_user : usr_id usr_login usr_passwd 1 user1 user1 2 user2 user2 3 user3 user3 4 user4 user4 mt_settings : sttgs_id sttgs_description 1 setting 1 2 setting 2 3 setting 3 4 setting 4 5 setting 5 mt_user_settings : uss_id usr_id sttgs_id 1 1 1 2 1 2 3 2 5 4 3 2 5 3 3 6 3 5 7 4 4 w

listview - Woocommerce list view -

i have wordpress site woocommerce installed, the problem i'm having on shop page products default shown grid (side side), there's button switch default grid mode list mode; every new client comes on site, have manually change it! i'd permanently change default view grid list every person comes on site, can't find way in code. does have knowledge on how this? there plugin can you: http://wordpress.org/plugins/woocommerce-grid-list-toggle after installing plugin go dashboard: woocommerce -> settings -> product -> scroll bottom of page , there option called default catalog view , change grid list. there option users on shop page change view list grid. hide option add following css: .gridlist-toggle { display: none !important; }

android - supress warnings: dead code and conditional compilation -

i declare constants conditionally compile/not compile chunks of code. put these constants on 1 class, use them along (big) app code. conf.java public static final int gui_actionbar_height=0; elsewhere (example): super.oncreate(savedinstancestate, conf.gui_actionbar_height==0?r.layout.activity_funq_play_noactionbar:r.layout.activity_funq_play, true); however, triggers warning " comparing identical expressions " in case shown. it's can live with, i'd know if there's supresswarning magic rid of (and yellow warning icon in sourcecode). @supresswarnings ("unused") doesnt't trick. this java compilation warning , toggling on/off depends on ide. assuming using eclipse, can navigate configurations preferences > java > compiler > errors/warning > comparing identical values ('x==x') 'ignore' should turn off.

Get String Before And After Character Then Set Them As a Variable Python -

if want 2 string separated character set them variable how go doing that? an example: john:doe i want set "john" variable fname, , "doe" variable lname. want outcome of script following: print fname john print lname doe all appreciated. thanks! split string : , unpack results: >>> s = "john:doe" >>> s.split(':') ['john', 'doe'] >>> fname, lname = s.split(':') >>> fname 'john' >>> lname 'doe'

C++ - Makefile Good Practice -

i have makefile works how i'm using it, tell me if i'm doing practice? or if there better, cleaner or more efficient way achieve goal reaching? here makefile code. # object files either reference or create objects = proj2.o blackjack.o deck.o card.o hand.o player.o # executable file created exec = proj2.out # c++ flags use compilation cxxflags = -wall # c++ compiler use compilation cxx = g++ # section called on 'make' # call compile, , call clean all: compile clean # perform action on object files (may or may not exist) # makefile implicitly compile .o files needed # compile them exec file listed compile: $(objects) $(cxx) $(cxxflags) -o $(exec) $(objects) # section called after compilation completed # clean existing .o files listed in directory clean: rm -f *.o here terminal output when call make . g++ -wall -c -o proj2.o proj2.cpp g++ -wall -c -o blackjack.o blackjack.cpp g++ -wall -c -o deck.o deck.cpp g++ -wall -c -o card.o card.cpp g+

javascript - Ember.js Handlebars BoundHelper Uncaught TypeError: Object #<Object> has no method 'split' -

i'm making handlebars helper simplify translation ember app. needs able bind count option, because count change on time, , translation needs plural or singular based on count. for example: {{i18n translation.key countbinding='numbercount'}} will go language file , see translation: { key: { 'one': 'widget', 'other': 'widgets' } } and return 'widget' or 'widgets' depending on value of numbercount here code helper: ember.handlebars.registerboundhelper('i18n', function(property, options) { var params = options.hash, self = this; // support variable interpolation options object.keys(params).foreach(function(key) { params[key] = em.handlebars.get(self, params[key], options); }); // coerce number-like strings numbers if (params.count && !isnan(params.count) && typeof(params.count) == "string") { params.count = number(params.count); } // i18

android - Java generic type for objects -

in objective-c have generic type objects called "id". id someobject = somevalue; if([someobject iskindofclass:[nsstring class]]) { nsstring *string = someobject; } i want know if there's in java. id someobject = somevalue; if(someobject instanceof string) { string string = someobject; } unless i'm missing something, close answer yourself: // obtain object somewhere object someobject = obtainobjectinstance(); // if it's string... if(someobject instanceof string) { // cast , assign variable string string = (string)someobject; } as side note, object instances contain information object's class: someobject.getclass()

email - Issue with Importing gmail contact list from Oauth and php -

i trying import gmail contact list of registered users. my index.php this- <html> <head> <meta name="robots" content="noindex" /> <title>import gmail or google contacts</title> <style type="text/css"> a:link {color:chocolate;text-decoration: none;} a:hover {color:cornflowerblue;} .logo{width:100%;height:110px;border:2px solid black;background-color:#666666;} </style> </head> <body> <br/> <div align="center" > <a style="font-size:25px;font-weight:bold;" href="https://accounts.google.com/o/oauth2/auth?client_id=969153863001-sfc4igc17cgqjqoifafqmjjbr6bouha3.apps.googleusercontent.com&redirect_uri=http://localhost/import_gmail/oauth.php&scope=https://www.google.com/m8/feeds/&response_type=code">click here import gmail contacts</a> </div> </body> and oauth.php - <?php $client_i

How Remove backslash from JSON Result -DataSet -

i want remove backslash json result current result this: "{\"info\":[{\"full_eng_nmae\":\"anda norse\",\"email\":\"keer0@gm my code this public string getdetails(string orderid) { ordercontract order = new ordercontract(); dataset dataset = new dataset(); try { sqlconnection con = new sqlconnection(configurationmanager.connectionstrings["connectionstring1"].connectionstring); con.close(); con.open(); sqldataadapter da = new sqldataadapter("select full_eng_nmae,email,mobile,client_id students center_id='" + orderid + "'", con); da.fill(dataset,"info"); dataset.acceptchanges(); string json = jsonconvert.serializeobject(dataset); return json; } catch (exception ex)

multithreading - Sending an image object via a UDP socket in C++ -

good day, i have image object in c++ generated via opencv. it's mat object, , want able send object in raw byte format on udp socket. size of object 200kb. have multiple objects i going assume bad idea: mat frame, edges; ..socket opening code.. write(sockfd,&frame,sizeof(frame)); i guessing correct way it, have 1 thread write mat object buffer array, , thread deques , writes socket object object. opinions on this.

ios - Moving to any of several view controllers from any of the others -

the app developing has 5 view controllers. lets call them a, b, c, d, , e, root view controller. a have 4 buttons navigate each of other view controllers. similarly, b, c, d, , e have 4 buttons each navigate other view controllers. is idea to use presentviewcontroller: implement navigation, since there no clear hierarchy in relationship of view controllers? don't think understand presented vs presenter relationship. does dismissal of presented view controller have handled presenter? suppose presents b, , b presents c, , c presents a. of controllers released/dismissed? handling dismissal? when presented, b still in memory? the other approach thought of design , write view controller container , manage view controllers. have read not easy territory walk on. which of these makes more sense? you can use uinavigationcontroller push new controllers stack. if don't want user go (it means not keeping old view controllers in stack) can set newly allocated vi

Class variable in Concern Rails 4 -

Image
i created concern encapsulate logic upload images resources of application, let's example there's image associated each course, , same every user. module picturable extend activesupport::concern included path_image = file.join rails.root,"public","#{table_name}_imgs" after_save :save_image end def photo=(file) unless file.blank? @file = file self.extension = file.original_filename.split(".").last.downcase end end def path_image file.join path_image, "#{self.id}.#{self.extension}" end def path_img "/#{self.class.table_name}_imgs/#{self.id}.#{self.extension}" end def has_image? file.exists? path_image end private def save_image unless @file.nil? fileutils.mkdir_p path_image file.open(path_image, "wb") |f| f.write(@file.read) end @file =nil end end end i have edited code because of

python - pyparsing OneOrMore().asxml() tags are not correct -

when use asxml() output parsedresults xml tags not match have specified in setresultsname(). example: #!/usr/bin/python import sys import os pyparsing import * mystring=""" b c x y z """ parserelement.setdefaultwhitespacechars(" \t\r") sol = linestart().leavewhitespace().suppress() eol = lineend().suppress() first = sol + word(alphas)('first') second = word(alphas)('second') third = word(alphas)('third') + eol line = group(first + second + third).setresultsname('line') print oneormore(line).setresultsname('mylines').searchstring(mystring).asxml() and output <item> <mylines> <mylines> <first>a</first> <second>b</second> <third>c</third> </mylines> <line> <first>x</first> <second>y</second> <third>z</third> </line> </mylines>

python - Extract a column from a DataFrame -

just basic question block me lot. how can extract column dataframe , have dataframe output ? suppose have : >>> dfm <class 'pandas.core.frame.dataframe'> datetimeindex: 17544 entries, 2015-01-01 00:00:00 2016-12-31 23:00:00 data columns (total 23 columns): t1 17544 non-null values t2 17544 non-null values >>> df = dfm['t1'] here df not dataframe. found subterfuge copy dataframe , del columns it's time consumming. alexis you can use [[]] instead of [] : df = dfm[['t1']] for example: from pandas import dataframe df = dataframe(dict(a=range(10), b=range(10))) type(df['b']) # <class 'pandas.core.series.series'> type(df[['b']]) # <class 'pandas.core.frame.dataframe'> this works because passing list of 1 ( ['b'] ) column subset operator.

java - Swagger Spring-MVC/SwaggerUI Authentication -

i've been attempting set swagger spring-mvc , swagger ui using latest version of springmvc implementation here : swagger spring-mvc i've been able initial setup working, when navigate swaggerui page, error saying can't access api because "server returned undefined". when in firebug, says it's getting 401 unauthorized. when first navigate swaggerui url, dialog pops me enter user-name , password. know it's correct because can manually use resources same credentials. my assumption have swagger adding form of authorization controllers generates itself. tried setting basic auth, , not setting auth @ all, doesn't work either. does know solution be? in advance. as posted question, realized answer. the default url provider set 127.0.0.1:8080 , navigating localhost:8080. resolve same place, guess authentication 1 won't applied other. silly me.

windows 7 - get all solutions (2 unknowns) from fsolve in python 3.2 -

i need solutions (2 unknowns) fsolve in python 3.2. but, returns 1 event though have set full_output = true in fsolve. def integrand1(x, b, c): return (x/b)**(c-1) * exp(-x/b) def intergralfunc2(b): integral,err = quad(integrand2, 0, 100, args=(b)) return 100 - integral def solvefunction(): sol= fsolve(intergralfunc1, 5, 5, full_output=true) return sol if __name__ == '__main__': sol = solvefunction() print("sol ", sol) i need know solution b , c, but, fsolve() returns solution b. using fmin (see documentation ) instead of fsolve , changing integralfunc takes sequence containing b , c , returns abs(100 - integral) both parameters. from scipy.integrate import quad scipy.optimize import fmin def integrand(x, b, c): return (x/b)**(c-1) * exp(-x/b) def intergralfunc(bc): integral,err = quad(integrand, 0, 100, args=(bc[0], bc[1])) return abs(100 - integral) def solvefunction(): sol= fmin(intergralfunc, [5,

swing - Java JPanel Gets Too Big For The Frame/ScrollBar -

Image
i dont intend throw code @ , ask complete it. unless following makes no sense in case code may lot of help. i have jframe set has scrollbar , 12 buttons on in gridlayout(12x1). each button has panel displays different things. the last button/panel changes size when image chosen filechooser , displayed. last panel becomes big , cant scroll down see rest of it. left half last panel. have tried resize() , setpreferredsize() frame, scrollbar , jpanel dont think working :( can offer insight through personal experience or know fix problem? i not upload pictures here used tinypic. shows problem example before , after. notice how scrollbar @ maximum in both images. solved: have been able view whole panel increasing size of scrollbar panel. makes other panels increase in size. if knows how can increase scrollbar 1 panel increases nice.

assembly - How disassembler extract opcode from memory works? -

i'm trying figure out how disassembler works. specifically, how content in memory maps corresponding assembly language opcode. below content in memory, first column address: 773eed5c 50 ff 15 0c 17 3a 77 90-90 90 90 90 8b ff 55 8b p....:w.......u. 773eed6c ec 51 51 83 7d 10 00 74-38 ff 75 10 8d 45 f8 50 .qq.}..t8.u..e.p 773eed7c e8 14 d7 ff ff 85 c0 74-24 56 ff 75 fc ff 75 0c .......t$v.u..u. 773eed8c ff 75 08 e8 ab ff ff ff-83 7d 10 00 8b f0 74 0a .u.......}....t. 773eed9c 8d 45 f8 50 ff 15 9c 15-3a 77 8b c6 5e c9 c2 0c .e.p....:w..^... 773eedac 00 83 65 fc 00 eb d2 90-90 90 90 90 8b ff 55 8b ..e...........u. 773eedbc ec 57 e8 c7 d6 ff ff 8b-4d 0c 6a 34 5f 03 c7 0f .w......m.j4_... 773eedcc b7 00 40 40 03 c9 3b c8-0f 82 07 e5 00 00 56 e8 ..@@..;.......v. and corresponding disassemble result, first column memory address, second column opcode of instruction, rest columns assembly instructions: 0x773eed5c 50 push eax 0x773eed63 90 nop 0x773eed65 90 nop

php - Working with window 8, Skype app, and Wamp -

i having problem connecting wamp window 8 while skype app turned on. know how stop skype app on window 8 using port 80? to fix problem, had take following steps. click on wamp icon select apache click on httpd.conf search "listen" change listen 80 to listen 81 save document restart wamp on browser, type http://localhost:81/php_file.php make sure put colon andn 81 in order view request.

html - I have a layout I'm working on and I need help wrapping my head around where to get started -

Image
i'm working on layout , instead of inserting image, wanted try css. seems it's possible, don't know start. on 20px grid, what's best way line of up? here's image i'm talking about. thank you! you can use grid systems available. http://getbootstrap.com

cordova - How to get softKeyboard up on focus method in Android :PhoneGap? -

i having 1 html page inside having 1 textarea id="txtmessage", on dom ready method, have put $("#txtmessage").focus(); but issue when page gets load, cursor on textarea, keyboard doesn't showed up. if again tap on textarea field, keyboard appears. can please me out? yes, it's know. can work around in android writeing native java code plugin programaticaly show softkeyboard. here few hints

android - Fill up the remaining space for GridView after a ImageView in Relative Layout -

hi making view through gridview , imageview in xml imageview shows selected image , gridview shows image. i have imageview lets of 300 dp of width , 200 dp of height setting using below code. <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="match_parent" android:background="@drawable/bg"> <relativelayout android:id = "@+id/relative1" android:layout_width="fill_parent" android:layout_height="wrap_content"> <imageview android:id="@+id/imageview1" android:layout_width="300dp" android:layout_height="200dp" android:adjustviewbounds="true" android:layout_alignparentleft="true" android:src="@drawable/ic_launcher" /> </relativelayout> <gridview android:id="@+

winapi - C++, MFC, tabbed document interface application, Win32 -

is mfc way or easiest way craete tabbed document interface application in c++? there way using plain win32 project create tabbed document interface application? mfc not deprecated. yes, easier use mfc create tabbed document interface. please choose mfc or similar framework instead of directly dealing ui in win32 unless have strong reason.

regex - Remove everything else from the String using regular expression -

i have regular expression allowed in string. ^\pl*['#-]?\pl*\$ the requirements have changed , need drop else string. example 1 of these special characters ', #, , - allowed. how can change regex drop else not fit ? here list of expected values: johno'connell -> allowed. should is. johndias -> allowed. should is. johnoconnell' -> allowed. should is. johnoconnell# -> allowed. should is. johnoconnell- -> allowed. should is. johnoconnell-# -> should return johnoconnell- johnoconn34ell -> should return johnoconnell *johnoconnell -> should return johnoconnell johnoconnell* -> should return johnoconnell johnoconn$%ell -> should return johnoconnell thanks if understand correctly, way: // test data def tests = [ [ input:"johno'connell", output:"johno'connell" ], [ input:"johndias", output:"johndias" ], [ input:"johnoc

Saving chrome timeline data via javascript api -

starting , stopping dev tools timeline easy: console.timeline("timeline1"); console.timelineend(); i looking way extract data timeline , post server. or trigger browsers 'save timeline data'. want collect timeline data peoples machines while test web application. is possible? thanks.

r - remove all words that start with "@" from a string -

how can remove words start "@" string? for example, "@agnezmo on @airasia airbus a320-216 fleet @ninetologymy livery -- 9m-ahg cc: @agnesmonicaent @agnezone http://t.co/hfxwuqq2oq " i have string "on airbus a320-216 fleet livery -- 9m-ahg cc: http://t.co/hfxwuqq2oq " try s input: gsub("@\\w+ *", "", s) giving: "on airbus a320-216 fleet livery -- 9m-ahg cc: http://t.co/hfxwuqq2oq"

php - Load hierarchical data from database into array -

i have table in database following structure/data: n_id n_parent_id ... other fields ... ==== =========== ========================= 1 null ... 2 null ... ... 11 1 ... 12 1 ... ... 25 2 ... ... 65 11 ... 66 11 ... ... this table stores hierarchical data, can seen sample above. need load php array in tree-like fasion, array contain this: array ( [1] => array ( [n_id] => 1 [n_parent_id] => [other_data] => ... [children] => array ( [11] => array ( [n_id] => 11 [n_parent_id] => 1 [other_data] => ... [children] => array (

symfony - Doctrine uploadable: Multiple file upload on the same entity -

i'm using excellent doctrine extension uploadable. can upload 1 file per entity fine, how can upload 2 different files on same entity? * @gedmo\uploadable(path="uploads/articles", appendnumber=true, filenamegenerator="sha1") class article { * @orm\column(name="photo", type="string", length=255) * @gedmo\uploadablefilepath private $photo * @orm\column(name="pdf", type="string", length=255) * @gedmo\uploadablefilepath private $pdf on controller have: $uploadablemanager->markentitytoupload($article, $article->getphoto()); $uploadablemanager->markentitytoupload($article, $article->getpdf()); only last file uploaded , saved database. how can this? you confused something. you have article entity 2 fields: photo , pdf, there no $materia entity. should change $materia $article. won't work because @uploadable cannot upload multiple files same entity. hint: use vichup

java doctor appointment reservation database (mysql) program..having trouble designing the appointments schema -

Image
i need build program in java uses mysql store doctors' appointments. have rough idea need table keep track of doctor's id, patient's id, , appointment date , time in same table. missing other attributes? assume need compareto method in java implementation check available times. hope have made clear want accomplish. currently, have doctor table , patient table, both having own id primary key. using hibernate map object oriented design relations in mysql if matters. date-time 1 value date-time values tracked in software single values. technically represented internally count of seconds/milliseconds/microseconds/nanoseconds since epoch . you may want present date , time separately in user interface, not internally. also, should thinking time zones. naïve programmers think can ignore time zones, cause anguish later. understand database’s handling of date-time different databases handle date-time differently. absolutely crucial read docs, play around, expe

c# - ApplicationException not being thrown to catch block properly -

i having issue override onvalidate method of linq sql class. have written business rules , well, when go catch exception in call repository, application treating exception unhandled. in linq sql partial class have following: partial void onvalidate(changeaction action) { if (!isvalid) //application halting here before catch block code reached throw new applicationexception("invalid note data recieved! correct following issues , try again:"); //updatetimestamp(); } the isvalid set of checks on linq sql class properties. in form have button click event calls submitchanges method on repository class. have wrapped in try/catch block exception not bubble catch instead errors @ throw new applicationexception() block in partial class. here code around button: ( repository injected implementation of irepository ). private void submitbutton_click(object sender, eventargs e) { try {

indexing - Lucene 4.7 long text index -

i'm trying index long texts lucene 4.7, thought fine realise search hits not complete. after long search found web page said "when try index long text in lucene, lucene index first n characters prevent stackoverflows." i want index full texts , don't know how ¿some hel please?. here code: file indexdir = new file(indexpath); directory directory = fsdirectory.open(indexdir); indexwriterconfig config = new indexwriterconfig(version.lucene_47, analyzer); config.setopenmode(indexwriterconfig.openmode.create); writer = new indexwriter(directory, config); document doc = new document(); doc.add(new doublefield("textid", textid, field.store.yes)); doc.add(new textfield("text", text, field.store.no)); doc.add(new textfield("title", title, field.store.no)); doc.add(new stringfield("discourse", discourse, stringfield.store.yes)); writer.adddocument(doc);

c++ - openmp bug with radial computation -

#pragma omp parallel schedule(static) default(none) for(int row = 0; row < m_height; row++) { for(int col = 0; col < m_width; col++) { int rysqr, rxsqr; settingsigman(eta, m_rxinitial + col, m_ryinitial + row , rxsqr, rysqr); functionusing(rysqr,rxsqr); } } void cimagepro::settingsigman(int eta, int x, int y, int &rxsqr, int &rysqr, int &returnvalue) { int rsqr = getradius(x,y,rxsqr,rysqr); returnvalue = getnumberfromtable(rsqr); } int cimagepro::getradius(int x, int y, int &rxsqr, int &rysqr) { if (x == m_rxinitial) { rxsqr = m_rxsqrinitial; if (y == m_ryinitial) { rysqr = m_rysqrinitial; } else if ( abs(y) % 2 == abs(m_ryinitial) % 2) { rysqr = rysqr + (y<<2) + 4; //(y+2)^2 } } else { rxsqr = rxsqr + ( x << 1) + 1; //(x+1)^2 } return clamp(((rxsqr+rysqr)>>rad

android - LOG CAT Error on Google Maps API using basic tutorial -

i submitted similar question earlier on more advanced project, thought simplify things using maps api tutorial provided google try , replicate error getting, , same error! , bad, @ least know it's not project causing error. now need figure out why getting error! new programming followed tutorial here verbatum: https://developers.google.com/maps/documentation/android/start here error getting: 03-24 20:47:03.244: e/androidruntime(6250): fatal exception: main 03-24 20:47:03.244: e/androidruntime(6250): java.lang.runtimeexception: unable start activity componentinfo{com.example.test/com.example.test.mainactivity}: android.view.inflateexception: binary xml file line #2: error inflating class fragment 03-24 20:47:03.244: e/androidruntime(6250): @ android.app.activitythread.performlaunchactivity(activitythread.java:2211) 03-24 20:47:03.244: e/androidruntime(6250): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2261) 03-24 20:47:03.244: e/androi

ireport - How to display the report without applying the input values in the jasperserver for the first time -

Image
i have published report ireport jasperserver cascading parameteres. i have set default values cascading parameters. while running report in jasperserver asking "you must apply input values before report can displayed." is possible display report first time passed default parameter values without applying anything. then if need change value , click apply button, value come respectively. please suggest. in advance. go jasperreport server (like http://localhost/jasperserver/ ) edit report ( manage server -> repository -> select report -> click edit button) open controls & resources tab uncheck always prompt option, , give default values in ireport parameters.

java - How to update/change webapp without stopping/restarting JAX-RS -

i have developed restful web service, having webapp in it, using dropwizard. facing problem while running service have stop web service first, if want bring changes in webapp (say html file). using eclipse ide (though running service through cli makes no difference). please guide me how can bring changes in webapp without stopping web service , avoid cumbersome activity.

Enforcing type of function arguments in C++ -

i try achieve function gets passed parameters simple (e.g. std::string) cannot permuted. imagine 2 functions like void showfullname(std::string firstname, std::string lastname) { cout << "hello " << firstname << " " << lastname << endl; } void someotherfunction() { std::string a("john"); std::string b("doe"); showfullname(a, b); // (1) ok showfullname(b, a); // (2) trying prevent } as can see 1 can mix order of function parameters - try prevent. my first thought kind of typedef, e.g. typedef std::string firstname; typedef std::string lastname; void showfullname(firstname firstname, lastname lastname) //... but (at gnu's) c++ compiler not behave want ;) does have solutions this? a compiler can't read mind , know string holds name , string holds surname (they don't speak english, afterall). 2 std::string objects interchangeable far compiler concerned (and t

python 3.x - check if a string only contains certain letters -

in python how create function checks see if user enter string contains letter , b? string can long user wants should contains combination of letters , b. thanks. alternatively using regular expressions, use generator expression checking whether all characters in string "ab" . >>> all(c in "ab" c in "foobar") false >>> all(c in "ab" c in "aaabaababbba") true

java - deactivate mnemonic for JButton -

i need deactivate mnemonic jbutton. using 3rd party api, set mnemonic "alt c". want remove mnemonic , wants set nothing (i.e wants remove mnemonic) compbutton. // alt + 'c' selects comp. compbutton.setmnemonic(keyevent.vk_c); how using compbutton.setmnemonic(0); edit: i saw javax/swing/abstractbutton.java : /** * returns key bindings associated object * * @return key bindings, if supported, of object; * otherwise, null * @see accessiblekeybinding * @since 1.4 */ public accessiblekeybinding getaccessiblekeybinding() { int mnemonic = abstractbutton.this.getmnemonic(); if (mnemonic == 0) { return null; } return new buttonkeybinding(mnemonic); } therefore, compbutton.setmnemonic(0); looks better compbutton.setmnemonic(-1); .