Posts

Showing posts from February, 2014

jsf - Pretty Faces EL Injection does not work -

i building online application in jsf 2 primefaces , spring. want use pretty faces make our search urls bookmarkable. here pretty-config.xml: <?xml version="1.0" encoding="utf-8"?> <pretty-config xmlns="http://ocpsoft.org/prettyfaces/3.3.3" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://ocpsoft.org/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.3.3.xsd"> <url-mapping id="index"> <pattern value="/" /> <view-id value="/sites/public/template/index.xhtml" /> </url-mapping> <url-mapping id="searchwithparams"> <pattern value="/search/#{searchview.searchquery}/#{searchview.searchtags}/#{searchview.searchorder}" /> <view-id value="/sites/public/product/productsearch.xhtml" /> </url-mapping> <url-mapping id="searchwithoutp

Bootstrap form-inline and display:none -

i have form-inline in bootstrap , have 1 of form <input> controls invisible until user selects particular option. when display page , control visible, well, when display , control has class="hide", , show using jquery.show(), control appears on next line. it seems control's position doesn't initialized if has "hide" class (display:none) when page first shown. how control initialize properly?

c++ - Convert "Cartesian coordinates" to "polar coordinates with respect to user specified origin" -

i trying convert few points in image polar coordinates in opencv. came across function called carttopolar give me polar coordinates points respect 0,0 being origin. want conversion considering point in image origin. can me doing so? came across posts remap helps shift origin not clear how works. then have move ref point origin: px -= ref.x; py -= ref.y; now pass (px,py) carttopolar function

Access SQL: Calculating Min date value and duration for each day -

i'm looking @ gps data vehicles, composed of following information: vehicle day ignition landmark --------------------------------------------------- sample guy 1 7/5/2013 14:32 on sample guy 1 7/5/2013 15:10 off random place b sample guy 1 7/5/2013 15:15 on random place b sample guy 1 7/5/2013 15:20 off sample guy 1 7/20/2013 18:14 on sample guy 1 7/20/2013 18:20 off random place h sample guy 1 7/20/2013 18:22 on random place h sample guy 1 7/20/2013 18:24 off sample guy 2 8/1/2013 12:10 on random place zz sample guy 2 8/1/2013 12:12 on sample guy 2 8/1/2013 12:15 off random place zy sample guy 2 8/1/2013 13:10 on random place zy sample guy 2 8/1/2013 13:15 off i'm trying find first ignition off point landmark not null, , last ignition on point landmark not null each day . ideally, calculated field "duration" include

c++ - Saving 'this' address into a variable -

will save address of pointing to: size_t this_address = size_t(this); is portable? need save address of pointing to. suggestion on if there correct way go this. note, optimization purposes. void * more portable and, in opinion, more correct way store pointer address: void *this_address = this; this said, why need portable? not type-safe @ all, should use pointer correct (base)-type or, when applicable, smart pointer of (base)-type.

Add Rich Text Full Editor to Sitecore Page Editor -

i know there web.config sitecore setting update default text editor within content editor sitecore use full text editor: <setting name="htmleditor.defaultprofile" value="/sitecore/system/settings/html editor profiles/rich text full" /> however, not provide full rich text editor toolbar within page editor mode. there setting missing or implemented differently? add /sitecore/system/settings/html editor profiles/rich text full source field in builder tab when in template manager mode.

HTML email - td not aligning properly -

i'm building html eblast. have on table lives inside of holds body copy. pushing outside of containing table. how can make sit inside container supposed be? here's it's doing: http://zachkeller.net/annie_moses/index.html <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <head> <title>the song of annie moses</title> <style type="text/css"> #backgroundtable { table-layout:fixed; width: 650px; background-image: url(images/background.jpg); } </style> </head> <body> <table border="0" cellpadding="0" cellspacing="0" height="750px" width="650px" id="backgroundtable"> <tr> <td align="center" valign="top" height="125px" width="650"> <img src="ima

google cast - Can we download the receiver api js library and serve it with our content, or do we have to use the hosted asset? -

can download receiver api js library , serve our content, or have use hosted asset? how library change? the receiver api library: //www.gstatic.com/cast/sdk/libs/receiver/2.0.0/cast_receiver.js updated periodically. minor bug fixes may done file @ url, don't recommend download , host yourself. major api changes announced in documentation, release notes, , googlecast-announcments@googlegroups.com list, , version number incremented. edit - updated url latest release.

