Posts

Showing posts from April, 2011

javascript - JQuery datepicker's button "behind" menu div -

Image
i'm working on mvc website. i have menu div @ top, , on page there text inputs added jquery datepicker, seen in picture: when mouse pointer @ red circle, , click, calender should go previous month. happens however, menu @ gets clicked , not calender (as can see in link on bottom) , causes controller call , page redirect. have tried fooling around z-index on divs not solve problem, indexed fine visually. does know of approach can take on problem?

c# - Item enabled on form load even though it's IsEnabled is bound to a presumably false value -

i expect lastnumberweeks numericupdown disabled on form load isn't. once switch radio selection , forth works properly, not on first load. outside of explicitly setting value in code behind can (i don't want have use code behind because of 1 case). <radiobutton groupname="dayrangegroup" content="last number of usable occurences:" name="lastusableoccurancesradiobutton" ischecked="true" /> <wincontrols:numericupdown x:name="lastusableoccurances" isenabled="{binding elementname=lastusableoccurancesradiobutton, path=ischecked}" /> <radiobutton groupname="dayrangegroup"content="last number of weeks:" name="lastnumberofweeksradiobutton" /> <wincontrols:numericupdown x:name="lastnumberweeks" isenabled="{binding elementname=lastnumberofweeksradiobutton, path=ischecked}" /> i tested xaml textbox instead of...

parsing - In perl, how to loop through file, parse line and then compare values in the lines? -

i'm new perl , trying figure out how parse lines within tab-delimited file , compare values parsed lines value , print line. for example: want print out lines have numbers greater 3. a 5.4 6.9 3.1 b 10.2 3.4 7.6 c 1.9 2.6 2.3 i output a 5.4 6.9 3.1 b 10.2 3.4 7.6 thanks in advance edit: sorry, explanation not clear , test case not good. find lines have numbers greater 3. for example: if change 5.4 of line 2.4, don't want code print line because contains number less 3. the program below you. works reading data filehandle data can incorporated program itself. read data elsewhere have open source , read filehandle instead. each line read $_ system variable , divided fields using split which, default, splits $_ on whitespace. fields put array @data . the grep function returns number of elements of list pass given test. slice @data[1..$#data] of @data array except first element (as array indices start @ zero). the c...

css sprites - Why would someone use pure CSS styled buttons over a bitmap/SpriteSheet technique? -

we have ongoing discussion @ job best way deploy buttons on our websites. art directors ask buttons in pure css, prefer make spritesheets in photoshop. argument- kerning, text-effects drop-shadow , aliasing better coming out of photoshop. argument- lose seo points, translation engines can't change buttons. i'm sure there arguments both sides- missing obvious either of these arguments? well, one, pure css buttons load faster, few lines of code. many things can't done in css/js, have images, , consume bandwidth. can save bandwidth, should. alone killer argument if speed priority project. . about effects looking better out of photoshop... wouldn't neccessarily agree here. don't think browser implementations bad in way, have beat those, first. . also, drawing button image cost more time writing lines of code. same applies changing button. maintainability on css side ;) . i don't think translation argument applies. if "localization eng...

oop - What's it called when people try to overuse Design Patterns? -

there must name when people try overuse design patterns. know terms anti-patterns , code-smell (among others), dont seem apply situation. dont me wrong, think patterns quite useful , powerful, many times see questions , code people seem try force use of pattern used pattern. more not simplicity absolute best way go. i did search , came this: when design patterns problem instead of solution? find interesting, dont agree with. if tag doesnt exist on stack overflow, @ least reserve right create please. not create new tag :) some ideas of called follow: over patternizing over patternized design pattern overdose i'd call overengineering -- doesn't need patterns, either. use kiss principle (as note).

How do you handle Java Singletons when a network connection fails? -

i have created singleton class contains instance of memcachedclient (this object requires making connection server providing concrete example). initialize memcachedclient in static init block. if memcachedclient cannot create instance due connection error, means class worthless because has null memcachedclient instance. my question: best solution type of situation? how other people handling situation? the question (as stated in title) broad, depends of singleton for. in case, obvious question: if initialization fails, can expect issue solved in near future? cost of keep trying (redesign app not crashes downward in weird ways) instead of rebooting app? if not expect error solved easily, crash application (with proper logs/alerts/notifications). if want keep running until issue resolves, steps be: 1) pass initialization constructor of singleton (why put in static block if can control access constructor). 2a) while constructor fails, calls getinstance return null. ...

android webview not functioning on a page with websockets -

