Posts

Showing posts from August, 2015

nexus 7 - App crashing when on nexus7 but works on emulator android -

nexus 7 - App crashing when on nexus7 but works on emulator android - i have created main screen have 3 buttons. , 1 of them open page displays info database in textview. works on emulator on laptop when re-create files nexus 7 button crashes application. other buttons work fine. here's code, basic: viewflare = (button)findviewbyid(r.id.bviewflare); viewflare.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { intent openviewflare = new intent("com.example.project.sqlflareview"); startactivity(openviewflare); } }); it calls page: public class sqlflareview extends activity { @override protected void oncreate(bundle savedinstancestate){ super.oncreate(savedinstancestate); setcontentview(r.layout.sqlflareview); textview textview = (textview) findviewbyid(r.id.tvsqlflareinfo); calms info = new calms(th...

ios - Check if UIWebview is displaying PDF -

ios - Check if UIWebview is displaying PDF - to clear, question not asking how display pdf in uiwebview. want check if user has navigated pdf (.pdf) document website or link. way can show more options user, saving pdf or printing it. what's best way check if uiwebview's content pdf? you can check mime type too, longer journey: @property (nonatomic, strong) nsstring *mime; - (void)connection:(nsurlconnection *)connection didreceiveresponse:(nsurlresponse *)response { mime = [response mimetype]; } - (bool)isdisplayingpdf { nsstring *extension = [[mime substringfromindex:([mime length] - 3)] lowercasestring]; homecoming ([[[self.webview.request.url pathextension] lowercasestring] isequaltostring:@"pdf"] || [extension isequaltostring:@"pdf"]); } ios pdf uiwebview

How to ensure PHP curl fully downloads pdf and pdftk command to skip damaged pdfs when merging -

How to ensure PHP curl fully downloads pdf and pdftk command to skip damaged pdfs when merging - currently have php scrip downloads 50+ pdfs , merges them. when downloading not download pdf damaged. when executing merging command using pdftk throws exception because of damaged pdfs. i using curl download pdfs, possible have check ensure file downloaded before downloading next one? or possible pdftk merge files skipping damaged ones? below code: downloading: $fp = fopen($paths, 'w'); $ch = curl_init(); curl_setopt($ch,curlopt_url,$urls); curl_setopt($ch, curlopt_file, $fp); $data = curl_exec($ch); fclose($fp); merging: "c:\program files\pdf labs\pdftk server\bin\pdftk.exe" 1.pdf...0.pdf cat output %mydate%.pdf" thanks in advance. by using: curl_setopt ($ch, curlopt_connecttimeout, 0); curl_setopt ($ch, curlopt_timeout, 0); i can ensure pdf downloaded before proceeding download next one. solves issue. hope helps. php pdf...

c++ - linker error "relocation R_X86_64_PC32 against undefined symbol" despite compilation with -fPIC -

c++ - linker error "relocation R_X86_64_PC32 against undefined symbol" despite compilation with -fPIC - i'm compiling c++ programme using command line g++ -c prog.cc -std=c++11 -march=native -fpic -fopenmp and seek create shared object via g++ prog.o -shared -fopenmp -o lib/libprog.so this has worked. today get: /usr/bin/ld: prog.o: relocation r_x86_64_pc32 against undefined symbol `_ztvn12_global__n_111handle_basee' can not used when making shared object; recompile -fpic /usr/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status the symbol _ztvn12_global__n_111handle_basee de-mangles vtable (anonymous namespace)::handle_base ( handle_base polymorphic class defined in anonymous namespace in prog.cc , yes phone call dynamic_cast<handle_base>() .) i'm using gcc version 4.7.0 (gcc) , gnu ld (gnu binutils; opensuse 11.1) 2.19. can help (suggest solutions [other doing without shared object or dynamic ...

javascript - jQuery task, get the value of a select html element -

javascript - jQuery task, get the value of a select html element - i have problem can't solve... have jquery code: v=$('#sede').val(); $('#sede').change(function() { console.log('valor de v:'+v); }); and html select: <select name="se" id="sede" size="1"> <option value="1">primer elemento</option> <option value="2">segundo elemento</option> <option value="3">tercer elemento</option> <option value="4">cuarto elemento</option> </select> the problem variable v shows first item value when click in select, no matters second, 3rd or item... you should value of <select> on alter event: var v; $("#sede").change(function() { v = this.value; console.log("valor de v:" + v); }); javascript jquery html

iphone - How to open mail within the app from webview? -

iphone - How to open mail within the app from webview? - this code.. if ([ [ requesturl scheme ] isequaltostring: @"mailto" ]) { mfmailcomposeviewcontroller *composer = [[mfmailcomposeviewcontroller alloc] init]; [composer setmailcomposedelegate:self]; if ([mfmailcomposeviewcontroller cansendmail]) { nsstring *stremail = [nsstring stringwithformat:@"%@",requesturl]; nsstring *substring = [[stremail componentsseparatedbystring:@":"] lastobject]; [composer settorecipients:[nsarray arraywithobjects:substring, nil]]; [composer setsubject:@"kreativ-q"]; [composer setmessagebody:@"" ishtml:yes]; [composer setmodaltransitionstyle:uimodaltransitionstylecrossdissolve]; [self presentmodalviewcontroller:composer animated:yes]; [composer release]; } } but when click on link in webview opening in mailbox. ...

