Posts

Showing posts from May, 2010

objective c - Are Cocoa input events thread safe with NSTimer -

are input events in cocoa (void)mousedown:(nsevent *)theevent , (void)keydown:(nsevent *)theevent thread safe , synced nstimer events firing? can have nstimer event accessing same memory touch input event would? thread safe? nstimer events fire on thread scheduled timer. if scheduled timer on main run loop, timer fire on main thread , “safe , synced” input events. it possible, unusual, create timer in 1 thread , schedule fire on different thread. if you're not sure thread scheduled timer on, show code creates , schedules timer, , tell thread code runs on.

ruby on rails - Filter in list page associated with other model -

using rails 4 , ruby 2.2, have subject list page need add filter subject's name, username, active , books associated subject. 3 model i.e subject, book , user are associated below: user.rb class user < activerecord::base has_many :subjects, dependent: :destroy has_many :books, dependent: :destroy end book.rb class book < activerecord::base belongs_to :subject, dependent: :destroy belongs_to :user, dependent: :destroy has_many :images, dependent: :destroy end subject.rb class subject < activerecord::base belongs_to :user has_many :books validates :name, presence: true, length: { minimum: 3 } def self.names(name) subject = subject = subject.where("name ?", "%#{name}%") return subject end def self.actives(active) subject = subject = subject.where("active = ?", "%#{active}%") return subject end def self.usernames(username)

ruby on rails - Querying model by attribute of HABTM association -

