Posts

Showing posts from September, 2011

css - Force HTML Tables To Not Exceed Their Containers' Size -

this question has been asked several times, none of answers provided seem me: see in action here: http://jsfiddle.net/blam/bsqnj/2/ i have "dynamic" (percentage based) layout 2 columns. .grid { width: 100%; box-sizing: border-box; } .grid > * { box-sizing: border-box; margin: 0; } .grid .col50 { padding: 0 1.5%; float: left; width: 50%; } in each of these columns have table supposed use full column width. .data-table { width: 100%; } .data-table td { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } my problem of columns in table have content needs truncated fit in given width of table. not happen, though. 2 tables overlaying each other. requirements: needs percentage based. can't set absolute sizes. each rows' height must not grow beyond 1 text line (which happen if remove white-space: nowrap) must work in chrome, firefox , internet explorer 8+ can't display tables below each o

Grails - How to use named queries inside Criteria -

i have case where, need use named query inside criteria. doesnt work! is possible use named query inside criteria? if yes how? you can't. but can use namedquery 1 class in namedquery of class. refer this jira issue . (mainly jeff's comment)

c# - Access To A Resource Text File Within My Application -

i building windows phone 8 application struggling following problem. although can access text files on computer , cannot access text file created in resource folder created in application. does know how access textfile in folder belongs application ande use streamreader read it? thank ! you use application.getresourcestream method passing in uri of file, in order access streamresourceinfo object returned, has stream property access (which can pass streamreader , on). as uri, depends on build action (from properties window) have set file, ie. whether resource or content. if it's resource, uri should be: new uri("/assemblyname;component/path/file.txt", urikind.relative); if it's content, uri should be: new uri("path/file.txt", urikind.relative); note 'assemblyname' name of assembly project contains file. , 'path' forwardslash-separated path file within project taking account folder , subfolders in.

Issue with GlobalExceptionHandler Sharepoint 2010 -

i have fatal error not know how solve,even after several days of trying. error have : "could not load file or assembly 'globalexceptionhandler, version=1.0.0.0, culture=neutral, publickeytoken=ed6585c9914bae60' or 1 of dependencies. system cannot find file specified." for more details: -i had never before seen error when deployed project encountered error cited above... -so ,after change, assume action mentioned before caused me error. -for this, executed orders @ "windows powershell" as: stsadm-o-name deletesolution solutionname.wsp remove solution completely. -after that, made sure project deployed ​​is no longer in server. -later, when logged the" sharepoint central administration" on port 24427. ,in hoping not see error anymore ,i saw error has not disappeared . so , no longer have access " sharepoint central administration",as error remains. i grateful proposal you. thank & sorry english. . please t

c# - How to remove the null value exception in the following statement -

the following code raising null value exception record rec = (record)obj.records.where(x => x.id == no).singleordefault(); there 3 potential places nullreferenceexception occur ( edit: know id int ): obj.records if obj null records.where(...) if records null x.id in lambda if there null entry in obj.records enumerable (ie x in context null ). here wouldn't (assuming compiles): singleordefault throw exception if there more one entry. if there isn't, return null reference type, or default value value type. (record) casting. since there no compiler error, assume record class. if there value, throw exception if it's invalid cast (and not null exception). (record)null valid reference type. you should debug , step through find out causing exception.

ios - Allocate any mutable object with immutable class or vice versa -

this may sound pretty strange people.. went on ask this.. obviously, no 1 wants it.. make concept clearer, want ask. this: nsstring *mystring=[[nsstring alloc]init]; nsstring *mystring=[nsstring string]; as far understand, gives pointer object of nsstring class, but, if this: nsstring *mystring=[[nsmutablestring alloc]init]; nsstring *mystring=[nsmutablestring string]; if happens, kind of class "string" belong.. , since have initialized mutable class, can i send messages of nsmutablestring class "mystring", object of nsstring class ?? whatever case can know concept behind this.. also, can in case of arrays, dictionaries , many other calsses. yes. type of object 1 used alloc method. if allocated nsmutablestring, object member of nsmutablestring class. nsstring *mystring=[[nsmutablestring alloc]init]; what's going on it's have pointer allocated object type of it's parent class, compiler not see methods of nsmutablestring , warn

arrays - How to display dynamic marker label info from database -

