Posts

Showing posts from July, 2015

c++ - Hang on CreateService when windows is starting -

i register program windows service. when reboot windows, service start_pending forever. after traced, found hung on createservice function. hservice=createservice( hscmanager, pszdrivername, pszdrivername, service_all_access, service_kernel_driver, service_demand_start, service_error_normal, pszdriverpath, null, null, null, null, null); i can resolve problem creating service before rebooting, want know hang happened. have idea? if remember well, services must created once. don't have call createservice function again ever ! , wouldn't recommend create while in windows boot process. as can see in following msdn example, have star...

javascript - Is it possible to save all field information when the user closes his browser? -

e.g. writing article accidently closes browser. possible save wrote? something this: onexit -> information user filled -> ajax request saves information in database. or is possible preemptively saving every x second? my company running ajax query save every 5 seconds, should localstorage saving on client, use onunload save , recover later. i made html5 notepad stores localstorage every onchange event , every 500ms , onbeforeunload save 1 field, easy modify, here's (essential) code: <textarea placeholder="type here, see here..." id="notepad"></textarea> <script> var n = document.getelementbyid("notepad"); /* save */ var s = function(){localstorage.setitem("notepad", n.value);} /* retrieve (only on page load) */ if(window.localstorage){ n.value = localstorage.getitem("notepad");} /* autosave onchange , every 500ms , when close window */ n.onchange = s(...

Recommendation for database for a search engine -

i writing search engine looking database store crawled datas used urldatabase , data store. it should disk based not memory based java preferable because application in java can embedded it. salable preferred linux , windows. take @ hadoop , hbase http://hadoop.apache.org/ http://hbase.apache.org/

wpf - Clipping from left rather than right when there isn't enough room for a child element? -

i have grid 3 columns of width *, auto, *. when collapse grid width using expander, want central column remain fixed size. want right hand column begin clipping right hand edge. default behaviour, , works fine. however, first column clip left-hand side. say, i'd left-hand edge of column become hidden first. left-hand column, clipping right-hand edge. hope i've explained enough! thanks you need set horizontalalignment="right" , ="left" appropriately. here's example, may not match requirements exactly, clips left , right require: <grid> <grid.columndefinitions> <columndefinition width="*"/> <columndefinition width="auto"/> <columndefinition width="*"/> <columndefinition width="auto"/> <columndefinition width="auto"/> </grid.columndefinitions> <textblock grid.column="0...

c++ - Properly print utf8 characters in windows console -

this way try it: #include <stdio.h> #include <windows.h> using namespace std; int main() { setconsoleoutputcp(cp_utf8); //german chars won't appear char const* text = "aäbcdefghijklmnoöpqrsßtuüvwxyz"; int len = multibytetowidechar(cp_utf8, 0, text, -1, 0, 0); wchar_t *unicode_text = new wchar_t[len]; multibytetowidechar(cp_utf8, 0, text, -1, unicode_text, len); wprintf(l"%s", unicode_text); } and effect ascii chars displayed. no errors shown. source file encoded in utf8. so, i'm doing wrong here ? to wouterh: int main() { setconsoleoutputcp(cp_utf8); const wchar_t *unicode_text = l"aäbcdefghijklmnoöpqrsßtuüvwxyz"; wprintf(l"%s", unicode_text); } this doesn't work. effect same. font of course lucida console. third take: #include <stdio.h> #define _win32_winnt 0x05010300 #include <windows.h> #define _o_u16text 0x20000 #include <fcntl.h> using namespace std; int...

image viewer - ImageViewer in WPF -

hi implement imageviewer (like 1 in facebook example) in wpf application i have listbox whith pictures, works well. add pop "image full size" when user double click on 1 of them. (something in fb, fade out of background etc). i'm thinking of use window...do have better idea of should use ? you use popup control . it comes some built in (but limited) animations, fade , see popupanimation. i'd try , if doesn't fit needs, second bflosabre91 oppionion , use separate opacity animated window. but bear in mind additional window have negative side effects e.g sync window positions correctly, handle task switches (ie. correctly hide window in taskbar/tasklist)

android softkeyboard - To Hide soft keyboard or virtual keyboard on loading the fragment -

there 2 edit text boxes in fragment.whenever fragment loaded activity soft-keyboard appears on screen covering half of tablet screen.i want hide soft keyboard whenever fragment loaded activity.the soft-keyboard should appear on clicking or tapping edit text boxes. padma's comment prevent soft keyboard ever coming in application, doesn't sound want since have edittext's need input somewhere. you close soft keyboard whichever edittext on view when it's loading: inputmethodmanager imm = (inputmethodmanager)getsystemservice(context.input_method_service); imm.hidesoftinputfromwindow(findviewbyid(r.id.your_edit_text).getwindowtoken(), 0);

mysql - How do I select the longest 'string' from a table when grouping -