i have habtm association between 2 models, user , conversation. want able query logged-in user's conversations ( current_user.conversations ), passing user's id, , have return conversation shared both users, if 1 exists. (an additional perk have query create 1 if 1 doesn't exist.) the associations working fine, can access associated objects through instance variables @user.conversations , @conversation.users , go long way , loop through each conversation object , search user associations in each of them... there must efficient way construct query. able current_user.conversations.where(conversation.users.exists?(id: @user_id)) or conversation.find(users: {id: @user_id , current_user.id}) . i imagine there obvious answer this, , i've been searching around here similar questions haven't found any. after looking through rails api docs, imagine solution i'm looking involves .includes() in way, can't working. any advice? thanks. suppose ha

Ruby - Saving a Model shows a Get url in browser -

ruby 2.2.4 rails 4.2.6 postgresql 9.5 i trying save simple model, when submit form, browser url shows " http://localhost:8080/notes/new?utf8=%e2%9c%93&authenticity_token=z0cyvnfukywdsdasdwffz96zj29uttdye8dllkri6mbznb2srtwnm%2bq91d2s2aasd2345fl3ftonecc2dng%3d%3d&note%5btitulo%5d=ddddddd&note%5bconteudo%5d=dddddddddddddddddd&commit=create " i curious because other project, has same methods, same routes, difference model have 1 column, works fine. def change create_table :notes |t| t.text :titulo t.text :conteudo t.timestamps null: false end my controller: notes_controller.rb def new @note = note.new end def create @note = note.new(note_params) if @note.save redirect_to '/' else render 'new' end end private def note_params params.require(:note).permit(:titulo,:conteudo) end my form <%= form_for(@note) |f| %> <div class="f

ios - Xcode failed with exit code 71 -

i tried build qt ios project got this issue . try build project in xcode error: error: can't exec '/applications/xcode' (no such file or directory) command /applications/xcode failed exit code 71 how can resolve it? sudo xcode-select -switch /applications/xcode.app/ , recreating project helped.

jquery - Highcharts - Area fillOpacity is mixing on multiple area charts -

Image
i using highcharts (area chart)... i trying use line color #f68936 , area background color 10% of opacity color. working expected when use 1 chart. getting issue in opacity background of front chart while combining more areas. green background opacity mixing red color , showing different color :( how can show original colors ( background opacity ) though has multiple areas. online demo expected result: what getting below: $(function () { // in common between charts var commonoptions = { colors: ['#f68936', '#70ba47', '#33b5e6', '#fd8f40', '#e7ca60', '#40abaf', '#f6f7f8', '#e9e9eb'], chart: { style: { fontfamily: 'roboto light', fontweight: 'normal', fontsize: '12px', color: '#585858', } }, title: { text: null }, subtitle: { text: null }, credits

Adding values to an array from an included functions file in PHP -

i new programming php , need i'm sure simple question. trying add values array called errors in form page way can echo out later verification, although cant seem add array included functions file. i require functions <?php require_once("functions.php") ?> then create array <?php $errors = array(); ?> then call function includes <?php minlength($test, 20); ?> function here function minlength($input, $min) { if (strlen($input) <= $min) { return $errors[] = "is real name? no not."; } else { return $errors[] = ""; } } then echo them out @ , @ end <?php if (isset($errors)) { foreach($errors $error) { echo "<li>{$error}</li><br />"; } } else { echo "<p>no errors found </p>"; } ?> but nothing echos in end, thank in advance help functions walled gardens - can

javascript - Rails: Trying to render a partial on button click -

i trying render partial on button click nothing happens. view: <div class ="container"> <span class ="center"><h1> title</h1> <%= link_to "correct answer", correct_answer_courses_path, :remote => true %> <%= link_to "false answer", false_answer_courses_path, :remote => true %> <div id = "result"> <!-- div used render result --> </div> </span> </div> <%= render 'layouts/coursefooter' %> my controller (courses_controller) def correct_answer respond_to |format| format.js end end def false_answer respond_to |format| format.js end end correct_answer.js.erb (in courses folder) $("#result").prepend('<%= escape_javascript(render :partial => "correct") %>'); my partial called _correct , located in courses fo

javascript - Change the link text -

hi guys want <a href="template.html">redirect</a> change text of link suppose click on link change link text confirm redirect & not redirect in template.html @ first time & wait second click & in second time when click on again redirect in template.html . you can use one() fire event handler once // bind click event handler fire once $('#btn').one('click', function(e) { // prevent default click event action e.preventdefault(); // change tag text $(this).text('confirm redirect') }) <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <a id="btn" href="template.html">redirect</a>

arrays - Placing a Sprite on an Isometric map and detect if a sprite/object is already present - Swift 2 -

i building tower defense game isometric map. able build map , place walls on map 2d array such: let walldata = [[1,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,2,0], [0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,3,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0], [1,0,0,0,0,0,0,0,0,0,0,0]] where 1-3 different walls , 0 grass. should able put towers on grass (i.e. 0) not on walls. in touchesmoved tower move selection menu , placed on grid touchesended. works fine. in touchesended using loop loop through nodes in 2d array. x in 0..<walldata.count { y in 0..<walldata[x].count { if walldata[x][y] != 0 { let coordinate = tilemap?.position(tilemap.pointforposition(tilemapposition)

xml - Section name with multiple words in TNativeXML -

i'm trying make xml file using nativexml v4.09 , used structure : <?xml version="1.0" encoding="utf-8"?> <root> <word1 word2>this value</word1 word2> </root> i write simple code : procedure tform1.buttonwriteclick(sender: tobject); var aaa: tnativexml; vsectionname : string; begin vsectionname := 'word1 word2';//name of section 2 words sparated space aaa:= tnativexml.create(self); aaa.createname('root'); aaa.root.nodenew(vsectionname); aaa.root.nodebyname('word1 word2').value:='this value'; aaa.xmlformat := xfreadable; aaa.savetofile('test.xml'); end; and read node of section write code : procedure tform1.buttonreadclick(sender: tobject); var aaa : tnativexml; vsectionname : string; vnode : txmlnode; begin vsectionname := 'word1 word2';//name of section 2 words sparated space try aaa := tnativexml.create(self);

rank - Ranking sum in mysql -

i have mysql query, trying sum column, , rank total. here query: select @rownum:=@rownum+1 rank, sum(length) total, user_id submissions, (select @rownum:=0) id = 1067 , status = 1 group user_id order total desc this results in: rank total user_id 2 65.25 1360 1 59.50 1151 4 58.00 1250 6 55.75 1374 5 51.25 1154 3 34.75 841 i think have use inner query grab totals first rank them outter select this: select @rownum:=@rownum+1 rank, total, user_id (select sum(length) total, user_id submissions id = 1067 , status = 1 group user_id order total desc)t,(select @rownum:=0)a

Methods of Fragment class in android not getting called -

hi beginner android , in app have show slidingpanelayout @ right side ok ok but when tapped on slidingpanelayout 1 of row want o reload listview wrote below code but here listview reloading default ,but when tapped on slidingpanelayout it's not reloading below lines not executing when calling getalltips() method mainactivity if (friendarraylist.size() != 0) {
 log.d("=======>" ," data available");
 ˚ adapter.notifydatasetchanged();
 }else{
 log.d("=======>" ,"no data available");
 } listviewfragment:- public class listviewfragment extends fragment implements asynctaskclass.backgroundservicecall { private arraylist<mytripbean> friendarraylist; listviewadapter adapter; @nullable @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view view =inflater.inflate(r.l

Android: why does Checkbox not show empty checkbox for unchecked state? -

Image
i have checkbox code in cardview layout file. cardview has white background. normally, think unchecked checkbox black square. layout shows no blank checkbox. see white cardview background (top cardview in screenshot). when click on right-most area of cardview checkbox code formatted, green checkbox appears (bottom cardview in screenshot). missing here? . layout file: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@color/background4main" > <android.support.v7.widget.cardview xmlns:card_view="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/singlecard_view1" android:layout_width="match_parent" android:layout_height="wrap_content"

html - Alignment issue with the content inside the two inline div? -

Image
i have 2 div , inside div multiple div there , facing the alignment issue whatever content inside div not proper align. css code: .breadcrumb-nav{ margin-left: 230px; left: 70px; top: 70px; width: 1291px; height: 66px; opacity: 100%; background: #efefef; } .grid{ margin-left: 230px; } /*left section styling */ .left-content{ top :104px; left: 151px; opacity: 100%; height: 20px; width: 194px; } .shown-device{ line-height: 20px; width :147px; font-size: 16px; color :#101010; margin-top: 15px; margin-left: 40px; } .filter-by{ left: 80px; top: 177px; width: 194px; height: 28px; background: #d8d8d8; margin-top: 6px; } .filter-by-heading-left{ left: 86px; top: 182px; height: 17px; padding:5px 134px 6px 6px; font-weight: bold; font-size: 13px; line-height: 17px; } .filter-by-heading-right{ left: 225px; top: 182px; height: 17px; paddin

php - multiple session files are created on each request in laravel 5.2.* -

currently i'm working laravel 5.2.29. on each request new session file generated , old file not deleted. config/session.php file <?php return [ 'driver' => env('session_driver', 'file'), 'lifetime' => 120, 'expire_on_close' => false, 'encrypt' => false, 'files' => storage_path('framework/sessions'), 'connection' => null, 'table' => 'sessions', 'lottery' => [2, 100], 'cookie' => 'laravel_session', 'path' => '/', 'domain' => null, 'secure' => false, 'http_only' => true, ]; i put routes inside middleware group 'web' route::group(['middleware' => ['web']], function () { //login route::post('login', 'user\logincontroller@login'); }); why happens? how solve problem? i have tried

ios - Using Multipeer Connectivity Framework and saving the nearby devices founded -

i new swift , developing multipeer connectivity app course project. app has online log-in feature stores each user information in firebase(the backend support). once app gets wifi connection, want have 'friends list' feature in app , add other app users list nearby devices found. far, way think of associate peerid existing app user firebase. however, according documentation, peerid seems associated device if 2 different users used same device sign in, approach can't work. there better way achieve goal? in opinion, depends on want go application how develop regarding business. 1 of possibility 1 user point of time registered 1 device. can provide simple login screen users enter name map device id , save firebase. username considered user id well. if try sign in device, check whether or not existed in system. if existed, ask them wish register device or not, update map (user id , device id) firebase. from friend list, still list of username of friends,in can

java - How do i refresh a div without reload the page -

this question has answer here: how use servlets , ajax? 7 answers i have have 1 searchbox , submit button, want refresh div after getting value of searchbox <form action="/searchemp" method="post"> employee <input type="text" name="employeename" id="text1"/> <input type ="submit" value="check"/> </form> <div> <table border="1"> <thead> <h3 align="center">selected rule</h2> <tr> <th data-field="id" width="30">id</th> <th data-field="details" width="20">rulename</th> <th data-field=&qu

python - How to pass a value in django select form? -

i creating invoice application. have model receivables as class receivables(models.model): user=models.foreignkey(settings.auth_user_model) receivable_name=models.charfield(max_length=250) receivable_address=models.charfield(max_length=250,blank=true) receivable_email=models.charfield(max_length=250,blank=true) receivable_telephone=models.charfield(max_length=250,blank=true) receivable_vat=models.charfield(max_length=250,blank=true) receivable_service_tax=models.charfield(max_length=250,blank=true) receivable_pan=models.charfield(max_length=250,blank=true) def __str__(self): return self.user.receivable_name have model serviceinvoice as class serviceinvoice(models.model): user=models.foreignkey(user,related_name='invoice') invoice_number=models.positiveintegerfield() invoice_date = models.datefield(auto_now_add=true) invoice_receivable=models.foreignkey(receivables) total_amount=models.decimalfield(d

javascript - Reactjs onclick not working -

i have: import react 'react'; import filterbutton './filterbutton'; import filterjobsscreen '../../actions/jobs-screen/filterjobsscreen'; export default class rightpanel extends react.component { constructor() { super(); this.state = { counts: {}, filters: {} } } componentdidmount() { this.load(); } componentwillreceiveprops(newprops) { if (newprops.counts) { this.setstate({ counts: newprops.counts }); } } load() { this.setstate({ counts: { my_jobs: 1, not_approved: 5 } }); } onclick (e) { alert(e) var filters_array = this.states.filters; filters_array.push(e); this.setstate({ filters: filters_array }) this.context.executeaction(filterjobsscreen, this); } render() {

python - How to retrieve value of n-th element in pandas Series object? -

i have series object (1 column of dataframe ) , extract value of first element. there way without converting list , without knowing key? or way access converting list first using tolist()[n] ? i think can use iloc : print df col 0 1 b 2 c 3 d 4 e print df.iloc[0] col name: 0, dtype: object

teradata - Inserting records from TPT error tables to a relational table from ET1 and ET2 -

i have workflow goes through loop , load split files td table. direct rows temporary tables created tpt i.e, et1 , et2 table. here detailed scenario: i have list of file names in file (abc.txt). these file names initialized in loop , triggers workflow(indirect load) each file. i using shell script trigger workflow. however, keep track of error records going et1 , et2 tables table. these records needs append each file load corresponding file name. please suggest how achieve this. thanks in advance the proper way of handling such scenario have additional flag in text file file names. flag can updated completed or processed after each successful run of workflow. to file name inside mapping have text file lookup inside mapping.

java - Apache Camel, routes added don't throw OnException -

i writing camel , spring world! i adding routes programmatically using recipe . basically camel context , add routes using file. this issue: routes added @ runtime don't trigger onexception , set on context file read spring. to recap: i have spring context file looks like: <camel:camelcontext> <onexception id="exceptions"> <handled> <constant>true</constant> </handled> <process ref="logexceptionprocessor"/> <to uri="activemq:adapterlog"/> <process ref="mailsender"/> </onexception> ... after i've added route getting camel context, added route doesn't throw onexception set. do have advice on behavior? there 2 different scopes error handlers can use. first route level error handler manage error handling route , second global error handling in context. if want few more details go "scopes&qu

objective c - NSSegmentedControl highlighting with blue tint and single-selection -

Image
is there documented way nssegmentedcontrol use trackingmode nssegmentswitchtrackingselectone (i.e. exclusively select 1 segment in control) , have rendered using blue tint highlighting mode - 1 automatically when using nssegmentswitchtrackingselectany ? what i’m looking style similar 1 seen in xcode’s toolbar or navigator sub tool bar/switcher: attempts far using either different styles or poking around headers didn’t turn - segmented control rendered dark grey highlighting (similar 1 observed in finder windows). any hints on how activate blue highlighting mode appreciated. i had same problem. not sure if right way do, create 2 versions of each image. 1 selected , normal state. can switch images once control clicked.

java - Overriding value in resource with SharedPreference -

i'm trying figure out if there easy way achieve i"m doing. have predefined values cities in strings.xml. user option change i"m storing internally sharedpreferences (in essence overriding resource values). firstly assume 1 of correct ways this. i'd keep implementation simple understand how , let's assume acceptable approach (if not, please provide suggestion on doing - not i'm looking at). my problem use iterator, list etc. , hence i'm using convoluted code sort this. code follows: // our predefined cities our resources file string [] predefinedcities = res.getstringarray(r.array.predefined_cities); arraylist<string> predefinedcitiesminusoverridden = new arraylist<string >(); // add values our custom cities onto adapter via sharedpreferences prefs = getsharedpreferences(my_prefs_name, context.mode_private); iterator<string> usercities = readcitiesfrompref(); // start of sort operation - show thes

r - returning matched value while using grep -

i using grep function identify if list of string(or col of string) partially present in particular col(query) or not. test$result <- sapply(test$query,function(x) ifelse(grep(paste(listofstring,collapse="|"),x),1,0)) is there way matched string instead of binary output? for example: listofstring <- c("mac","windows","linux","android") test <- data.frame(query = c("i love mac","i love ubuntu","i love android","i love both android , linux")) using above code able output : query result love mac 1 love ubuntu logical(0) love android 1 love both android , linux 1 but want matched value , desired output : query result love mac mac love ubuntu n/a love android android lov

python - Is there any method to using seperate scrapy pipeline for each spider? -

i wanna fetch web pages under different domain, means have use different spider under command "scrapy crawl myspider". however, have use different pipeline logic put data database since content of web pages different. every spider, have go through of pipelines defined in settings.py. there have other elegant method using seperate pipelines each spider? item_pipelines setting defined globally spiders in project during engine start. cannot changed per spider on fly. here options consider: change code of pipelines. skip/continue processing items returned spiders in process_item method of pipeline, e.g.: def process_item(self, item, spider): if spider.name not in ['spider1', 'spider2']: return item # process item change way start crawling. from script , based on spider name passed parameter, override item_pipelines setting before calling crawler.configure() . see also: scrapy. how change spider settings after sta

c# - Concat list null check -

i have 5 variables in have individual data, after concatenating respective charge volumes 1 variable. works fine. now issue suppose have 1 data ( var ccpcv has data) , rest not have data, var combinedpcv line breaks because charge volume null other variables. there can n number of scenarios (2 have data, 3 have data etc). one approach check each individual variable null value , null check on combination of variables. please suggest better approach. var ccpcv = (guidedpcvyear1ccviewmodel)wizard.steps[est bettgwizard.orderedsteps[typeof(guidedpcvyear1ccviewmodel)]]; var cpcpcv = (guidedpcvyear1cpcviewmodel)wizard.steps[wizard.orderedsteps[typeof(guidedpcvyear1cpcviewmodel)]]; var vpaypcv = (guidedpcvyear1vpaviewmodel)wizard.steps[wizard.orderedsteps[typeof(guidedpcvyear1vpaviewmodel)]]; var bippcv = (guidedpcvyear1bipviewmodel)wizard.steps[wizard.orderedsteps[typeof(guidedpcvyear1bipviewmodel)]]; var gnicsccpcv = (guidedpcvyear1ccgnicsviewmodel)wizard.steps[wizard.orderedst

Optimizing loop by using floating point value as loop counter -

i need execute loop while (x) y for n times, large number. while y, loop body, rather quick, test x takes 70% of runtime. i can calculate number of loop iterations n beforehand instead of using x condition, simple for-loop possible. for (i=1 n) y however, n might exceed maximum value integer can store on machine, not option. alternative, proposed use floating point variable f instead. n large, f cannot equal n. thus, calculate f largest floating point number smaller n. allows me run for (i=1 f) y while (x) y most of iterations not need test x everytime, last n-f do. the question is: how implement for-loop 1 f? increasing counter or decreasing f 1 in each step not work, numerical error grow large. current solution is: for (while f > maxint) (i=1 maxint) y f -= maxint while (x) y is there better way solve problem? what mean numerical error? floating point counting exact within precision. here maximum values representable integers using

java - Connect JIRA and retrieve Information -

i have task retrieve information jira account through java. downloaded jira api working java, have no idea how make work. have pass somewhere username , password log in , after retrieve information want project want. jirarestclientfactory factory = new asynchronousjirarestclientfactory(); uri uri = new uri(jira_url); jirarestclient client = factory.createwithbasichttpauthentication(uri, jira_admin_username, jira_admin_password); // invoke jrjc client promise<user> promise = client.getuserclient().getuser("admin"); // here getting error!! user user = promise.claim(); /////////////////////////////////////// // print result system.out.println(string.format("your admin user's email address is: %s\r\n", user.getemailaddress())); // done system.out.println("example complete. exiting."); system.exit(0); that above code not working, because either if pass wrong password , wrong username showing me same result. have know how connect jira , r

Android application crashs when i drop item into gridview -

i try drag , drop item between grid view, item correctly dragged when in action application crashs. code case dragevent.action_drop: passobject passobj = (passobject)event.getlocalstate(); view view = passobj.view; artifact passeditem = passobj.artifact; list<artifact> srclist = passobj.srclist; abslistview oldparent = (abslistview)view.getparent(); artifactadapter srcadapter = (artifactadapter) oldparent.getadapter(); linearlayoutabslistview newparent = (linearlayoutabslistview)v; artifactadapter destadapter = (artifactadapter)(newparent.abslistview.getadapter()); list<artifact> destlist = destadapter.getlist(); if(removeitemtolist(srclist, passeditem)){ additemtolist(destlist, passeditem); } srcadapter

android - Can FireBase offline mode can be used for localstorage only? -

consider blogging application allows offline mode in free version. , once user subscribes paid version - data being synced firebase. the question - since firebase has offline capabilities - can work (like parse) queries explicitly use local storage when querying data? (save/read). paid sync can feature flag because can tell skimming docs, offline capability seems "store offline until i'm online" scenarios thanks the firebase database online database, continues work while user offline. while user disconnected, firebase queues local writes operation in memory (and if call setpersistenceenabled(true) disk). way works means local-only performance worse local write queue grows. so unless have reasonable maximum local number of write operations, scenario may not work on firebase's offline architecture.

java - How to run code when app is closed (force kill only) -

in application want client send message server when application closed, not when sent background. onpause() not solution me, because means when activity goes background code execute. i have tried ondestroy seems nothing @ all. the relevant code: public class chatactivity extends activity implements imessagelistener{ @override public void ondestroy() { data.getmsger().sendmsglogout(); super.ondestroy(); } the code 'data.getmsger().sendmsglogout();' tries send message via socket, fails on ondestroy() event. thank you.

c# - ASP.Net MVC 4 Display Single Row of Data using button -

i working on asp.net mvc 4 application , trying display single row of data data base instead of rows. the website designing has list of buttons , when each button clicked data corresponding row in database displayed e.g. button1 - row1, button2 - row2 etc... currently displayed on http://myexample/movies/onemovie displayed on http://myexample/movies/ the code have in controller this: public actionresult onemovie(int id = 0) { movie movie = db.movies.single(m => m.id == id); if (movie == null) { return httpnotfound(); } return view(movie); } the button code is: <input id="button1" type="button" value="button" name="id"/> <input id="button2" type="button" value="button" name="id"/> can me display data corresponding row when button clicked? ok when generate buttons loop collection id's of movies, here button need : <input type=&q

c# - Targets variable as public not defined in CameraControl.cs -

Image
i need (which done in red) ,but there no targets variable following unity tanks tutorial controlling camera movement. near end of tutorial asks drop tank gameobject onto public variable 'targets' of camera control script, on dropdown menu of camera control script in unity there no 'targets'. can see tutorial video should be, it's not there on computer. tried make public gameobject targets; , dropped tank on didn't work. please tell me should ? did copy , paste finished code? because right after says drop tank, going add hideininspector attribute, which, name suggest, hides field in inspector. i didnt watch full video, read transcript, should if remove [hideininspector] target field. the line in question [hideininspector] public transform[] m_targets; // targets camera needs encompass.

java - Minimal way to make a cleanable drawing area -

i got class resizable background. there paintings on background(using paint method , java2d). how can delete drawn every time background gets resize? (to draw again in correct places) there sort of transform can on already-drawn objects(like scaling fit image again)? import java.awt.graphics; import java.awt.graphics2d; import java.awt.renderinghints; import java.awt.geom.affinetransform; import java.awt.image.bufferedimage; import java.io.file; import java.io.ioexception; import javax.imageio.imageio; import javax.swing.imageicon; import javax.swing.jlabel; import javax.swing.jpanel; import javax.swing.jslider; import javax.swing.event.changeevent; import javax.swing.event.changelistener; public class background extends jlabel implements changelistener { private imageicon background; private bufferedimage image; public background(jpanel parent){ super(); parent.add(this); try { image = imageio.read(new file("/example/backgr

excel vba - User can unprotect vba protected sheets without providing the password -

i've placed worksheets protection lines follows: private sub workbook_open() worksheets("sheet1").protect password, userinterfaceonly:=true worksheets("sheet1").protect allowfiltering:=true worksheets("sheet2").protect password, userinterfaceonly:=true worksheets("sheet2").protect allowfiltering:=true worksheets("sheet3").protect password, userinterfaceonly:=true worksheets("sheet3").protect allowfiltering:=true worksheets("sheet4").protect password, userinterfaceonly:=true worksheets("sheet4").protect allowfiltering:=true end sub however, whenever click unprotect worksheet main menu, excel doesn't ask password , unprotects sheet. doing wrong here? thanks all! worksheets("sheet1").protect password, userinterfaceonly:=true, allowfiltering:=true do each line , should work well, assuming did put password sting variable password

In JPA how can i bind Y N to Boolean type -

is possible bind boolean variable varchar(1) y/n in mysql using jpa annotations ? i using below mapping @basic @column(name = "is_active", columndefinition = "varchar", length = 1) private boolean active; which throwing exception java.lang.illegalargumentexception: parameter value [a] did not match expected type [java.lang.boolean (n/a)] so figured out reason error, because passing 'y' parameter named query. params.put("isactive", "y"); but when changed params.put("isactive", boolean.true); the query not returning result seems it's passing 'true' parameter query. can tell me how correctly map ? <dependency> <groupid>org.jboss.spec</groupid> <artifactid>jboss-javaee-all-6.0</artifactid> <version>3.0.0.final</version> <scope>provided</scope> </dependency> safest way define attributeconver

How to change command-palette scroll key bindings in atom -

Image
i'm new atom user , want override atom command palette (shift-ctrl-p) scrolling key bindings more vi friendly ctrl-n , ctrl-p instead of annoying arrow keys (which force me take hands off home row). just clear, don't want change key binding brings command palette, key bindings use scroll through list once it's up: i can find binding override command palette toggle: as can see in following config file, was able override autocomplete scrolling, , hope same command palette. i've tried 'command-palette:up' , 'command-palette:down' , 'command-palette:move-up' etc. no avail. here's keymap.cson. # atom flight manual: # https://atom.io/docs/latest/using-atom-basic-customization#cson #vt add 'body atom-text-editor.autocomplete-active': 'ctrl-p': 'autocomplete-plus:move-up' 'ctrl-n': 'autocomplete-plus:move-down' 'alt-p': 'autocomplete-plus:page-up' 'alt-n

php - Convert ordered string to mysql Datetime -

i have api returns date string : 190416102906 which means : 19 april 2016 @ 10:29:06 . i want store in mysql datetime don't know how format it. need go 190416102906 2016-04-19 10:29:06 . i've tried use didn't understand how works : $date_reponse = '190416102906'; $date = datetime::createfromformat("dmyhis",$date_reponse); $newdate = date_format($date, 'y-m-d h:i:s'); because format incorrect : "dmyhis" y = year format 4 digit. use y year 2 digit ( dmyhis ) $date = datetime::createfromformat("dmyhis",$date_reponse);

MySql Unique Index how to generate appropriate Response? -

i have simple database contains table users of game. want user names , email addresses unique, have set them have unique index. whenever new user register game, statement executed: tmpquery = "insert vertix_users (user_name, user_email, user_pass) " + "values (" + mysql.escape(username) + ", " + mysql.escape(useremail) + ", " + mysql.escape(userpass) + ") " + "on duplicate key " + "return 'this username exists'"; i can simple insert ignore avoid duplicate user names or email addresses. do, generate useful feedback user; "this name has been taken." or "email in use". code above arbitrary example of thought work. how can achieve along lines? i think simplest solution run previous query check whether name exists. registering process not demanding process, since every user registers once. don't think worth try in 1 query. besides, separate "che

How do I test long session timeouts in ASP.NET -

lets set session timeout 2 days, how test this? how can sure happens? anyway simulate or make sure happens without waiting 2 days? you should not use session long time period.. use persistent cookies it.

java - Can't find a codec for class org.springframework.data.mongodb.core.query.GeoCommand -

here code criteria c = new criteria(); c.andoperator(criteria.where("country").is(country), criteria.where("createtime").lte(wp), criteria.where("location").withinsphere(circle), criteria.where("titlecontent").exists(true)); aggregationoperation match = aggregation.match(c); aggregationoperation limit = aggregation.limit(20); aggregationoperation sort = aggregation.sort(new sort(sort.direction.desc, "createtime")); aggregationoperation group = aggregation.group("titlecontent").sum("count").as("titlecount").count().as("contentcount"); aggregation aggregation = aggregation.newaggregation(match, sort, limit, group); aggregationresults<titleres> result = template.aggregate(aggregation, "post", titleres.class); when add criteria.where("location").withinsphere(circle) it throw exception org.bson.codecs

geoserver - How to register a 'DataSourceFactiry' with 'Geo Server'? -

if have written own datasourcefactory , how can geo server recognize datasourcefactory ? know if register org.geotools.data.datastorefactoryspi automatically geo server recognizes our data source. don't know how register geo server . planning create java project (mvn). if implementing store can follow tutorial at: http://docs.geotools.org/stable/userguide/tutorial/datastore/index.html (geoserver expects find geotools data stores). in particular, answer specific question @ bottom of page, have register in meta-inf/services/org.geotools.data.datastorefactoryspi file: http://docs.geotools.org/stable/userguide/tutorial/datastore/source.html

ffmpeg - Muxing with libav -

i have program supposed demux input mpeg-ts, transcode mpeg2 h264 , mux audio alongside transcoded video. when open resulting muxed file vlc neither audio nor video. here relevant code. my main worker loop follows: void *writer_thread(void *thread_ctx) { struct transcoder_ctx_t *ctx = (struct transcoder_ctx_t *) thread_ctx; avstream *video_stream = null, *audio_stream = null; avformatcontext *output_context = init_output_context(ctx, &video_stream, &audio_stream); struct mux_state_t mux_state = {0}; //from omxtx mux_state.pts_offset = av_rescale_q(ctx->input_context->start_time, av_time_base_q, output_context->streams[ctx->video_stream_index]->time_base); //write stream header if avformat_write_header(output_context, null); //do not start doing until encoded packet pthread_mutex_lock(&ctx->pipeline.video_encode.is_running_mutex); while (!ctx->pipeline.video_encode.is_running) { pthread_cond