Posts

Showing posts from September, 2012

how can i mask input by using batch file without extra file -

i want batch file mask input * without file for example http://pastebin.com/2c4etg4g this code working slow when write letter can 1 give code fast , without file ? or edit code in link fast ?? does meet "no file" criterion? it's batch file creates , deletes tool input, , portable, , works in 64 bit machines too. herbert kleebauer wrote utility , source code can found on usenet. it requires vista , later think. newsgroups: alt.msdos.batch.nt subject: re: hinput.cmd (new version) date: mon, 25 feb 2013 19:08:59 +0100 @echo off certutil -f -decode %~f0 pass.exe>nul set /p =enter password: <nul /f %%i in ('pass.exe') set password=%%i echo. echo %password% del pass.exe pause goto :eof -----begin certificate----- tvpgaqeaaaaeaaaa//8aagabaaaaaaaaqaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaoaaaaa4fug4atannibgbtm0htmljzsb0bybtzwv0ihnvbwvi b2r5ihdobybpcybzdglsbcb1c2luzybet1msdqpidxqgaglzihbyb2dyyw0gcmvx dwlyzxmgv2lumziudqokafbf

c - How to safely get the return value of setjmp -

i return error code using longjmp, , pass on function called setjmp. simplified code: int do_things(stuff ........) { int error_code; jmp_buf jb; if ((error_code = setjmp(jb)) == 0) { /* stuff */ return 0; } else { return error_code; } } but i'v read: "an invocation of setjmp macro shall appear in 1 of following contexts:" entire controlling expression of selection or iteration statement if (setjmp(jb)) { switch (setjmp(jb)) { while (setjmp(jb)) { or 1 operand of relational or equality operator other operand integer constant expression, resulting expression being entire controlling expression of selection or iteration statement if (setjmp(jb) < 3) { or operand of unary ! operator resulting expression being entire controlling expression of selection or iteration statement if (!setjmp(jb)) { or entire expression of expression statement (possibly cast void). setjmp(bf); is there nice way return value? ( without usi

html - PHP file doesn't run -

i have 2 files: index.html <html> <body> <form action="welcome.php" method="post"> name: <input type="text" name="name"><br> e-mail: <input type="text" name="email"><br> <input type="submit"> </form> </body> </html> and welcome.php <html> <body> welcome, <?php echo $_post["name"]; ?><br> email address is: <?php echo $_post["email"]; ?> </body> </html> this example there when user fills form , hits "enter" should display: welcome, the_name_you_enter email address address_you_enter but me displays welcome.php source code (i using safari 7). knows why? this happens because php file not executed on web server or php not enabled on webserver. you trying access file directly using file:// take @ mamp (i assuming using os x)

python - Mako template sum -

i have problem creating mako template, take list of numbers , output sum. example: list = [1, 2, 3, 4, 5] output: 1 + 2 + 3 + 4 + 5 i want list passed argument template. way go around using python ' + '.join(list) ? know can use \ escape new line characters , in loop special care needs taken regard last + , quite ugly. thanks! built in function sum() should work fine, see python doc sum your template body should contain just def template(context, numbers_list): return sum(numbers_list) or, if numbers passed in string: def template(context, numbers_list): return sum(int(x) x in numbers_list)

apache - ThinkingSphinx on production : Cannot assign requested address -

i have problem cannot fix today. happened me @ least once don't remember i've done fix it. i'm deploying rails 4 application (with apache , passenger , using ruby 2.1) on own server using capistrano 3. cannot use thinking-sphinx because of following error : fatal: bind() failed on my.ip.address : cannot assign requested address this error strange because can use without error command index not rebuild . i'm working directly on server ssh trying solve problem. have start searchd by own ? have stop apache during rebuilding ? i don't know begin. last word : strangest part working cannot restart it. i've joined configuration files. config/initializer/thinking_sphinx.rb thinkingsphinx::activerecord::databaseadapters.default = thinkingsphinx::activerecord::databaseadapters::postgresqladapter thinkingsphinx::sphinxql.functions! config/thinking_sphinx.yml development: mysql41 : 9312 enable_star: true min_prefix_len: 3 utf8: true

actionscript 3 - How to drag and drop instances of a movieclip -