for past month or have been trying solve problem. checked website extensively, including tutorials find, , bought book. posted have had no luck. have more info help. have map in filemaker database. works fine, except 1 thing change. when roll on each marker see label show customers name, instead of static "marker 1", "marker 2", etc. included link dropbox has html, markersarray custom function , info that's passed html may needed. through trial , terror , can't figure out how make happen. or guidance appreciated. steve https://dl.dropboxusercontent.com/u/71328624/googlemapsdocs/html.txt https://dl.dropboxusercontent.com/u/71328624/googlemapsdocs/ss1geo.png instantiate variable calculates company name inside of loop. replace "marker" +i variable.

performance - Adding button to controlgroup dynamically on every list item takes too long jquery mobile -

Image
i quite new jquery mobile might trivial question. fact documentation not centralized jquery mobile making me post on stackoverflow. currently, trying load listview , every item of listview has following structure. options button controlgroup button variable number of buttons below it, again received json. currently there 250 objects , obtained server on 85 kb json. due dynamic nature of content caching data bit tricky. i running problem wherein taking 15 seconds load page. find out reason causing added timestamp values within loops create list items dynamically. interestingly main bottleneck - upto 12 out of 14 seconds taken while creating html controlgroup. here image of options button give idea html i keen know why rendering dynamic control groups on list items causing delay. not know how cache controlgroup since, grouped buttons dynamic , received json. < i forward feedback on this, thanks rajat edit code snippet added. use routine generate every list

ajax cascading dropdown not working -