web applications - How to get uuid or mac address from client in Java? -

web applications - How to get uuid or mac address from client in Java? - i'm looking solution java based webapplication uniquely identify client. server in same network clients , thought using mac address solution. problem can't work cookies because can deleted client-side , can't utilize ip because issue new dhcp lease renewal. so fallback mac address of clients. i'm aware there no java built in feature mac address. there library can handle output of every os? (primary windows , mac) since java application runs on both platforms. or there other suggestions uniquely identifying client within website , http protocol ? (maybe html5 info stores or else) i'm using java 1.7 btw. i won't forcefulness user login or otherwise identify himself , won't programme native app clients smartphone. i wrote own method solve issue. here if ever needs code find mac address in same network. works me without admin privileges on win 7 , mac os x 10.8.2 ...

Change excel form checkbox name -

Change excel form checkbox name - i using excel 2010. chagne name of excel form checkbox i've added. how can that, not in vba? you can alter in name box: forms excel checkbox

c - A hash function like from K&R book -

c - A hash function like from K&R book - consider function: unsigned hash(char *s) { char *p; unsigned hashval; for(p = s; *p; p++) hashval = *p + 31 * hashval; homecoming hashval; } how can measure how many bytes in s returns wrong result,such overflow? i'm on 32-bit platform. if alter read unsigned hash(const char *s) { const unsigned char *p; unsigned hashval = 0; (p = (const unsigned char *) s; *p; p++) hashval = *p + 31u * hashval; homecoming hashval; } then there no longer possibility of undefined behavior due integer overflow, because types involved in arithmetic unsigned, wraps mod 2n (where n width of unsigned in bits). have fixed utilize of uninitialized variable, , made s , p const , may improve optimization and/or grab mistakes in body of function. (i'm not remembering exact arithmetic conversion rules right now; might not have been possible in first place. however, writing way makes obviously impossib...

javascript - Jquery and Get traversing API -

javascript - Jquery and Get traversing API - is there simple way node list (including given node) matched query jquery? i thought using .find method following: var getnodes = function(dom, query){ var nodes = $(dom).find(query || '*'); nodes.splice(0,0,dom); homecoming nodes; } olivier if want search within set made of dom , contents elements matching query, can do $(dom).find(query).add($(dom).filter(query)) or $(dom).find(query).addback().filter(query); a simpler 1 (but slower if there many children) be $(dom).find('*').addback().filter(query); javascript jquery splice

javascript - RegEx to split on commas, but excluding those within braces, brackets, and parenthesis -

javascript - RegEx to split on commas, but excluding those within braces, brackets, and parenthesis - i'm trying parse comma-separated list, while omitting commas fall within inner structures defined braces, brackets, or parenthesis. example, string: 'text:firstname,css:{left:x,top:y},values:["a","b"],visible:(true,false),broken:["str", 1, {}, [],()]' should split as: text:firstname css:{left:x,top:y} values:["a","b"] visible:(true,false) broken:["str", 1, {}, [],()] so far, i've got following... close breaks on nested structures: [^,\[\]{}]+(({|\[)[^\[\]{}]*(}|\]))? any help appreciated! unless willing alter info format, or can find easy way turn proper json after receiving, best bet parsing manually. the simplest matcher (assumes "nice" values): class="lang-none prettyprint-override"> on ([{ - increment parens on )]} - decrement parens or emit ...

mongodb - mongo: aggregate - $match before $project -

mongodb - mongo: aggregate - $match before $project - having mongodb around 100gb of info , per field in $match expression, have index (single field index). now tried aggregate() , wrote $project first part in pipeline, $match behind this. the aggregation runs , returns right results, takes hours! process filtered ($match) info or mongo aggregate on total range of info , filter afterwards? in test case, $match filters around 150mb (instead of total info size of 100gb). by accident, changed order , wrote $match before $project in pipeline definition. way, done within few seconds. when mongodb cut down input info , deal index fields in $match? as have noticed, order of pipeline operators crucial when dealing big collection. if done incorrectly can run out of memory allow lone process taking long time. noted in docs: the next pipeline operators take advantage of index when occur @ origin of pipeline: $match $sort $limit $skip. so...

ruby on rails - Add folder to asset pipeline path? -

ruby on rails - Add folder to asset pipeline path? - we have rails app updated rails 3.0 rails 3.2. app services multiple clients. customize each client, have directory app/themes . in there submodules. each submodule contains things locales/en.yml , views/layouts , views/controller_name , etc. utilize prepend_view_path add together theme views, , i18n.load_path add together in locales. we're looking @ using asset pipeline can maintain mix of client material out of public directory, , maintain contained in each theme. is there way can dynamically tell rails load theme/theme-name/assets folder want? utilize settings logic set theme active. if have theme set "google", applicationcontroller loads files path: app/themes/google/locales/*.yml app/themes/google/views what i'd able have manifest file, app/themes/google/assets/stylesheets/application.css easily accessible layout, much in app/views/layouts file: = stylesheet_link_tag "applic...