i have movieclip (star) in library , set it's class linkage name "star". use code call on stage.i want create multiple instances of star in same position , draggable unfortunately manage create 2 instances of movieclip , 1 draggable.i need code. thank you. var stars:array = []; var star:star = new star(); this.addchild(star); stars.push(star); star.x=550; star.y=490; for(var i=0; i<stars.length; ++i) { trace(stars); star.addeventlistener(mouseevent.mouse_down, clicktodrag); star.addeventlistener(mouseevent.mouse_up, releasetodrop); } function clicktodrag(e:mouseevent):void { e.target.startdrag(); var star:star = new star(); this.addchild(star); stars.push(star); star.x=550; star.y=490; } function releasetodrop(e:mouseevent):void { e.target.stopdrag(); if (star.hittestobject(target)) { trace("collision detected!"); e.target.removeeventlistener(mouseevent.mouse_down, clicktodrag); } else {

c# - Linq chained SELECT and DISTINCT operators -

i new linq , had basic query. say have large list of customer objects list<customer> c = null; c = //fetch db - resulting 1000+ non-unique customers; and if convert list list of class - lack of better name - customerentity , pick out distinct ones follows: var ce = c.select(cust => new customerentity() { customerid = cust.custid, customername = cust.custname }).distinct(new customerentitycomparer()).tolist(); customerentitycomparer class compares 2 customerentity objects on basis of customerid. query is: if select , distinct chained, result in multiple iterations on list? thanks vikas to give more elaborate answer: can notice select() returns ienumerable, , distinct(). that's because you're creating query. no selection or distinct filtering done until call tolist() method. when tolist() method executed, whole query evaluated. that's called de

javascript - Toggling between bold and normal text with jQuery -

i'm working way through learning jquery 4th edition packtpub, trying out 1 of it's exercises on dom manipulation. i'm trying toggle make div bold clicking it(by adding element instead of using classes or css), , remove bolding subsequent clicks.(i.e toggling between bold , normal text). this i've come far. html //more html <div id="f-author">by edwin a. abbott</div> <-- div bolded //more html my jquery $(document).ready(function(){ $('#f-author').click(function(){ if($(this).contents().has('b')){ $('this').find('b').contents().unwrap(); }else{ $(this).wrapinner('<b>'); } }); }); nothing happening in code when click on div , i've been stuck couple of hours trying figure out going wrong.my guess problem lies if conditional. i've tried replacing if conditional if($(this).children().has('b')) but nothing seems working. i

datasource - Osmdroid - from offline folder -

i using osmdroid display both online , offline data in app. offline data stored in .zip file required structure. is possible have these offline tiles stored in directory (extracted .zip file same structure)? please tell me how achive this? thank you. well, far understand trying get... more or less standard xytilesource doing. so if use ready-to-use tile source one: map.settilesource(tilesourcefactory.mapnik); you see downloaded tiles files stored in /sdcard/osmdroid/tiles/mapnik/ the main difference adds ".tile" extension @ end of each tile file (probably prevent tools android gallery index images). if have zip file tiles ready use, extract them in directory, , add .tile extension each tile (355.png => 355.png.tile) and tilesourcefactory.mapnik able use them.

java - Asynchronous callback not invoked during test using Mockito -

i trying test application using mockito framework. following example works perfectly: val dl = mock(classof[dichlistener]) val = argumentcaptor.forclass(classof[int]) when(dl.test(i.capture())).thencallrealmethod() dl.test(666) i.getvalue shouldbe 666 however, similar (but waiting asynchronous response), next 1 doesn't: when(dl.echoreqcallback(c.capture(), m.capture())).thencallrealmethod() // not working: // verify(dl).echoreqcallback(c.capture(), m.capture()) n2.sendechorequest("hello!") thread.sleep(1000) println(m.getvalue) echoreqcallback called after sendechorequest , dl mocked object. echoreqcallback run response network message, not invoke after line: n2.sendechorequest("hello!") i tried using longer sleep time, result same: callback method not invoked m variable didn't value. log: using verify : > [info] org.mockito.exceptions.verification.wantedbutnotinvoked: > wanted n

c++ - Deferred shading in OpenGL? -

