Posts

Showing posts from August, 2011

node.js - Connecting to database in Express -

trying connect database using express i new express(i have used nodejs), i trying connect database , display simple json resultant output i tried below code var express = require('express') , http = require('http'); var app = express(); var connection = mysql.createconnection({ host: 'localhost', user: 'root', password: "root", database: 'restaurant' }); // environments app.set('port', process.env.port || 7002); app.get('/',function(request,response){ connection.query('select * restaurants', function(err, rows, fields) { console.log('connection result error '+err); console.log('no of records '+rows.length); response.writehead(200, { 'content-type': 'application/json'}); response.end(json.stringify(rows)); }); } ); http.createserver(app).lis...

html - jQuery slideshow overlapping CSS ribbon -

Image
i'm designing website has css ribbon hanging top left corner. when place image under ribbon, ribbon overlaps image, i'm going for. however, when implement j-query slide show technique following happens. my question is, how can overlapping appearance desire while being able use slide show? below i've posted code following. html , javascript slideshow <center> <div id="slideshow"> <div> <img class="slide_img" src="images/limo_banner.png"> </div> <div> <img class="slide_img" src="images/24_banner.png"> </div> <div> <img class="slide_img" src="images/limo_banner.png"> </div> </div> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script> <script> $(document).ready(function(){ $("#slideshow > div:gt(0)...

math - How to find nPr (permutations) efficiently? -

is there better way using basic formula n!/(n-r)! have ncr(combinations) ncr = (n-l)cr + (n-1)c(r-1) ? how this: npr = (n−1)pr + (n−1)p(r−1) ⋅ r rationale: npr denotes number of ways choose r elements n while noting order , not putting them back. in above recursion distinguish 2 cases. either don't choose n th element, in case you'll choosing r elements set of (n−1) . or you'll choosing n th element well, in case you'll choosing other (r−1) elements set of (n−1) , , there r possibilities @ point in order chose n th element. apart this, note can avoid 2 factorials taking product on difference: n ─┬──┬─ n! │ │ = ──── = (n−r+1)⋅(n−r+2)⋅…⋅(n−1)⋅n = npr │ │ r! i=n−r+1 this leads yet recursive formulation: npr = (n−1)p(r−1) ⋅ n

jquery - Masonry v3.0.4 resizing -