example: select partnumber, manufacturer, condition, sum(qty), avg(price), description parts [something] group partnumber, manufacturer, condition i have descriptions blank, , there can many partnumber, manufacturer, condition values, , on group seems take first description available, can blank. id longest description available. i tried this: max(length(description)) however returns number of characters in string. possible im trying in mysql? try order length(description) desc , use limit 1 largest.

Migrate iOS app to Android machine architecture -

i'm migrating ios 5.0 application android 2.3.3. this ios app has encryption algorithm use uint32_t variables. i've found on stdin.h: #ifndef _uint32_t #define _uint32_t typedef unsigned int uint32_t; #endif /* _uint32_t */ uint32_t unsigned int in objective-c, equivalent in java long . correct? my question is: does int, char, long, etc. objective-c types have same memory representation on android? no. android (which java) not have unsigned variable types. so if need store c unsigned 32bit integer you'll need use long in java 64 bits (so able store full precision of uint32). any signed representation, instead, have same memory layout (but i'm not sure endianness, should check own). this true unless choose use c/c++ in android , skip java (which can done you'll need bridge api calls java jni in case). to solve similar issues found library, called javolution able provide implementation c structs maintaining same layout, tak...

How to add ADs banners in android application without using AdMob, AdSense, etc -

i wanna add ads banners applications without using ad sdk admob, adsense, etc. possible use custom banner custom code?. if has example please post in answer. thank very much! i'm pretty sure can make layout act banner ad , include within other layouts , add onclick function banner. or i use admob ads. admob has "in-house ads" can run ads in app free. can choose them display exclusively , use admob track statistics ads being clicked , how being displayed. http://support.google.com/admob/bin/answer.py?hl=en&answer=1619751

how to display a button on a website using jquery in making firefox plugin -

Image
the button position http://ft.trillian.im/bharris007/68advvaxg-ouhhoj6dcv.png after clicking on button http://ft.trillian.im/bharris007/68adzrxcg-m58h2naphh.png so when press button should popup in style shown.i think can jquery.secondly should appear permanently on gmail account once have installed it.just http://www.rightinbox.com/ .thanks in advance bulding html in firefox add-on quite challenge. can't use innerhtml. many alternatives check out these 2 articles on mdn: for nice solution: appendix e: dom building , html insertion for straight one: how create dom tree you should inspect styles gmail using, , replicate that, did on youtube, nice: as appending event it, can use addeventlistener or bind (if want use jquery). can't provide full code here, because take space, it's work , it's work have do, if want achieve anything.

javascript - How can I alter the colour of a html5 canvas element using jquery? -