iis 7.5 - gzip js in IIS doesn't get compressed if static compression enabled -

iis 7.5 - gzip js in IIS doesn't get compressed if static compression enabled - i have used squishit minify , bundle js , compress bundled file enabled alternative (enable static content compression) in iis 7.5 issue js doesn't compressed , minified js if enable dynamic content compression js gets compressed. now problem dynamic compression not cache file , on each request has compression take time of cpu. can help me out why js doesn't compressed in static content compression mode and ideal way send js on client side js -> minify js (squishit) -> compress (static /dynamic) the compression of static files handled dynamically while file considered infrequent iis. 1 time file considered frequent compressed , cached. cached version go on served until becomes infrequent again. there 2 config settings can utilize in iis configure frequent files: system.webserver/serverruntime: frequenthitthreshold : how many times should same file requeste...

knitr - Is it possible to call external R script from R markdown (.Rmd) in RStudio? -

knitr - Is it possible to call external R script from R markdown (.Rmd) in RStudio? - it's trivial load external r scripts per this r sweave example. can same done r markdown? yes. put @ top of r markdown file: ```{r setup, echo=false} opts_chunk$set(echo = false, cache=false) read_chunk('../src/your_code.r') ``` delimit code next hints knitr (just @yihui in example): ## @knitr part1 plot(c(1,2,3),c(1,2,3)) ## @knitr part2 plot(c(1,2,3),c(1,2,3)) in r markdown file, can have snippets evaluated in-line: title ===== foo bar baz... ```{r part1} ``` more foo... ```{r part2} ``` r knitr rstudio rmarkdown

android - Loading a preference on checkboxpreference click event -

android - Loading a preference on checkboxpreference click event - i want load set of preferences(below) on checkboxpreference/switchpreference on corresponding click event. my checkboxpreference follows: <?xml version="1.0" encoding="utf-8"?> <preferencescreen xmlns:android="http://schemas.android.com/apk/res/android" > <checkboxpreference android:defaultvalue="true" android:key="email_preference_checkbox" android:summary="@string/pref_description_social_recommendations" android:title="@string/pref_title_social_recommendations"> </checkboxpreference> </preferencescreen> the preference want load follows: <?xml version="1.0" encoding="utf-8"?> <preferencescreen xmlns:android="http://schemas.android.com/apk/res/android" > <edittextpreference android:capitalize="words...

git - gitweb redirect to https -

git - gitweb redirect to https - i apache noob , trying automatically redirect requests http://.com/gitweb https://.com/gitweb i've set next /etc/apache2/conf.d/gitweb alias /gitweb /usr/share/gitweb <directory /usr/share/gitweb> options followsymlinks +execcgi addhandler cgi-script .cgi redirect gitweb https://<myserver>.com/gitweb sslrequiressl </directory> however maintain getting 403 forbidden notice forbidden don't have permission access /gitweb on server. apache/2.2.22 (ubuntu) server @ dndo-gamma port 80 i don't want directories hosted server redirect; request gitweb. my /etc/apache2/sites-enabled/000-default unchanged default <virtualhost *:80> serveradmin webmaster@localhost documentroot /var/www <directory /> options followsymlinks allowoverride none </directory> <directory /var/www/> options indexes followsymlinks multiviews ...

javascript - Three.js - Shape disappears on flip side -

javascript - Three.js - Shape disappears on flip side - i've made circle follows: material = new three.meshbasicmaterial({ color: 0x00ff00 }); arcshape = new three.shape(); arcshape.absarc( 0, 0, 20, 0, -math.pi*2, true ); geometry = arcshape.makegeometry(); circle = new three.mesh(geometry, material); scene.add(circle); like that, visible. rotate it, , disappears. shadow.rotation.x = math.pi / 2; i've seen several other posts problem has not been solved. (so unless has solution, i'll resort making flat cylinder instead. it's niggling problem). i've set mesh.doublesided = true , mesh.flipsided = false . i've tried 4 combinations of toggling renderer's depthtest , material's depthwrite properties. is there else try? if not, i'm guessing code sensitive order of of calls, in case, i've had long day i'll stick cylinder!! material.side = three.doubleside; javascript three.js webgl shape

mysql Trigger issue in wrong schema -

mysql Trigger issue in wrong schema - what trigger in wrong schema mean ? delimiter $$ create trigger `wordpress_database1`.`insert_user_from_database2` after insert on `wordpress_database2`.`wp_users` each row begin insert `wordpress_database1`.`wp_users` ( id, user_login, user_pass, user_nicename, user_email, user_url, user_registered, user_activation_key, user_status, display_name) values ( new.id, new.user_login, new.user_pass, new.user_nicename, new.user_email, new.user_url, new.user_registered, new.user_activation_key, new.user_status, new.display_name ); end;$$ trigger needs on same schema inserting (i.e. create trigger on wordpress_database2 ). can still insert other schemas. simple change, entire rest of should work. mysql triggers

coffeescript - Call a click on a newly added dom element -

