Posts

Showing posts from April, 2013

hibernate - Grails not using query cache in view -

i've found odd issue regarding query cache in grails , it's called. i've tested several times , got same result. problem: bellow view\gsp code hits database every time though have cache:true on. <g:select name="foo.thing.id" in="${thing.findall([cache:true])}" value="${foo.thing?.id}" /> workaround: pushing query call controller respects cache:true argument , stops hitting database on every page load. controller: def dostuff = { def things = thing.findall([cache:true]); return ['things':things] } view: <g:select name="foo.thing.id" in="${things}" value="${foo.thing?.id}" /> i'm using grails 1.3.7 following config.... hibernate { cache.use_second_level_cache=true cache.use_query_cache=true cache.provider_class='org.hibernate.cache.ehcacheprovider' } has else seen or can describe me why work differently? i'm not sure why doesn

Pass many input values through ajax -

my question related how send many form input values $.ajax want understand how pass ~ 100 input values through ajax for example input <input type="text" name="your_form[]" id="amount1"> <input type="text" name="your_form[]" id="amount2"> <input type="text" name="your_form[]" id="amount3"> and ajax this? var data=$(your_form).serialize(); $.ajax( { type: "post", url: "php_file.php", data: {"data" : data}, cache: false, please, advice you can pass input fields this: <form id="my-form"> <input type="text" name="your_form[]" id="amount1"> <input type="text" name="your_form[]" id="amount2"> <input type="text" name="your_form[]" id="amount3"> ... </form> jquery $.post("php_file

ios - How to add image to delete button when we swipe on tableview cell -

Image
i have implemented code delete button when swipe on tableview cell(see first image). want custom means want add image in place of delete button(see second image). googled didn't methods or code. every showing normal delete button. how can add image delete button. ideas!.please me. probably not idea change button else, users expect behavior remains consistent.however can implement method in custom cell. method called when user performs swipe action : - (void)willtransitiontostate:(uitableviewcellstatemask)state {  [super willtransitiontostate:state];  if ((state & uitableviewcellstateshowingdeleteconfirmationmask) == uitableviewcellstateshowingdeleteconfirmationmask) { (uiview *subview in self.subviews) {   if ([nsstringfromclass([subview class]) isequaltostring:@"uitableviewcelldeleteconfirmationcontrol"]) { uiimageview *deletebtn = [[uiimageview alloc]initwithframe:cgrectmake(0, 0, 64, 33)];

c# - Synaptics Touchpad Signature -

i want use synaptics sdk use touchpad capture signature. trying capture absolute x , y positions of touch can track people lifting finger , putting down somewhere else. know i'm able access touchpad because can disable , access dimensions of touchpad. the next step absolute x , y coordinates. according synaptics ps/2 touchpad interfacing guide (page 22) there "absolute mode" can information. far can't seem access it. don't know how set mode. i'm developing in visual studio express 2012 using c#. also, can't seem activate of events whatsoever. i'm trying register events this: using syncomlib; using synctrllib; synctrllib.synapictrl synapictrl1 = new synapictrl(); synctrllib.syndevicectrl syndevicectrl1 = new syndevicectrl(); synctrllib.syndisplayctrl syndisplayctrl1 = new syndisplayctrl(); synapictrl1.onnotify += synapictrl1_onnotify; syndevicectrl1.onpacket += syndevicectrl1_onpacket; syndisplayctrl1.onmessage += syndisplayctrl1_on

mapreduce - How to queryl based on time interval in riak -

i trying implement following functionality. have bucket storing objects. 1 of object field timestamp. want retrieve objects timestamp between interval (20130605 08:00:00 20130605 08:05:00) mean need objects 8.00 8.05. can implement using map reduce or using secondary indexes? another approach considering bucket created 20130605:0800:0805 , store objects under bucket. now, dont want implement conditional time interval based queries. please suggest way. depending on type of data storing, there few options. correctly point out, secondary indexes 1 way approach this, these support both exact match , range queries. can e.g. create binary index (possibly integer index) containing timestamp outlined in example , fetch based on range query on index. if data allows it, option might store several objects in single record , give record key represents specific time interval. allow retrieve records covering specific time period directly using keys, efficient , scales well. have d

Convert Hexadecimal Character from URL in php -

i want convert hexadecimal character urls (e.g. %c3%a4) "normal" utf8 character (e.g. ä) (like "hexadecimal codes characters" in hexadecimal character codes in url ). how in php? i tested following: echo hexdec("%c3%a4"); // 50084 echo bin2hex("%c3%a4"); // 254333254134 echo dechex("%c3%a4"); // 0 echo pack('h*', "%c3%a4")"; //warning: pack(): type h: illegal hex digit % in ... warning: pack(): type h: illegal hex digit % in ... 51 0� (i've convert word "w%c3%a4re" "wäre") try this: urldecode('%c3%a4');

I get a syntax error after JQuery upgrade from 1.51 to 2 -

the code hasn't changed jquery version. simplified version of ajax call is: $.ajax( { type: 'get', url: mappath($(this).attr('path')), cache: false, data: '{}', datatype: 'html', success: function (result) { console.log(result); if ($(result).filter('#feedback').length > 0) { $('#center').children(':first').before($(result).filter('#feedback').outerhtml()); } else { $('#feedback').remove(); $('#dialog').html(result); $('#dialog').dialog('option', 'title', 'edit mailbox'); $('#dialog').dialog('open'); } } }); just before if statement log result. shows expected formatted html snippet. snippet meaning contains div child elements. when use select

c# - Marshaling CTL_USAGE -

i'm doing project work certificates , need convert ctl_usage structure c#. original structure follows: typedef struct _ctl_usage { dword cusageidentifier; lpstr *rgpszusageidentifier; } ctl_usage, *pctl_usage, cert_enhkey_usage, *pcert_enhkey_usage; according p/invoke website, c# structure should this: [structlayout(layoutkind.sequential)] public struct ctl_usage { public int cusageidentifier; public intptr rgpszusageidentifier; } to use code, convert each string want add structure byte array using encoding.ascii.getbytes(). turn byte array gchandle using gchandle.alloc(bytearray, gchandletype.pinned). add value array of intptrs , create gchandle intptr array , assign rgpszusageidentifier. call cryptencodeobjectex doesn't throw error, resulting data garbage , cannot unencrypted using cryptdecodeobject. encoding follows: //enhancedusage list<string> containing enhanced usage oids ctl_usage usage = new ctl_usage() { cusageidentifier = enha

Set up a subsection for Google Analtyics -

Image
i have client (on shared enterprise site). wants share google analtyics data external marketing firm. have manager while against this, has agreed share information only parts of site . luckily, data shared falls under 1 path. is, external marketing firm should see falling under http://domain.com/section_to_share/ -- nothing outside of scope. how should set external have access part of data ( /section_to_share/* )? how can ensure management can see /section_to_share/ , nothing else? i'm navigating choppy waters. update: so set porfile , filter based on suggestions. current problem doesn't seem reading data. so i'm doing wrong. don't know where. i've set filter follows. is there additional step(s) have overlooked? create new profile, go admin section, goto "filters", set predefined filter "include traffic subdirectory equals" , enter path subdirectory in text field. add marketing company read access new profile.

cmd - Read a string from a text file and copy it on another text file using batch file -

what want read text file containing ping results, detect string , copy in text file. strings want copy bold in example. envoi d'une requˆte 'ping' sur star.c10r.facebook.com [31.13.81.17] avec 32 octets de donn‚esÿ: r‚ponse de 31.13.81.17ÿ: octets=32 temps=77 ms ttl=240 statistiques ping pour 31.13.81.17: paquetsÿ: envoy‚s = 1, re‡us = 1, perdus = 0 (perte 0%), dur‚e approximative des boucles en millisecondes : minimum = 77ms, maximum = 77ms, moyenne = 77ms i tried execute program variable "resultat" does't appear in result. @echo off setlocal enabledelayedexpansion set output_file=result.txt >nul copy nul %output_file% /f %%i in (testservers.txt) ( set server_address=address n/a /f "tokens=1,2,3,4" %%a in ('ping -n 1 %%i ^&^& echo server_is_up') ( if %%a==r,ponse set resultat="%%b %%c %%d" ) echo %%i [!server_address::=!] resultat >>%output_file% )

asp.net - Initial SelectedValue in DropDownList not posting back when re-selected -

i have dropdownlist following markup: <asp:updatepanel id="updatepanel1" runat="server" childrenastriggers="true" updatemode="always"> <contenttemplate> <asp:dropdownlist id="ddlcampaignmodule" runat="server" onselectedindexchanged="ddldynamictype_selectedindexchanged" autopostback="true"> <asp:listitem value="-1">none</asp:listitem> <asp:listitem value="10">category menu</asp:listitem> <asp:listitem value="11">best sellers</asp:listitem> <asp:listitem value="12">best reviews</asp:listitem> </asp:dropdownlist> </contenttemplate> </asp:updatepanel> in code behind select second option category menu . if run code , select other option posts ddldynamictype_selectedindexchanged if re-select second option (afte

C - pstree equivalent -

in bash there pstree command 'draws' tree of processes. wondering similar function in c programming language? a simple example appreciated. there no such 'function' in c. can program creates alike, using execl() / system() calls ps , or reading /proc file system (on linux). from there, can children list of every process, , each process of list children etc.. starting process 1 init . otherwise, int main() { system('pstree'); return 0; } would work :-) if want reimplement it, you'd better follow carl norum's advice use source, luke !

Are there circumstances where an Akka-based application can replace a Hadoop setup? -

from reading akka , own beginning uses of it, seems me akka used, , more simply, hadoop setup applications. wouldn't have hdfs use, write application send out pieces of work different "mappers" , have results sent "reducer", , easier set hadoop in vms or on hardware, fewer services set up. reasonable or 2 technologies used totally different things? yes, totally reasonable. have built large scale (1000+ workers) map-reduce system using akka 2.0. akka 2.2+ better because can use clustering , remote deathwatch features instead of having write functionality yourself. see this post feel how might work.

mysql - Should I split large table into smaller identical ones in this case? -

imagine have multisite script, e.g. having multiple instances if same thing (like forum hosting). if using mysql better create new set of tables each site or have 1 large table site_id column? one table of course easier maintain, abut performance? if used redis, answer different? stop trying outsmart dbms, won't win battle. data should broken tables logically, not performance reasons. what describing weak attempt @ trying re-invent index.

css - Can't set height on the thumbnail -

i using twitter bootstrap object thumbnail, , css bootstrap gives out. want set fixed height of 200px when change in .thumbnail in css nothing happens. thumbnail kind of responsive amount of text controls height .thumbnail { height: 200px; display: block; padding: 4px; line-height: 20px; border: 1px solid #ddd; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055); -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055); -webkit-transition: 0.2s ease-in-out; -moz-transition: 0.2s ease-in-out; -o-transition: 0.2s ease-in-out; transition: 0.2s ease-in-out; } the strange thing wont work when put css height inline in html document works. don't want in html document. <div class="span3"> <ul class="thumbnails"> <li class="span12"> <div class="thu

Not a valid regular expression error in Django -

please see urlpatterns given below, following error when try run program... improperlyconfigured @ / "^product/(?p<product_slug> [-\w]+)/$" not valid regular expression: unexpected end of pattern request method: request url: http://127.0.0.1:8000/ django version: 1.5.1 exception type: improperlyconfigured exception value: "^product/(?p<product_slug> [-\w]+)/$" not valid regular expression: unexpected end of pattern exception location: c:\python27\lib\site-packages\django-1.5.1-py2.7.egg\django\core\urlresolvers.py in regex, line 178 python executable: c:\python27\python.exe urls.py urlpatterns = patterns('ecomstore.catalog.views', (r'^$','index',{'template_name':'catalog/index.html'},'catalog_home'), (r'^category/(?p<category_slug>[-\w]+)/$','show_category',{'template_name':'catalog/category.html'},'catalog_category

c# - Generics of unknown type -

i'm creating settings class so: class setting<t> {...} i storing settings in tree so: class settingsnode { public setting<> setting; public setting<> child; public setting<> sibling; } this doesn't compile because of <> . can have multiple types ( setting<int> , setting<string> , etc) don't know how create settingsnode. so changed to: class settingsnode { public object setting; public object child; public object sibling; } but having trouble casting right type: // create setting type name text settingsnode tmp = new settingsnode(); type generictype = typeof(setting<>); type[] typeargs = { type.gettype("system.int32") }; type ctype = generictype.makegenerictype(typeargs); tmp.setting = activator.createinstance(ctype); // here's have problem type basetype = typeargs[0]; ((setting<basetype>)(tmp.setting)).somefunction(); the error on last line is: the type o

pic - How to detect that an i2c slave doesn't respond to the master on PIC18f -

i have pic18f i2c master , other devices slaves. i want detect if slave not on bus or if doesn't responds. right now, communication master<->slaves works except when slave doesn't responds. when happens, pic stays in waiting state , whole program stopped. how can detect , fix ? (in software way) for information, i'm working on pic18f25k22. i assume using mplab c18. source i2c functions can found in: c:\program files (x86)\microchip\mplabc18\v3.46\src\pmc_common\i2c next, you'll need figure out functions hanging , write own versions don't go endless loops if slave doesn't respond. readi2c hanging waiting slave respond. replace myreadi2c takes timeout parameter. modified version of code in i2c_read.c. #if defined (i2c_v1) int myreadi2c( long timeout ) { if( ((sspcon1&0x0f)==0x08) || ((sspcon1&0x0f)==0x0b) ) //master mode sspcon2bits.rcen = 1; // enable master 1 byte reception while ( !sspstatbits.bf &&

how to resize a pdf file from legal format to letter format using c#` -

i have pdf files exported legal format , want convert them letter format (basically shrink them), each file may have 1 3 pages, below code tried have these problems: the page size reduced good, can't use margin properties put page @ correct borders of container (the page kind of shrinked drawn somewhere @ bottom of resulted pdf file) i couldn't increment number of pages code draws both pages, 1 on top of other. here's code pdfimportedpage page; pdfreader reader = new pdfreader(@"c:\pdf\legalformat.pdf"); document doc = new document(pagesize.a4, 0, 0, 0, 0); pdfwriter writer = pdfwriter.getinstance(doc, new filestream(@"c:\pdf\letterformat.pdf", filemode.create)); doc.open(); pdfcontentbyte cb = writer.directcontent; (int = 1 ; < reader.numberofpages + 1; i++){ page = writer.getimportedpage(reader, i); // number of page float scale = 0.67f; cb.addtemplate(page, scale, 0, 0, scale, 0, 0); } doc.close(); problem solve

ruby on rails - Rename files in same path -

i trying write method rename .new file extensions new name have seen similar post nothing specific asking. my code needs rename files in directory in. since method searching multiple directories. code have written renames files in root directory. this function ran on multiple directories using pathname = "/path/to/app/" not work me. here code: dotnewfiles = file.join("**", "*.new") dir.glob(dotnewfiles).each |f| filename = file.basename(f, file.extname(f)) #keep commented until works #file.rename(f, filename) print "renamed file from:\t" printf "%-50s %s\n", f, "to".upcase + "\t" + filename end my output looks this: renamed file from: app/assets/javascripts/application.js.new application.js renamed file from: app/assets/stylesheets/application.css.new application.css dir.glob('**/*.new').each |f| filename = file.expand_path('../' + file.basename

sql server - Statement blocks in SQL SELECT using IF ELSE -

i'm trying return different data depending on variable in select . this: select if @variable = 'yes' column1, column2 else column3 table what proper way use if condition in sql? or there better alternative i'm trying accomplish? you can use if statement, you'll need set multiple queries. can use case selecting 1 column or another, not select 1 or multiple in question. declare @var int = 1; declare @test table ( col1 int, col2 int, col3 int ) insert @test values (1,2,3) if @var = 1 begin select col1, col2 @test end else begin select col3 @test end

c# - get sent mails via imap -

does know how can sent mails specific user using ae.net mail library? i've tried this: imap = new imapclient(imapmailserver, username, password, imapclient.authmethods.login, imapmailport, imapusessl); if (imap.isconnected) { imap.selectmailbox("inbox"); var msg = imap.searchmessages(searchcondition.to("examplemail@gmail.com")); } but without success (msg collection empty)... edit (solution) : i had select sent folder instead of inbox. because using gmail, gmail's sent mail folder named "[gmail]/sent mail". has be: imap.selectmailbox("[gmail]/sent mail"); are looking message you've sent? in case, they're in sent folder, [gmail]/sent mail on google.

c# - Unexpected text (System.Int32[]) -

i trying make code computes hold time , press/release times of keys entered through keyboard. hold time = keyup(i) - keydown(i+1) release_press time = keydown(i+1) - keyup(i) press_press time = keydown(i+1) - keydown(i) release_release time = keyup(i+1) - keyup(i) and code neither error nor warnings ...but when run ( system.int32[] ) in text boxes hold , press/release times should exhibited. don't know why i'm getting error or error is. form1.cs using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; using domainnn; using sessionnn; namespace thelatestks { public partial class form1 : form { brokerrr b = new brokerrr(); public form1() { initializecomponent(); } int = 0; private void timer1_tick(object sender, eventargs e) { i++; }

python - Unittesting with translations -

i'm trying unittest code use webapp2_extras.i18n.lazy_gettext , don't want test requests. when test code use method, following exception: assertionerror: request global variable not set. can test translations without using webapp2?

c# - WCF over net.tcp with security mode none gives exception -

we streaming data wcf using callbacks. wcf hosted in iis (default settings, added net.tcp protocols). we trying disable security on wcf, i've set security mode "none", both on client , server, following communicationexception: the socket connection aborted. caused error processing message or receive timeout being exceeded remote host, or underlying network resource issue. local socket timeout '00:00:59.8439844'. i've put on tracing on service , traceviewer gives me following exception (system.servicemodel.protocolexception): stream security required @ http://www.w3.org/2005/08/addressing/anonymous , no security context negotiated. caused remote endpoint missing streamsecuritybindingelement binding. client program.cs: using system; using system.servicemodel; using wcfclient.servicereference1; class program { static void main() { callback callback = new callback(); instancecontext context = new instanc

javascript - Prevent navigator.getCurrentPosition coordinates from being altered -

my web app uses javascript's navigator.getcurrentposition method determine user's location. understanding js can pinpoint user's location greater degree of accuracy can done on server side. having said that, know users can modify coordinates on client side. prevent them being altered if possible or @ least validate integrity of values on backend, using php. suggestions? thanks, cody

database - javascript: to make backend db changes is reflected to browser instantly, is it possible? -

here problem. have hardware scanner connecting windows computer. when scan item windows computer price/information item. insert price database through windows program/c# program. i have web application, has access same database c# program . web application should open @ time when scanning. changes in db reflected web browser right @ time when scan. is related javascript technology(or other technology)? possible? thanks if web app, running on web server has access database , can notified of changes, use http persistent (aka keep-alive) connection 'push' updates down pipe browser js pick them up http://en.wikipedia.org/wiki/http_persistent_connection more details here: persistent connection client

javascript - HTML5: readAsDataURL -

i have added eventlisterner code register, if user has dragged image browser. want src of image. i'm working locally xampp. not work. console says "anonymous function" , uncaught error. document.body.addeventlistener('drop', function (e) { e.stoppropagation(); e.preventdefault(); file = e.datatransfer.files[0]; reader.readasdataurl( file ); console.log("dropped"); console.log("file: "+reader.readasdataurl( file ).result); }); here example can reference problem, shows drag , drop method, , file chooser method. can't more specific code have provided snippet, have not provided full error shown in console , don't have jsfiddle demonstrates issue. css #progress_bar { margin: 10px 0; padding: 3px; border: 1px solid #000; font-size: 14px; clear: both; opacity: 0; -moz-transition: opacity 1s linear; -o-transition: opacity 1s linear; -webkit-transition: opacity 1

c# - Ajax.BeginForm refreshing the whole page in MVC -

i've been trying add ajax functionality mvc site, however, run problem regarding page refreshing. i've created rss view on homepage sidebar, allows user select rss feed want view using drop down list. using html.begin form option in mvc, however, decided cool feature have rss feeder refresh, rather having whole page refresh. implemented ajax.begin form, whole page still refreshing. here code inside view: <div class="rss_feed"> <h3>rss feed</h3> @using (ajax.beginform("index", "home", new ajaxoptions { httpmethod = "post", updatetargetid = "feedlist" })) { @html.dropdownlistfor(x => x.selectedfeedoption, model.feedoptions) <input type="submit" value="submit" /> } <div id="feedlist"> @foreach (var feed in model.articles) { <div class="feed&

memory leaks - Azure service dies after a few days -

i have small size (x2) cloud service running , operating fine 4-6 days becomes unresponsive , requires manual restart through azure portal online. windows event logs show virtual memory running low. after 2-3 days start getting: windows diagnosed low virtual memory condition. following programs consumed virtual memory: waiishost.exe (3836) consumed 3810709504 bytes, cacheservice.exe (1528) consumed 823902208 bytes, , w3wp.exe (1728) consumed 145485824 bytes. after while services start failing (due memory problem??): application: cacheservice.exe framework version: v4.0.30319 description: process terminated due unhandled exception. exception info: microsoft.applicationserver.caching.configstoreexception stack: @ microsoft.applicationserver.caching.customproviderproxy+<>c_ displayclass5.b _3(system.object) @ system.threading.executioncontext.run(system.threading.executioncontext, system.threading.context

r - Expressions in markdown using knitr -

Image
i'm trying use inline expression in .rmd markdown file. i'm converting .rmd file pdf using pandoc. contents of file this: report ======================================================== text , expression 100km^2 ```{r} summary(cars) ``` i expected 100km^s render normally, renders literally '100km^2'. how can expression render? you can use latex math mode this, knit(text="$100 km^2$",output="test.md") pandoc("test.md", format="latex") gives me:

php - PDO error handling and storing errors in database -

how go getting pdo statements generate safe error message? don't want user see error message. want them directed page says clean message, "whoops unexpected happened!". log errors in database review , catch errors others generating. i'm using php , mysql. i found when make connection can set error handling this. $dbh = new pdo($dsn, $user, $password); $dbh->setattribute(pdo::attr_errmode, pdo::errmode_exception); anyone before? i think better write logs file, instead of database. since want log pdo errors, indicate wrong database connection. you can show user nice error page catching errors. can redirect users error page then, in case went wrong.

changing text in svg by jquery (text is an dynamically value - temperature) -

i'd change text-part of svg: <text id="vl_temp" xml:space="preserve" style="font-size:40px;font-style:normal;font-weight:normal;line-height:100%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:sans;-inkscape-font-specification:sans;font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr" x="432.24234" y="110" sodipodi:linespacing="100%">**--**</text> i'd display temperature, comes knx-installation i've tried following code, nothing happens: <script> <![cdata[ var thisga = '14/0/4'; var thistransform = 'dpt:9.001'; visu = new cometvisu('/cgi-bin/'); visu.update = function ( json ) { var temp = transform[thistransform].decode( json[thisga] ); $('#vl_temp', svg.root()).text('temp'); } $(window).unload(function() { visu.stop(); }); visu.user = 'demo_user'; vi

.net - Can't connect Amazon rds database in Amazon ec2? -

i have console application has amazon rds connection entity framework . running in local pc. when running application in amazon ec2 can not connect amazon rds database , saying 'the underlying provider failed on open' . connection string of entity framework ... <add name="myentities" connectionstring="metadata=res://*/yhfinmodel.csdl|res://*/yhfinmodel.ssdl|res://*/yhfinmodel.msl;provider=system.data.sqlclient;provider connection string=&quot;data source=datasourcename,portnumber;initial catalog=databasename;persist security info=true;user id=userid;password=password;multipleactiveresultsets=true;app=entityframework&quot;" providername="system.data.entityclient" /> thanks in advance. have looked @ security groups? think need add ec2 security group using have port access rds instance.

mod rewrite - Apache: Remove "www." and redirect to sub directory -

on web server have installed wordpress sub folder /wp . want use apache's mod_rewrite achieve following: redirect www.domain.com traffic domain.com redirect traffic sub folder /wp i tried following in root's .htaccess file: rewriteengine on rewritecond %{http_host} ^(www\.)?domain\.com$ rewriterule ^(/)?$ wp [l] rewritecond %{http_host} ^www\.domain\.com rewriterule ^(.*)$ http://domain\.com/ [r=permanent,l] but not work intended. ideas doing wrong here? edit : have solved first requirement changing latter 2 lines to: # redirect www.domain.com domain.com rewritecond %{http_host} ^www [nc] rewriterule ^.*$ http://domain.com/$0 [r=301,l] the second requirement still open though ... append additional rule: rewriterule (?!^wp/)^(.*)$ /wp/$1 [l,nc]

wpf - How to suppress Disable add-in dialog when Excel is force close -

my addin written in c#, netoffice, exceldna using wpfframework. part uses winforms, too. main ui wpf when there modal dialog displayed, users force close excel. next time when launch excel, excel " excel experienced serious problem ' * ' add-in. if have seen message multiple times, should disable add0in , checke see if update available. want disable add-in?" yes, no users click yes or enter without reading message , add-in disappears excel. not want dialog show up. possible , how? i try catch exception in autoopen() below. seems have no effect stop dialog @ all. public void autoopen() { ..... system.windows.forms.application.threadexception += applicationonthreadexception; appdomain.currentdomain.unhandledexception += currentdomainunhandledexception; dispatcher.currentdispatcher.unhandledexception += currentdispatcher_unhandledexception; taskscheduler.unobservedtaskexception += tasksc

Ansible Mercurial clone hangs -

when try clone repository bitbucket ansible, seems task 'hangs'. in documentation have found information, i'm not using ssh. if task seems hanging, first verify remote host in known_hosts. ssh prompt user authorize first contact remote host. 1 solution add stricthostkeychecking no in .ssh/config accept , authorize connection on behalf of user. however, if run different user such setting sudo true), example, root not @ user .ssh/config setting. these 2 playbooks i've tried. both 'hangs'. playbook #1 - hosts: staging_mysql user: ec2-user sudo: yes vars_files: - vars/mercurial.yml tasks: - name: mercurial credentials setup action: template src=templates/hgrc.j2 dest=/home/ec2-user/.hgrc - name: install mercurial action: yum name=hg - name: setup api repository action: command hg clone https://bbusername@bitbucket.org/username/my-repo -r default --debug playbook #2 - hosts: staging_mysq

objective c - UISearchDisplayController inside UIPopOverController - searchResultsTableView not displaying properly -

so have tableview inside uipopovercontroller , attached uisearchbar header of tableview , have uisearchdisplaycontroller displaying correct results. however, can't results display within uipopovercontroller window. it's displaying behind popover view detailview covering half screen ( splitviewcontroller ipad). how bring results/tableview popover view? tried adding searchtableview popover view, covers original tableview. here code of setting up: //initialize popover controller uiview *ccpopoverview = [[uiview alloc] init]; uiviewcontroller* popovertablecontent = [[uiviewcontroller alloc] init]; self.cctableview = [[uitableview alloc] initwithframe:cgrectmake(0, 44, 320, 400) style:uitableviewstyleplain]; self.cctableview.datasource = self; self.cctableview.delegate = self; self.searchbar = [[uisearchbar alloc] initwithframe:cgrectmake(0, 0, 320.0, 44.0)]; self.searchdisplaycontroller = [[uisearchdisplaycontroller alloc]initwithsearchbar:self.searchbar contentscon

javascript - Poorly Performing Query -

i have server using store log files using mongodb. problem while browsing revision have notable delay , performace spike on server. there better way folowing: function getrevisionslist(project,callback){ mongoclient.connect("mongodb://localhost:27017/devbed", {native_parser:true}, function(err, db) { tmp=[] if(err) { console.dir(err); } db.collection(project).find({}).toarray(function(err, items) { fillrevarr(tmp,items,0,project,callback); db.close(); }); }); } function fillrevarr(tmp,items,i,project,callback){ console.log(items) num=json.stringify(items[i].revision).replace(/["']{1}/gi,""); tmp.push("<a href=\"/"+project+"/"+num+"/log\">"+num+"</a>") if(i==items.length-1){callback(tmp)} else{fillrevarr(tmp,items,(i+1),project,callback)} } which gives me array of revisions. do not transform resultset array. use cursor instea

android - how to convert this uri file://mnt/ to this uri content://media -

i posted similar question, have not received answer solves problem. convert url sdcard content uri i need simple code convert format: file:///mnt/sdcard/movies/your_voice/your_voice080513_141510.mp4 not forma content://media/external/video/media/2308 to format : content://media/external/video/media/2308 i saw related q : how convert file:// uri content:// uri? in oposit side android: getting file uri content uri?

html - How do I echo slashes in php? -

everytime check html output of piece of code, slashes aren't included. thus, background image fails. put through html php converter. im lost; please help. while($row = mysql_fetch_array($data)) { //echo theme template on pages echo "<div style='background-image:url('../uploads/avi/{$row['avi']}')></div>"; echo "<div class='myname'>{$me}</div>"; } the simplest answer be, have unclosed ' on style attribute.. echo "<div style='background-image:url('../uploads/avi/{$row['avi']}')'></div>";                                                                                                                                               ^here but wouldn't work is.. should adjust quotes this: echo "<div style='background-image:url(\"../uploads/avi/{$row['avi']}\");'></div>"; you can

android - ADT logcat displayes weird message /sbin/sh: can't fork -

Image
i completly new this. installed adt log while testing mobile app. see there cool filters think me have problem. run adb server, phone connected via usb, , when type adb logcat can see full log. run adt -> ddms, highlight device in "devices" tab , in "logcat" section this: i tried clear log after nothing happend. edit: after restarting adt in console tab got thiss error [2013-05-08 21:36:38 - ddms] adb rejected shell command (getprop): closed [2013-05-08 21:36:41 - ddms] adb rejected shell command (logcat -v long): closed [2013-05-08 21:36:41 - unexpected error while launching logcat. try reselecting device.] closed com.android.ddmlib.adbcommandrejectedexception: closed @ com.android.ddmlib.adbhelper.executeremotecommand(adbhelper.java:381) @ com.android.ddmlib.device.executeshellcommand(device.java:462) @ com.android.ddmuilib.logcat.logcatreceiver$1.run(logcatreceiver.java:110) @ java.lang.thread.run(unknown source)

c++ - Correcting live IMFMediaSource time stamps -

i have 2 cameras, listed below, trying use in media foundation topology. here summary of topology: webcam --> mjpg decoder --> custom mft --> h264 encoder --> mp4 file sink the problem generated mp4 file has incorrect duration , time scale tags, both mp4 container , h264 stream. can correct tool mp4box or yamb, eventual goal stream video. one potential cause have identified samples generated camera sources not start @ time 0. according bullet #2 in http://msdn.microsoft.com/en-us/library/windows/desktop/ms700134(v=vs.85).aspx#live_sources , timestamps of live source should start @ 0. along line, i've tried following "correct" sample timestamps: re-based sample time in custom mft, using imfsample::setsampletime . created wrapper imfmediasource , imfmediastream objects, catches , corrects time stamps associated memediasample , mestreamtick events. in both of these cases, media session throws error 0xc00d4a44 ( mf_e_sink_no_samples_processe

delphi - TJvValidateEdit, Language Settings, Variants and Float Issues -

in jvvalidateedit value property variant behaves strangely different windows language settings when setting or getting float. if customize windows number formatting default settings comma decimals , dots thousands separator value appears correctly. e.g. float of 1.23 displayed "1,23". however if change windows language spanish has same number formatting real number assigned displayed incorrectly. e.g. 1.23 value displayed "123". if assign string text ( ed.text := floattostr ( 1.23 ) appears correctly if try , access number reformatted. when trace through code problem seems occurring before jvvalidateedit starts processing it. appears compiler trying convert string in order assign variant it's doing wrong. unfortunately been long time since i've looked @ assembler , ibm 360. i'm using xe , generating 32bit code if makes difference.

c# - Connection.open for hangs indefinitely, no exception is thrown -

when try following code, program hangs indefinitely. don't know why , there seems other unanswered topics on matter. although, if ip\website cannot reached, works intended. private void dostuff() { string connectionstring = "data source=www.google.com;connection timeout=5"; using (sqlconnection connection = new sqlconnection(connectionstring)) { connection.open(); //hangs here indefinitely console.writeline("test"); } } for example, if set connection string connectionstring = "data source=www.nonexistentsite.com;connection timeout=5"; then throw exception. how throw exception active site? ... google testing purposes, obviously. edit : if try connect unreachable server name or ip address will exception... a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , s

github - Using Aptana Studio to import git project but Permission denined (publickey) -

i tried import existing project github repository aptana studio error says permission denied (publickey). fatal: remote end hung unexpectedly i made sure add ssh account in github. ran $ssh -vt gitt@github.com , says private key cannot found. on other windows 7 machine never had problem importing git project on home pc can't work. have solution? apparently has proper ssh - keys set aptana. there 2 possibilities 1) if you've installed github windows application have key-pair. registered github. can find these under https://github.com/settings/ssh once you've logged on github. need explain aptana use proper private key open aptana and go window/preferences -> general/network connections/ssh2 click add private key... , select github_rsa file, not pub file, want tell aptana private key is. now aptana use proper key connect github

c# - ASP.Net: missing references -

i'm new asp.net. have access existing solution. when opened in studio, of projects seems missing references. example, 1 of projects seems missing nunit.framework . looked @ .csproj file , saw this: <reference include="nunit.framework, version=2.4.3.0, culture=neutral, publickeytoken=96d09a1eb7f44a77, processorarchitecture=msil"> <specificversion>false</specificversion> <hintpath>..\..\references\nunit.framework.dll</hintpath> </reference> i'm guessing machine doesn't have dll? i tried right clicking references folder, add reference , looked nunit under assemblies . nothing found. system missing this? if so, how it? other missing references: system.web.extensions , microsoft.practices.enterpriselibrary.data . nunit unit-testing framework. can download here , @ point you'll have it. or presumably remove it, , remove whatever unit-testing code had been written in project, if needed compile right yo

ios - Website Attached to App -

how attach website app in xcode using uiwebview? chunk of code in assistant editor is: #import <uikit/uikit.h> @interface xyzappdelegate : uiresponder <uiapplicationdelegate> @property (strong, nonatomic) uiwindow *window; @property (readonly, strong, nonatomic) nsmanagedobjectcontext *managedobjectcontext; @property (readonly, strong, nonatomic) nsmanagedobjectmodel *managedobjectmodel; @property (readonly, strong, nonatomic) nspersistentstorecoordinator *persistentstorecoordinator; - (void)savecontext; - (nsurl *)applicationdocumentsdirectory; @end what next step? http://conecode.com/news/2011/05/ios-tutorial-creating-a-web-view-uiwebview/ google answer question.

javascript - JQuery Ajax request to http://pastebin.com/raw.php -

i try make jquery ajax request ' http://pastebin.com/raw.php ' , using code: $.ajax({ url: 'http://pastebin.com/raw.php', data: "i=vj29ufnk", complete: function(jqxhr, textstatus) { alert('complete'); }, success: function(data) { alert(data); }, error: function(xhr, status, error) { alert('noh!') } }); with status '404' within xhr url can see in firebug looks correct: http://pastebin.com/raw.php?i=vj29ufnk ideas? xhr calls protected under same origin policy . what can do, however, call server side script bypass this.

c++ - Translation/Transliteration problems -

i working on translation/transliteration program, reads english story, , translates elvish, using english/elvish dictionary. after code shown below, explain error receive. i have lot of code, not sure if should post all, post think should sufficient. apologies if code seems bizarre - beginner. there main file, header file 2 classes: translator , dictionary , , cpp file implement class functions. i have constructor reads in dictionary file dictfilename , copys english words englishword , , elvish words elvishword : translator::translator(const char dictfilename[]) : dict(dictfilename) { char englishword[2000][50]; char temp_eng_word[50]; char temp_elv_word[50]; char elvishword[2000][50]; int num_entries; fstream str; str.open(dictfilename, ios::in); int i; while (!str.fail()) { (i=0; i< 2000; i++) { str>> temp_eng_word; str>> temp_elv_word; strcpy(englishword[i]

Why does MATLAB change the sample rate while trying to acquire data? -

i using dataq acquisition device in matlab 32-bit data acquisition toolbox. on occasion, when have sample rate set 300, tells me: warning: hardware not support requested value of 300 samplerate. samplerate has been set 1000" however, if set samplerate 1000, sets 300 same error message. also, if set program after error displays , device has started recording returns samplerate, @ whatever set to, not program claims changed to. anyone have idea how find out actual sample rate or keep resetting mine? need know how many samples there per second further calculations. the problem not matlab daq. have similar "problem" ni daq. hardware set sample @ high rate avoid aliasing. sample @ higher rate required , use matlab command "resample" reduce sampling rate. resample avoid aliasing of higher frequencies.