Image
i've got strange problem deferred shading implementation. render required information via mrt fbo, diffuse, position , normals in world space, looks this: this done following setup tree textures: diffuse = std::shared_ptr<bb::texture>(new bb::texture(gl_texture_2d)); // generates texture id diffuse->bind(); diffuse->texture2d(0, gl_rgb, width, height, 0, gl_rgb, gl_float, 0); // gltexture2d diffuse->parameterf(gl_texture_wrap_s, gl_clamp_to_edge); diffuse->parameterf(gl_texture_wrap_t, gl_clamp_to_edge); diffuse->parameterf(gl_texture_min_filter, gl_linear); diffuse->parameterf(gl_texture_mag_filter, gl_linear); diffuse->unbind(); texture2d(gl_color_attachment0+1, diffuse->getid(), 0); these used in drawing stage: dsshader->bind(); dsshader->enablevertexattribarrays(); ds->diffuse->bind(gl_texture0); // "ds" fbo containing textures ds->position->bind(gl_texture0+1); ds->normal->bind(gl_texture0+2); dssh

android - Downloading xml from web and using xmlpullparser -

i new android community , want learn how steps i have link http://one.zero.two.two:8080/ofpb%20v2/contacts.xml note : tomcat running & numbers changed words because of post problems which contains these values : <contacts> <contact> <name>will</name> <address>add1</address> <phone>92</phone> <age>8</age> </contact> <contact> <name>dean</name> <address>add2</address> <phone>925738132</phone> <age>18</age> </contact> <contact> <name>renz</name> <address>add3</address> <phone>1329871287</phone> <age>18</age> </contact> <contact> <name>louie</name> <address>add4</address> <phone>987</phone> <age>18</age> </contact> </contacts> how make android application , , post in list view ? note : me reference on can idea on how this

java - cannot find symbol when defining my own exception -