scala - akka non-blocking BoundedMailbox -

i'm trying find non-blocking way use akka actors boundedmailbox. should drop messages when actor's mailbox full. can achieve setting pushtimeout 0? there drawback or things notice approach? yes, if set pushtimeout 0 new messages dropped if mailbox full. dropped messages sent special dead letters actor .

clojure - Wrong number of arguments for a simple function -

can explain behavior in clojure code below? don't it. clojure somehow replace or "optimize" function arguments? why calling function single nil argument result in arityexception ? (defn foo [bar] (reduce #(%1) bar)) (foo nil) -> arityexception wrong number of args (0) passed to: test$foo$fn clojure.lang.afn.throwarity (afn.java:437) see (doc reduce) : [...] if coll contains no items, f must accept no arguments well, , reduce returns result of calling f no arguments. [...] here coll nil , being treated collection containing no items (as in similar contexts), , f #(%1) . thus #(%1) being called no arguments , ends throwing exception see.

asp.net mvc 4 - MVC4 AntiForgery token cookie name is appended with random string -

i encountering issue mvc4's @html.antiforgerytoken() html helper. on development machine, when run project, upon inspecting headers (using fiddler) , name of token returned is __requestverificationtoken but when deployed iis version 7.5 (windows 2008 r2), token name looks like: __requestverificationtoken_l2v6b3jkzxi1 where getting changed? because application not deployed "root folder" of iis? e.g. application deployed "http://myserver/myapp" instead of "http://myserver" i found answer after looking @ source code: http://aspnetwebstack.codeplex.com/sourcecontrol/latest#src/system.web.webpages/helpers/antiforgeryconfig.cs yes, because application deployed path, following code below appends encoded equivalent of path... hope finding save trouble. // if app path provided, we're generating cookie name rather field name, , cookie names should // unique development server cookie , iis cookie - both running on

c# - using QueryString in ASPX file -

i trying use sql command in aspx file capture querysring value having syntax issue. works fine when try filter querystring syntax issue. how can filter query using querystring? here code: <asp:sqldatasource id="dd_ai_ds" runat="server" connectionstring="<%$ connectionstrings:myconnectionstring %>" selectcommand="select distinct [myfield] [mytable] id = '"+request.querystring[id]+"' order id asc" > </asp:sqldatasource> try instead: <asp:sqldatasource id="dd_ai_ds" runat="server" connectionstring="<%$ connectionstrings:myconnectionstring %>" selectcommand="select distinct [myfield] [mytable] id = @id order id asc" > <selectparameters> <asp:querystringparameter name="id" querystringfield="post_id" type="string" /> </selectparameters> </

android - Not receiving push notifications until app is started manually -

hope can me tricky problem have. the point have appcelerator based app incorporates push notifications service of appcelerator cloud services. goes fine when user starts app manually, if goes background, receives notifications. however, if phone restarted, notifications no longer received. i'm not sure if manifest issue or what, post it. if need other information, request it! thank much, javier manifest <?xml version="1.0" encoding="utf-8"?> <ti:app xmlns:ti="http://ti.appcelerator.org"> <property name="acs-oauth-secret-production" type="string">xxxxx</property> <property name="acs-oauth-key-production" type="string">xxxxx</property> <property name="acs-api-key-production" type="string">xxxxx</property> <property name="acs-oauth-secret-development" type="string">xxxxx</property> <property nam

.net - Entity Framework 5: Get List of Foreign Keys on an Entity -

just quick question on ef 5 code-first. how i, @ run-time, access list of foreign keys exists particular entity please? thanks in advance you iterate through child collection on parent entity , save id each of child entities.

android - Activity lag on Jelly Bean -

i have lot of activities same thing each shows different text in .xml layout. noticed there lag 4 seconds every time activity starts. lag happens on jelly bean devices specifically. here how classes like: @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); this.requestwindowfeature(window.feature_no_title); overridependingtransition(r.anim.fadein, r.anim.fadeout); setcontentview(r.layout.general); textview txt1 = (textview) findviewbyid(r.id.textview1); final edittext txt2 = (edittext) findviewbyid(r.id.edittext1); final edittext txt3 = (edittext) findviewbyid(r.id.edittext2); txt1.settext(getstring(r.string.k_item1)); txt2.settext(getstring(r.string.k1_0)); txt3.settext(getresources().getstring(r.string.k1_0tr)); fade = new alphaanimation(0,1); fade.setduration(500); txt1.startanimation(fade); txt2.startanimation(fade);} the manifest xml file looks this: android:versioncode=&