i have chat web application on spring mvc. used android webview chat page, using websockets. can see page on android webview when type , click send doesn't respond. page works fine when deploy on browser using jetty. webview= (webview)findviewbyid(r.id.webscreen); webview.setscrollbarstyle(webview.scrollbars_outside_overlay); webview.getsettings().setjavascriptenabled(true); webview.getsettings().setjavascriptcanopenwindowsautomatically(true); webview.getsettings().setsupportmultiplewindows(false); webview.getsettings().setsupportzoom(false); webview.setverticalscrollbarenabled(true); webview.sethorizontalscrollbarenabled(false); webview.setclickable(true); webview.setlongclickable(true); webview.setbackgroundcolor(0); webview.getsettings().setjavascriptcanopenwindowsautomatically(true); webview.getsettings().setlighttouchenabled(true); ...

java - Add JTextField to JToolBar -

Image
i'm trying add jtextfield jtoolbar , works, long. need take 3 letters. here screenshot of now... i tried following methods, jtextfield field = new jextfield(3); // thought limits 3 characters. and tried, field.setcolumns(3); // didn't work either. the default layout of tool-bar respects maximum size set text field. import java.awt.*; import javax.swing.*; public class textfieldintoolbar { textfieldintoolbar() { jpanel p = new jpanel(new borderlayout()); jtoolbar tb = new jtoolbar(); p.add(tb, borderlayout.page_start); icon disk = (icon)uimanager.get("fileview.floppydriveicon"); icon pc = (icon)uimanager.get("fileview.computericon"); tb.add(new jbutton(disk)); jtextfield tf = new jtextfield(3); tf.setmaximumsize(tf.getpreferredsize()); tb.add(tf); tb.addseparator(); tb.add(new jbutton(pc)); p.setpreferredsize(new dimension(25...

javascript - using id="submit" twice on one page -

i creating login/register part site. , login , register forms on page. like: <form name="loginform" style="text-align:center;" method="post" onsubmit="return validateform();" action="index.php"> <div class="row"> <input type="text" name="email" id="email" autocomplete="off" placeholder="email address" /> </div> <br /> <div class="row"> <input type="password" name="password" id="password" autocomplete="off" placeholder="password" /> </div> <br /> <div class="row"> <button id="submit" type="submit" class="button large arrow-type-2 dark...

Parsing of Textarea with html content -

i work jsoup1.6.2.jar. consider following code. string data = "<textarea><table><tr><td>look @ following elements</td></tr></table></textarea>"; document doc = jsoup.parse(data); system.out.println(doc); output: <html> <head></head> <body> <textarea>&lt;table&gt;&lt;tr&gt;&lt;td&gt;look @ following elements&lt;/td&lt;/tr&lt;/table</textarea> </body> </html> why missing &gt self closing tags? encountered problem textarea far. can me this? you can't put table inside text area. there's mistake

sql - join two Oracle tables, date to not overlapping date ranges -

i have 2 tables: trips: id_trip, id_object, trip_date, delta (8980026 rows) ranges: id_range, id_object, date_since, date_until (18490 rows) i need optimize following select statement select r.id_range, sum(t.delta) sum_deltas trips t, ranges r t.id_object = r.id_object , t.trip_date between r.date_since , r.date_until group r.id_range according condition there 1 matching row trip in 'ranges' the trips table growing, there no updates or deletions table ranges may change time time in way (deletions, updates, inserts), function based index not way :( there indexes on id_object (in both tables) , date_since (in trips) does have idea how speed things up, possible? it's possible speed things up; may not worth time / effort / money / disk-space / additional overheads etc. firstly please use explicit join syntax. it's been sql standard few decades , helps avoid lot of potential errors. query become: select r.id_range,...

ios5 - EXC_BAD_ACCESS at MFMessageController -

i have got error when press send button message composer sheet, piece of code this: -(void)composersheet { picker = [[mfmessagecomposeviewcontroller alloc] init]; picker.messagecomposedelegate = self; [self presentmodalviewcontroller:picker animated:yes]; [picker release]; } i have initialised picker in .h file. how out of here? tried using nszombies problem occurring @ messaging part, can't use them there. the problem release of objects, have commented out release objects in proj. running well. checked doing wrongly. worked.

android - doesNotRecognizeSelector equivalent in Java -

is there equivalent or hack catch unimplemented method call in java can doesnotrecognizeselector in objective c. i'm looking way have object replying method call default behavior when method not implemented ? possible use such pattern in java ? you can use unsupportedoperationexception similar thing.

php - JQgrid how do I change background color of row based on server data? -

i'm trying change background color of multiple rows based on data returned sql query. i'm using json data type , have tried using loadcomplete iterate through grid , color rows adding css class after grid loaded. works have 1000's of rows returned , method slows down loading of grid. user has wait long time before grid loaded. i haven't tried using customer formatter color rows because i'm told grid not available yet when customer formatter triggered there error? have seen documentation on setting timeout period grid available in dom customer formatter sounds slow loading of grid i'm trying avoid. ideally assign class row during server call (php) based on table data , when grid loaded on client side colors row based on css style. seems assigning class on server side efficient way don't have cycle through data more once or draw grid more once? other techniques available doing this? thanks! the best way want use rowattr . described in t...

Autosize HTML table cell height based on content when rowspan is involved -

Image
is there way autosize html table height based on content? if it's cell (or cells) next neighbor cell multiple rowspans. e.g. if have table (cell on right has rowspan="2" , height of cell content = 600px, in each cell on left height of cell content = 150px): there gap between 2 cell consents on left because cells autosized height. i'd this: where top cells automatically collapse cell content height. there anyway achieve this? this sets last row of cells correct height ( demo ): function grow(td) { var table, target, high, low, mid; td = $(td); table = td.closest('table'); target = table.height(); low = td.height(); // find initial high high = low; while (table.height() <= target) { td.height(high *= 2); } // binary search! while (low + 1 < high) { mid = low + math.floor((high - low) / 2); td.height(mid); if (table.height() > target) { hig...

objective c - Difference between CoreData sqllite file size with images stored in it and total iCloud space -

i have decided give try saving images coredata binary. small images 2k 90k maximum, , can have trashed many lines of code, ones dealing icloud issues. considering coredata storage put in icloud using properties such nspersistentstoreubiquitouscontentnamekey, have noticed sqlite file 1.6mb in size. while total icloud space occupied application itself, seen in ios settings, 34mb, , not have other documents around. i put nssqlitemanualvacuumoption option, wondering causing space taken. transaction log ? you should using external data references. with each change entity stores images writing out of image data. external data references, image data stored separate file, , can deleted once no longer referenced.

knockout.js - Knockout JS: how to update a whole observable array -

i need little knockout js. i have todo-list type web-app , need update on demand whole observable array contain task list data fetched database. i have created sample fiddle here: http://jsfiddle.net/ingro/43xcu/26/ self.update = function(){ var values = [ {time: "17:00", title: "test#11"}, {time: "18:00", title: "work#22"}, {time: "19:00", title: "task#33"}, {time: "20:00", title: "sleep#14"} ]; self.clone = ko.observablearray(ko.utils.arraymap( values , function( clone) { return new post(clone.time, clone.title); })); var count = 0; ko.utils.arrayforeach(self.posts(), function(post) { post.time(self.clone()[count].time()); post.title(self.clone()[count].title()); count++; }); } data in "values" simulate json response server. way made work creating clone observable arra...

ruby on rails - I got the error syntax error, unexpected $end, expecting keyword_end -

i'm first ruby, when following guide(http://guides.rubyonrails.org/getting_started.html) got error like: started "/questions" 127.0.0.1 @ 2012-06-07 17:22:36 +0900 syntaxerror (/users/sookcha/desktop/dev/csap/app/models/question.rb:3: invalid multibyte char (us-ascii) /users/sookcha/desktop/dev/csap/app/models/question.rb:3: syntax error, unexpected $end, expecting keyword_end   validates :name,  :presence => true ^): app/controllers/questions_controller.rb:2:in `' rendered /users/sookcha/.rvm/gems/ruby-1.9.3-p125/gems/actionpack-3.2.5/lib/action_dispatch/middleware/templates/rescues/_trace.erb (3.1ms) rendered /users/sookcha/.rvm/gems/ruby-1.9.3-p125/gems/actionpack-3.2.5/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.1ms) rendered /users/sookcha/.rvm/gems/ruby-1.9.3-p125/gems/actionpack-3.2.5/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (10.7ms) ...

CSS nested elements ignored by Chrome/Firefox? -

this might painfully easy, apologies in advance, i'm on hour 5 trying figure mess out. here's ul i'm trying present horizontal bar: <div id="navbarwrapper"> <ul id="navbar"> <li><a href="works.html">search</a></li> <li><a href="works.html">tips</a></li> <li><a href="works.html">neighborhoods</a></li> <li><a href="works.html">relocation</a></li> </ul> </div> and here's strange css seems malfunction: #navbar {} #navbar ul { list-style-type: none; margin: 0px; padding: 0px; } #navbar li {display: inline;} #navbar ul li {text-decoration:line-through;} the problem i'm having markup, text wrapped in anchor tags in html aren't receiving line-through (i'm using line-through placeholder because it's obvious when it's working or not; don't want li...

java - What makes Scala scalable? -

i novice learning scala said scalable language . understand scala code compiles jvm compatible byte code. questions what's makes scala compiler generate " scalable bytecode " , why java compiler i.e. javac cannot same?

vim - Cannot use gcc which is set by autocmd to compile java in MacVim -

i compile java program using gcc rather using javac because can give out more detail information compared javac. in startup configuration. use "make" me compile program have set compiler "make" first i use command set compiler gcc automatically when filetype java. autocmd filetype java compiler gcc but when i tried compile program using "make" give out lot of message don't understand, , cannot compile program. however, when first set compiler javac,then set gcc later. "make" works!! in startup config : autocmd filetype java compiler javac when editing file, :compiler gcc then can compile java program using make gcc compiler i don't know problem is. can automatically set compiler gcc instead of setting later when editing file ?? try autocmd filetype java set makeprg=gcc in .vimrc.

c# - Issue when trying to determine common elements in two List<T> -

i have class, called classx purposes of question, declared follows: class x { public guid id { get; set; } public string name { get; set; } public string description { get; set; } } if have 2 instances ( instanceone , instancetwo ) of list<t> of these classes, how can find elements same in both instances: assume there 2 elements in instanceone , 4 elements in instancetwo. 2 of elements same (as defined fact have same guid id) in each of instances i thought should able linq way isn't doing me // what's common 2 instances? var commonelements = ( in instancetwo join b in instanceone on a.id equals b.id select b).tolist(); // what's not in instanceone , in instancetwo? var notininstanceone = instancetwo.except(commonelements) in situation instancetwo superset of instanceone may not case should able flip original linq statement elements in instanceone not in instancetwo viz: var notininstancetwo = instanceone.except(c...

Silverlight OpenFileDialog Filter Property with Extension and file name -

is there way when set filter property of openfiledialog control in silverlight, can filter file extension , part of file name? example how set filter property if want show files starts letter , have extension .dat. please keep in mind might have other files same extension starts different letter. don't want show those. reply.

html - How can I POST to multiple urls at the same time? -

our website hosted using ee. i've been tasked add our "contact us" form posts external sales lead generation system (hubspot) we given url post to, , when found html form in question noticed pointing sales lead system. don't want remove url. possible 2 posts @ same time? <form action="https://www.salesforce.com/servlet/servlet.webtolead?encoding=utf-8" method="post" http://yoursite.yourportal.hubspot.com/?app=leaddirector&formname=x you can't single request. use xmlhttp objects or jquery.post(); different url's , same data. send multiple requests. alternatively, send 1 request server, php can send onwards other pages, other servers, evading same-origin policy javascript has.

user interface - How to cancel the effect of RequestWindowFeature in android\monodroid? -

i write game. use requestwindowfeature(windowfeatures.notitle); @ splash screen, how can disable @ settings screen? in settings activity oncreate, run this: requestwindowfeature(window.feature_custom_title); getwindow().settitle("settings");

php - Equivalent of array_unique and preg_split PREG_SPLIT_NO_EMPTY -

i'm looking exact javascript equivalent of php: $tags = preg_split('/+/', $_get['q'], null, preg_split_no_empty); $p = array_unique(array_map('strtolower', $tags)); sort($p); it's done var querystring = decodeuricomponent(location.search.substring(1)).tolowercase(); var key = querystring.split('&')[0].split('='); if (key.length > 1){ //q should query key var tags = key[1].split(/\+/g); // make tags values unique, non-empty , ordered alphabetically } but i'm looking 3 things make tags values unique, non-empty , ordered alphabetically, it's done in php, hope there such solutions in js thx you can find on phpjs project: split (regex) array_unique code: split : ( explode dependency) function split (delimiter, string) { // http://kevin.vanzonneveld.net // + original by: kevin van zonneveld (http://kevin.vanzonneveld.net) // - depends on: explode // * example 1...

list - Dynamic variable in Python -

this question has answer here: how create variable number of variables? 12 answers how can create lists dynamic names in python, example for in range(len(myself)): list(i) = [] what should use instead of list(i) ? means want names below: list1 list2 list3 ... i'd advise just use list or dictionary instead of dynamic variable names . versions below result in lists[0] , lists[1] etc being [] , seems close enough want, , more readable/maintainable in long term. (note: i'm using lists instead of list variable name because latter overwrite builtin list function, don't want). 1) version lists being list of lists (the numbers order of lists): lists = [[] in range(len(myself))] 2) same loop instead of list comprehension: lists = [] in range(len(myself)): lists.append([]) 3) version lists being dictionary of lists numbers keys...

android: How to pick contacts phone num -

i need pick contact phone num, , used this... intent intent = new intent(intent.action_pick, contactscontract.contacts.content_uri); startactivityforresult(intent, get_contact_from_result); but, when contact has multiple numbers, pick activity list 1 contact, , can select 1 phone. what can display contacts' every phone num? you can ask contact picker show 1 contact per phone, contact multiple phones appear several times: intent intent = new intent(intent.action_get_content); intent.settype(contactscontract.commondatakinds.phone.content_item_type); startactivityforresult(intent, pick_contact);

c# - OPC.Tests.SmokeTest (TestFixtureSetUp): SetUp : OpenQA.Selenium.InvalidSelectorException -

i trying use cssselector locate element on webpage. using firefox driver. here how using locator (i checked selenium ide able locate element this [findsby(how = how.cssselector, using = "label:contains('version: 2.0.')")] public iwebelement labelversion; but when use in c# code , initialize pagefactory.initelements in constructor. i hit error... (the error pretty clear don't know how fix it) appreciate inputs. opc.tests.smoketest (testfixturesetup): setup : openqa.selenium.invalidselectorexception : given selector css=label:contains('version: 2.0.') either invalid or not result in webelement. following error occurred: [exception... "an invalid or illegal string specified" code: "12" nsresult: "0x8053000c (ns_error_dom_syntax_err)" location: "file:///........../anonymous439571104.webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js line: 5811"] ...

c++ - Looking for one linear algebra library for embedded systems (without malloc and free) -

i use work microcontrollers. rtoss employ in applications not have free , malloc (and other calls assert), available, prefer have static in system. i have started employ linear algebra, of them need dynamic memory. matrices dense , 'small' (not more 10x10). i eigen (everything can static decided in compile time), apparently there bug calling asserts not provided rtos (even -dndebug). library should provide matrix decomposition routines (like qr, cholesky, lu...) i prefer c instead c++. suggestions? many in advance! anything wrong clapack? or straight fortran lapack (you can compile gfortran, part of gcc). [c]lapack's routines take memory buffers in arguments allocated, , not heap allocation whatsoever. routines take "work" buffers in addition other arguments (for example, dgesdd computing svd), can call them special "size only" argument, , in response required size work buffers, can allocate wish.

c++ - Troubles when compiling phash program -

here (probably) simple problem: i'm trying use perceptual hashing library phash ubuntu 11.10. had ffmpeg installed, way i've done: sudo apt-get install libphash0 sudo apt-get install libphash0-dev then tried compile program: #include <iostream> #include <phash.h> using namespace std; int main() { ulong64 myhash=0; ph_dct_imagehash("test.jpg", myhash); cout<<myhash<<endl; } when compiling, prints out: undefined reference `ph_dct_imagehash' any suggestion? should do? in advance! matteo monti you forgot link phash library, linker cannot find function. try adding -l phash gcc command line (or update makefile). if doesn't work, maybe you'll need specify library path (the location of *.a file) using -l "/usr/lib/"

python - Non-blocking realtime redirection stdout from process to wx.TextCtrl control -

Image
i've got countdown.exe file (source code of file below). when files executed write in console every second text. start execution of file when gui python app executed: self.countdown_process = subprocess.popen("countdown.exe", shell=true, stdout=subprocess.pipe) i redirect stdout in subprocess.pipe , start thread out_thread read stdout of process , add textctrl: out_thread = outtextthread(self.countdown_process.stdout, self.addtext) out_thread.start() this full code of python app: import os import sys import wx import subprocess, threading class myframe(wx.frame): def __init__(self): super(myframe, self).__init__(none) self._init_ctrls() def _init_ctrls(self): self.outtext = wx.textctrl(id=wx.newid(), value='', name='outtext', parent=self, pos=wx.point(0, 0), size=wx.size(0, 0), style=wx.te_multiline|wx.te_rich2) self.outtext.appe...

mysql error:ERROR hbm2ddl.SchemaUpdate - Row size too large when pushing Grails app to Cloud Foundry -

i able deploy cloud foundry last time , new domain classes getting introduced, need update it. updated successfully, 1 table not created, why tried delete app , push again see error in detail , got: error hbm2ddl.schemaupdate - unsuccessful: create table case_file (id bigint not null auto_increment, version bigint not null, case_type varchar(255) not null, category varchar(255) not null, client_id bigint not null, date_created datetime not null, class varchar(255) not null, has_criminal_record bit, house_size decimal(19,2), number_of_children integer, agreement varchar(255), brief_evaluation varchar(4000), comments varchar(4000), court_order varchar(255), date_from datetime, date_of_birth datetime, date_of_report datetime, date_signed_authorized_person datetime, date_signed_revisor datetime, date_to datetime, demand_number varchar(255), first_name varchar(255), has_court_order bit, has_intervention_plan bit, has_voluntary_measures bit, interventions_measure_and_resources varchar...

sql server - Convert right outer join to Linq query in EF -

i want convert below sql query linq query confused: select * dbo.vahed inner join dbo.vahedmahsol on dbo.vahed.vahedid = dbo.vahedmahsol.vahedid right outer join dbo.mahsol on dbo.vahedmahsol.mahsolid = dbo.mahsol.mahsolid i wrote code: vaheds = ( in db.spgetvahedbywhatwhere(what, wherestr, int.parse(whattype), new guid(shahrid)) join gr in db.gorohsenfis on i.gorohsenfiid equals gr.gorohsenfiid join ct in db.contacts on i.vahedid equals ct.vahedid join vm in db.vahedmahsols on i.vahedid equals vm.vahedid select ) .tolist(); but don't know how convert right outer join dbo.mahsol on dbo.vahedmahsol.mahsolid = dbo.mahsol.mahsolid to linq query. first of can rewrite sql query use left outer join instead of right outer join (because easier convert linq): select * dbo.mahsol left outer join dbo.vahedmahsol on dbo.mahsol.mahsolid = dbo.vahedmahsol.mahsolid inner join dbo.vahed on dbo.vahedmahsol.vahedid = dbo.vahed.vahedid now can convert query abov...

Rails assets:precompile is trying to compile too many files -

i cannot run rake assets:precompile in app try compile partials. i have: config.assets.precompile += %w( active_admin.js active_admin.css ) and nothing else. rake give error on file: undefined variable: "$selected-row-color". (in /home/eloyesp/projects/diputados/app/assets/stylesheets/expedientes_index.css.scss) why trying precompile file? found this pull request related and this test show that should not happen. my rails version 3.2.2 i've found it: not trying compile expedientes_index.css.scss compiling application.css.scss (this had *= require_tree . shouldn't in app). the problem because error didn't name file trying compile.

android - EditText Customization -

in application , dynamically generating linearlayout contains edittext , buttons . i want when user presser 'enter' on keyboard of device keyboard should hide i tried setting input type of edittext , when user presses "enter" moves onto edittext . how can that?? package com.integrated.mpr; import android.app.activity; import android.app.dialog; import android.app.progressdialog; import android.view.view; import android.view.view.onclicklistener; import android.view.viewgroup.layoutparams; import android.widget.button; import android.widget.edittext; import android.widget.linearlayout; import android.widget.scrollview; import android.widget.textview; public class page1 extends activity implements onclicklistener{ static string partname; int pos = staticerror.n; int ns= staticerror.ns; string s = staticerror.s; int[][] id = new int[pos][6]; int submit ; double timedataa[] = {0,0,0,0,0}; double timedatab[] = {0,0,0,0,0}; ...

jquery - how to fix this weird behaviours? Hover link -> fadeIn the div, mouleave -> fadeOut the div -

trying make form appear login when mouseover on link log in class="classb" , , box information when hover on link info class="classa" , box should fadeout when mouse leaves box , link. effect weird, it's not working properly. code below, , see here: http://jsfiddle.net/75hyl/11/ <ul class="links"> <li class="classa"><a><span>my info</span></a></li> <li class="classb"><a><span>log in</span></a></li> </ul> <div id="userinfo">content goes here. box should stay visible when mouse on it, fadeout when mouse leaves</div> <div id="login" > <div class="form"> <form> login form here. box should stay visible when mouse on it, fadeout when mouse leaves </form> </div> </div> <style> .links li { display:inline-block;cursor:pointer; } .links li { padding:0 4px 0 1px; } .lin...

performance - MySQL Speeding up left outer join / check for null queries -

the object of query rows table gender = f , username not exist in table b campid = xxxx. here query using success: select `id` pool left join sent on pool.username = sent.username , sent.campid = 'ya1lgfh9' sent.username null , pool.gender = 'f' the problem query takes on 9 minutes complete, pool table contains on 10 million rows , sent table going grow larger that. have created indexes many of columns including username , gender. however, mysql refuses use of indexes query. tried using force index. here indexes pool , output of explain query: +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+ | table | non_unique | key_name | seq_in_index | column_name | collation | cardinality | sub_part | packed | null | index_type | comment | +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------...

Java Graphics.drawImage with different source color spaces and image types -

Image
i'm trying overlay mostly-transparent png on jpeg, , output result jpeg file. i've attached test input. here's code: (edit: fyi, translated java scala, not sure if missed syntax error or two, should idea code) bufferedimage img = new bufferedimage(800, 800, bufferedimage.type_4byte_abgr); //goes test.jpg img.getgraphics.drawimage(source, 0, 0, color.black, null); //source.jpg img.getgraphics.drawimage(overlay, 0, 0, 400, 400, color.black, null); //overlay.png //first, final jpg memory in byte array (i use elsewhere in actual code) bytearrayoutputstream baos = new bytearrayoutputstream(); imageio.write(img, "jpg", baos); baos.flush(); byte[] bytes = baos.tobytearray(); baos.close(); fileutils.writebytearraytofile(new file("test.jpg"), bytes); obviously, output not expected. doing wrong here?

Confuse of Push Notification in Android -

i followed push notification tutorial . when finish tutorial, found out 2 classes did not use authenticationutil , messageutil . moreover, google login , link seem unworkable. second, token id android device or account only? thought push notification push message token id of android device. on others hand, found out bundle.putextra(key, value) , keys did not use it. example put "app" in c2dmregistrationreceiver() did not key. in sendregistrationidtoserver() , seem never being call out. i being confused tutorial push notification. who can guide me or give me workable tutorial or example push notification? i pro point out what's wrong. this registration id public static final string[] registration_id = { "apa91bfv6mwoah0unop69pz2likpsbuhsheniupzh44_6gdgkzvclvoh_nm31emzmvlzi-saifwp4izae72dswkih3gad0rqyppm9zo0arwmnoxfyyyrel_kpq9qd_p0broclt12rha4ymk0cbt00cmpsbshiwyxig", "apa91bewmxgvs7znbkc4p0n4dotem73dtihnqgbop8gxhf2svw-...

c - How to get the pid of a process that is listening on a certain port programmatically? -

i have write snmp module monitor server application have written too. problem have know if application running , should able kill whenever can. i know port application listening (reading application configuration file) , can try bind port socket in order know if (or isn't) being used application or enough module. here code: int get_server_status() { struct sockaddr_in local; int port,sockfd; if (parse_config_file(&port,null,config_file_path) == -1) return -1; //error if ((sockfd = socket ( af_inet, sock_stream, 0 )) < 0) return -1; //error local.sin_family = af_inet; local.sin_port = htons ( port ); local.sin_addr.s_addr = inet_addr ("127.0.0.1"); if (bind(sockfd, (struct sockaddr *) &local, sizeof (local) ) < 0 ){ if(errno == eaddrinuse) return 1; //port being used else re...

objective c - NSDate issue with locale -

i'm working on ipad app speaks private php api built communicate database. api has transfer 3 dates, starting time, end time , current time. i want test if current time in-between date range. took times (like 16:50:00) , convert them nsdates: nsdateformatter *former = [[nsdateformatter alloc] init]; [former setdateformat:@"hh:mm:ss"]; [former setlocale:[nslocale currentlocale]]; nsdate *fromdate = [former datefromstring:@"10:15:00"]; nsdate *nowdate = [former datefromstring:@"13:25:00"]; nsdate *todate = [former datefromstring:@"16:30:00"]; when i'm logging dates using nslog(@"\n%@\n%@\n%@", fromdate, nowdate, todate); see locale incorrect. it seems nsdateformatter ignores locale setting. logged currentlocales identifier right 1 ("de_de" in case"). locale remains +0000. how can fix issue? thanks, kind regards, julian alright, i've removed previous answer, try following nsdateformatte...

php - I see a DLL in GAC_MSIL but there's not an assembly -

i'm looking @ classlibrary1.dll inside c:\windows\microsoft.net\assembly\gac_msil\classlibrary1\v4.0_1.0.0.0__2efc1c0b243a0c09 that placed there automatically result of this: c:\program files (x86)\microsoft sdks\windows\v7.0a\bin\netfx 4.0 tools>gacutil. exe /i "c:\users\wherever\classlibrary1.dll" microsoft (r) .net global assembly cache utility. version 4.0.30319.1 copyright (c) microsoft corporation. rights reserved. assembly added cache c:\program files (x86)\microsoft sdks\windows\v7.0a\bin\netfx 4.0 tools> but afterward corresponding assembly found inside c:\windows\assembly what doing wrong? i'd able use class library following code: <?php $obj = new dotnet("classlibrary1", "version=1.0.0.0", "culture=neutral", "publickeytoken=2efc1c0b243a0c09", "classlibrary1.class1"); $output=$obj->helloworld(); echo $output; ?> the class looks this: public class class1 public...

c# - Why can't I implicitly cast this object to a class reference -

can please explain why doesn't work? myclass myclass1 = new myclass(); object obj = myclass1; myclass myclass2 = obj; <-- error if obj "points" same block of memory of type myclass, why can not "point" myclass2 same block of memory on last line? thanks help. the type of myclass2 " myclass ". can assign value of type is, or derives from, myclass . object not , not derive myclass , need cast. if able implicitly, happen if did object not myclass ?

objective c - How it is possible to make one view controller to be viewed in Portrait view in iPhone -

i developing app, display number of books fetched server , user read through book whenever wants. in every book supposed add simple games. here, have done is, app start in landscape view , works fine. now, want game view controller (not other vc ) should load in portrait view. googled , can't find real solution. appreciated. thanks. by default, uiviewcontroller class displays views in portrait mode only. support additional orientations, must override shouldautorotatetointerfaceorientation: method , return yes orientations subclass supports. so have override shouldautorotatetointerfaceorientation: function in view controller view in portrait: - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { return (interfaceorientation == uiinterfaceorientationportrait); }

c# - Guidelines for reading from Excel on Windows Azure Web Role -

my requirement have user upload csv or excel file import purposes on web application running on windows azure. there associated excel column field mapping requirement well. environment c#, asp.net, sql server 2010. i have solution working microsoft access database engine 2010 ( link ). reasonably confident not fly on windows azure given installer putting registry entries on computer + there security constraints on azure. any guidelines/help on appropriate solution same on windows azure? through startup scripts, can modify registry , run msi's (as long they're automated without user input). remember windows azure web , worker roles windows server 2008 sp2 or r2, plus scaffold code called either startup script or roleentrypoint implementation (including onstart() , start() ). for more information startup scripts, see here .

visual studio 2010 - How to include dependencies in Setup and Deployment Project? -

i have solution consists of 3 projects. i've created deployment project including dependencies 1 of projects in solution. what i've done far in setup , deployment project, right-clicked "application folder" add --> project output. next selected main project dropdown , selected "primary output". clicked ok , project's dependencies included in deployment. i tried repeat same process other dlls in solution, didn't include dependencies. how include dependencies each project? please note dependencies detected visual studio setup project more suggestions. shouldn't put trust in them since false positives common. for professional installer should determine correct dependencies , add them in project in appropriate form. example, of dependencies may part of runtime or framework can added prerequisite installer. if can't figure out dependencies application has, can try using dependency walker .

twitter image thumbnail in tweet -

Image
how show images in twitter instagram ? metatags twitter tries find in page show image thumbnail ? when twitpic or instagram link provided . like example i use http://embed.ly/ you can use service create regex of image services, find links, pass them embed.ly , image thumbnail back. you can write simple set of regular expressions common service, here's 1 use. '#youtube\.com\/watch\?v=([_-\d\w]+)#i' => 'http://i.ytimg.com/vi/%s/1.jpg', '#youtu\.be\/([_-\d\w]+)#i' => 'http://i.ytimg.com/vi/%s/1.jpg', '#qik\.ly\/([_-\d\w]+)#i' => 'http://qik.ly/%s.jpg', '#twitpic\.com\/([\d\w]+)#i' => 'http://twitpic.com/show/thumb/%s', '#twitgoo\.com\/([\d\w]+)#i' => 'http://twitgoo.com/show/thumb/%s', '#hellotxt\.com\/i\/([\d\w]+)#i' => 'http://hellotxt.com/image/%s.s.jpg', '#ts1\.in\/(\d+)#i' ...

driver - Windows Kernel-Level global Critical Section -

i'm writing user-space buffer kernel-level driver (from iocontrol functionality) , need make sure user-land program/service won't overwrite buffer or read before driver has finished writing it. is there way (and if so, preferred way) enter kind of 'global critical section' within kernel-mode driver on windows allowing driver obtain exclusivity processing system-wide short time driver can have guaranteed exclusive access buffer in user-space? taking account reply in comments, 1 way achieve maintain kernel-mode threads affinitized each system processor , raise irql dpc @ time when write buffer. thread scheduling not allowed @ dpc irql user-mode application won't able take control. note: answer question, agree comments saying not supposed that. should redesign driver works under assumption user-mode buffer can change @ moment.

c# - During request ,the parameter encoded in strange manner -

sometimes face following problem : string txt = con.request.params["par_name"].tostring();//the original par value arabic text i following result!! ��� ������ ������� ����� what's reason problem , how original arabic text ?? when send string via url parametres, via ajax , utf-8 avoid conflicts must encode javascript functions encodeuricomponent . encode part of value, not parameters , full url ! when read parameters on code behind urldecode default, if not, manually. for example code https://stackoverflow.com/a/10968848/159270 be: jquery.ajax({ url: "/logaction.ashx?par_name=" + encodeuricomponent(par_name) + "&par_address=" + encodeuricomponent(par_address), type: "get", timeout: 3000, async: true, // can try , async:false - maybe better data: action=4, // here send log informations cache: false, success: function(html) { jquery("#formid").submit(); }, error:...

jsf - Failed to retrieve Session from FacesContext inside a Servlet Filter -

after autheticating user, want put reference in session current logged in user. here how in setcurrentuser method : facescontext facescontext = facescontext.getcurrentinstance(); httpsession session = (httpsession) facescontext.getexternalcontext().getsession(true); session.setattribute("current_user", currentuser); unfortunately, session reference null ! alternatively, tried sessionmap facescontext facescontext = facescontext.getcurrentinstance(); map<string, object> sessionmap = facescontext.getexternalcontext().getsessionmap(); sessionmap.put("current_user", currentuser); it miserably failed exception : java.lang.unsupportedoperationexception @ java.util.abstractmap.put(abstractmap.java:186) (...) what doing wrong ? the full code of controller usercontroller.java public class usercontroller implements filter { private filterconfig fc; private static final string current_user = "current_user"; public...

is it possible to take the statistics for extracted region using R? -

i have binary file size of (360 720 )for globe.i wrote code given below read , extract area file. when use summary whole file got. summary(a, na.rm=false) min. 1st qu. median mean 3rd qu. max. na's 0.00 1.00 3.00 4.15 7.00 20.00 200083 . but when used summary region(b) extracted, got many v1,v2. not right should have got 1 line (as a)not many v1,v2. here code: x <- c(200:300) y <- c(150:190) conne <- file("c:\\initial-wtd.bin", "rb") a=readbin(conne, numeric(), size=4, n=360*720, signed=true) a[a == -9999] <- na y <- matrix(data=a,ncol=360,nrow=720) image(t(t(y[x,y])),ylim=c(1,0)) b = y[x,y] summary(b,na.rm=false) v1 v2 v3 v4 v5 v6 v7 min. : na min. : na min. : na min. : na min. : 8 min. : na min. : 1st qu.: na 1st qu.: na 1st qu.: na 1st qu.: na 1st qu.:11 1st qu.: na 1st qu.: median : n...