basically have several canvas drawings on page want happen when jquery function activated canvas drawings change colour of choosing. assume involves way of accessing context.fillstyle defines original colour unsure how alter it. in addition, possible instead give canvas drawing css style in first instance , change style when jquery processed? html <canvas class="canvaslink" id="canvasid" width="50" height="50"></canvas> <canvas class="canvaslink" id="canvasid2" width="50" height="50"></canvas> canvas script <script> function drawsomething(canvas) { var context = canvas.getcontext("2d"); var width = 125; // triangle width var height = 45; // triangle height var padding = 5; // draw path context.beginpath(); context.moveto(padding + width-125, height + padding); // top corner context.lineto(padding + width-90,height-17 + padding); // point conte...

CSS padding shorthand confusion -

padding:45px 65px 95px; why shorthand above set left padding 65px when value left padding not given? this little confusing me. it indeed confusing, it's css works. if specify 1 value, used 4 sides. if specify two, first top/bottom padding , second left/right . when specifying three, goes top, left/right, bottom , echoing usage when 2 values provided.

How to get Duration of captured video in android? -

using below code captured video,but how duration of captured video in android ? , when user discard video , record new video duration of new video . intent cameraintent = new intent( android.provider.mediastore.action_video_capture); startactivityforresult(cameraintent, take_video); using cursor can duration , there duration column in cursor , can string. cursor cursor = mediastore.video.query(getcontentresolver(),data.getdata(), new string[] { mediastore.video.videocolumns.duration }); system.out.println(">>>>>>>>>>"+cursor.getcount()); cursor.movetofirst(); string duration = cursor.getstring(cursor.getcolumnindex("duration"));

javascript - Clock in different time zones -

i trying create 2 clocks on website says 2 times on it. 1 london , other new york. i have been able create clock reads current time on computer i'm not sure how place time zone this. the code have far is: <script type="text/javascript" language="javascript"> function rendertime() { var currenttime = new date(); var diem = "am"; var h = currenttime.gethours(); var m = currenttime.getminutes(); var s = currenttime.getseconds(); if (h == 0) { h = 12 } else if (h > 12) { h = h - 12; diem = "pm"; } if (h < 10) { h = "0" + h; } if (m < 10) { m = "0" + m; } if (s < 10) { s = "0" + s; } var myclock = document.getelementbyid ("clockdisplay"); myclock.textcontent = h + ":" + m + ":" + s + " " + diem; settimeout ('rendertime()',...

Not printing string from struct in C -

having problem print strings structs in c... typedef struct box{ char *ref_or_sys; int num, x, y, w, h, o; }box; sscanf(str, "%s %d %d %d %d %d %d", &label, &refnum, &x, &y, &w, &h, &o); box detect = {label, refnum, x, y, w, h, o}; printf("\nlabel %s\n", detect.ref_or_sys); //prints out string correctly //(either word ref or sys) return detect; when structure passed structure, displayed right except string.. void printbox(box detect){ printf("type: %s ref: %d x: %d y: %d w: %d h: %d o:%d\n", detect.ref_or_sys, detect.num, detect.x, detect.y, detect.w, detect.h, detect.o); } am missing simple? ref_or_sys prints out ??_? use strdup() (usually available, if not use malloc() ) copy string read label sscanf() : detect.ref_or_sys = strdup(label); as when function returns label out of scope , ref_or_sys dangling pointer. remember fre...

validate form input type file type using jquery validate plugin -

the following code: script code <script type="text/javascript"> $(document).ready(function() { $("#formelem").validate({ rules: { dimage:{ minlength:200 } }, messages: { dimage:{ required: 'please select image!' } , } }); }); </script> html code <form id="formelem" name="formelem" action="" method="post"> <input type="file" name="dimage" id="dimage" /> </form> i'm using jquery validate.js file client side validation. when create file above code it's not showing error message. how should alert error message when user not selected file? try this. $(document).ready(function() { $("#formelem").validate({ rules: { dimage:{ required: true ...

java - Diff. b/w performance results shown with Jmeter and Firebug-Net Panel -

i trying test performance of application through jmeter , found result using aggregate report reports showing low performance in comparison found using firebug-net panel. difference b/w timings shown in firebug-net panel , jmeter. have enabled caching in jmeter real scenario implemented. appreciated. different tools perform different kinds of bytecode sampling , instrumentation. find discrepancy between tools measuring performance. why should looking @ numbers magnitude wise , not literal value. pay attention magnitudes , not scalar values.

mysql - Process that was killed still on my processlist -

the thread killed still on thread list how eliminate it? +-----+------+-----------+-------------+---------+-------+-----------+------------------------------------------------------------------------------------------------------+ | id | user | host | db | command | time | state | info | +-----+------+-----------+-------------+---------+-------+-----------+------------------------------------------------------------------------------------------------------+ | 678 | root | localhost | hthtthv | killed | 36923 | query end | insert `gtgttg` values (1,'tgtg'),(2,'shopping'),(4,'tgtgtg'),( | | 695 | root | localhost | null | query | 0 | null | show processlist | +-----+------+-----------+-------------+---------+-------+-----------+-...

ehcache - Finding out what Cache Hibernate is using? -

is there fail safe way 100% sure cache hibernate using? i.e using ehcache of else? thanks. string cacheintegrationname = ( (sessionfactoryimplementor) sessionfactory ) .getsettings() .getregionfactory() .getclass() .getname(); of course hibernate logs "something". enable debug logging org.hibernate.cfg.settingsfactory logger , "cache region factory : xyz"

eclipse - Web-Service Deployment Error -

i using apache tomcat 7.0 web-service deployment , eclipse ide.i have made web service using eclipse when close eclipse , try use web service gives error while giving result stating exception: java.net.connectexception: connection refused: connect but when start eclipse , start tomcat localhost server(i.e clicking run tomcat server @ localhost) eclipse web service works fine , give result should. how use web-service without starting eclipse , starting tomcat 7.0 normally. package application war (web archive) file put in <tomcat_dir>/webapps folder. start tomcat using <tomcat_dir>/bin/startup.bat

apache - Is it possible to return HTTP response code to the browser using pl/sql? -

i working on web application written in pl/sql . uses basic authentication. there no efficient way of logging out unless close browser. using on log off page owa_util.mime_header('text/html', false, null); v_browser:= owa_util.get_cgi_env('http_user_agent'); owa_cookie.send('wdb_gateway_logout', 'yes', path=>'/'); -- close http header owa_util.status_line(401,'unauthorzed access', true); owa_util.http_header_close; is possible. i'll appreciate help. thank yes, oracle has package called utl_http , utl_url from docs : http_unauthorized constant pls_integer := 401 resp type this pl/sql record type used represent http response. syntax type resp record ( status_code pls_integer, reason_phrase varchar2(256), http_version varchar2(64), );

web applications - How to determine how MyEclipse deploys Tomcat webapp -

i given myeclipse project deploys app tomcat. deployment works fine , can run app in myeclipse ide. i prefer use intellij development. intellij has artifact , facet properties screen determine in webapp directory classes, resources, , libraries deployed. there place can find out in myeclipse it's copying parts of webapp, can recreate project in intellij? on servers view, double click tomcat server -- screen has information looking for. if servers window isn't displayed, select window / show view / servers.

Rails asset pipline and Jquery plugins issue -

i using rails jquery gem. i have following in application.js //= require jquery //= require jquery_ujs //= require_tree . do these declarations include files in order ? i using jquery pluging textareaexpander (http://www.sitepoint.com/blogs/2009/07/29/build-auto-expanding-textarea-1/) i getting js error jquery("textarea[class*=expand]").textareaexpander(); on last line of plugin below // initialize expanding textareas jquery(document).ready(function() { jquery("textarea[class*=expand]").textareaexpander(); }) i don't ? because jquery hasn't been loaded. why textareaexpander still not defined ? for reference below rest of code in plugin file. (function($) { // jquery plugin definition $.fn.textareaexpander = function(minheight, maxheight) { var hcheck = !($.browser.msie || $.browser.opera); // resize textarea function resizetextarea(e) { // event or initialize element? e = e.target || e; // find content length , box width var vlen ...

IPython run script from breakpoint or line number -

i use magic function %run often. there way run script given line number or other label? example use: edit script in editor , use %run in ipython. need modify how i'm visualizing data compute in beginning of script, don't need recompute each time. (i know can cache data in file, or refactor code; that's not answer i'm looking for.) you can take @ ipython notebook . lets write chunks of code , run them @ time on interactive namespace. here's demo

iphone - Stdout redirection not working in iOS without debugger -

i trying redirect output can send on network. reason if run code while debugger attached works perfectly. once start application in normal way code freezes on read function , never returns. if has pointers highly appreciate it. dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_low, 0), ^(void) { static int pipepair[2]; if ( pipe(pipepair) != 0) { return; } dup2(pipepair[1],stdout_fileno); while (true) { char * buffer = calloc(sizeof(char), 1024); ssize_t readcount = read(pipepair[0],buffer,1023); if (readcount > 0) { buffer[readcount] = 0; nsstring * log = [nsstring stringwithcstring:buffer encoding:nsutf8stringencoding]; //sent on network } if (readcount == -1) { return; } } }); ap...

PHP regex sytax with preg_replace -

php regex weakness of mine, still manage things done online tools. consider following: a subject string follows pattern: 1551 utc 04 june 2012 i want extract "04" , assign $day variable using below: $day = preg_replace("/^([0-9]{4})\s([a-z]{3})\s([0-9]{2})\s([a-za-z]{3,})\s([0-9]{4})$/", "$3", $weather['date']); this works on following website: http://sqa.fyicenter.com/online_test_tools/test_regular_expression_search_replace.php but can't work in script... $day equal whole subject string. the result of var_dump() string(38) "1551 utc 04 june 2012 " . has 38 chars while should 21. looks there multiple whitespaces in string. try trim() input string , replace \s \s+ support multiple whitespaces: $day = preg_replace("/^([0-9]{4})\s+([a-z]{3})\s+([0-9]{2})\s+([a-za-z]{3,})\s+([0-9]{4})$/", "$3", trim($weather['date']));

sql - Is there a way to replace a character or string in all fields without writing it for each field? -

i warn front, question borders on silly, i'm asking anyway. the impetus question creating csv query result , of fields containing commas already. obviously, csv doesn't know better , merrily jacks mood having stragglers in non-field columns. i know can write replace(fieldname, oldchar, newchar) for each field, i'm more curious if there's shortcut replace them in query output. basically i'm looking ( logically ) is: replace(allfields, oldchar, newchar) i don't know of sql tricks (or many of them), thought maybe community may able enlighten me...or call me nuts. there no sql syntax describe, you've seen there many ways dynamic sql. here's way prefer (this assumes want replace commas pipe, change see fit): declare @table nvarchar(511), @newchar nchar(1), @sql nvarchar(max); select @table = n'dbo.table_name', @newchar = n'|', -- tailor accordingly @sql = n''; ...

jQuery check element ID -

i know there plugin called .hasclass(); i have following $('#page_background, #header_background').colorpicker({... how check if page_background clicked , not header_background? this have now, won't work. $('#page_background, #header_background').colorpicker({ onsubmit: function(hsb, hex, rgb, el) { $(el).val(hex); $(el).colorpickerhide(); var id = this.id; if(id == 'page_background') $('body').css("background-color","#"+hex); }, onbeforeshow: function () { $(this).colorpickersetcolor(this.value); } }) .bind('keyup', function(){ $(this).colorpickersetcolor(this.value); }); $(function(){ $('#page_background, #header_background').click(function(){ var id = this.id; if(id == 'page_background') // page background else //header }); }); ...

events - JavaScript reference to anonymous function from inside that function -

i'm creating small canvas library in have anonymous function needs reference itself. however, don't know how this. have following incomplete code: var removedraghandler = (function (object) { return function (e) { if (typeof object["dragend"] === "function") { object["dragend"](e); } removeevent({ element: window, event: "mousemove", callback: object["drag"] }); removeevent({ element: window, event: "mouseup", callback: ????? //what here? }); }; })(object); addevent({ element: window, event: "mouseup", callback: removedraghandler }); of course replace ????? arguments.callee, doesn't work in strict mode. there other options? you can give name anonymous function. note there bug in older ie anonymous function leaks declared function in outer scope should not issue here since outer scope pretty empty anyway. var rem...

Merging arrays from all ranks using MPI -

i have array of same length on ranks (lets assume 10). values in array contain rank of processor. example ... proc 1: [1 0 0 0 0 1 0 0 0 1] proc 2: [0 2 2 0 0 0 0 2 2 0] proc 3: [0 0 0 3 3 0 3 0 0 0] now efficient way (using mpi-2) processors end following array [1 2 2 3 3 1 3 2 2 1] which can thought of sum of arrays (distributed on ranks). performance important want fast on 1k+ cores. this doable mpi_allreduce() mpi_sum or mpi_max operator. see documentation of mpi_allreduce . supposed implemented in 1 of best possible ways given architecture. int arr_a[len], arr_b[len]; ... // fill in arr_a mpi_allreduce(arr_a, arr_b, len, mpi_int, mpi_sum, mpi_comm_world); // result in arr_b or if short on memory use in-place operation hurt performance: mpi_allreduce(mpi_in_place, arr_a, len, mpi_int, mpi_sum, mpi_comm_world);

visual studio 2010 - How do I set up my code/VS10 to recognize CUDA function calls within .c files? -

basically, have compiler compiling .cu files , have (i think) full operation within .cu files, when try call them ( kernel<<<1,1>>>(void) ), compiler registers syntax errors due cuda syntax. also, calls cudamalloc fail within c files. here 3 short files, can tell erroring. //kernel.cu #include "kernel.h" #include <cuda.h> #include <cuda_runtime_api.h> __global__ int kernel(void){ return 5; } and //kernel.h #ifndef _kernel_h_ #define _kernel_h_ extern "c" int kernel(void); #endif and //main.c #include "kernel.h" #include <cuda.h> #include <cuda_runtime_api.h> int main() { int* device_a; cudamalloc( (void**)&device_a, sizeof(int) ); kernel<<<1,1>>>(); } i got header file of sdk examples. also, have build configuration set cuda 4.2, hence why .cu file compiles. if made incidental syntax errors, because simplified posting, not in source, although pleas...

ruby - Rails - grouped_collection_select -

i'm trying grouped_collection_select following class user has_many :pages, :through => pages_users end class page has_many :users, :through => pages_users # name - string # type - string end class pagesuser < activerecord::base belongs_to :page belongs_to :user end and want drop down grouped type name underneath. example i've seen city/country/continent, isn't helpful i'd like. what's best way of doing this? think want ... <%= grouped_collection_select(:user, :page_id, user.pages, :type, :name, ) %> but isn't correct. any thoughts? edited show actual relationships through pages_users table. here's ended ... <%= select_tag 'page_id', grouped_options_for_select(page.for_select) %> where page.for_select looks ... def for_select { 'type 1' => type1.map { |p| [p.name, p.id] }, 'type 2' => type2.map { |p| [p.name, p.id] } } end hope helps else.

xcode 4.x.x Project Navigator - use real folders -

is there way make xcode use real folder hierarchies in project navigator? i'm finding these pseudo folders annoying because not reflect project on disk. or @ least have xcode-made-folders different color real folders? thanks. not really, although are colored differently. you have groups (yellow) -- can refer directory, not update automatically reflect what's on disk. groups can represent group has no relation directory or structure of contents. you have reference (blue). updates automatically, contents not first class project items. personally, structure projects such can (re)constructed on-disk representation (e.g. drop folder), or in ide. quite often, details could (unnecessarily) defined in xcode moved outside of xcodeproject. synchronizing representation in project navigator easy drag , drop once work out how structure program/sources/targets. edit: referring project navigator. whether refer "project organizer" means project navigator o...

google maps - Draw route and avoid obstacles -

i have several coordonates (latitude,longitude) want draw route without passing trough buildings how can that? https://developers.google.com/maps/documentation/javascript/directions#waypoints directions don't pass through buildings, follow roads; , can pass through known coordinates specifying them waypoints.

How to generate entire DDL of an Oracle schema (scriptable)? -

can tell me how can generate ddl tables, views, indexes, packages, procedures, functions, triggers, types, sequences, synonyms, grants, etc. inside oracle schema? ideally, copy rows less important. i want on scheduled job of kind , not manually each time, rules out using wizard in sql developer. ideally, since running on several schemas have grants , synonyms 1 another, have way find/replace in output schema names match whatever names of new schemas going be. thanks! you can spool schema out file via sql*plus , dbms_metadata package. replace schema name 1 via sed. works oracle 10 , higher. sqlplus<<eof set long 100000 set head off set echo off set pagesize 0 set verify off set feedback off spool schema.out select dbms_metadata.get_ddl(object_type, object_name, owner) ( --convert dba_objects.object_type dbms_metadata object type: select owner, --java object names may need converted dbms_java.longname. --that code not include...

how to show class level validations error on UI using Spring validation -

i validation beans using hibernate validations (jsr 303).all validations working find , able display them on ui following code <spring:bind path="lastname"> <c:if test="${status.error}"> <li>${status.errormessage}</li> </c:if> </spring:bind> i facing problem 1 validation applicable @ class level @equalattributes(message = "{validation.checkpwd.equals}", value = { "pwd", "checkpwd" }) public class registerform { //bean class } i not sure how show error message respect validation on ui confused field should bind it can 1 guide me right path? <spring:bind path="registerform"> or "command", or whatever name using bind object.

java - Regarding a JButton and an ImageIcon -

i reading book on java, , studying swing graphical user interface components. while doing so, stumbled upon code example, author setting image on jbutton unusual way, depicted below: icon bug1 = new imageicon( getclass().getresource( "bug1.gif" ) ); in order above work, need have image on same folder .class files. can explain me why using particular code (which far know, must reflection code, again, not particularly sure one) , if there 1 way me same thing, without getting things complicated does? things complicated if don't understand them. once have understood above code does, extremely simple. getclass() returns class object of current object ( this ). getresource() called relative path above, looks file, in classpath, named bug1.gif, , in same package class object being called. looks bug1.gif in same package class containing above code. getresource() returns url. , imageicon constructor takes url argument, loads image bytes url, , constructs ima...

amazon ec2 - How does AWS EC2 scale if more resourses needed? -

i launched t1.micro instance running apache , mysql servers on ubuntu. i'm using host photo sharing app may have huge random spikes in terms of visitors. how aws go it? will instance automatically upgrade appropriate horse power keep demand , growing storage demands? no, have manually make instance more powerful first making sure in stopped state (this requires ebs volumes or you'll lose data), going aws console, right click instance , select 'change instance type'. if interested in more automated approach, suggest elastic load balancer auto-scaling policy. auto-scaling, amazon spin or down new instances based on set points provide (i.e. cpu usage reaches 80% 10 minutes).

jquery - IE Conditionals for Javascript -

i running issues ie support dynamic opacity , scaling using jquery .animate() . change these specific lines ie has issues while still leaving them "original" way in chrome , firefox. i have cam accross solution uses <!-- [if ie]> qrapped around <script> tag. problem want use line specific ie conditional in various places inside of .js file. is there solution issue, or need create ie version of .js file? you can use jquery make browser dependent check... if ($.browser.msie) { //ie } else { //not ie }

javascript - Changing image on hover -

i need menu consisting of images , images should change when hover around it. html <div id="menu" > <a href="#" id="home"><img src="images/about.png" alt="logo" /></a> </div> css #menu { margin-left : 353px; margin-top : -70px; padding-bottom : 16px; } #home { background : transparent url(images/about.png); z-index : 1; } #home:hover { background : url(images/aboutr.png); z-index : 2; } the problem facing when hover around menu item, image displayed on hover displayed at of old image. moreover, hover background image displayed very small in width , height. please out. ![enter image description here][1] as stated, no need js solution. another of doing loading both images , hiding/showing them :hover event. this: html: <a id="home"><img class="image_on" src...

sencha touch 2 - how to hide titleBar in list? -

by default list not have titlebar, when create list in such way has empty titlebar ext.define('application.view.recipelist', { extend: 'ext.list', xtype: 'recipelist', requires: ['application.store.recipes'], id:'list', config: { grouped: true, itemtpl: '{title}', store: 'recipes', onitemdisclosure: true } }); can me understand how hide titlebar? the empty bar navigation bar. if want hide need set navigationbar false in mainpanel update config: { navigationbar: false, items: [{ xtype: 'recipelist', }] } update here's how add searchbar in navigationbar this.getmain().getnavigationbar().add({ xtype: 'searchfield', itemid:'contact_search', placeholder: 'search....', listeners: { scope: this, clearicontap: this.onsearchclearicontap, keyup...

java - is JavaFX Scene Builder available on linux support? -

i can't find javafx scene builder linux package on oracle official website http://www.oracle.com/technetwork/java/javafx/overview/index.html there solution can work on on linux plateforme ? the mac os version works on linux, because scenebuilder 100% pure java, mostly. download macos dmg file here: http://www.oracle.com/technetwork/java/javafx/downloads/index.html then extract 7-zip. it's compressed hfs file system. $ mkdir javafx_scenebuilder $ 7z e -ojavafx_scenebuilder javafx_scenebuilder-1_0-macosx-universal.dmg now extract hfs partition: $ cd javafx_scenebuilder $ 7z x 4.hfs this extract lots of files. you'll need "javafx scene builder 1.0/javafx scene builder 1.0.app/contents/java". can remove other files. start scenebuilder: $ cd "javafx scene builder 1.0/javafx scene builder 1.0.app/contents/java" $ java -cp javafx-beans-dt.jar:javafx-designtime.jar:jfxrt.jar:scenebuilder.jar com.oracle.javafx.authoring.main there...

amazon ec2 - Programmatically setting instance name with the OpenStack Nova API -

Image
i have resigned myself fact many of features ec2 users accustomed (in particular, tagging) not exist in openstack. there is, however, 1 piece of functionality absence driving me crazy. although openstack doesn't have full support instance tags (like ec2 does), does have notion of instance name. name exposed web ui, allows set it: this name exposed through nova list command line utility. however (and problem) field not exposed through nova-ec2 api layer. cleanest way them integrate existing ec2 platform tools simulate instance tag name "name", don't this. what's more, can't figure out nova api endpoint can use read , write name (it doesn't seem documented on api reference ); of course must somehow possible since web client , nova-client can both somehow it. at moment, i'm forced change manually website every time launch new instance. (i can't during instance creation because use nova-ec2 api, not nova command line client). m...

REST design for API accessing multiple resources -

imagine api returns json data tv listings app zap2it tv listings. it's list of tv channels , each channel shows on , beyond. currently, have api returns channels get /channels . however, there need add show on each channel in data. thinking of adding new api, get /channels/on_now , differentiate current api. i want clear new api, don't want make individual call each channel, show-on-now data needs returned channels. rest api design? current get /channels json data [ "channel": { "channelname": "kron4", }, "channel": { "channelname": "ktov5", }, ... ] expected json data new api get /channels/on_now below [ { "channel": { "channelname": "kron4", }, "on_now": { "starttime": "2012-06-04t11:30:00", "endtime": "2012-06-04t12:00:00", "shortdescription": ...

performance - Why are some functions in the Seq module optimized whilst others were not in F#? -

this follow previous question regarding seq module's iter , map functions being slower compared array , list module equivalents. looking @ source, can see functions such isempty , length performs simple type check optimize arrays , lists before resorting using ienumerator . [<compiledname("isempty")>] let isempty (source : seq<'t>) = checknonnull "source" source match source | :? ('t[]) -> a.length = 0 | :? list<'t> -> a.isempty | :? icollection<'t> -> a.count = 0 | _ -> use ie = source.getenumerator() not (ie.movenext()) [<compiledname("length")>] let length (source : seq<'t>) = checknonnull "source" source match source | :? ('t[]) -> a.length | :? ('t list) -> a.length | :? icollection<'t> -> a.count | _ -> use e = source.getenumerator() ...

autocomplete - Best way to represent language tokens for an autocompletion scenario -

as of know, i'm developing own ide. might think "oh no, one?!" - don't worry, no one's forcing use it, , doubt published anyway. so, onwards main issue. i'm trying implement autocompletion system. exact ui not concern. however, storing language/library tokens in flexible way, main problem. let's we're suggesting css selectors or attributes user. we'd have like: - css/core - // anchor tag - etc // valid html tags - .stuff // class name parsed user project - ?etc // more stuff parsed user project (ids, classes...) - css/properties - border // regular css properties - need associate // <border-style> , <color> value tokens - etc // rest of them - css/values/border-style // property value tokens - solid - dotted - css/values/color - red - green - fucshia so each token gets...

vba - How do you link a time stamp to a cell using a userform button control? -

hello fellow vb developers/users/hobbyists. how you? i have userform has 2 buttons: start stop when press start , record current time in format dd/mm/yy hh:nn:ss in specific column. then when press stop button record time again in cell next it. then if press start again, record below first cell's current record. building timer record data see how long tasks take. i post excel file , provide more information necessary. thanks provided. current code public runtimer double public starttime date dim counter date sub setstart() counter = 0 starttime = runtimer = + timeserial(0, 0, 1) application.ontime runtimer, "setstart", , true set mytime = sheet4.range("f1") set timerng = sheet4.range("c8:c100") = worksheetfunction.counta(timerng) = + 1 cells(i, "c") = mytime sheet4.cells(i, "c").numberformat = "yyyy/mm/dd hh:mm:ss" if >= 2 cells(i...

java - wrong JAR packaging in ant file with zipfileset -

Image
i'm encountering strange issue in ant file use building java app. when generating jar file, include resource files (images, fonts , config files) in jar using zipfileset, this: <zipfileset dir="src/res" prefix="res"/> <zipfileset dir="src/res/images" prefix="res/images" /> <zipfileset dir="src/res/images/bubbles" prefix="res/images/bubbles"/> <zipfileset dir="src/res/images/clocks" prefix="res/images/clocks"/> <zipfileset dir="src/config" prefix="res/config"/> <zipfileset dir="src/ontology" prefix="res/ontology"/> to mantain original structure, looks this: res |-images | |-bubbles | |-clocks |-fonts |-config |-ontology so replicated within jar, i'm using prefix parameter in zipfileset. thing i'm getti...

java - What happens if your input file contains some unsupported character? -

i have text file might contain unsupported characters in latin1 character set, default character set of jvm. what characters turned when java program tries read file? concretely, supposed had 2-byte long character in file, read one-byte character (because each character in latin1 1-byte long)? thanks, first of can specify character set use when reading file. see example: java.io.inputstreamreader secondly. yes if reading using 1 byte character set each byte used map 1 character. thirdly: test , shall see, beyond doubt happens!

android - Using a generic class for multiple objects (actionBar tabs) -

currently use abs, actionbar tabs , tabsadapter/viewpager make nice tab layout app. have 5+ category tabs top - user able add new categories (i'll set later) well. so, @ moment, have main sherlockfragmentactivity many sherlockfragment category files. in oncreate main sfa, build actionbar , add tabs, so: mtabsadapter.addtab(bar.newtab().settext(r.string.login), loginfragment.class, null); mtabsadapter.addtab(bar.newtab().settext("geographics"), geofragment.class, null); mtabsadapter.addtab(bar.newtab().settext(r.string.economics), econfragment.class, null); mtabsadapter.addtab(bar.newtab().settext(r.string.elections), electionsfragment.class, null); what instead, create new solution, categoryfragment rather using of specific elections, geo, econ etc. can imagine solution? ideally, pass string tab gets added, categoryfragment can inflate based on string. solution because code redundant in multiple class...

linker - intel_sse2 problems when linking to gsl with icc -

my program links both petsc , gsl, , both libraries compiled icc. here's link command: /usr/local/mpich2/bin/mpicc -wall -wwrite-strings -wno-strict-aliasing -wno-unknown-pragmas -g3 -i/usr/local/gsl-icc-1.15/include/ -i/usr/local/gsl-icc-1.15/include/ -l/usr/local/gsl-icc-1.15/lib/ -lgsl -lgslcblas prog_name.o -l/usr/local/petsc-3.2-p6/lib -lpetsc -lx11 -lpthread -llapack -lblas -l/central/intel/compiler-11.1.072/mkl/lib/em64t -l/central/intel/compiler-11.1.072/lib/intel64 -l/central/intel/compiler-11.1.072/tbb/intel64/cc3.4.3_libc2.3.4_kernel2.6.9/lib -l/usr/lib/gcc/x86_64-redhat-linux/4.1.2 -ldl -lgcc_s -lifport -lifcore -limf -lsvml -lm -lipgo -lirc -lpthread -lirc_s -lm -lstdc++ -lstdc++ -ldl -lgcc_s -ldl -o prog_name mpich_cc set icc, mpicc calls intel compiler. when try link gsl .so file, following errors: gsl-icc-1.15/lib/libgsl.so: undefined reference `__intel_sse2_strcpy' gsl-icc-1.15/lib/libgsl.so: undefined reference `__intel_sse2_strchr' gsl-ic...

knockout.js data on page not updating when updated in modal -

i'm using knockout.js , twitter bootstrap's modal plugin data-bind user's email address can change via modal. however, i'm expecting see email address simultaneously update on page when i'm editing inside input box inside modal. wrong data-binding? here's jsfiddle of below: http://jsfiddle.net/xn58k/1/ var model = { "schoolemailaddress": "email@domain.com", "firstname": "john", "lastname": "doe", "middlename": null, "id": 3 }; $(document).ready(function() { var viewmodel = new accountsettingsviewmodel(); ko.applybindings(viewmodel); viewmodel.user(model); }); function user(data) { var self = this; ko.mapping.fromjs(data, {}, this); } function accountsettingsviewmodel() { var self = this; this.user = ko.observable(); this.editemail = function() { $("#editemailmodal").modal("show"); } ...

c++ - Sending data through socket spaces, receiving with spaces -

i'm using c++ qt4 this. , when try send large html files(in case, 8kb), process of sending , receiving work well. file received come spaces between each character of html file. here example, file sent this: <!doctype html public "-//w3c//dtd html 4.0//en" "http://www.w3.org/tr/rec-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'ms shell dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">a</p></body></html> and it's received, this: ¼ < ! d o c t y p e h t m l p u b l c " - / / w 3 c / / d t d h t m l 4 . 0 / / e n " " h t t p : / / w w w . w 3...