javascript - how to use common inputs for two forms? -

i want create landing page has 2 form 1 login , foe register. design following fig.(i try explain in fig.) , want use nested form. login form inside registration form. when user click on login submit data login.jsp , register button submit register.jsp i know nested form not possible in html other method available in javascript or jsp can implement functionality. so want use these email , password inputs login form , registration form also. __________________________________________ | | | ___________________________ | | | | | | | | | | | email | | | | | | | | | | | | | login | | | | | | | password | | | | | | | |

replication - Concurrent writes to cassandra replicas - Is duplication possible? -

i have 2 machine cluster running cassandra 1.2.6. using keyspace has replication factor of 2. application demands me write both replicas in parallel , let cassandra replication , hoping cassandra not duplicate key/value on replica nodes. for example: i have nodes node1 , node2. have keyspace has replication factor 2 configured on , column family push key/value pairs i use python client (pycassa) write cluster. a key, "keyx", hashes node1 , node2. (i find out key hashes servers through node tool command. (`$nodetool getendpoints keyspacename columnfamilyname keyhexstring`) i use client write (keyx, value) concurrently nodes node1 , node2. (in connection pool give specific server name) when writing, wait 1 write succeed (to master). (consistency level one) now, monitor through `$nodetool status` command amount of disk space cluster uses. i write around 100 keys each having 2mb values. ideally should store around 400mb on disk overhead storing keys should margi

ios - Access IBOutlet inside dispatch_async block -

it doesn't hide label if call inside dispatch blocks: dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{ //here non-main thread. [self.loading sethidden:no]; dispatch_async(dispatch_get_main_queue(), ^{ //here returns main thread. [self.loading sethidden:no]; }); }); this works, still not hiding: [self.loading sethidden:no]; dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{ //here non-main thread. dispatch_async(dispatch_get_main_queue(), ^{ //here returns main thread. [self.loading sethidden:no]; }); }); how can access iboutlets inside blocks? you never calling sethidden:yes hide it. plus, interface, should on main thread.

bash - What does < in Shell Scripts do? -

this question has answer here: what symbols -, < , > mean? 1 answer for example, matlab -nodesktop -singlecompthread < run%d/run.m i know means matlab suppose use run.m file in run%d directory mean shells in general? by itself, command < filename tells shell run named command input coming file filename , instead of terminal typed command line. you can go other way, too, sending output of command file, command > filename . there 2 different output streams connected terminal - normal one, called "standard output" , redirected > , , "standard error" stream, lets program tell when went wrong though normal output going file instead of terminal. if don't want see error messages, want them go terminal well, can use >& filename . if want send errors own separate file, can use 2> *error_filename*

Exclude some parts of the page from pagelinks in MediaWiki -

i'm using mediawiki. of pages in wiki contain 1 or more large navigation block, ones on bottom of page: https://www.eftepedia.nl/ blocks these included in many pages. now, when page saved, list of links other pages updated ( pagelinks table). references used 'what links here' special page , other similar pages well. but don't want links in these blocks count that. there way can influence mediawiki exclude parts of page in updating-links-to-other-pages process? i've written extensions, overriden specific classes , used hooks, know basics of how stuff works, cannot find right hook influence part of process. as far attempts go, i've found parseroutput::addlink , used store parsed links array. then, on save, array merged database. addlink called couple of places, notably parser::replaceinternallinks2 , called parser::internalparse . if understand correctly, internalparse called each piece of text separately. includes separate includes, nested tags.

android - Facebook wall post with text and image -

i've been stuck days looking simple tutorial on making facebook wall post icon or image , text using graph api. i've tried countless tutorials , seem complicated , can't them work. samples come sdk not create sessions. i have been sucessful in setting sdk , getting app_id left java code custom button share app on users wall. you can post image text application in way. call method while clicking on button widget btnimageposttowall like... btnimageposttowall.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { postimagetowall(); } }); get profile information making request facebook graph api.... public void postimagetowall() { facebook.authorize( this, new string[] { "user_photos,publish_checkins,publish_actions,publish_stream" }, new dialoglistener() { @override public void onfacebookerror(fac

Android multiple activity tasks when application is killed -

the app has 2 tasks of activities: task 1 activity (launcher) activity b task 2 activity c <---- that's stack points @ in example. now try that: go recent apps carrousel (you know clicking button on right of home button in newer phones). swipe apps out. your application killed , new application instance created ( application#oncreate() called). android tries show activity c of task 2 . the funny thing if you're here: task 1 activity (launcher) activity b <---- here ...and repeat scenario, application killed , android goes home screen think should. in short, looks android not clear tasks when killing application. true in precise scenario. go settings > applications > app > force stop, , see clear tasks. anything can force android kill tasks when killing application? after looking @ how recent apps handled on android sdk (see source here line 135 http://grepcode.com/file/repository.grepcode.com/java/ext/com

Binary image type in C -

if want create , work on binary image in c, data type should set image pixels? since binary image pixel has 2 values assuming need 1 bit each pixel , have use bit wise c functions, correct (most efficient) way binary image processing in c? if case, how can allocate space image? malloc allocates space in units of bytes if not mistaking. for clarification: have 32bit float image (with known size), apply threshold , save thresholding result binary can label separate components. using single bit per pixel memory-efficient least time-efficient, since accessing pixels requires bitwise operations. if wanted this, have malloc((numpixels + 7)/8) , i.e. round allocation size nearest byte. it better balance of memory , space considerations store image char s. internal representation thresholded images in opencv, example.

How do I mouse scroll in Emacs in the terminal? I haven't gotten mouse-wheel-mode to work -

i use emacs in terminal, either 23 or 24 depending on machine i'm sshed into, ubuntu / mint. have line alias emacs='emacsclient -a "" -t' in .bashrc file, if matters. i've wanted figure out how able scroll mouse months, can't seem to, if i'm using emacs locally. every time open emacs in terminal, have scroll bar on right, not functional, because part drag (that part moves when scroll) fills entire height of scroll bar, , immovable. i've seen many people suggest m-x mouse-wheel-mode . when begin type out, tab complete shows me list of completions, , isn't on it. accepted answer here states it's included , on default. if that's true, else wrong. before finding this, i've tried finding .el it, , haven't succeeded in either. i've gotten (xterm-mouse-mode) working. may related in it's proof emacs have mouse. i don't know try next. ideas? edit 2: tried running emacs -q -nw in xterm. in situation

.htaccess - htaccess from www to non-www bringing variable in session/cookie -

.htacces redirects www.example.com example.com (same domain without www.) returning visitor have in user-agent visitor_id cookie. want bring value through domains within cookie or session. tried this, cookie created www domain rewritecond %{http_host} ^www.example.com rewritecond %{http_cookie} visitor_id=([^;]+) rewriterule .* - [c,env=foo:%1] rewriterule ^(.*) http://example.com [l,r=301] header set set-cookie "visitor_id=%{foo}e; path=/" env=foo moreover environment variable works on localhost (apache 2.4.2, win32), online (apache 2.2.25, linux) value in cookie "%{foo}e" instead of expected number. also tried mod_session_cookie can't find practical examples. how redirect through domains, bringing visitor_id in cookie or session cookie? since, environment %{env} variables not behaving consistently across different apache versions, suggest setting cookie rewriterule using [co] cookie flag. rewritecond %{http_host} ^www\.exa

MySQL best approach for db normalising, relationships and foreign keys -

Image
there username/password verification step first database has following structure ^ primary key * uses foreign key 1.studentdetails table =========================================================================== id^| username | password | email | address * | website |comments ====+============+==========+=============+===========+=========+========== 1 | xxxxxxxxxx | xxxxxxx | xx@xxx.xxx | 1 | http:// | text 2.submissions table =========================================================================================== id^|username*|submitdate|selectedcourse*|price*|promotion*|submitcomments|submitstatus* ===+=========+==========+===============+======+==========+==============+================= 1 |xxxxxxxxx|2013-7-12 | int | int | int | text | int 3.submitcomplete table ================================================== id^| username * | selectiondate | submitstatus * ====+============+===============+================ 1

sql - How can I create a new table based on merging 2 tables without joining certain values? -

Image
i asked question earlier, wasn't able explain myself clearly. i made graphic explain i'm trying do. i have 2 separate tables inside same database. 1 table called 'consumers' 200 fields including 1 called 'meter_numbers*'. , 1 other table called 'customer_info' 30 fields including 1 called 'meter'. these 2 meter fields join or whatever method based on. problem not meter numbers in 2 tables match , null values , value of 0 in both tables. i want join information records have matching meter numbers between 2 tables, keep null , 0 values own records. there null , 0 values in both tables don't want them join together. there few duplicate field names, location shown in graphic. if it's easier fix these duplicate field names manually can that, it'd cool able programmatically. the key need result in new table! this process 1 time thing, not often. hopefully, explained , if can me out that'd awesome! if more informat

javascript - Why is document.forms["myform"]["input"].value return undefined -

so here's me trying make html5 version of tone matrix program. here's problem, have user enter how long want song , make sure entered number, used function initiate(){ var min = document.forms["initiator"]["min"].value; var sec = document.forms["initiator"]["sec"].value; // logic return false;} to check see if stuff entered indeed number when try this, browser spits "uncaught typeerror: cannot read property 'min' of undefined" here's what's in dom. <form onsubmit="return initiate()"> song (at most): <input type="number" name="min" id="min"> minutes , <input type="number" name="sec" id="sec"> seconds long.<br> <input type="submit" value="start" /> </form><br> i have placed thing onto hosting service located here http://www.sfu.ca/~zla49/mmc/ ya :) you d

c# - What is the simple way to extend the use of array to prevent out of memory exception? -

float[][, , ,] tempdata = new float[30][, , ,]; private void inittempdata() { const int focussize = 400; try { (int = 0; < 30; i++) { tempdata[i] = new float[40, focussize, focussize, 5]; } } catch (outofmemoryexception ex) { messagebox.show(ex.message); } } i need use tempdata array size of this: tempdata[30][40, 400, 400, 5] but have experienced far, go outofmemory when define new array @ size more 100. what idea think of is, initialize 4 new array size of 100. , use 4 new array starting different initial counter per below: float[][, , ,] tempdata0 = new float[30][, , ,]; float[][, , ,] tempdata1 = new float[30][, , ,]; float[][, , ,] tempdata2 = new float[30][, , ,]; float[][, , ,] tempdata3 = new float[30][, , ,]; private void inittempdata() { const int focussize = 100; try { (int = 0; < 30; i++) { tempdata0[i] = new float[40, focussize, focussize,

.net - Visual Studio 2012 under Windows8: how to prevent copying ASP.NET web site files into user temp folder? -

i have asp.net web site (started work on in in vs2008). after upgraded machine windows 8 visual studio started working slower: each compilation took significant amount of time. if earlier 10-15 seconds, 25-50. , vs hangs during time. eventually found out causing that: upon compilation of project in solution or of whole web site, vs copies web site files temp folder located under user's appdata\local folder : c:\users\my_user\appdata\local\temp\tmp719c.tmp.testgen\ totally 35mb of files, biggest "bin" folder (20 mb, 294 files) , folder pictures (13.1 mb, 2569 files). and copies ton of files on each compilation! that literally takes half of minute. i delete picture files (as represent business data not required during development), instead prevent visual studio copying files @ all. question: how prevent visual studio copying asp.net web site files temp directoty? p.s. use windows 8 (64 bit), vs2012 update 3, disabled edit-and-continue. web site written u

sql - Compare between strings in query statement in Oracle -

i have table: id value aa000001 500 aa000002 1000 aa000003 1500 aa000004 2000 aa000005 2500 aa000006 3000 aa000007 3500 the type of id string , use below sql statement query record: select sum(value), max(value), min(value) my_table id between 'aa000001' , 'aa000007' and it's works expected. wonder if there exceptions in query? i'm using oracle 10g release 2 , 11g release 2. thanks in advances. i'm not sure mean "exceptions". query is: select sum(value), max(value), min(value) my_table id between 'aa000001' , 'aa000007'; it match between these values. in addition in table, match, say, 'aa000003zyw243'. safe matches start 'aa00000'. next character between '1' , '7', , can follow (unless character '7').

java - Send multiple records via json to php mysql -

how send more 1 record @ time using json? code sample found online need send 100 objects or records @ time. data comes database. protected string doinbackground(string... args) { string name = inputname.gettext().tostring(); string price = inputprice.gettext().tostring(); string description = inputdesc.gettext().tostring(); // building parameters list<namevaluepair> params = new arraylist<namevaluepair>(); params.add(new basicnamevaluepair("name", name)); params.add(new basicnamevaluepair("price", price)); params.add(new basicnamevaluepair("description", description)); // getting json object // note create product url accepts post method jsonobject json = jsonparser.makehttprequest(url_create_product, "post", params); you must create jsonobject represent objects, , add request: if have structure example: {[{na

How create custom app on Rails and auto initiate tedious setting -

this question has answer here: passing template “rails new” 1 answer i'm new rails. every time, when want create new app, should add in bootstrap, simple-form, devise, , many gems, create tables, etc. example , write own css file , how copy default file in every new app project. it's tedious routine. is there tutorial, or keywords searching, want learn? @deefour covers main solution - thing thought might add might rails composer - it's handy situation create lot of rails apps, particularly because can resolve gem dependencies. (would comment, insufficient rep currently.)

How to handle better data from HashMap in Java? -

in order develop text editor in java, user able open several files object jtabbedpane . then, stores such files on hashmap<string,tabmanager> . (the key of hashmap ), should name of file. after, have on memory files opened within of hashmap . now, need manage tabs. example, if user on tab selected it, evident user change font of text, save file selected, copy it, , on. manage tab selected user, need of class objects tab selected, just. such as, jtextpane , file . basically, should do: for(map.entry<string, tabmanager> entry: hashmap.entry) { string key = entry.getkey(); tabmanager = entry.getvalue(); if(tab.gettabselected().equals(key)) { // resquest objects tab selected user this.container = tabmanager.getjtextpane(); this.file = tabmanager.getfile(); } } i have on hands objects tab selected user. now, going handle it. issue is: how handle big amount

get the last sunday and saturday's date in python -

looking leverage datetime date of beginning , end of previous week, sunday saturday. so, if it's 8/12/13 today, want define function prints: last sunday 8/4/2013 , last saturday 8/10/2013 how go writing this? edit: okay, there seems question edge cases. saturdays, want same week, else, i'd calendar week preceding today 's date. datetime.date.weekday returns 0 monday. need adjust that. try following: >>> import datetime >>> today = datetime.date.today() >>> today datetime.date(2013, 8, 13) >>> idx = (today.weekday() + 1) % 7 # mon = 0, sun = 6 -> sun = 0 .. sat = 6 >>> idx 2 >>> sun = today - datetime.timedelta(7+idx) >>> sat = today - datetime.timedelta(7+idx-6) >>> 'last sunday {:%m/%d/%y} , last saturday {:%m/%d/%y}'.format(sun, sat) 'last sunday 08/04/2013 , last saturday 08/10/2013' if allowed use python-deteutil : >>> import datetime >&

Firefox SDK + JQuery AJAX problems -

i'm working on add-on firefox using sdk (previously known jetpack). in add-on need access data via jsonp requests php script on remote server (which i'm in control of), , use data returned server update web page elements. in main.js file use page-mod , contentscriptfile inject copy of jquery library, , own javascript file web page. javascript file uses jquery's "$.ajax" function access remote php script. the problem: responses never received. i stumbled across stackoverflow question, deals same issue: error in jsonp call firefox-extension i've followed of advice there, , changed $.ajax request specifying own callback, , added callback function file using "unsafewindow.callback" - don't understand what's happening, seems "window" reference acquired jquery not the same real underlying window object (i thought sort of thing meant handled invisibly xraywrapper, confused that). that's ok. single parameter passed c

unit testing - UnitTesting for mixed C++/Cli projects -

which unittest framework should use test mixed c++ code (native , c++/cli)? howto's or tutorials? thx you can use nunit test both easily. if write tests in c++/cli able test native code too. see here related discussion.

php - How to jQuery fadeIn() fadeOut() a text in a div in WordPress -

im trying create 2 buttons can fadein() , fadeout() wordpress menu using id or class , not working... in example below, i'm trying use id . when change #menu_jquery use p tag works perfect... <script> $(document).ready(function(){ $(".btn1").click(function(){ $("#menu_jquery").fadeout(); }); $(".btn2").click(function(){ $("#menu_jquery").fadein(); }); }); </script> <button class="btn1">hide menu</button> <button class="btn2">show menu</button> <div id="menu_jquery"> <?php #wp_page_menu( 'sort_column=menu_order' ); ?> </div> it works jsfiddle . are sure you've put script tags around javascript? <script> $(document).ready(function() { $(".btn1").click(function() { $("#menu_jquery").fadeout(); }); $(".btn2").click(f

glib - Iterative folder read using C and GSList -

i'm trying create iterative program reads folders specific starting folder using gslist , c. haven't managed find flaw in code now. the problem i'm having reads each folder , of it's subfolders until in reaches 1 more subfolders. after repeats open 1 directory. the running result below: http://pastebin.com/jzmfbrxc code: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <dirent.h> #include <glib.h> #include <glib/gprintf.h> #include <limits.h> #include <errno.h> #include <sys/types.h> int main(int argc, char *argv[]) { gslist *list = null; list = g_slist_prepend(list, "/home/ravior/documente"); /* folder searching */ dir *d; int index = 0; while((char *)g_slist_nth_data(list, 0) != null) { gchar *element = g_strdup((char *)g_slist_nth_data(list, 0)); d = opendir(element); if(!d) { fprintf(stderr, "couldn

regex - Controlling number of characters in expression? -

can somehow limit number of characters of whole expression? i want limit number of characters in expression like: ([0-9]+(\.?[0-9]+)*) i want strings following limit accepted. example, if limit 4: 12.3 gets accepted 012 doesn't 12345 doesn't. use anchored ahead (for example max 33): ^(?=.{0,33}$)([0-9]+(\.?[0-9]+)*) to make exactly 33, remove 0, to ignore number of periods in limit ^(?=(\.*[^.]){0,33}\.*$)([0-9]+(\.?[0-9]+)*)

mysql slow log query details about Query_time -

i using mysql : 5.5.31-0ubuntu0.12.04.1-log (ubuntu) , enabled slow log query ,slow log query time set 2 sec details : show variables 'slow_launch_time'; +------------------+-------+ | variable_name | value | +------------------+-------+ | slow_launch_time | 2 | +------------------+-------+ 1 row in set (0.00 sec) and in my.cnf : long_query_time = 2 it means query takes more 2 sec, stored in mysql slow log query. when tried using select sleep(1) ; select sleep(2) ; select sleep(3) ; , viewed slow log query ,only sleep(2) , sleep(3) saved in slow log query query_time: # query_time: 2.000263 , # query_time: 3.000278 respectively . saw many queries have query_time less 2 sec saved in slow log query for more details : # query_time: 0.001775 lock_time: 0.000154 rows_sent: 1 rows_examined: 120 why type of query saved in slow log , don't understand ? probably because log_queries_not_using_indexes on: if using option slow query log

sql - MySql subquery: average difference, grouped by column -

i have mysql table visitor_id, country, time_of_visit. i want average duration of visit country. to duration, difference between earliest , latest time_of_visit each visitor_id. so gets me average duration of visits: select avg(duration) ( select timestampdiff(second, min(time_of_visit), max(time_of_visit))/60 duration tracker group visitor_id ) tracker that works. group country, fail. here's recent attempt average duration country: select country, avg(duration) ( select timestampdiff(second, min(time_of_visit), max(time_of_visit))/60 duration tracker group visitor_id ) tracker group country the error is: unknown column 'country' in 'field list'. i think should simple, i'm noob. searched lot, tried lots of ideas, no good. help? thanks in advance. you have select country column in subquery , have reference country field derived table tracker.country select tracker.country, avg(tracker.duration)

php - Can't make cookies expire -

i'm trying make cookie expire, i've saw code it, , i've done already. so, i've done making expire date time() - 10 make cookie time limit expire immediately, can't seem make work. $number_of_days = 30 ; $date_of_expiry = time() + 60 * 60 * 24 * $number_of_days ; setcookie( "userlogin", $user_hash, $date_of_expiry, "/" ) ; this should work: setcookie("cookie_name", "", time()-3600); if not work, have output before, have call before echo or html output. otherwise headers sent , can't change cookie information.

console - Gem not available in self executing ruby file -

i have written myself simple ruby script requires listen gem. running in console works perfectly. $ ruby script.rb args i passing pwd argument. got annoyed of wanted make script executable across linux. added following line beginning of script #!/usr/bin/env ruby require "listen" ... when use self executing file, runs error. $ ./script.rb output: ./listen.rb:55: uninitialized constant listen (nameerror) ./script.rb:3:in `require' ./script.rb:3 do have suggestions cause of problem be? have 1 guess: #!/usr/bin/env ruby calls different ruby env $ ruby is. how can find out? (i using rbenv manage rubys)

.net - MS Word 2010 - How to programatically clear the "Document Recovery" -

according stackoverflow question ( document recovery ), it's not possible turn off "document recovery" in ms word 2010. time time need kill winword processes stored in "document recovery" , when there tens or hundreds of them, application stops generate word documents , need manually open word document , click "close" in "document recovery". so, possible automatically clear "document recovery" in ms word 2010? how access powershell or .net? what want remove appropriate registry key(s): hkuser:(sid)\software\microsoft\office\14.0\(office application)\resiliency\documentrecovery

c++ - The usage of _InterlockedCompareExchange64 -

on msdn, see interlockedcompareexchange64 requires parameters 64 aligned, but _interlockedcompareexchange64 i see no such requirement alignment, , mentioned provide compiler intrinsic support interlockedcompareexchange64. so, means can use _interlockedcompareexchange64 without caring alignment? 'cause don't quite know alignment means here. i'm pretty documentation mistake, rather direct difference between 2 function - seeing result in same cmpxchg8b instruction. [assuming of course looking it atomic on smp system - it's pretty specialized instruction, doubt has other use].

asp.net - Adding a Key Check to all attempts to access any functions in a WebService -

i building web service api provide remote access data management system. there various functions in api , require access key. i wrapping insides of functions this: function getsomething(api_key) if integratedapis.grant_api_access(api_key) /// stuff else return "api key not provided or incorrect" end end function obviously integratedapis.grant_api_access(api_key) function returns boolean output , checks user's key in database this works, problem it's bit of maintenance pain. how can automatically wrap around calls webservice? is possible via global.asax file return error on application_beginrequest example? look aspect oriented programming (aop) frameworks .net. these frameworks intercept calls , run them through function relies heavily on reflection. for example: // original function call want routed through aop. [keycheck] public void originalfunctioncall() { ... } // aop function accepts functions d

javascript - Chrome changes regex and can't match with value from dropdownlist -

i'm having problems regex , can't value validated. i have function this: function validationobject(validationname, validationregex) { this.validationname = validationname; this.validationregex = validationregex; } it creates validationobject parameters gets. dropdownlist containing number have regex: \d+ but when validate value regex piece of code won't work: if (inputvalue.match(validatingregex)) { dosomethings(); } if check validationobject see chrome has changed regex /d+/ . i've tried setting regex-type, doesn't work either. work on textfields. seems me backslashes converted else. also i've tried escaping backslash browser takes literal value. hopefully have answer, help! best regards, boyyerd you need escape special chars if you're passing them regexp constructor: var expr = new regexp(somstr.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), 'i'); since you're passin

c# - How to carry httpcontext over to separate thread -

i have third-party web service i'm calling - it's constructed this: var response = client.postlead(param1, param2 etc); two of parameters requires properties of current request (useragent & ipaddress). i want launch method in thread can control timeout, because method relies on httpcontext, there issue. i can pass httpcontext parent class or method, first time i've done threading don't know whether best or course of action.

Where download older versions of Android Facebook SDK? -

can tell me can download older versions of android facebook sdk? lower 3.0 version . thanks. the facebook sdk android open source , hosted @ github. checkout revision old enough suit purposes.

.htaccess - Rewrite or Redirect url htacces -

i´m trying this, can´t it: rewriterule ^(.*)pagina1(.*)$ $1pagina$2 [r=301,l] ($2, because need pass parameters in url) how can "redirect or rewrite" files: (pagina1.html, pagina2.html, pagina3.html,etc) pagina.html i have work relative url, because want folders inside directory. well, after 2 days trying, don´t know how can do... with redirect *.html pagina.html rewriterule ^([a-za-z0-9_-]+).html$ pagina.html [qsa]

Android Custom Camera -

i looking create custom camera in android. have gotten alot of here problem image preview orientation seems distorted. when phone in portrait mode, image been drawn in landscape ? not normal , feel here code library. please me package com.whatsthegoss.simplecamera; import java.io.file; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.io.ioexception; import java.util.list; import android.app.activity; import android.content.intent; import android.graphics.bitmap; import android.graphics.bitmapfactory; import android.graphics.pixelformat; import android.hardware.camera; import android.hardware.camera.autofocuscallback; import android.net.uri; import android.os.bundle; import android.os.environment; import android.view.menu; import android.view.surfaceholder; import android.view.surfaceview; import android.view.view; import android.view.view.onclicklistener; import android.view.window; import android.view.windowmanager; import android.widget.butt