i'm upgrading site masonry 2 masonry 3. in masonry 2, using $(window).bind('smartresize.masonry', function() { //recalculate container width }); on page http://masonry.desandro.com/appendix.html#upgrading-from-v2 "smartresize jquery plugin has been removed" without more explanation. smartresize.masonry perfect me, allowed me recalculate container width , masonry fit in new width without delay. now v3, i'm doing: container.masonry('bindresize'); $(window).resize(function() { //recalculate container width }); these 2 separate events , there's small delay between 2 of them. seems bindresize not called same frequency $(window).resize(), wrong? is there way smartresize doing? the bad part new masonry, there's no onbeforeresize , onafterresize. installed plugin smartresize (debouncedresize) , disabled masonry's resizing event container.masonry('unbindresize'); refresh masonry's layout inside own resi...

Simplify a mysql query please -

i have mysql query : select p.* posts p ( p.userid in ( select blogid abos userid=11 ) or p.userid = 11 ) , not exists ( select null posts_denied r r.post_id = p.id , r.userid = 11 ) order p.id desc limit 5 i remove "where in" clause... how can find best performance query syntax please? select distinct p.* posts p join abos on p.userid = a.blogid or p.userid = 11 left join posts_denied r on r.post_id = p.id , r.userid = 11 (a.userid = 11 or p.userid = 11) , r.post_id null order p.id desc limit 5

trying to convert from java x509 key to php and decode string -

anyone can convert code java php ? read more below.. so .. got piece of code .. i'm trying convert php ( 5.{3,4,5} .. doesn't matter .. don't want run tomcat , stuff ) private static byte[] caglt(string lc){ try { publickey public_key; string key = "miibudccaswgbyqgsm44baewggefaogbap1/u4eddriput9knc7s5of2ebdspo9e.............long 593 char stuff here"; keyfactory keyfactory = keyfactory.getinstance("dsa"); public_key = keyfactory.generatepublic(new x509encodedkeyspec(base64.decodebase64(key.getbytes()))); byte[] decodedbytes = base64.decodebase64(lc.getbytes()); bytearrayinputstream in = new bytearrayinputstream(decodedbytes); datainputstream din = new datainputstream(in); int textlength = din.readint(); byte[] lt = new byte[textlength]; din.read(lt); byte[] hash = new byte[din.available()]; din.read(hash); try{...

visual c++ - using custom build event in VS 2010 -

i in process of creating visual studio solution wrap command-line portions of ocaml. in standard ocaml make file there following target: version.h : ../version echo "#define ocaml_version \"`sed -e 1q ../version`\"" > version.h which hoping simulate via custom build event. have modified vcproj file include following lines: <custombuildstep> <command>c:\windows\system32\sed.exe -e "1 s/^/#define ocaml_version " "$(sourcedir)version" &gt; "$(sourcedir)version.h" </command> <inputs>version</inputs> <outputs>version.h;%(outputs)</outputs> <message>building version header file ....</message> </custombuildstep> i have sed installed on system (from unxutils), , command work correctly command terminal (after macro-expansion naturally). however, when execute inside visual studio following error message: custombuildstep: description: building ver...

dynamics crm - How can I change the ownership of a Mail Merge in CRM 2011 -

Image
i have series of mail merges uploaded our crm 2011 system, when attempting use them under different user realized ownership assigned individual created , therefore not available me. i have tried opening mail merge template change ownership level 'individual' 'organization', field grayed out , read only. when creating new template, same field set 'individual', grayed out, , read only. have checked security role settings user, , have full permissions mail merge template entity. how change ownership of mail merge 'organization' can have the users of system have access it? open mail merge document. select [actions] make available organization you can change owner through using [assign…] ~assuming have either permission assign, or owner.

c++ - Design decision regarding std::array fill -

std::array in c++11 useful class provides c++ container interface on c stack array. but why std::array not have typical fill constructor containers have? instead, has method fill . is there reason why std::array unique among stl containers in regard? from section 23.3.2.1: an array aggregate (8.5.1) can initialized syntax array = { initializer-list }; if worked std::vector wouldn't pod anymore. additionally same section: the conditions aggregate (8.5.1) shall met. these conditions are: an aggregate array or class (clause 9) no user-provided constructors (12.1), no brace-or-equalinitializers non-static data members (9.2), no private or protected non-static data members (clause 11), no base classes (clause 10), , no virtual functions (10.3).

Trying to modify awk code -

awk 'begin{ofs=","} fnr == 1 {if (nr > 1) {print fn,fnr,nl} fn=filename; fnr = 1; nl = 0} {fnr = fnr} /error/ && filename ~ /\.gz$/ {nl++} { cmd="gunzip -cd " filename cmd; close(cmd) } end {print fn,fnr,nl} ' /tmp/appscraps/* > /tmp/test.txt the above scans files in given directory. prints file name, number of lines in each file , number of lines found containing 'error'. im trying make script executes command if of file reads in isn't regular file. i.e., if file gzip file, run particular command. above attempt include gunzip command in there , on own. unfortunately, isn't working. also, cannot "gunzip" files in directory beforehand. because not files in directory "gzip" t...

Hibernate Search/JPA - Can't create initial index; program hangs AFTER apparent index creation -

i have been trying use hibernate search jpa 2 days , have compiling cleanly , running without obvious errors. however, when try create initial index, program runs , prints out each object indexing (using manual indexing), prints "indexing completed" message. no no errors thrown, main method never exits. running in eclipse kepler in maven project jre1.7 can kill processing hitting red stop button. if that, file search index files, don't find any. if run search program, java.lang.illegalargumentexception: none of specified entity types or of subclasses indexed. i appreaciate suggestions on how work. i've tried going version 4.2 of hibernate search , same thing. the domain class car. here indexer output: indexing: make infinity model g35 indexing: make honda model civic indexing: make audi model a4 indexing: make toyota model carolla indexing completed if run in debugger debug window shows following active threads when program should have...

select * from table where id=1 -

i need return information row id 1 the name of table customer , column descricaoid tks $sql = "select * customer id=1"; $query = mysql_query($sql); while($sql = mysql_fetch_array($query)){ $id = $sql["1"]; echo "resultados para o id $id"; } the output must be: the customer with id 1 is: jessica $id = $sql["1"]; do this: $id = $sql['id']; (i don't know why put 1 there...)

php - Sort an array according to a set of values from another array -

i aware there another question on supposed answer same thing. problem don't see array merge has do anything. don't want merge arrays , don't understand how ordering them ... don't understand ordering coming it. if relevant please explain in bit more detail whether other answer work me or not , how here have ( array quite large simplification ) essentially have this array ( [0] => stdclass object ( [term_id] => 72 [name] => name [slug] => slug [term_group] => 0 [term_order] => 1 [term_taxonomy_id] => 73 [taxonomy] => gallery_category [description] => description [parent] => 78 [count] => 85 ) [1] => stdclass object ( [term_id] => 77 [name] => name [slug] => slug etc, etc, etc, there lot of objects in array then have ordering array like array ( [0] => 77, [1] => 72, ...

reflection - Prism + Log4Net build error : "Cannot resolve dependency to assembly log4net" -

i trying add log4net support in prism application. unfortunately following error each prism modules : error 101 unknown build error, 'cannot resolve dependency assembly 'log4net, version=1.2.10.0, culture=neutral, publickeytoken=1b44e1d426115821' because has not been preloaded. when using reflectiononly apis, dependent assemblies must pre-loaded or loaded on demand through reflectiononlyassemblyresolve event.' [prism module 1 project name] error 101 unknown build error, 'cannot resolve dependency assembly 'log4net, version=1.2.10.0, culture=neutral, publickeytoken=1b44e1d426115821' because has not been preloaded. when using reflectiononly apis, dependent assemblies must pre-loaded or loaded on demand through reflectiononlyassemblyresolve event.' [prism module 2 project name] ect ... i set logger follow : i added log4net assembly reference both main app, , bootstrapper. i added log4net configuration app.config file. i added ...

iis - Sp Services not working with Https -

i have sharepoint 2010 installation. using sp services 2013.01 find if current user in sharepoint group. works great if url not set https. when url secured, status response call error , responsexml undefined. here example of doing: var groupname = "my group"; $().spservices({ operation: "getgroupcollectionfromuser", userloginname: $().spservices.spgetcurrentuser(), async: false, completefunc: function(xdata, status) { if($(xdata.responsexml).find("group[name='" + groupname + "']").length == 1) { // yes user in group isuseringroup = true; } } }); return isuseringroup; but when site https comes error. may not code problem , may iis issue, trying insight on check on. thanks.

html - Why can't I find the image URL of the background on this site via inspect element? -

http://conversionxl.com/dont-use-automatic-image-sliders-or-carousels-ignore-the-fad/ i'd figure out how they're handling background can't seem find in source code anywhere. if can direct me how find it, and/or knows how background set , wants point me directly there, i'd appreciate it. thanks! body { background: url("images/body-bg.png") repeat scroll 0 0 #dadee0; color: rgba(0, 0, 0, 0.6); font: 0.75em/150% "lucida sans unicode","lucida grande",sans-serif; word-wrap: break-word; } css using in http://conversionxl.com/dont-use-automatic-image-sliders-or-carousels-ignore-the-fad/

SQL Server 2008 DB - Autogrowth failure -

sql server 2008 r2 database not able grow beyond initial size though auto-growth option set increase database size 500mb. tried increase size manully failed below error: modify file encountered operating system error 665 (the requested operation cannot completed due file system limitation) while attempting expand physical file (microsoft sql server, error 5149) i have lot of free space on drive, not sure why error occurring. i remember reading similar while , error related ntfs file system being fragmented, making impossible grow files further attribute list stores information file allocations reach limit. work around might defragment volume containing files. this article microsoft support relevant.

html - How to create MATLAB static text with editable font style -

matlab® provides static text uicontrol (created using uicontrol style text: uicontrol('style','text','label','static text'…) , not allows use neither html nor tex interpretation. solution creating static text interpretable language allows change font style , color? huh? have tried this? h = uicontrol('style','text','string','hello'); set(h,'foregroundcolor','r','fontsize',10,'fontname','helvetica','fontweight','bold'); is want? or missing something?

JQuery Validation Email Regex not working -

i trying build validation system in jquery without using plugins my jquery code such, have validation function each input, e.g.: function isemail(email) { var regex = /^([a-za-z0-9_\.\-\+])+\@(([a-za-z0-9\-])+\.)+([a-za-z0-9]{2,4})+$/; alert("email "+regex.test(email)); return regex.test(email); } you notice have alert in one, because email not validating despite regex being borrowed highly-reputed answer -> email validation using jquery i tested several valid emails no avail. valid emails taken here -> http://en.wikipedia.org/wiki/email_address#valid_email_addresses . changed regex /\s+/ , else worked know problem lies within regex. anyways, why regex not evaluate true? understanding is: /^([a-za-z0-9_\.\-\+])+ begins character a-z, a-z, 0-9, ., -, or +. 1 or more times \@ followed "@" symbol (([a-za-z0-9\-])+\.)+ followed 1 or more of 1 or more characters a-z,a-z,0-9, or -, period "." ([a-za-z0-9]{2,4})+$ ending ...

ios - How to create unscubscribe functionality to let user unsubscribe from in-app subscription purchase? -

i building code let user subscribe in-app purchase subscription. but not see tutorials or examples (even official site) let user unsubscribe. please point me tutorial this, or please explain how users can unsubscribe in-app subscriptions? thank you@ that not possible. users have go itunes , set subscription not auto-renew themselves.

html5 - Excluding map tiles from appcache -

i trying implement offline use through appcache site corvallistrails.org. of images , resources hosting cache perfectly, when attempt use site map tiles opencyclemap.org fail load. not specified in .appcache file. have added entries * , http:/* , https://* , *.opencyclemap.org/* , , opencyclemap.org/* under network: no avail. research has turned nothing. want force browser load map tiles through network every time. kind of entry put in manifest produce such result? network section ask resources newer availible offline (you can use * pattern there). cache section ask resources cached, must put there cached resources , can't use * pattern, because browser can't resolve resources must download. there can set resources domain http://tile.example.com/zoom/x/y.png . fallback section ask resources must mapped when application offline, can set there self host resorces. if want make map offline must put need tiles cache section, it's match tiles , take lot...

jruby runtimes and tomcat -

we running jruby/rails app under tomcat, , can not make shift threadsafe due of components using. in interim plan set jruby.runtime.min , jruby.runtime.max prevent perm-gen out of memory errors. unfortunately throttle number of concurrent users small number, question when runtime recycled? session based or else. lowetring session timeout speed availability of pools or there more that. links better understand specifics of how jruby runtime works appreciated. first of there's bit of confusion in q - setting min/max runtime parameters not prevent perm-gen errors ... need increase memory bit (depending on application's footprint) you're seeing esp. if you're setting min/max values higher. secondly - sure throttle concurrency not - think of mongrel (thin) cluster: concurrent requests handled >= number of running instances a single runtime blocked duration of single request (does not depend @ on session state), after response returned runtime ret...

Flash & Visual Studio [Form Design] -

i'm developing desktop application using visual studio, in c++ , c#. managed hide form edges , make custom ones that's not want. problem is: make form window better, , mean different basic one. example: draw , script advanced randomic moving swarm of dark pixels edges of visual studio form window. example 2: when move cursor on swarmy pixels (the edges of form) change color or react in way. i'm not asking how examples.. i'm want know best way learn accomplish this. can imagine examples "easily" done in online web-flash enviroment, first thing thought, i'm talking desktop application, not flash site. question is: should learn flash , actionscript , find way implement in visual studio? or should use external graphical api has nothing flash? or scriptable in c#/c++? p.s. can learn because have time, i'm deciding best way that. can me? in advance , sorry not strong english. i saw website meet every need. amethyst tutorials

Jquery change class CSS on click event -

have got code similar work, cant work instance. using jquery change css of div above link hide subnav ( currently stays open because link href="#" ). all links have class of "team" , once of them clicked, should change subnav display="none" code is: $('a.team').click(function() { $('.subnav', this).css('display','none'); }); jsfiddle: http://jsfiddle.net/a9aye/ you supposed using closest (as subnav ancestor of .team elements) $(this).closest('subnav').css('display', 'none');     it better idea use class change style instead of defining them inline .hide{ display: none; } just add class apply specific class. lot more cleaner , less messy. also prevent default action of link being followed. $('a.team').click(function (e) {       e.preventdefault(); $(this).closest('.subnav').addclass('hide') }); // remove hide class // has...

php - Running Wordpress updates while in production? -

we have production site powered wordpress. in experience, wordpress updates tend go pretty smoothly, every goes wrong , run updates locally or on our dev site first make sure nothing breaks. my questions this: practice commit changes (from upgrade) locally , push changes production? ...effectively updating production site? seems work, know updates include modifications database. fear update modify local db, not production db , cause problems when newer code runs (expecting db have been modified). is valid concern? will well-written plugins account issue somehow? is there entirely different , better way this? update: think purpose of question unclear. know can run update locally, test it, commit, run update in production, commit, merge. that's sucks , i'm not sure if it's necessary. point of question figure out, or learn better way. example, if knows definitive nature of wp updates , how handle db modifications, pretty answer question. if able execut...

unix - linux: what is the difference between these two symbolic link commands -

i trying create symbolic link on server command ln -s , option 1: ln -s /home/thejobco/public_html/jccore/ajax_search /home/thejobco/public_html/demo/typo3conf/ext/ result 1: ajax_search -> /home/thejobco/public_html/jccore/ajax_search option 2: ln -s /home/thejobco/public_html/jccore/ajax_search/ /home/thejobco/public_html/demo/typo3conf/ext/ result 2: ajax_search -> /home/thejobco/public_html/jccore/ajax_search/ question: i want know if above 2 options same, or there different between them? option 1 not have / , option 2 has / , both of them work well, wonder standard way? a symbolic link implemented file containing name of target. there minor difference, you've seen: 1 of symlinks has trailing / , , other doesn't. can see difference in output of ls -l ; on lower level, shows difference in path returned readlink() system call. but there should no functional difference between them -- long target directory. either can used access lin...

clojure - Jetty threads getting blocked and dead locked -

Image
i using jetty "7.6.8.v20121106" part of https://github.com/ring-clojure/ring/tree/master/ring-jetty-adapter server. i making calls using http://http-kit.org/ following code. making server calls ignoring response. finding server threads become blocked/deadlocked after that. seems easy way bring server down , wanted understand going on here. code client is: (require '[org.httpkit.client :as hk-client]) (defn hget [id] (hk-client/get (str "http://localhost:5000/v1/pubapis/auth/ping?ping=" id))) (doall (map hget (take 100 (range))))) ; gives problem (doall (map deref (map hget (take 100 (range)))))) ; doesn't give problem threads blocked at sun.nio.cs.streamencoder.write(streamencoder.java:118) and deadlocked at java.io.printstream.write(printstream.java:479) would appreciate if can going on over here. finally found problem was. took lot of digging through , starting sample project find this. when started learning clojure , ...

apache - .htaccess poiting a domain to another domain/directory -

i need modify .htaccess file can override domain. first tell don't know .htaccess file. , there lot of stuff in .htaccess file. what want redirect www.one-domain.com to www.second-domain.com/abc i don't want else change. one-domain.com start showing content of second-domain.com/abc between both sites domain of wordpress. one-domain.com content @ root/ second-domain.com content @ root/direcoty below content of .htaccess file has. # -frontpage- indexignore .htaccess */.??* *~ *# */header* */readme* */_vti* <limit post> order deny,allow deny allow </limit> <limit put delete> order deny,allow deny </limit> <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond ...

c++ - how to limit log size in Qt -

in server application i'm creating log file of size 5kb. if exceeds 5 kb of file size , have overwrite old contents of new contents. if have ideas share me. i need implementation of technique in qt . i've found out examples in c++, using boost library, i'm not familiar, can me on implementation in qt. std::ostream & liblogging::filerotationlogsink::getcurrentstream( std::string::size_type required ) { if ( static_cast<std::string::size_type>(m_currentstream.tellp( )) + required > m_limit ) { m_currentstream.close(); // remove old backup if ( boost::filesystem::exists( m_backuppath ) ) { boost::filesystem::remove( m_backuppath ); } // backup current logfile boost::filesystem::rename( m_logfilepath, m_backuppath ); // open new logfile m_currentstream.open( m_logfilepath ); } return m_currentstream; } example implementation: #ifndef filerotati...

Arduino serial event not returning -

i'm working on arduino project , receive commands serial port arduino serial event. won't fulfill condition, making code not knowing serial event has been finished. here code. void serialevent() { while (serial.available()) { // new byte: char inchar = (char)serial.read(); if (inchar == '`') { // add inputstring: inputstring += inchar; // if incoming character newline, set flag // main loop can it: if (inchar == '|') { settingsreceived = true; // <----- never called serial.println("true"); // <------ nor } } } } i've tried passing string `hello| serial monitor yet won't respond. additionally, i've tried line ending no line ending , newline yet won't work, can please help? thanks! i have figured problem, serial.read() read byte per time, example, `hello| split ` h e l l o | so first time, if (inchar == ...

Executing a jQuery function depending on scrollbar position -

i creating simple webpage animates user scrolls down. example, click here . obviously, know superscrollorama exists. looks have fantastic features, yet it's still rather confusing novice jquery user myself. so keep simple stuff. here code have made sliding in div. code works on page load, , couldn't find how execute function when element comes in browser viewport. $(document).ready(function() { $('.slide').slidedown('slow'); }); how can animation occur when element scrolled to? can reverse animation once element once again out of view? better go figure out scrollorama deal this?

parse json rest response in java -

i trying parse json output neo4j in java as: object obj = parser.parse(new filereader("d:\\neo4j.json")); jsonarray json = (jsonarray) obj; system.out.println(json.size()); (int = 0; < json.size(); i++) { jsonobject jsonobject = (jsonobject) json.get(i); string data = (string); jsonobject.get("outgoing_relationships"); string name = (string) jsonobject.get("name"); system.out.println(data); system.out.println(name); } can me values inside "data" element: i have json output neo4j follows: [{ "outgoing_relationships": "http://host1.in:7474/db/data/node/133/relationships/out", "data": { "mothers_name": "parveen bagem", "mobile_no": "9211573758", "gender": "m", "name": "mohd", "tel_no": "0120-", "pincode": "110001" }, "tra...

javascript - In array find match and replace it by jQuery -

here have array set: totalarray =[ [1,2,3,4], [8,9,10], [15,16,17], [8,14,20] ] and need make combine if set have same number. like that: totalarray =[ [1,2,3,4], [8,9,10,14,20], [15,16,17] ] other example: totalarray =[ [1,2,3,4], [6,10,19], [6,16,4], [4,14,20] ] to totalarray =[ [1,2,3,4,6,10,14,16,19,20] ] so, need make if number match on other array , make together. e.g: array = [[1,2,3,4],[8,9,10],[8,11,12]]; array[1][0] , array[2][0] match, array become array = [1,2,3,4],[8,9,10,11,12]. any suggestion? you have write boring looping code. might make little more manageable with [].push.apply(arr1, arr2); : pushes elements of arr2 arr1 without building new array indexof : looks element in array. if want support ie8, tagged question jquery , may use $.inarray here's code : var totalarray =[ [1,2,3,4], [8,9...

github - How to stop TeamCity from building a pull request when it is viewed or commented? -

currently, team using teamcity automatically build pull requests github. we have configuration build pull requests. in version control settings of config, our branch specification is +:refs/pull/*/merge in "build triggers" configuration setting, have 1 trigger following trigger rule: +:root=pull requests on our repository:\***/*\* "pull requests on our repository" our vcs root name. the issues: when views pull request on github website without doing else, build triggered in teamcity build agent. quite annoying, because time time, have multiple build agents building same pull requests (when multiple people view it). when comments on pull request, build triggered. from perspective, time want teamcity start build when new commits pushed pull requests. is there way it? do have teamcity configured per blog post ? activate teamcity service hook in github takes care of triggering build in teamcity whenever there push. seems right thing me...

datagrid - change column to row in gridcontrol wpf devexpress -

i have devexpress gridcontrol ,which displays data sql database. default,the table in gridcontrol coming in column fashion, whereas need convert column header row header, column data presented row data. i have seen lot of forums , blogs didn't found helpful material helps condition, kindly suggest me way ... devex has vertical grid sadly not available wpf winforms. this link shows example of how show grid resemble winforms verticalgrid control. this link question on devex site sounds similar yours. maybe you'll find answer there. hope helps :)

missing or unreadable manifest.json chrome extension -

i having problems trying create simple personalized shortcut on chrome's new tab page. having no experience in coding world, followed steps in cool site. http://www.howtogeek.com/169220/how-to-create-custom-chrome-web-app-shortcuts-for-your-favorite-websites/ the problem when loading uncompressed extension, mentions cannot find manifest file or unreadable. { “manifest_version”: 2, “name”: “cnn“, “description”: “cnn site“, “version”: “1.0″, “icons”: { “128″: “128.png” }, “app”: { “urls”: [ "http://cnn.com/" ], “launch”: { “web_url”: “http://cnn.com/” } }, “permissions”: [ "unlimitedstorage", "notifications" ] } is correct? have chrome language set portuguese? have created 128.png image, , notepad title exacly "manifest.json" hope can help, cheers srd your quotation marks don't correct. instead of using “ , ” , use " .

clang - How to pass std::map as a default constructor parameter in c++ class function -

i have problem when attempting use std::map in clang-3.3 , clang-3.0 on ubuntu 12.04: #include <iostream> #include <map> #include <string> class { public: #if 0 //clang compiles ok typedef std::map<std::string,std::string> mapkeyvalue_t; void printmap(const mapkeyvalue_t &my_map = mapkeyvalue_t()) #else // clang compiles fail void printmap(const std::map<std::string,std::string> &my_map = std::map<std::string,std::string>()) #endif { std::map<std::string,std::string>::const_iterator it; (it = my_map.begin(); != my_map.end(); it++) { std::cout << it->first << " " << it->second << std::endl; } } }; int main() { a; a.printmap(); return 0; } however, while code compiles in both g++ , clang keep getting these errors output: test.cpp:14:36: error: expected ')' = std::map<std::string,std::string>()) ...

node.js - error on running node.io via commandline on windows server 2008 -

Image
am getting following error on running node.io via command line i had same problem , tried couple of things. seems windows 7 had problem command file name (node.io.cmd). if copy command without period (ie. nodeio.cmd), invoke tool using "nodeio" instead of "node.io". the file need changed in %appdata%\npm directory. %appdata% environment variable mapped "c:\users{my user name}\appdata\roaming".

c# - Overriding property setter -

i'm making program there balls bouncing around, want inherit class , make new 1 impossible set it's velocity i've tried doesn't anyting public class ball { public ball(double posx, double posy, double rad, vector vel) { pos = new point(posx, posy); rad = rad; vel = vel; } public double rad { get; set; } public point pos { get; set; } public vector vel { get; set; } } public class staticball : ball { public staticball(double posx, double posy, double rad) : base(posx, posy, rad, new vector(0, 0)) { } public vector vel { { return vel; } set { vel = vel; } } } how should this? i'm making program there balls bouncing around, want inherit class , make new 1 impossible set it's velocity your requirement violates substitution principle . if velocity of ball can changed, velocity of class inheriting ball must changeable. solution: instead of inheriting c...

angularjs - Is there a way to avoid Preflighting with $http? -

i'm using nginx on remote server, , no support options method i've been terribly stuck. both server , angular refuse talk each other. i want make simple $http.post() request. there way configure service send post request, , not preflighting options? this not angularjs does, browser according cross-origin resource sharing standard. see answer on related issue . however, if make angularjs application served same domain resource (different subdomains affect cross-origin), browser not send options request resource no longer cross-origin server. example: www.example.com requests resource on api.example.com trigger options request www.example.com requests resource www.example.com/api not trigger options request

Using #define in defining string size C -

i'm beginner in c , want ask difference in memory allocation procedure in 2 different codes mentioned below: #define max_len 10000 int main() { char str_new[max_len]; ... } int main() { char str_new[10000]; ... } are these 2 not same essentially?? memory not allocated in same way in these two? not answered in questions searched. although both different methods used frequently. they both equivalent. in first program macro max_len replaced 10000 simple textual substitution.

java - Show encoded url on web browser address bar -

i want show encoded url on web browser address bar when corresponding url going. aleady url , encoded using given code. string geturl=request.getrequesturl().tostring(); out.println(geturl); string output = urlencoder.encode(geturl); out.println(output); you have encode individual query string parameter name and/or value. string url = "http://mysite.com/query?q=" + urlencoder.encode("bla bla", "iso-8859-1"); // or "utf-8".

How to work external javascript in ASP.NET SignalR? -

i new asp.net signalr , trying allow number of users draw on canvas. drawing logic in separate js file , not understand how it.... here html code <html lang="en"> <head> <title>finger painting</title> <script src="~/scripts/draw.js"></script> </head> <body> <div> <canvas id="canvas" width="1000" height="500" style="background-color:white"> browser not support html 5 canvas. </canvas> </div> < div> <p>color selected: <span id="color_chosen">black</span></p> <p> <input type="button" id="black" /> </p> <p><input type="button" id="reset_image" value="reset drawing"/></p> </div> </body> </html> here javascript code draw on canvas: window.addeventlistener('load', eventwindowloaded, false); funct...

osx - reset file permissions on mac root folder -

here have done, cd / chmod 000 . which has changed file permissions. i can see blue screen on mac , not able login. i tried following links no luck. 1 login single user mode , execute these commands /sbin/mount -uw / cd /private/var/db rm .applesetupdone halt https://apple.stackexchange.com/questions/20192/how-can-i-fix-permission-issue-when-i-cannot-start-mac-os-x i don't want try random things further, appreciated. thanks..! here worked me. http://macs.about.com/od/faq1/f/emergencystart.htm in case faces same problem.

ios - Why is my tableview not scrolling to the requested indexPath? -

i have tableview in view , works fine, each custom cell (todolistcell) has text field allow users edit, updating data. , well, problem occurs whenever trying scroll cell going hidden keyboard. note: adjust size of table using nsnotificationcenter observer methods apple documentation recommends , know not problem. - (void)scrolltoselectedcell { nsindexpath *currentindexpath = [nsindexpath indexpathforitem:0 insection:0]; while (currentindexpath.row < self.todos.count) { todolistcell *cell = (todolistcell *)[self.table cellforrowatindexpath:currentindexpath]; if (cell.titlefield.isediting == yes) { [self.table scrolltorowatindexpath:currentindexpath atscrollposition:uitableviewscrollpositionmiddle animated:yes]; break; } currentindexpath = [nsindexpath indexpathforitem:currentindexpath.row + 1 insection:0]; } } any idea why not scroll cell not on scre...

ios - Highlight cell in my side bar -

i've created side bar (like facebook app) , works fine. 1 thing though want cell in table view (basically sidebar) highlighted if that's view active. i have no idea how this. though in ib button there options different states not case. any ideas? you can create subclass of uitableviewcell , override method setselected: - (void) setselected: (bool) selected animated: (bool) animated { [super setselected: selected animated: animated]; // configure view selected state } if need set selected cell can programmatically: [mytableview selectrowatindexpath:[nsindexpath indexpathforrow:0 insection:0] animated:no scrollposition:0];

Python listing directories in Windows XP from Linux host -

i'm running python on linux machine , have windows xp guest running on vbox. want access shared folder on xp machine. tried following command same error. d = os.listdir(r"\\remoteip\share") oserror: [errno 2] no such file or directory the shared folder on xp created creating new folder in shared documents folder , i'm able ping machines. windows sharing implemented using smb protocol. windows explorer , of linux file managers (like nautilus) make transparent user, easy common file operations on files\folders shared through smb. however, linux (and python runs on top of it) not add abstraction default on file system level (though can mount smb share part of fs). so, in end, access files can: mount share using mount -t cifs (man or google details) , access share python usual folder (to mind rather kludgy solution) use library deals smb, pysmb (here relevant docs section ) , file operations it's help. hope help.

javascript - Scroll from corner to corner -

i wondering how scroll left-top corner right-bottom corner. from top bottom default. $(function() { $("body").mousewheel(function(event, delta) { this.scrollleft -= (delta * 30); event.preventdefault(); }); }); how can make scroll corner corner?

c# - 2 input but validate only one -

could me problem? assume had form table of stuff (products example), possibility of add new product , edit existing product. requirement have add row visible. have problem when, click on 'edit' product, have 2 inputs( 1 edit , 1 add ). when posted form server choosing save editable row, wanted validate edit row , nothing add row (which empty while). and problem default mvc validation applied on add row inputs, controls become red, , property validation message appear. don't want see them, because confusing. can't understand why happens. possibly because mvc can not cast empty string decimal (the type in viewmodel input refered) you need 2 different forms, 1 add project , 1 edit project. these need point different actions, validate 1 object. im not sure code looks suggest more following, views separated entirely: start view displays of 'products' or whatever data is. when populate in view, can assign edit links each individual one. need 1 ove...

JavaScript split().join() thousands separator replacement for .replace() for use on eBay -

i use comma separated thousands on site, works great... str.replace(/\b(?=(\d{3})+(?!\d))/g, ","); i'm trying implement similar method ebay using split().join(), since ebay have banned usage of .replace(), solution? i tried using same regx inside split(), far has not worked same way. thanks. maybe can try use search() index of string , remove characters given index. var pre_string = str.substing(0, found_index); var post_string = str.substing(found_index + 3); var replaced_string = pre_string + post_string;

r - customized ridge regression function -

i working on ridge regression, want make own function. tried following. work individual value of k not array sequence of values. dt<-longley attach(dt) library(mass) x<-cbind(x1,x2,x3,x4,x5,x6) x<-as.matrix(x) y<-as.matrix(y) sx<-scale(x)/sqrt(nrow(x)-1) sy<-scale(y)/sqrt(nrow(y)-1) rxx<-cor(sx) rxy<-cor(sx,sy) (k in 0:1){ res<-solve(rxx+k*diag(rxx))%*%rxy k=k+0.01 } need optimized code too. poly.kernel <- function(v1, v2=v1, p=1) { ((as.matrix(v1) %*% t(v2))+1)^p } kernelridgereg <- function(trainobjects,trainlabels,testobjects,lambda){ x <- trainobjects y <- trainlabels kernel <- poly.kernel(x) design.mat <- cbind(1, kernel) <- rbind(0, cbind(0, kernel)) m <- crossprod(design.mat) + lambda*i #crossprod x times traspose of x, looks neater in openion m.inv <- solve(m) #inverse of m k <- as.matrix(diag(poly.kernel(cbind(trainobjects,trainlabels)))) #...

ios7 - Xcode 5 DP5 fails to download iOS 7 doc set -

Image
when download ios 7 doc set, xcode says my account not have access ios 7 doc sets . account used had joined developer program , paid $99 / year. why happening?

c# - How can i avoid or pass over a directory that is access denied? -

i have method: private void searchfordoc() { try { outputtext = @"c:\temp\outputtxt"; outputphotos = @"c:\temp\outputphotos"; temptxt = @"c:\temp\txtfiles"; tempphotos = @"c:\temp\photosfiles"; if (!directory.exists(temptxt)) { directory.createdirectory(temptxt); } if (!directory.exists(tempphotos)) { directory.createdirectory(tempphotos); } if (!directory.exists(outputtext)) { directory.createdirectory(outputtext); } if (!directory.exists(outputphotos)) { directory.createdirectory(outputphotos); } t = environment.getenvironmentvariable("userprofile") + ...

.htaccess - htaccess rewriterule preserve post data -

the address of contact form of website is www.mysite.com/contact and actual contact form address www.mysite.com/contact.php when user fills contact form, want contact.php receive post data coming "/contact". created folder named contact , put .htaccess file content below rewriterule (.*) /contact.php but post data lost after form submitted , /contact redirected contact.php. ideas solve it? remove contact directory. put rule in htaccess file in document root rewriterule ^contact/?$ /contact.php [l] the reason why losing post data , getting redirected because if there contact directory, , request /contact , mod_dir module redirect /contact/ enforce trailing slashes requests directories. redirect , rewrite both applied , see /contact.php .

jquery - Unslider arrow code overriding slider options -

not sure why whenever add arrows part options overridden. not best @ jquery , javascript if guys can point out not seeing. tried adding options in second part , nothing. $=jquery; $('.slider').unslider({ speed: 500, // speed animate each slide (in milliseconds) delay: 33000, // delay between slide animations (in milliseconds) complete: function() {}, // function gets called after every slide animation keys: false, // enable keyboard (left, right) arrow shortcuts dots: true, // display dot navigation fluid: false // support responsive design. may break non-responsive }); // overrides options above. var unslider = $('.slider').unslider(); $('.unslider-arrow').click(function() { var fn = this.classname.split(' ')[1]; // either unslider.data('unslider').next() or .prev() depending on classname unslider.data('unslider')[fn](); }); i'm...

jsp - why printing the value after casting from request.getAttribute to int causing NullPointerException? -

int age = (integer)request.getattribute("age"); out.println(age); why 2nd line throwing nullpointerexception ?? out.println(age); the thing can null in statement out . so, if nullpointerexception @ line, means out null.

Android Content provider Cursor returns 0 -

i have looked @ couple of days , can't work out why content provider return 0 using arguments passing it. here's contentresolver code: string[] expenditureprojection = { businessopsdatabase.col_expend_cat_id, businessopsdatabase.col_expend_date, businessopsdatabase.col_expend_amount, businessopsdatabase.col_expend_desc, businessopsdatabase.col_sterling_exchange, businessopsdatabase.col_company_id, businessopsdatabase.currency_id, businessopsdatabase.col_mod_date }; // defines string contain selection clause string selectionclause = null; // array contain selection arguments string[] selectionargs = {expend_id.trim()}; selectionclause = businessopsexpenditureprovider.expenditure_id + "=?"; log.d(tag, expend_id+" selected list."); cursor expendcursor = getcontentresolver().query( businessopsexpenditureprovider....

c# - Set Text to the lowest right edge of a label? -

Image
easy example, lets i'm creating label that: label label = new label(); label.text = "hello" + "20.50"; label.width = 250; label.height = 100; panel1.controls.add(label); how "20.50" should appear in lowest right edge of label? for clarity made little example in word: how achieve this? appreciated! there's no built-in support label control. you'll need inherit label create custom control, , write painting code yourself. of course, you'll need way differentiate between 2 strings. + sign, when applied 2 strings, concatenation. 2 strings joined compiler, this: hello20.50 . either need use 2 separate properties, each own strings, or insert sort of delimiter in between 2 strings can use split them apart later. since you're creating custom control class, i'd go separate properties—much cleaner code, , harder wrong. public class cornerlabel : label { public string text2 { get; set; } public cornerlabel() ...