can tell me why getting "cannot find symbol" while compiling. this how define own exception: public void setidnumber(int i)throws invalidemployeeid { idnumber = i; if ((idnumber <= 0)) { throw new invalidemployeeid("invalid id. please input numeric id"); } } cannot find symbol: public void setidnumber(int i)throws invalidemployeeid symbol: class invalidemployeeid here try , catch statement in demo program: try { id = integer.parseint(input); worker.setidnumber(id); } catch (invalidemployeeid e) { system.out.println(e.getmessage()); } thanks in advance; add class code: public class invalidemployeeid extends exception { public invalidemployeeid(string string) { super(string); } } just saying new not define exception you. furthermore, must consistent in usage of class names. try { id = integer.parseint(input); worker.setidnumber(id); } catch (invalidemployeeid

.htaccess - Codeigniter at subfolder and htaccess for inner redirection -

i have project custom engine @ backend, i'm trying hook every request @ /somewhere/ codeigniter. put ci /www/somewhere/ , configured codeigniter's .htaccess new rewritebase, looks like: adddefaultcharset utf-8 options -indexes <ifmodule mod_rewrite.c> rewriteengine on rewritebase /somewhere/ directoryindex index.html index.php rewritecond %{request_uri} ^system.* rewriterule ^(.*)$ /index.php?/$1 [l] rewritecond %{request_uri} ^application.* rewriterule ^(.*)$ /index.php?/$1 [l] </ifmodule> my ci creates static html project , stores @ /compiled/ , have structure /www/ /custom-engine/ /img/ /js/ /somewhere/ <--- ci's root /application/ /system/ /compiled/ <--- storage html my-file.html /my-compiled-folder/ /one-more/ /sub-compiled/ index.html and works fine. but. need open compiled files without /compiled/ in url. works: http://domain.com/somewhere/compi

java - How to do clean up in native heap when opengl context lost in GLSurfaceview in Android? -

i'm making wrapper native 3d engine. , used glsurfaceview establish egl context engine. the problem that, when glsurfaceview lose egl context (onpause, etc), wanna free memory engine used. however, there seems no way safely. i've try override function onpause in glsurfaceview below: @override public void onpause(){ engine.release(); super.onpause(); } however, cause memory problem. 04-06 21:33:40.415: e/libegl(8249): call opengl es api no current context (logged once per thread) 04-06 21:33:40.425: a/libc(8249): fatal signal 11 (sigsegv) @ 0x00000000 (code=1) it might due memory freed renderer thread still running. i think best way clean free memory in renderer thread before ends. don't know how implements it. could me? glsurfaceview own egl context management. takes responsibility creating it, destroying it, , ensuring it's current on renderer thread when ondrawframe() called. if not want, should use plain surfaceview instead, , issu

haskell - Using a c .a file installed by os in a cabal package? -

i want add foreign function defined in static library ( .a ) file cabal package. libsdl2_test2.a distributed libsdl2. what correct , portable way of doing so? note field extra-libraries handles shared object ( .so ) files. there few evils in world tell children watch out for. placing pre-compiled binaries inside of cabalized package such dark evil can't bring myself tell them - hope issue never arises. the best solution if want distribute binaries select platform (operating system , architecture) of choice , make binary distribution. means making .deb, .rpm, .msi, homebrew, or macports packages. an alternative if must place monstrosity in .cabal mikhail has right idea. can specify extra-source-files in .cabal file distribute binaries. how intel-aes package allowed users leverage aes-ni before compilers had support instruction.

Java search in text file with joptionpane? -

im new java. im quite lost here, im working on project should search in text file corresponding word, line line. got little someone, there´s errors gui in joptionpane. this have until now. gui: private void jmenuitemlookupactionperformed(java.awt.event.actionevent evt) { joptionpane.showoptiondialog(null, "title", "message", joptionpane.default_option, joptionpane.plain_message, null, options.toarray(new string[] {}), options.get(0)); } and code search. public string lookup(string question){ list<string> options = new arraylist<>(); (object value : data.values()) { if (value.tostring().startswith(question)) { options.add((string) value); } } move list<string> options = new arraylist<>(); outside lookup method , make class variable. compiler cannot find options object.

apache - Redirect non-www and non-https to https://www -

i want redirect non-www , non-https urls https://www domain, have following htaccess, works ok redirecting non-https https still allows access domain.com without www, rewriteengine on rewritecond %{https} !=on rewriterule .* https://%{server_name}%{request_uri}%{query_string} [l,r] # redirect trailing slashes... rewriterule ^(.*)/$ /$1 [l,r=301] # handle front controller... rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ index.php [l] i've found should use following force www, can't should placed best, thanks rewritecond %{http_host} !^www. [nc] rewritecond %{http_host} ^(.+)$ [nc] rewriterule ^(.*)$ http://www.%1/$1 [r=301,l] you can use: rewriteengine on rewritecond %{https} off [or] rewritecond %{http_host} !^www\. [nc] rewriterule ^ https://www.domain.com%{request_uri} [r=301,l,ne] # remove trailing slashes... rewritecond %{request_filename} !-d rewritecond %{the_request} \s(.+?)/+[?\s] rewriterule ^(.+?)/$ /$

Command Prompt window appears with gui window c++ -

Image
whenever try make c++ gui program/window command prompt window appears window this: but did this:: #include <iostream> #include "define.h" lresult callback winproc(hwnd hwnd,uint message,wparam wparam,lparam lparam); int winapi winmain(hinstance hinst, hinstance hprevinst, lpstr lpcmdline, int nshowcmd){ window win; msg msg; win.cbclsextra = null; //additional parameters win.cbwndextra = null; //additional parameters win.hbrbackground = (hbrush)color_window ; //sets background color window win.hcursor = loadcursor(null, idc_arrow); //the cursor appear in window win.hicon = null; //icon window win.hinstance = hinst; //handle application instance win.lpszclassname = "window class"; //the unique name of window class win.lpszmenuname = null;

javascript - Finding object in nested collection with Underscore.js -

i have collection of teams (in league) so: var fra1 = { "sports":[ { "name":"soccer", "id":600, "uid":"s:600", "leagues":[ { "name":"french ligue 1", "abbreviation":"fra.1", "id":710, "istournament":false, "country":{ "id":7, "name":"france", "abbreviation":"fra" }, "uid":"s:600~l:710", "groupid":9, "shortname":"ligue 1", "teams":[ { "id":159, "uid":"s:600~t:159", "

r - How do I replicate values based on previous value -

how replicate 1 value based on previous value? e.g my dataset name <- c("sergio",na,na,na,na,"john", na,na,na,na,na,na) number <-c(1234,na,na,na,na,5678, na,na,na,na,na,na) mydata <- cbind(as.data.frame(name),as.data.frame(number)) new dataset name number sergio 1234 sergio 1234 sergio 1234 sergio 1234 john 5678 john 5678 john 5678 john 5678 john 5678 john 5678 .... etc you can use na.locf "zoo" package: mydata <- data.frame( name = c("sergio",na,na,na,na,"john", na,na,na,na,na,na), number = c(1234,na,na,na,na,5678, na,na,na,na,na,na)) library(zoo) na.locf(mydata) # name number # 1 sergio 1234 # 2 sergio 1234 # 3 sergio 1234 # 4 sergio 1234 # 5 sergio 1234 # 6 john 5678 # 7 john 5678 # 8 john 5678 # 9 john 5678 # 10 john 5678 # 11 john 5678 # 12 john 5678 if prefer not use package, here

c# - Any way to save an UIElement created programmatically in an image file? -

i'm trying save uielement created programmatically in jpg/png/bmp image in windows phone 8.1 (c#) application. i'm using class rendertargetbitmap using method renderasync() works ui elements created in xaml code. when use on ui elements created directly in c# have exception: "system.argumentexception (value not fall within expected range.)" am doing wrong or class doesn't allow rendering of uielement(s) created programmatically? there way on windows phone 8.1? thank you! here's code use: private static async void rendertext(string text, int width, int height, int fontsize, string imagename) { rendertargetbitmap b = new rendertargetbitmap(); var canvas = new grid(); canvas.width = width; canvas.height = height; var background = new canvas(); background.height = width; background.width = height; solidcolorbrush backcolor = new solidcolorbrush(colors.red); backgrou

validating a string in Java returns incorrectly. Testing for length of string from scanner? -

string validation issue: this method works part, theres apparent logic problem. if user hits enter @ console no input, should return "error! entry required" message, doesnt. have imagined would, since testing input of 1 or less chars public string getchoicestring(string prompt, string s1, string s2) { this.println(prompt); string userchoice = this.sc.next(); string i; boolean isvalid = false; while (isvalid == false) { if (userchoice.equalsignorecase(s1) || userchoice.equalsignorecase(s2)) { isvalid = true; } else if (userchoice.length() <= 1 || userchoice.equalsignorecase("")) { system.out.println("error! entry required. try again."); userchoice = this.sc.next(); } else { this.println("error! entry must " + s1 + " or " + s2 + ". try again."); userchoice = this.sc.next(); }

javascript - Replacing different text, onClick, to SAME div -

i'm pretty new javascript , have been @ @ awhile, still can't figure out, advice how continue this, appreciated. i've tried place in jsfiddle, not work, when part of code working on computer. i've got first part (#preheat , #pans) want. javascript: <script> $(function () { $('#preheat').on('click', function () { $("<p>preheat oven 350°f. prepare 2 9-inch pans spraying baking spray.</p>").appendto('#content'); $("#steps").replacewith('<span id="steps1">allow <span id="verb_1">cool</span> 10 minutes, remove <span id="noun_1">pans </span>and cool completey.</span>'); }); //this part not working $('#cool').on('click', function () { $("<p>allow cool 10 minutes, remove pans , cool completely.</p>").appendto('#content&

mysql - How do I make a php page that reads different selections for different users? -

i have mysql lists 500 items. users can register @ site , mark item have already. simple php reads table , each row. how should structure database each user can have particular setting each item? so when bob opens account, sees has item 1, when mary opens it, she'll have item 1 missing , can see has item 1 twice or more times may contact whoever has more 1 of item? you this: have table shows users have items... table name: user_items primary_key | user_id | item_number ----------------------------------- 1 | 1 | 1 2 | 1 | 1 3 | 1 | 2 4 | 2 | 2 or have this primary_key | username | item_number ----------------------------------- 1 | bob | 1 2 | bob | 1 3 | bob | 2 4 | mary | 2 this table above shows that: user 1 / bob has: item 1 x2 item 2 user 2 / mary has: item 2

postgresql - How to import data from a particular table from a large postgres file? -

i want import data particular tables in postgres. how can that? i've tried following command. didnt worked though. pg_dump -u postgres -a -d -t data_pptlconfig db_name > db_file assuming mean "a dump" when "postgres file": if it's sql format dump, you'd have extract part want text editor , run part. dump sql "program" re-create database, there's no other way selectively restore bits of it. if it's custom-format dump, can use pg_restore -t flag. use file the-dump-file find out if not know. or @ file text editor - if first 5 bytes pgdmp it's postgresql custom format dump; otherwise it'll sql format dump.

objective c - How do I access and manipulate JPEG image pixels? -

i have jpg file. need convert pixel data , change color of pixel. this: nsstring *string = [[nsbundle mainbundle] pathforresource:@"pic" oftype:@"jpg"]; nsdata *data = [nsdata datawithcontentsoffile:string]; unsigned char *bytesarray = datai.bytes; nsuinteger byteslenght = data.length; //--------pixel array nsmutablearray *array = [[nsmutablearray alloc] initwithcapacity:byteslenght]; (int = 0; i<byteslenght; i++) { [array addobject:[nsnumber numberwithunsignedchar:bytesarray[i]]]; } here try change color of pixels since 95 till 154. nsnumber *number = [nsnumber numberwithint:200]; (int i=95; i<155; i++) { [array replaceobjectatindex:i withobject:number]; } but when convert array image got blurred picture. don't understand why don't have influence on pixels , why have influence on picture in total? the process of accessing pixel-level data little more complicated question might

c# - NullReferenceException i am familiar with them, but cannot solve on this occasion -

im new asp.net familiar null reference exceptions cant solve one. im trying collect data webform , pass database through connection string, when exception occurs. using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; using system.data.sqlclient; using system.configuration; public partial class register : system.web.ui.page { protected void page_load(object sender, eventargs e) { try { if (ispostback) { sqlconnection studconna = new sqlconnection(configurationmanager.connectionstrings["studconnection"].connectionstring); studconna.open(); string checkuser = "select count(*) studtable name='" + textboxname.text + "'"; sqlcommand studcoma = new sqlcommand(checkuser, studconna); int temp = convert.toint32(studcoma.executescalar().tostr

html - Why is my image not showing up? -

before put code in: <div id="bannerinright"> <img src="images/race.jpg" width="475" height="258"/></div> i had "nivo slider" in place. tried delete nivo code find, image isn't appearing @ all. below css: #bannerinright { float: right; height: 261px; margin: 8px 28px 20px; width: 475px; } and here live link if helps @ all: http://www.lymemd.org/indexmm6.php thank in advance. your stylenew.css file includes: #bannerinright img { position: absolute; top: 0px; left: 0px; display: none; } which causes image remain hidden. remove rule , image shows up.

isapi - How to implement URL filtering of classic asp pages -

greetings! i have website classic asp pages in iis 6.0. i'm trying implement url filtering of .asp requests avoid cross-site scripting attacks in url. please let me know ways can implemented. i have written common function , calling function each page.(not best practice). any appreciated. have tried using server.htmlencode() on request.form or request.querystring used on asp pages. in addition parametering sql variables may help

Read from stdin in C++ -

here code: ... ... { cin >> command; switch(command) { case 'i': cin >> key >> nome >> idade >> endereco; count++; pessoas = (pessoa **) realloc(pessoas, count*sizeof(pessoa *)); pessoas[count-1] = new pessoa(key, nome, idade, endereco); btree->add(pessoas[count-1]); break; case 's': cin >> key; tosearch = (pessoa *) btree->search(key); if(tosearch == null) { cout << "-1" << endl; } else { cout << key << endl; cout << tosearch->getnome() << endl; cout << tosearch->getidade() << endl; cout << tosearch->getendereco() << endl; } break; case 'e

html - Strange behavior of "overflow: auto" on Chrome -

i'm developing site blog section. need section have fixed height. in order able see posts in blog added overflow: auto shows scrollbar when needed. <div id="container"> <div id="content"> <div class="post"> long post.... </div> <div class="post"> long post.... </div> <div class="post"> long post.... </div> .... .... .... .... </div> </div> #container { overflow: hidden; } #content { height: 200px; overflow: auto; border: 1px solid red; } .post { margin: 20px 0; } i tested on chrome, firefox , ie. site on firefox , ie works expected, chrome, although shows scrollbar when list of posts bigger container, adds white gap size of list of posts under container. i created fiddle can't reproduce chrome behavior there: http://jsfiddle.net/u5d56/3/ using overflow: scroll instead

node.js - nodejs, mongodb get array of only specified fields value -

is possible array of specified fields value in mongodb? like instead of getting: [{"color":"blue"},{"color":"red"}] i get: ["blue","red"] is question clear enough? you can run array.map on results array achieve desired result: var colors = [{"color":"blue"},{"color":"red"}].map(function(obj){ return obj.color; });

web services - Android: How To Load Image From Url? -

This summary is not available. Please click here to view the post.

Spring form errors with multiple identical forms on the same page -

i printing arbitrary number of identical forms on page using spring's <form:form tag, , need way distinguish between them, because form errors of 1 form printed on forms. currently identical forms bound same, single backing object. works fine, because user can submit 1 form @ time. i using spring validation validate form fields. when 1 of fields has error (let's 'name' empty) error message printed under 'name' field of forms. obviously, need way allow spring distinguish between forms, how? some example code: this spring webflow definition creates clientformbacking object client forms. , submits form post bindandvalidate method, calls validator. <webflow:var name="clientformbacking" class="com.example.clientformbacking"/> <webflow:view-state id="list" view="clients" model="clientformbacking"> <webflow:on-entry> <webflow:evaluate expression="contextparamete

unity3d - EveryPlay IsRecordingSupported is False on Android Nexus 5 -

everyplay.sharedinstance.isrecordingsupported() false on android devices - nexus 5 , 7. i still able record , post video on devices if ignore value. note: everyplay.sharedinstance.issupported() true should check everyplay.sharedinstance.isrecordingsupported() before showing everyplay recording/sharing option user - everyplay.sharedinstance.isrecordingsupported() ? due wide range of driver behaviour, hardware encoders, gpus , android version differences out there, everyplay sdk caches device specific settings online remote server until settings received, recording support automatically disabled. after receiving server response, recording support either enabled or continued disabled workaround devices known cause trouble. next time application started, settings applied cache upon startup without requiring network access in it's current form, there's chance of getting unsupported status everyplay.sharedinstance.isrecordingsupported() if method called

c++ - Rounding a 3D point relative to a plane -

Image
i have plane class holds n normal , q point on plane. have point p lies on plane. how go rounding p nearest unit on plane. snapping cursor 3d grid grid can rotating plane. image explain: red current point. green rounded point i'm trying get. probably easiest way achieve taking plane define rotated , shifted coordinate system. allows construct matrices transforming point in global coordinates plane coordinates , back. once have this, can transform point plane coordinates, perform rounding/projection in trivial manner, , convert world coordinates. of course, problem underspecified way pose question: transformation need has 6 degrees of freedom, plane equation yields 3 constraints. need add more information: location of origin within plane, , rotation of grid around plane normal. personally, start deriving plane description in parametric form: xvec = alpha*direction1 + beta*direction2 + x0 of course, such description contains 9 variables (three vectors), c

c# - LiveSDK onedrive - How to read an album -

i trying follow sample on msdn read properties of folder on onedrive, running errors. here tutorial following: http://msdn.microsoft.com/en-us/library/live/hh826522.aspx#reading_albums the error when run code says: "error 1 'testrun.mainpage' not contain definition 'session' , no extension method 'session' accepting first argument of type 'testrun.mainpage' found (are missing using directive or assembly reference?) c:\users\me\desktop\project" am missing have run before click button? thing fails "this.session" parameter. barely learning livesdk i'm not sure if i'm missing reference or what. , :) my code: private async void button_login_click(object sender, routedeventargs e) { try { liveconnectclient liveclient = new liveconnectclient(this.session); liveoperationresult operationresult = await liveclient.getasync("path/to

Why is this PHP code showing up as regular text (html)? -

i've been staring @ hour , last resort hoping of guys might give me hand figuring out php code showing regular text in html file? appreciated. http://jsfiddle.net/yyh27/ <?php $name = $_post['name']; $email = $_post['email']; $message = $_post['message']; $from = 'from:'; $to = ''; $subject = 'hello'; $human = $_post['human']; $body = "from: $name\n e-mail: $email\n message:\n $message"; if ($_post['submit'] && $human == '4') { if (mail ($to, $subject, $body, $from)) { echo '<p>your message has been sent!</p>'; } else { echo '<p>something went wrong, go , try again!</p>'; } } else if ($_post['submit'] && $human != '4') { echo '<p>you answered anti-

html - css extend border to include image -

Image
this question has answer here: why content showing outside div? 4 answers i have html div id information . ideally, border extend bottom of image in div. <div id="information"> <img src="newtroot-256.png" id="newtroot256" style="float:left;"/> <span style="position:relative;left:10px;"> hi! name nicki. </span> </div> for html and div#information { color:burlywood; margin-left:2em; margin-right:2em; border:2px solid lime; border-radius:25px; background-color:rgba(85,107,47,0.75); padding:10px; background-opacity:0.5; } for css relevant parts. output is but want border include image. how css/html. not wish incude javascript, if it's soulution, i'll take it. because image floated, removed normal flow. make paren

javascript - Show/Hide cascading menu while hovering element -

i need show/hide cascading menu when user move mouse on element. quite easy achieve jquery, using hover function: n.b: timer used hide menu after 200ms, , not important. $(document).ready(function() { var timer; $('.element,.cascading_menu').hover(function(){ cleartimeout(timer); $('.cascading_menu').show(); }, function(){ timer = settimeout(function(){$('.cascading_menu').hide();},200); }); }); i have repeat code every menu want hide. since have lot of menus, reduce code length. my idea use array of " id of element hovering:id menu show/hide ". do think possible write jquery function that, given array of elements, provide show each menu, without having write code dozen of times? you can use this can use same code elements, depends on html code formatting. here example. $(document).ready(function() { $('.element').hover(function(){ $(this).find(".cascading_menu&qu

java - Extending the automatically generated JPA controller (Netbeans 7.x) -

netbeans 7.x offers possibility generate entities (pojos) existing relational database (ex: customerentity, orderentity, etc.) also, generates automatically controller each entity (ex: customerjpacontroller, orderjpacontroller, etc.). the generated controllers contains many ready-to-use methods (findall, create, delete, etc.). advantage using controllers' generator possibility recreate/update them once entity (or table) modified (adding new constraints, new fields, etc.). unlike "partial class" concept offered .net, not possible extend these controllers user-defined methods in separate classes. what suggest (in terms of best practices or design patterns) take advantage of these automatically generated controllers? i use generated controller classes in self-created dao classes.

c# - MS Dynamics CRM System.InvalidCastException -

i have strange problem, have tons of entities , have xrmschema.cs generated crmsvcutil in crm system worked me pretty good, while using queries , converting them entity objects in code. convertion method worked perfect entites except one, keep getting system.invalidcastexception: unable cast object of type 'microsoft.xrm.sdk.entity' error 1 entity. here's following code segment generates it, throws exception in tolist() method: public list<etel_productcharacteristic> retrievecharacteristic(guid characteristicid) { using (xrmdatacontext context = new xrmdatacontext(crmconnection.organizationservice)) { var query = characteristic in context.etel_productcharacteristicset characteristic.etel_productcharacteristicid == characteristicid && characteristic.statecode.value == etel_productcharacteristicstate.active select characteristic; re

How to find the same item in an array with Ruby -

i have array this. @arr = ["ac", "ba", "ca", "dd", "ac", "bd", "ca", "dd"] i want swap letter if first 1 capital. in case, ac becomes ca, ba -> ab etc. becomes this. @arr = ["ca", "ab", "ac", "dd", "ac", "bd", "ca", "dd"] then want find same item. in case there two, ca , dd. @newarr = ["ca", "dd"] thanks in advance. ==== this got far. @firstarr = @arr.map{|item| if item[0] =~ /[a-z]/ item = item[1]+item[0] else itme = item end } this gives @firstarr = ["ca", "ab", "ac", "dd", "ac", "bd", "ca", "dd"] for reversing criteria: foo = @arr.map |x| (x[0].downcase!).nil? ? x : x.reverse end # => ["ca", "ab", "ac", "d

c - Pointer of pointers starts to go wild after being freed -

i have function splits string multiple strings char. #include <stdlib.h> #include <stdio.h> #include "tokens.h" char isseparator(char character, char *seps) { int = 0; while(*(seps + i) != '\0') { if (*(seps + i) == character) { return 1; } ++i; } return 0; } int parse_tokens(char *str, char *seps, char ***tokens) { /* implemente aca la funcion parse_tokens */ char **foundtokens = (char **) malloc(10*sizeof(char*)); int = 0; int tokencount = 0; int tokenletter = 0; while(*(str + i) != '\0') { if (!isseparator(*(str + i), seps)) { if(*(foundtokens + tokencount) == null) { *(foundtokens + tokencount)= (char *) malloc(30*sizeof(char)); } *(*(foundtokens + tokencount) + tokenletter) = *(str + i); ++tokenletter; } else { // revisar si es que el slot de token ac