coffeescript - Call a click on a newly added dom element - im trying phone call click on newly created anchor: $('.file-status').html("finished downloading <a class='download' download href='#{fileentry.tourl()}'>#{name}</a>") $('.download').click() but click event not called. not sure why is? im trying forcefulness download, not open link in browser. dropbox does edit here code, more clear: fileentry.createwriter ((filewriter) -> filewriter.onwriteend = (e) -> $('.file-status').html("finished downloading <a class='download' download href='#{fileentry.tourl()}'>#{name}</a>") $('.download').trigger('click'); filewriter.onerror = (e) -> console.log "write failed: " + e.tostring() filewriter.write blob ), errorhandler update: so after understanding answers below not possible, except if serve...

spring - JPA unable to assign a new persisted entity in a many to one relationship -

spring - JPA unable to assign a new persisted entity in a many to one relationship - i have jpa entities defined bidirectional relationship many one, hereby: @entity public class section implements serializable { private static final long serialversionuid = 1l; @id @sequencegenerator(name="departamento_id_generator",sequencename="departamento_seq") @generatedvalue(strategy=generationtype.sequence,generator="departamento_id_generator") @column(name="dep_id") private long id; @column(name="dep_desc") private string desc; //bi-directional many-to-one association academico @onetomany(mappedby="department") private set<proffesor> proffesors; //getters , setters } @entity @table(name="academicos") public class proffesor implements serializable { private static final long serialversionuid = 1l; @id @sequencegenerator(name="academicos_id_generat...

javascript - How can i add multiple row support to FlexSlider? -

javascript - How can i add multiple row support to FlexSlider? - i'm using flexslider on wordpress site. working good. want gallery visible 2 row. searched not found solution. this flexslider.js: http://pastebin.com/3ygkefb4 try out approach. have tried , worked me :) function make2rows(iwidth) { var iheight = parsefloat($('.flexslider .slides > li').height()); $('.alliance-list .slides > li').css('width', iwidth+'px'); $('.alliance-list .slides > li:nth-child(even)').css('margin', iheight+'px 0px 0px -'+iwidth+'px'); } $(window).load(function() { var itemcnt = 5; // number of columns per row var iwidth = parsefloat($('.flexslider').width() / itemcnt); $('.flexslider').flexslider({ animation: "slide", slideshowspeed: 1000, animationspeed: 300, animationloop: false, directionnav: false, slideshow:...

multiple android developer accounts with one google account -

multiple android developer accounts with one google account - i wish create multiple android developer accounts 1 google business relationship 'ownership' 1 google account. possible? as per google policies multiple google play accounts not allowed. if google found multiple accounts same name ban of accounts. also not thought of having multiple accounts on same name. if 1 of business relationship suspended of accounts suspended. https://support.google.com/googleplay/android-developer/answer/4454563?hl=en android

uitableview - Is that effective to check the internet Reachability in iOS? -

uitableview - Is that effective to check the internet Reachability in iOS? - assuming have net connection, i' utilize code know if device connected via wifi or not : + (bool)haswificonnection { reachability *reachability = [reachability reachabilityforinternetconnection]; [reachability startnotifier]; networkstatus status = [reachability currentreachabilitystatus]; if (status == reachableviawifi) { homecoming yes; } else { homecoming no; } } is code fast run? i'm using when generating urls pictures (so know if load high or low resolution pictures). pictures displayed in list view (3 per line). when scroll list function called several times per second. efficient? if u dont want utilize reachability class utilize next code. @interface cmlnetworkmanager : nsobject +(cmlnetworkmanager *) sharedinstance; -(bool) hasconnectivity; @end implementation @implementa...

javax.net.ssl, https clients and close_notify -

javax.net.ssl, https clients and close_notify - simple netty implementation of https server utilizing javax.net.ssl, self-signed certificate. server up, , request made using dhc restlet. on server side get: io.netty.handler.ssl.sslhandler sethandshakefailure warning: sslengine.closeinbound() raised exception due closed connection. javax.net.ssl.sslexception: inbound closed before receiving peer's close_notify: possible truncation attack? @ sun.security.ssl.alerts.getsslexception(unknown source) @ sun.security.ssl.sslengineimpl.fatal(unknown source) @ sun.security.ssl.sslengineimpl.fatal(unknown source) @ sun.security.ssl.sslengineimpl.closeinbound(unknown source) @ io.netty.handler.ssl.sslhandler.sethandshakefailure(sslhandler.java:905) @ io.netty.handler.ssl.sslhandler.channelinactive(sslhandler.java:576) @ io.netty.channel.defaultchannelhandlercontext.invokechannelinactive(defaultchannelhandlercontext.java:819) @ io.ne...

android - Using SharedPreferences to store user password -

android - Using SharedPreferences to store user password - so need simple app have password. default password "admin" , user can alter if he/she wants to. having problem on changing part. don't know why activity made forcefulness closes. it's first time utilize sharedpreferences. don't know if i've used correctly. please, help me. here's code: import android.annotation.suppresslint; import android.app.activity; import android.content.sharedpreferences; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.edittext; import android.widget.textview; import android.widget.toast; public class changepass extends activity { @suppresslint("commitprefedits") @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.change_pass); final sharedpreferences se...

c++ - Change ld-linux location -

c++ - Change ld-linux location - i have find out load libraries, executable first opens /lib/ld-linux-x86-64.so.2 . functionality regarding loading shared libraries (search in many paths, using rpath, etc) work after ld-linux loaded, because ld-linux implements these functionality. it seemed me ld-linux.so location hardcoded in executable (invoking strings on executable reinforces theory). problem in linux distribution, compiler (g++) sets ld-linux location /lib/ld-linux-x86-64.so.2 . while on ubuntu (which more popular) located @ /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 . i wondering if can create executable looks ld-linux.so @ /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 (which nowadays in distro symbolic link). try adding -wl,--dynamic-linker=/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ldflags . c++ linux gcc shared-libraries ld

Use Redis to track concurrent outbound HTTP requests -

Use Redis to track concurrent outbound HTTP requests - i'm little new redis, i'd see if can used maintain track of how many concurrent http connections i'm making. here's high level plan: incr requests // request begins http.get(...) // request ends decr.requests then @ point, phone call get requests see how many open. the ultimate goal here throttle http requests remain below arbitrary amount, 50 requests/s. is right way it? there pitfalls? as pitfalls, 1 can see server goes downwards or loses connection redis mid-request may never phone call decr . since don't know server request, can never reset count right value without bringing scheme halt , reset 0. redis

iphone - How to stop the status bar covering the navigation bar in iOS6 -

iphone - How to stop the status bar covering the navigation bar in iOS6 - this issue.... this happens when: status bar faded out using button. rotate 180 deg landscape upside-down landscape. status bar faded in using button. - covers navigation bar. the button code toggle status bar visibility: - (ibaction)togglebar:(id)sender { nslog(@"view frame : %@", nsstringfromcgrect(self.view.frame)); // toggle status bar visiblity bool isstatusbarhidden = [[uiapplication sharedapplication] isstatusbarhidden]; [[uiapplication sharedapplication] setstatusbarhidden:!isstatusbarhidden withanimation:uistatusbaranimationfade]; } the view reports frame 480 x 288. the issue fixable on ios 5 using hacky workaround, stopping rotation filling space. - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { if ([[uiapplication sharedapplication] isstatusbarhidden]) { ...

bash - Sending Unix/Linux SIGNAL through PIPE -

bash - Sending Unix/Linux SIGNAL through PIPE - i want sent signal process after .5 seconds. maybe not thought want uncommon temporary case. i tried following, not working. (sleep .5;kill -9)| some_process sleep .5; kill -9 $(pidof some_process) should work. pidof returns process id process name. $() returns result of command kill command. alternative be: sleep .5; pidof some_process | xargs kill -9 check man pidof details. edit: there timeout . timeout -s sigkill 0.5s some_process should trick if understood question correctly. linux bash signals pipe

snmp4j - Can the same USM user be added with different set of authentication and privacy algorithms? -

snmp4j - Can the same USM user be added with different set of authentication and privacy algorithms? - in code, configuring usm user , adding user snmp v3. want configure user in way back upwards below set of algorithms @ same time. sha-1 + aes128, sha-1 + des, md5 + aes128, md5 + des let's same usm user capable of supporting these 4 combinations @ same time. now, when seek management console, want select combination of above 4 , snmp agent should work. note: not want add together new usm users. want same user configured above 4 combinations @ same time. usmuser user = new usmuser(new octetstring(m_usmuser), snmpauthenticationalgorithm, snmpauthenticationpassword, snmpprivacyalgorithm, snmpprivacypassword); usm.adduser(user.getsecurityname(), user.getlocalizationengineid(), user); rather above, want user below. usmuser u...

javascript - Setting variable to result of function acting very strange -

javascript - Setting variable to result of function acting very strange - i have function in javascript supposed homecoming array of articles linked wikipedia page, given title. here is: function getlinksfrom(title, returnarray, plcontinue) { var url = 'http://en.wikipedia.org/w/api.php?action=query&prop=links&titles=' + title + '&format=json&pllimit=500&plnamespace=0&callback=?'; if (!returnarray) { returnarray = []; } if (!plcontinue) { plcontinue = ''; } if (returnarray.length === 0 || plcontinue !== '') { if (plcontinue !== '') { url = 'http://en.wikipedia.org/w/api.php?action=query&prop=links&titles=' + title + '&format=json&pllimit=500&plnamespace=0&plcontinue=' + plcontinue + '&callback=?'; } $.ajax({url: url, datatype: 'json', async: false, success: function(data) {...

.htaccess - How can I link a subdomain to a joomla user? -

.htaccess - How can I link a subdomain to a joomla user? - we've got custom component sorts of wonderful things a registered user. among requirements ability utilize username subdomain retrieve , utilize variety of settings. e.g. http://abc.ourdomain.com must retrieve jos_users record username "abc". there utilize info in session , carry on component functions values. i've tried tinkering $_server["http_host"] things started, hoping there cleaner approach htaccess, or plugin serve purpose better. something might work in 1 .htaccess file: options +followsymlinks rewriteengine on rewritebase / rewritecond %{http_host} !www\. [nc] rewritecond %{http_host} ^([^\.]+)\.ourdomain\.com [nc] rewritecond %{request_uri} !getuser\.php [nc] rewriterule .* http://ourdomain.com/getuser.php?user=%1 [l] maps silently http://abc.ourdomain.com to: http://ourdomain.com/getuser.php?user=abc captures subdomain abc grouping %1 , append...

multithreading - Java - creating threads in a EventListener -

multithreading - Java - creating threads in a EventListener - i got code: thread thread = new thread(new runnable() { @override public void run() { octopuswsclient.sendpoolsensorreading(poolsensorreading, octopusclientstart.currentmacaddress); } }); thread.setname("thread - ws"); thread.start(); is within event listener executing approximately every 30 seconds (when event occurs), creating new thread every 30 seconds lastly 20 seconds complete, now, question is... ok phone call threads way?, if not, how???... , also, i'm watching threads id , names code: set<thread> threadset = thread.getallstacktraces().keyset(); for(thread t : threadset){ system.out.println(" thread #"+t.getid()+" name: "+t.getname()); } and prints id , name current threads, se...

oracle - WITH clause in MySQL? -

oracle - WITH clause in MySQL? - does mysql back upwards mutual table expressions? illustration in oracle there's with clause? : with aliasname ( select count(*) table_name ) select count(*) dept,aliasname one way utilize subquery: select count(*) dept, ( select count(*) table_name ) aliasname note , between 2 tables cross bring together 2 tables same in query posted. if there relation between them can join them instead. mysql oracle common-table-expression

Command line command to open http sessions to a service -

Command line command to open http sessions to a service - i want know if possible open http sessions service through command line or batch file. want accomplish check if particular service allowing more x active connections . note: cannot install utility on production machine. regards, prayag uhm... can seek write vbs file connecting webserver telnet , requesting root page. create .vbs file , set content. execute prompt. set wshshell = wscript.createobject("wscript.shell") wshshell.run "cmd" wscript.sleep 100 wshshell.sendkeys "telnet www.yahoo.com 80~" 'subst www.yahoo.com host wscript.sleep 5000 wshshell.sendkeys "get / http/1.0~~" wscript.sleep 2000 wshshell.sendkeys "^c~" 'close telnet wscript.sleep 1000 wshshell.sendkeys "exit~" 'close prompt http session

cuda - Which threads in a block form a warp? -

cuda - Which threads in a block form a warp? - in 2-d or 3-d cuda block, how threads grouped warps? assumption iterate first x, y, z. example, in threads <z,y,x> , <0,0,[0-31]> warp, , <0,1,[0-31]> , etc. correct? yes correct. threads grouped first x, y, z (thread coordinates) when creating warps (groups of 32 threads execute together). has implications coalescing: want arrange usage of thread coordinates in matrix subscripts warp-adjacent threads (i.e. in x coordinates, typically) access adjacent elements in matrix (by using threadidx.x or derivative in rapidly varying matrix dimension. typically want data[z][y][x] , not data[x][y][z] cuda gpu

python - context switching with 'yield' -

python - context switching with 'yield' - i reading gevent tutorial , saw interesting snippet: import gevent def foo(): print('running in foo') gevent.sleep(0) print('explicit context switch foo again') def bar(): print('explicit context bar') gevent.sleep(0) print('implicit context switch bar') gevent.joinall([ gevent.spawn(foo), gevent.spawn(bar), ]) in flow of execution goes foo -> bar -> foo -> bar . not possible same without gevent module yield statements? i've been trying 'yield' reason can't work... :( generators used purpose called tasks (among many other terms), , i'll utilize term here clarity. yes, possible. there are, in fact, several approaches work , create sense in contexts. however, none (that i'm aware of) work without equivalent @ to the lowest degree 1 of gevent.spawn , gevent.joinall . more powerful , well-designed ones require equivalent...

Visual studio 2010 resizing winforms -

Visual studio 2010 resizing winforms - i develop in laptop has resolution of 1280x800. in winforms app there forms height bigger 800. connect lcd 17" or 19", when not , open form has 1280x1024, visual studio 2010 automatically resizes laptop resolution form , have troubles resize controls. i wonder if there alternative avoid behavior. thanks lot you have study .dockstyle , .autosize behavior winforms visual-studio-2010

objective c - Loading 8MP photos in the background on iOS -

objective c - Loading 8MP photos in the background on iOS - i'm customizing gallery similar photos app in ios. want able scroll between individual photos in custom gallery. preloading images shown (if scroll right, preload i.e. 2 next images right) however, image loading seems cpu consuming interferes scrolling. making scrolling hang split of second. is there improve way this? (i have considered keeping smaller versions of each image matches screen resolution) basically phone call in background thread: uiimage *img = [uiimage imagewithcontentsoffile:path]; and perform selector on main thread initialises existing imageview loaded image. i figured out in way. i needed render image off-screen on background thread create sure loaded. otherwise not load until decided render in main thread. caused main thread block while loading. ios objective-c

asp.net mvc - Entity framework Custom SQL and store result value -

asp.net mvc - Entity framework Custom SQL and store result value - i want run simple custom sql query, in ef seeder, how can implemented simple sql query , store result (a count(), integer) in c# variable? try this: var cmd = db.database.connection.createcommand(); cmd.commandtype = commandtype.text; cmd.commandtext = "/*query*/"; cmd.parameters.add(new sqlparameter("@param", paramvalue)); var value = cmd.executescalar(); asp.net-mvc entity-framework

html - Can't get same origin iframe body on IE10? -

html - Can't get same origin iframe body on IE10? - i've created page empty iframe on it. can select iframe document , navigate it's body: var iframe = document.getelementsbytagname('iframe')[0]; var doc = iframe.contentdocument || iframe.contentwindow.document; var body = doc.body; console.log("body is", body); in firefox , chrome gives me body object. in ie10 gives me null. here jsbin demonstrating issue. open js, console, output panels , click "run js". two questions: how access iframe's body in cross-browser manner? which right "to-spec" behavior? i had similar problem before today. seems ie, @ to the lowest degree 9 , 10, doesn't create iframe body correctly (when used developer tools able see body tag within iframe, wasn't able phone call it), when there's no specified src. gives null cause doesn't exist. the answer, whether there cross browser manner access iframe's body, n...

java - Weka J48 changing option - no difference -

java - Weka J48 changing option - no difference - i trying alter options j48 classifier, makes no difference in resulted tree. my code: j48 cls = new j48(); instances info = new instances(new bufferedreader(new filereader("somearfffile"))); data.setclassindex(data.numattributes() - 1); //was trying utilize -m 1 , -m 5, no difference string[] options = new string[1]; options[0] = "-c 1.0 –m 1"; cls.setoptions(options); cls.buildclassifier(data); //displaying j48 tree treevisualizer tv = new treevisualizer(null,cls.graph(),new placenode2()); after set value method working fine. cls.setminnumobj(5); any ideas how can utilize setoptions method instead of setminnumobj? the problem how seek set options. options array should args array in main method, 1 string per element: string[] options = {"-c", "1.0", "–m", "1"}; cls.setoptions(options); otherwise won't work. java wek...

php - Back button in ie browser -

php - Back button in ie browser - whenever press button of ie, browser display message "web page expired". i have 1 registration page reg.php have save info in save_reg.php , button press , message display " web page expired". i have seek next code: header("expires: sat, 01 jan 2000 00:00:00 gmt"); header("last-modified: ".gmdate("d, d m y h:i:s")." gmt"); header("cache-control: post-check=0, pre-check=0",false); session_cache_limiter("must-revalidate"); but message remain remain set expiration date in future: header("expires: ".date("d, d m y h:i:s", time() + $desiredduration)." gmt"); time returns current time measured in number of seconds since unix epoch , add together desired time in seconds , format date function. php internet-explorer http-headers

java - Where to add code which filters results returned from Spring service -

java - Where to add code which filters results returned from Spring service - in spring controller receiving list of items service , using custom code within controller create new filtered list subset of list retured service. i don't think filtering code should take place in controller ? here controller : @controller public class mycontroller { @autowired private myservice myservice; @rendermapping public string getvalues(modelmap modelmap){ list<string> = myservice.getnewvalues(); list<string> filteredlist = ...... /** code here process list , convert specific list */ modelmap.addattribute("values", filteredlist); } } should filtering take place @ service implementation layer ? so instead of myservice.getnewvalues(); should utilize new method filters results : myservice.getnewfilteredvalues(); ? note : ...

java - Why UIComponentBase class doesn't expose a setAttribute() method? -

java - Why UIComponentBase class doesn't expose a setAttribute() method? - uicomponentbase have public abstract map<string, object> getattributes() method doesn't have setattributes() method .why designed ? assuming designers wanted create map unmodifiable why ? my requirement clean attributes of component . how instead of calling each of setters ? can not phone call clear() on attributes map because it throws unsupportedoperationexception because it's not "just" hashmap or so. it's customized map next specific features mentioned in the javadoc: the returned implementation must back upwards of standard , optional map methods, plus back upwards next additional requirements: the map implementation must implement java.io.serializable interface. any effort add together null key or value must throw nullpointerexception . any effort add together key not string must throw classcastexception . if attribute n...

ios - Fetched Property works in iOS5 but not iOS6 -

ios - Fetched Property works in iOS5 but not iOS6 - i having serious issue within coredata database. have created 1 many relationship between 2 tables , added fetched property on table containing unique values. code works expected within ios 5 in ios 6 receive next errror: 2013-02-08 15:15:49.382 ardsboroughcouncil[16152:c07] * terminating app due uncaught exception 'nsunknownkeyexception', reason: '[<_nsobjectid_48_0 0xb25c3b0> valueforundefinedkey:]: class not key value coding-compliant key tour_id.' * first throw phone call stack: (0x31c7012 0x24a3e7e 0x324ffb1 0x1c445ed 0x1bb08db 0x1bb088d 0x1bceb17 0x1bfe746 0x21b74bb 0x21b7176 0x21b6e44 0x21b66f4 0x21b2d63 0x21b2a82 0x21b2850 0x21b2625 0x21b1e07 0x21b18f4 0x21b0a6d 0x21ae9c9 0x2201276 0x227b155 0x2201071 0x2880014 0x286fd5f 0x286faa3 0x220103b 0x2200e9e 0x21ae9c9 0x2209dfa 0x22375cf 0x2237a03 0x59de1 0x11c2753 0x11c2a7b 0x11d0590 0x11d85bd 0x11d8eab 0x11d94a3 0x11d9098 0x1534da3...

python - SuspiciousOperation using sorl-thumbnail -

python - SuspiciousOperation using sorl-thumbnail - i have django web application accesses , manipulates several server filesystems (e.g. /fs01, /fs02, etc.) on behalf of user. i'd nowadays thumbnails of images on filesystems user, , thought sorl-thumbnail way it. it seems though images must under media_root sorl-thumbnail create thumbnails. media_root /users/me/dev/myproject/myproj/media , works: path = "/users/me/dev/myproject/myproj/media/pipe-img/magritte-pipe-large.jpg" try: im = get_thumbnail(path, '100x100', crop='center', quality=99) except exception, e: exc_type, exc_obj, exc_tb = sys.exc_info() print "failed getting thumbnail: (%s) %s" % (exc_type, e) print "im.url = %s" % im.url it creates thumbnail , prints im.url, i'd expect. when alter path to: path = "/fs02/dir/ep340102/foo/2048x1024/magritte-pipe-large.jpg" it fails with: failed getting thumbnail: (<class 'django.c...

sql - What is a multiple key index? -

sql - What is a multiple key index? - add_index :microposts, [:user_id, :created_at] i going through michael hartl's railstutorial , noticed he's using called multiple key index. know means active record uses both keys @ same time, i'm not sure advantages , disadvantages of using multiple key indexes are. if can give reply appreciate it. any index can give benefit allowing query narrow downwards set of rows examine. a multi-column index can help when query includes conditions on multiple columns. for example: select * mytable user_id = 123 , created_at > '2013-02-01' the multi-column index narrows downwards subset of rows associated user_id 123, within subset, farther narrows downwards selection recent created_at value. without sec column in index, rdbms have load all rows user_id 123 memory before determine if pass criteria. for more information, see presentation how design indexes, really. sql ruby-on-rails

postgresql - pgAdmin III: How to view a blob? -

postgresql - pgAdmin III: How to view a blob? - i understand postgresql writes blob content separate table, there way view blob contents in easy , convenient way within pgadmin? i not sure mean "easy , convenient" best can lo_read(...) this presents lob bytea . this easy , convenient in sense of getting info out pgadmin won't convert escaped string original binary left looking @ textual representation of binary, not "easy , convenient" if want show image contained in lob when in png format or anything. postgresql pgadmin

c# - LINQ Design time compile error -

c# - LINQ Design time compile error - can please inform me right syntax below query? i design time compile error origin @ "equals" keyword @ next spot: && a.applicationid equals ga.applicationid with next error: "a query body must end select clause or grouping clause" i understand error means, can't see syntax error is.... public static list<applicationconfigurations> getappconfigs() { seek { using (wmswebentities dbcontext = new wmswebentities()) { ienumerable<applicationconfigurations> myappconfigs = new ienumerable<applicationconfigurations>(); myappconfigs = (from in dbcontext.applicationconfigurations bring together ga in dbcontext.groupapplicationconfigurationslk on a.configurationid equals ga.configurationid && a.applic...

android - Drawing a bitmap with relative layout returns illegalargumentexception -

android - Drawing a bitmap with relative layout returns illegalargumentexception - i trying create bitmap out of relative layout have created programmatically. realtivelayout showing expected when seek create bitmap , returns illegal argument exception height , width must > 0 how doing bitmap.createbitmap(savelayout.getwidth(), savelayout.getheight(), bitmap.config.argb_8888); any pointers? edit: added code, too: viewtreeobserver viewtreeobserver = savelayout.getviewtreeobserver(); if (viewtreeobserver.isalive()) { viewtreeobserver .addongloballayoutlistener(new ongloballayoutlistener() { @override public void ongloballayout() { savelayout.getviewtreeobserver() .removeglobalonlayoutlistener(this); viewwidth = savelayout.getwidth(); viewheight = savelayout.getheight(); ...

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer - when trying request rest service @ time of response getting exception.. feb 21, 2013 2:34:49 pm com.sun.jersey.spi.container.containerresponse mapmappablecontainerexception severe: exception contained within mappablecontainerexception not mapped response, re-throwing http container java.lang.noclassdeffounderror: not initialize class net.sf.cglib.proxy.enhancer @ org.hibernate.proxy.pojo.cglib.cgliblazyinitializer.getproxyfactory(cgliblazyinitializer.java:117) @ org.hibernate.proxy.pojo.cglib.cglibproxyfactory.postinstantiate(cglibproxyfactory.java:43) @ org.hibernate.tuple.entity.pojoentitytuplizer.buildproxyfactory(pojoentitytuplizer.java:162) @ org.hibernate.tuple.entity.abstractentitytuplizer.<init>(abstractentitytuplizer.java:135) @ org.hibernate.tuple.entity.pojoentitytuplizer.<init>(pojoentitytuplizer.java:55) @ org.hibernate.tuple.e...