i using ajax toolkit 4.5. have use cascading dropdown in project. tried this- <asp:dropdownlist id="dropdownlist1" runat="server" width="126px"></asp:dropdownlist> <asp:cascadingdropdown id="cascadingdropdown1" targetcontrolid="dropdownlist1" category="country" runat="server" usecontextkey="true" prompttext="select" servicemethod="getcountry" servicepath="~/ajaxservice.asmx" ></asp:cascadingdropdown> and web service code is- public cascadingdropdownnamevalue[] getcountry(string knowncategoryvalues, string category) { ajaxdatacontext db = new ajaxdatacontext(); var list = db.countries.select(con => new {con.country1,con.id }).distinct(); list<cascadingdropdownnamevalue> values = new list<cascadingdropdownnamevalue>(); foreach (var data in list) { values.add(new cascad

html - JQM, CSS: How to change disabled fields css? -

Image
i have simple jquery mobile form have textfields disabled or enabled depending on conditions. normal enabled textfield looks this: and disabled looks that: i'd make text in disabled field bit more readable. how can this? html <asp:label id="lblcitypostal" associatedcontrolid="txtcitypostal" runat="server" text="city"></asp:label> <div class="clear"> </div> <asp:textbox id="txtcitypostal" runat="server"> solution as suggested below i'm using following css: input.regtxt:disabled { font-weight:bold; } i've added cssclass="regtxt" text fields. use :disabled selector. example: input:disabled { color: #444; border: 1px solid #888; } see fiddle demo: http://jsfiddle.net/a9cn8/ all notable modern browser support :disabled , internet explorer 8 , below out of luck: for browsers cannot chang

linux - Error with sed option -

i have created script in script have variable ... line 1 ... ... line 2 ... num_ligne_pop3_server_name=15 ... line 4 ... i execute command: pop3_server_name=$( sed -n '$num_ligne_pop3_server_names/.* = //p' /applis/diapason/$rep_install/conf/mail/$fic_file_manager) i have error: sed: -e expression n°1, caractère 8: commande inconnue: `/' try using double quotes allow variable substitution, , using braces env var name. pop3_server_name=$( sed -n "${num_ligne_pop3_server_name}s/.* = //p" /applis/diapason/$rep_install/conf/mail/$fic_file_manager) ^ ^ ^ ^

Typecast from Enthoughts traits to python native objects -

this seems trivial task, still not find solution. when using api of enthought.traits , working data types (e.g. integer int), how can typecast these values native python objects within hastraits class. example: from traits.api import hastraits, int, list class traitsclass(hastraits): test = int(10) channel = list(range(0,test)) # fails range expects integers i tried following within class, both yielding errors test_int = int(test) test_int = test.get_value() someone having quick hint me? lot. this answer revised question. initializing list trait @ class declaration time fails because, @ stage, test still trait instance. value need created @ time class instantiated (see previous answer). instead, should use default initializer channel : in [22]: traits.api import hastraits, int, list in [24]: class traitsclass(hastraits): test = int(10) channel = list def _channel_default(self): return range(0, self.test) ....

javascript - Comma-separated jQuery selectors performance -

please advise way using selectors in jquery faster: $('.class1, .class2').html(''); or $('.class1').html(''); $('.class2').html(''); in terms performance seems same (7-8%), in terms of maintainability first method better since there no duplication of code

javascript - Determine if geolocation is supported by browser and if WiFi is on -

how can check in javascript if client using browser capable of geolocation , has wifi turned on (otherwise geolocation doesn't work). how can done? you can check if geolocation available navigator.geolocation . cannot detect wifi connection: how check connection type (wifi/lan/wwan) using html5/javascript? how detect 3g vs. wifi connection on mobile safari?

In-built method to deselect child nodes of a node in ExtJs 4 tree panel -

Image
i using extjs tree panel. there in-build method or property deselect child nodes of node when select node. so consider below image, assuming nodes in yellow color selected. if select 1.1 now, system should automatically deselect 1.1.2 & if selected node 1, should deselect 1.1.2, .1.2.1, 1.2.2. please provide suggestions ext.create('ext.tree.panel', { title: 'simple tree', renderto: ext.getbody(), width: 400, height: 400, store: { root: { expanded: true, children: [{ text: "1 detention", expanded: true, "checked": false, children: [{ text: '1.1 foo', leaf: true, "checked": false }, { text: '1.2 bar', leaf: true, "checked": false }]

solrj - solr 4.4 multiple datasource connection -

in db-data-config.xml have configured 2 datasource, each parameter name, example: <datasource name="test1" type="jdbcdatasource" driver="com.mysql.jdbc.driver" url="jdbc:mysql://localhost/firstdb" user="username1" password="psw1"/> <datasource name="test2" type="jdbcdatasource" driver="com.mysql.jdbc.driver" url="jdbc:mysql://localhost/seconddb" user="username2" password="psw2"/> <document name="content"> <entity name="news" datasource="test1" query="select..."> <field column="otype_id" name="otypeid" /> <field column="nws_id" name="cntid" /> .... </entity> <entity name="news_update" datasource="test2" query=&quo

php - How can I understand the download is completed? -

i wrote simple download system php, should store size of downloaded files database can calculate bandwidth usage of user later, code : <?php $filename = _files_paths."/".$_get['file']; $type = getfiledata($filename); // wrote function return file type $size = filesize($filename); mysql_query("insert download_logs (user_id,filename,filesize) values (".$_session['user_id'].", '".$_get['file']."', '".$size."'"); header("content-type: ".$type); header("content-length: ".$size); header("content-disposition: attachment;filename=".$_get['file']); echo file_get_contents($filename); ?> this code work without problem, maybe user cancel download operation before completion, store file size in database. how can store downloaded bytes in database or if impossible, how can store file size after download completed ?

php - Wordpress: Show extra sidebar widgets based on size of adjoining content? -

i'd able show or hide content in sidebar based on height of adjoining content div, i'm not sure if/how can done. for example, on blog page of current project ( http://djryanmcnally.pixelworx.it/?page_id=18 ) have 2 widgets in sidebar (one latest tweets, , 1 latest music news) however, can see on page, content of blog posts (all test posts...) longer height of 2 widgets, , of course, larger more posts added. leaves amount of blank space below last widget in sidebar, fill based on height of adjoining #content div. suppose, example, wanted put sidebar other content divs, such #latest-pics , #latest-mixes , #latest-events if adjoining content large enough create space them, how that? i thought using inline styling variables, such as: (pseudocode) $i = #content(height); if $i > 500px { $display1 = 'inline' } else { $display1 = 'none' } elseif $i > 1000px { $display2 = 'inline' } else { $display2 = 'none' } elseif $i &

c - Changing code to make it parallel -

#include <conf.h> #include <kernel.h> #include <stdio.h> #define max_items 50 typedef long double ld; int run_solve_equ(); void xmain(){ int pid; pid = create(run_solve_equ, 20*initstk, initprio, "b", 0); resume(pid); } int solve_equ(ld b, int n, ld a[], int choosen[] ){ if ( n == 1 ) if (a[0] == b) { choosen[0] = 1; return 1; } /* if */ else if (b == 0) { choosen[0] = 0; return 1; } /* else if*/ else { choosen[0] = 0; return 0; } else /* n > 1 */ if (solve_equ(b, n-1, a, choosen)) { choosen[n-1] = 0; return 1; } /* if */ else if (solve_equ(b - a[n-1],n-1, a, choosen)) { choosen[n-1] = 1; return 1; } /* else if */ else{ choosen[n-1]

c# - Is it possible to access a property from the control's view model from a listview item template? -

i creating feature navigate through menu items given breadcrumbs go back. in order create in windows 8 app, generating collection of items , adding on collection navigate through menu. the xaml code displaying breadcrumbs is: <listview verticalalignment="top" horizontalalignment="left" margin="120,60,0,0" itemssource="{binding parents}"> <listview.itemspanel> <itemspaneltemplate> <stackpanel orientation="horizontal"/> </itemspaneltemplate> </listview.itemspanel> <listview.itemtemplate> <datatemplate> <stackpanel orientation="horizontal"> <textblock text=">>" /> <button content="{binding name}" command="{binding opencommand}" commandparameter="{binding}" /> </stackpanel>

python - find sequence in non tab delimited file -

today encountered again problem. i have file looking like: file a >chr1 acgactgactgtcgatcgatcgatgctcgatgctcgacgatcgtgctcgatc >chr2 gtgacgcacacgtgctagcgctgatcgatcgtagctcagtcag >chr3 cagtcgtcgatcgtcgatcgtcg and on (basicly fasta file). in other file have nice tab delimited informations read: file b chr2 0 * 2s3m5i2m1d3m * cactttttgtcta nm:i:6 both files huge i want write needs done, part have problem with: if filed chr2 file b matches line >chr2 in file a, cactttttgtcta (fileb) in sequence of file (only in sequence in >chr2 region. next >chr different chromosome don't want search there). to simplify let's : cacacgtgctag sequence in file a i trying using dictionary file a, it's not feasible. any suggestions? something like: for req in fileb: (tag, pattern) = parseb(req) tag_matched = false filea = open(file_a_name) line in filea: if line.startswith('>'): tag_matched = line[1:].s

html5 - Problems removing registry localStorage -

i'm trying delete record localstorage , not work. i have html button id localstorage have remove: <input type='button' onclick='eliminardato(this.id)' id=' "+ dato_clave + "' value='eliminar' /> then, have function id(clicked_id) correctly received. function eliminardato(clicked_id) { if(confirm('¿desea eliminar el favorito seleccionado?')) { localstorage.removeitem(clicked_id); } } but record not deleted!. doing wrong?. if replace localstorage.removeitem(clicked_id); localstorage.removeitem('m1'); removed. may quotes? :s thanks, daniela. found it. don't blame being confused this! id=' "+ dato_clave + "' your problem space on line. remove space directly after single-quote, , id "m1" instead of " m1" (what trying remove). feel there should sort of action can take prevent issues later on, maybe you&#

c# - Lightening the users accent colour -

for feature in app retrieve accent colour of user, lighten amount, give paler version of theme colour use within app. does know how achieve this? thanks. place following in app.xaml.cs private void setaccentresources() { var accent = (color)current.resources["phoneaccentcolor"]; var accent80 = accent; var accent60 = accent; var accent40 = accent; var accent20 = accent; accent80.a = (byte)(accent.a * 0.8); accent60.a = (byte)(accent.a * 0.6); accent40.a = (byte)(accent.a * 0.4); accent20.a = (byte)(accent.a * 0.2); resources.add("phoneaccentfullcolor", new solidcolorbrush(accent)); resources.add("phoneaccent80color", new solidcolorbrush(accent80)); resources.add("phoneaccent60color", new solidcolorbrush(accent60)); resources.add("phoneaccent40color", new solidcolorbrush(accent40)); resources.add("phoneaccent20color", new solidcolorbrush(accent20)); }

WebView in Android - invisible but not null -

if change visibility invisible webview, webpage still there? or close webview page & reload when it's visible? want webpage still there invisible. if invisible, still there. not have reload when becomes visible. invisible make invisible, still take layout space. gone make invisible, , not take layout space. neither should make page reload when become visible again.

paypal - Generating Authentication Header -

is there way generate authentication header third party through not using paypal sdk. have gotten access token , secret. these have been through curl requests have been straightforward me. there anyway this? in addition, generate header need api signature of third party? how this? thank help. for else looking node.js solution paypal x-paypal-authorization header values, wrote this: function paypalurlencoder(s) { var hex = "0123456789abcdef"; var untouched = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz1234567890_"; var result = s.split('').map(function(c){ if (untouched.indexof(c)>=0) { return c; } else if (c==' ') { return "+"; } else { // needs converting hex var code = c.charcodeat(0); return "%" + hex.charat((code & 0xf0) >> 4) + hex.charat(code & 0xf); } }); return resul

java - Confirm Browser Exit in GWT -

this question has answer here: execute code on window close in gwt 2 answers i want display confirmation dialog when users tries leave gwt application. if user chooses stay in app, nothing done otherwise application should first send logout request server before closing. how can that? which handler use? window.addclosehandler or window.addwindowclosinghandler based on methods has , addwindowclosinghandler seems need. edit: think need is... addwindowclosinghandler called when window closing, i.e. when user clicks close or reload button. addclosehandler called when window closes. use both ! use closing handler display confirmation dialog, use close handler stuff want on close. window.addwindowclosinghandler(new window.closinghandler() { @override public void onwindowclosing(closingevent event) { event.se

c++ - catch cancel click nsis installer from shellexecuteex -

hi trying run installer using shellexecuteex c++ application. able make installer run. if click cancel on nsis installer anytime how catch c++ application , print installation failed. i tried this if((uint)shexecinfo.hinstapp <= se_err_ddetimeout ) { fprintf(fp, "failed start installer \n"); exit(-1); } but no luck, tried print whats in shexecinfo.hinstapp , result number 42. ideas? hinstapp holds error (if any) occurred during start up. has nothing application closing. you want @ exit code of installer process getexitcodeprocess , stored in shexecinfo.hprocess if set see_mask_nocloseprocess flag in shexecinfo.fmask . you'll have check nsis documentation exit code returned when user hits cancel.

excel - Groovy POI created cells considered blank by other programs until ENTER is manually pressed in cells -

ok kind of hard explain. i create cell in worksheet using java poi newcell= row.getcell(index) if (containercell == null) { containercell = row.createcell(index) } newcell.setcelltype(hssfcell.cell_type_string) newcell.setcellvalue(strvar) if open worksheet in excel, see cell value indeed set. if load external program reads excel sheets, claims cell set blank. now, if go excel , simple "hit return" on cell in question, in formula bar (even though not formula) , try reload external program, works fine. need evaluate formula on string? thanks i have no experience java, having hit enter in cell indicative of calculation being set manual. since working api may treating input java formula (?). open offending workbook in broken state, , on sheet having problems choose [formulas] tab @ top, [calculation]>calculate sheet. if updates value see 2 options... see if there option manually calculate sheet poi, after value has been ente

How to SUM of SUMS of fields with same value in MYSQL -

i have these table: need "sum" values same key1 & key2 when key3 = x | key1 | value1 | key2 | value2 | key3 | | 1 | 9 | 2 | 2 | x | | 1 | 10 | 2 | 3 | x | | 2 | 5 | 1 | 8 | x | | 2 | 5 | 1 | 9 | y | select key1 k1, key2 k2 table1 key3 = x for each result of these query need do: select coalesce(sum(case when key1 = k1 totalamount1 else 0 end),0) + coalesce(sum(case when key2 = k2 totalamount2 else 0 end),0) total table1 key3 = x y need these output: total id 1: 27 id 2: 10 how can join thes 2 query? thanks! here's 1 way result: select if(i.i,t.key1,t.key2) `id` , sum(if(i.i,t.value1,t.value2)) `total` table1 t cross join (select 0 union select 1) t.key3 = 'x' group if(i.i,t.key1,t.key2) sql fiddle demo here: http://sqlfiddle.com/#!2/d7599f/1 the "trick" used 2 sets of rows, performing cross join of table1 s

python - Write to file with nccurses -

i'm attempting create menu system ncurses configure ip address of ubuntu box. i've taken example found here: http://tuxradar.com/content/code-project-build-ncurses-ui-python the program prompts information, run issues when attempting write /etc/network/interfaces. code snippet screen.addstr(4, 4, "1 - configure static ip address") ..... staticip = get_param("enter ip address") system("echo 'address ' + staticip >> /etc/network/interfaces") this writing file, it's writing literal text without using value of variable. address staticip the last line "execute_cmd", discovered "system" seems same thing without prompting after each line executed. i'm python/ncurses newb...and pro tips out there appreciated! if there's better option, i'm open well...not tied ncurses. thanks! you have command wrongly escaped. should read: system("echo 'address '" + s

php - Highcharts - dual-axes column chart not rendering the way it was a week ago -

i have created duel-axes column chart, columns side side, , working great until yesterday. yesterday, started rendering stacked column graph instead of columns showing side side. after checking highcharts examples on website, realized theirs rendering way now. any thoughts on how columns side side again? here image of see in ff , chrome: here js highcharts.com ( http://jsfiddle.net/d4gfs/ ): $('#container').highcharts({ chart: { zoomtype: 'xy' }, title: { text: 'average monthly temperature , rainfall in tokyo' }, subtitle: { text: 'source: worldclimate.com' }, xaxis: [{ categories: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'] }], yaxis: [{ // primary yaxis l

serialization - Rails serialized integer attribute in params, but not saving into model instance -

so have following model contains serialized integer attribute rake file: class createcompanyassetstats < activerecord::migration def change create_table :company_asset_stats |t| t.integer :companyid t.string :geo t.integer :assettype t.date :starttime t.date :endtime t.timestamps end end end model: serialize :companyid, array serialize :assettype, array serialize :geo, array in view have form have multiselect dropdown stores value(s) params: <div class="dropdown" data-init="dropdown"> <button >multi select</button> <select name="company_asset_stats[companyid][]" multiple> <% allfieldvalues('company', 'companyname', 'company').each |value| %> <option value=<%= value[1] %>><%= value[0] %></option> <% end %> </select> </div> the resulting param in following for

ruby - Manually upload and save files in Carrierwave -

i have directory of existing files need migrate rails app part of legacy migration. need upload these files manually , save new record them in database. haven't quite found proper way this. have following in rake task: @attachments.each |attachment| begin new_attachment = attachment.new @attachment_file_path = "/home/username/attachments/" + attachment.filename file = file.open(@attachment_file_path) new_attachment[:file] = new_attachment.file.store!(file) # map old record fields new new_attachment.attributes = { :project_id => attachment.projectid, :name => attachment.description, :user_id => attachment.userid, :created_at => attachment.createddate, :updated_at => attachment.lastmodifieddate } new_attachment.save! puts "attachment added " rescue => error puts "error migrating attachment: #{error}" end end attachment.rb class attachmen

android - what adapters should i use for listfragment and what class they should extend -

first of newbie.i developing app has viewpager , fragments in it,but later decided put lists in fragments had change them listfragments had change adpaters bit,and not working , totally confused adapter should extend what. initially had viewpager adapter extends fragmentpageadapter(should extend kind of listfragment pageadapter) and have customadapter extends base adapter(custom adapter because want custom listview in fragments). thanx in advance. listview (and extension listfragment ) doesn't care adapter long conforms listadapter interface, yours if extends baseadapter . there other adapter implementations in sdk simple use cases, can explore them on own or @ apidemos sample application. similarly, viewpager cares provide extends pageradapter , fragmentpageradapter does.

math - Android getOrientation Azimuth gets polluted when phone is tilted -

i'm having annoying problem ar view acting compass. when hold phone in portrait (so screen pointing face), call remapcoordinatesystem pitch 0 when holding portrait. azimuth (compass functionality) perfect, tilt phone azimuth gets ruined, if bend forward azimuth increases , if bend backwards decreases. i use 2 sensors readings, sensor.type_magnetic_field , sensor.type_gravity . i use lowpassfilter pretty basic, it's implemented alpha constant , used directly on read values sensors. here code: float[] rotationmatrix = new float[9]; sensormanager.getrotationmatrix(rotationmatrix, null, gravitymetervalues, magnetometervalues); float[] remappedrotationmatrix = new float[9]; sensormanager.remapcoordinatesystem(rotationmatrix, sensormanager.axis_x, sensormanager.axis_z, remappedrotationmatrix); float results[] = new float[3]; sensormanager.getorientation(remappedrotationmatrix, results); float azimuth = (float) (results[0] * 180 / math.pi); if (azimuth <

How to clear class without setTimeout in jQuery -

i'm trying bind every click on "body" little animation under cursor: http://jsfiddle.net/nippon/parr3/ var timeouthandle = settimeout(function(){ $(".click").removeclass("clickon"); }, 1000); $('html').click(function(e){ e.preventdefault(); $(".click").addclass("clickon"); cleartimeout(timeouthandle); settimeout(function(){ $(".click").removeclass("clickon"); }, 1000); }); the problem don't know how addclass , remove on same click. i'm using settimeout , it's working slow clicks , no double clicks. when start clicking mad man animation going hell. can me clean mess i've made , make smooth/double-click-proof? i took different approach. created new element each click. here 2 options: http://jsfiddle.net/kxjkk/ $(document).bind('mousemove', function (e) { $('#clickwrapper').css({ left: e.pagex - 20, top: e.p

c# - How to animate rectangle frames? -

so have image 2 frames , want put rectangle.this image animate it's frames , loop them - 1st frame, 2nd frame. here's code: //create image texture2d image; //load, draw , update image in rectangle //load contnet protected override void loadcontent() { // todo: use this.content load game content here image = content.load<texture2d>("image"); } protected override void update(gametime gametime) { //don't know write here, should make frames loop } protected override void draw(gametime gametime) { //begin drawing image spritebatch.begin(); spritebatch.draw(image, new rectangle(244, 536, 32, 32), color.white) spritebatch.end(); } can tell me how fill in update method? added these variables above public game1() : //sprite texture texture2d texture; //a timer variable float timer = 0f; //the interval (300 milliseconds) float interval = 300f; //current frame holder (start @ 1)

Optimistic locking in vaadin and mysql db -

the vaadin book says can set column optimistic locking follows: tq.setversioncolumn("optlock"); however says that: tablequery assumes database take care of updating version column either using actual version column (if supported database in question) or trigger or similar mechanism how take care of updating version column in database? any appreciated if using jpa or implementation should able annotate beans with: @version private long version; so every time persist bean version number increased 1 automatically. in case bean has lower/different version number during persisting means changed in meantime , jpa throws optimistic locking exception.

c# 4.0 - c# send pdf file from web service -

i new c# , have web service generates pdf file containing barcode(using datamatrix). want send pdf file on client byte[] the web service contract follows: [webinvoke(method="get", responseformat = webmessageformat.json, bodystyle = webmessagebodystyle.bare ,uritemplate = "/mymethod?param1={param1}&param2={param2}")] byte[] mymethod(string param1, string param2) at client side, read response memory stream , convert array , write file. memorystream ms = new memorystream(); httpwebrequest request = (httpwebrequest)webrequest.create(url); request.getresponse().getresponsestream().copyto(ms); byte[] responsebytes = ms.toarray(); httpcontext.current.response.outputstream.write(responsebytes, 0, responsebytes.length); the data written file [37,80,25,....] actual byte[] sent web service. i have gone through many answers here not figure out how actual bytes @ client side. appreciated. i figured out answer myself. i used memory stream @ server

java - Oracle type DATE -

i have field type date in database table i need select information date range: select to_char(log_hour, ' dd/mm/yy hh24') log_hourly_page page_counts to_char(log_hour, 'dd/mm/yy') = '25/06/13' order log_hour desc; and getting right results (many records each hour) 25/06/13 23 25/06/13 23 25/06/13 23 25/06/13 22 ........... 25/06/13 04 25/06/13 04 25/06/13 00 25/06/13 00 but when run select to_char(log_hour, ' dd/mm/yy hh24') log_hourly_page page_counts log_hour = '25-jun-2013' order log_hour desc; i 0 hour, 25/06/13 00 25/06/13 00 25/06/13 00 25/06/13 00 ............. 25/06/13 00 25/06/13 00 25/06/13 00 why second query works way? testing query since pass java.util.date object date , returns wrong data, 00 hour. there time component date specified in way in oracle: '25-jun-2013' and time component 0 (midnight), , hour 0, matches specific point in time, , not whole day. to ent

c - Why does this code produce an incomplete IP address? -

i reading buffer socket (af_packet, sock_dgram, htons(eth_p_arp)) following code. using arp_frame struct access component parts of contained arp reply. inet_ntoa() returns correct first octet of ip other octets 0 producing 172.0.0.0. question 1 why might happen? question 2 how can print r bytes of msg buffer hex in host byte order debug packet? unsigned char msg[65535]; struct ether_arp *arp_frame = (struct ether_arp *)msg; while ((r = recv(sock, msg, sizeof(msg), 0))) { // skip it's not arp reply if (ntohs(arp_frame->arp_op) != arpop_reply) continue; (i = 0; < sonos_prefix_num; i++) { if (!memcmp(sonos_prefixes[i], arp_frame->arp_sha, 3)) { struct in_addr addr; addr.s_addr = *arp_frame->arp_spa; printf("blah: %lu\n", ntohl(*arp_frame->arp_spa)); pri

ios - How to send error in signal chain -

i have signal contains integer values. value of -1 indicates invalid result, i'd to, instead of passing -1 along value, send error. way subscribes b receive valid integers through subscribenext: , errors through subscribeerror:. i think know how racsubject: racsequence *a = [@[ @(2), @(6), @(5), @(-1), @(4) ] rac_sequence]; racsubject *b = [racsubject subject]; [a subscribenext:^(nsnumber *val) { if ( [val integervalue] == -1 ) { [b senderror:[nserror errorwithdomain:@"mydomain" code:0 userinfo:nil]]; } else { [b sendnext:val]; } } error:^(nserror *error) { [b senderror:error]; } completed:^{ [b sendcompleted]; }]; i'm wondering if there's more "inline" way along lines of: racsequence *a = [@[ @(2), @(6), @(5), @(-1), @(4) ] rac_sequence]; racsignal *b = [a filter:^bool(id val) { if ( [val integervalue] == -1 ) { //fixme: send error b's subscriber(s) return no; } else {

How uncheck in change on RTC? -

i've accidentally checked in changes in change set , don't want deliver them. how move change pending changeset unresolved changes in rtc? the usual option " discard ", remove changes (it remains in repository, not listed in folder, feels changes vanished). what is: backup first files (somewhere outside sandbox or local workspace) discard copy files in sandbox refresh sandbox. the page mentions tip: to make easier retrieve discarded change set not exist in other stream or workspace, can associate work item before discard , accept work item later.

jquery - Mapping key/value with javascript -

is there way map keys , values ​​in array using javascript? in opinion, similar jquery .map() , instead of mapping value, "maps" keys. suppose have following array: var names = [ 1, 2, 3, 4, 5 ]; and use function called numbertoname() created , generate array this, , result should this: var names = { "one": 1, "two": 2, "three": 3, "four": 4, "five": 5 }; currently use following method: var names = [ 1, 2, 3, 4, 5 ], names_tmp = {}, names_i = 0, names_len = names.length; for(; names_i < names_len; names_i++) { names_tmp[numbertoname(names[names_i])] = names[names_i]; } the question is: there way (preferably native) improve method? use jquery without problems. perhaps function similar this: var names = jquery.mapkeys([ 1, 2, 3, 4, 5], function(k, v) { return { key: numbertoname(v), value: v }; }); you're looking reduce : var names = [1, 2, 3, 4, 5].reduce(function(obj,

sql update - PHP+MySQL website (localhost) working with netbeans xdebug, but NOT ALONE -

okay, may sound off-topic, want know if have had similar experience , if found problem/solution. sorry post has grown more self try-and-error raportting, cause no 1 have answered. have added status updates of problem solving in bottom of question. for moment problem seems database update query. i'm developing php+mysql website on netbeans 7.3. + xampp. working fine. no suddenly log-in form (suppose save $_session variables , redirect page) is not working . strange thing when debug netbeans + xdebug goes fine . session variables set , page forwarded correctly. question: faced similar problem? has idea going wrong? i can suppose in system set differently when run xdebug. (but exact(?) same log-in working fine few days ago). i have tried lot of things (many many hours of them don't come mind now). tried move page on remote server , same behavior continues. (if want more info ask , i'll edit.) hope has ideas! edit: think has php-session variables. reali