Posts

Showing posts from July, 2012

opengl - Focus on MouseOver in Windows with Ogre3D -

i have application using ogre3d create multiple render windows, , i'm using solution posted here support non-exclusive mouse input these windows. however, find have physically click on render window before regains focus, whereas i'd render windows gain focus on mouseover event. possible capture mouseover event on unfocused render window in ogre3d/ois , subsequently set focus render window? to support kind of functionality using ogre3d in windows, had implement singleton object kept collection of of instantiated displays. class inputprocessor { /// @name types /// @{ public: /// @} /// @name inputprocessor implementation /// @{ public: void adddisplay(display* _pdisplay); bool processmousemoved(int _x, int _y, int _z, int _keymodifier); bool processmousepressed(int _keymodifier, int _id); bool processmousereleased(int _keymodifier, int _id); static inputprocessor& getsingleton(); /// @} /// @name 'stru

XCode client with Java server -

i wonder if create objective-c client xcode , somehow make communicate java developed application, deployed in jboss application server. is can't deny best visual performance ipad comes xcode, got bunch of logic in jboss app. i think confusing xcode (an ide) objective c (a language). yes, can communicate between ios app , java server in many ways, easiest being via json based rest services.

PCI-E / Linux : How to capture TLP packet? -

is possible linux software capture tlp packet of pci-e? i want know debugging pci-e card. thanks i don't believe -- software viewpoint, pci-e quit disguised (fast) pci. as far know, reasonable way specialized hardware -- logic analyzer pci-e bus probe. i've used agilent analyzer futureplus probe , , can recommend combination couple reservations: first, it's not cheap. second, can bit of jump accustomed purely software.

windows - Get currently logged in user asp.net -

i´m having bit of trouble , see if me out! for webapp in asp.net, need able user name. i had been able through: user = principal.windowsidentity.getcurrent.name.tostring on developement machine, when go production, shows asp.net user... i tried user = context.user.identity.name.tostring and in dev station blank string, , in production, "apppool/asp.net4.0 any ideas how working? this webapp supposed work in intranet. make sure you've enabled windows authentication in web.config (check .config.xxx transforms too). should see tag in web.config: <system.web> ... <authentication mode="windows" /> ... </system.web>

javascript - How to get the selected checkbox value? -

i trying selected checkboxes value , hidden field value next when user submits form. <form....> <td><input type='checkbox' name='checkbox' value='1' ></input></td> <input type='hidden' name='sid1' value='1'/> <td><input type='checkbox' name='checkbox' value='1' ></input></td> <input type='hidden' name='sid2' value='2'/> <td><input type='checkbox' name='checkbox' value='1' ></input></td> <input type='hidden' name='sid3' value='3'/> i try: $(document).ready(function(){ if( $("input[name='checkbox']['checked']")) { $("input[name='checkbox']['checked']").each(function(){ var test=$(this).val(); alert(test); }) } }) but gives me checkbox

How do I import/add an existing Python file to a PyCharm project? -

how import/add existing python file pycharm project? copy files directory under project root using favorite file manager or add directory containing files project using settings ( preferences on mac) | project structure | add content root .

c# - Create an instance of an unknown type of object and TryUpdateModel -

i'm using mvc , have controller action handles several different view models, each view model has validation , i'd controller check validation. this controller action: [acceptverbs(httpverbs.post)] public actionresult wizardcaseresult(formcollection fc) { viewa vm = new viewa(); tryupdatemodel<viewa>(vm); } how change code type of view model can set dynamically this: [acceptverbs(httpverbs.post)] public actionresult wizardcaseresult(formcollection fc, string viewtype) { viewtype vm = new viewtype(); tryupdatemodel<viewtype>(vm); } i have many different view models different action each type out of question. you need write custom model binder work: public class mymodelbinder : defaultmodelbinder { protected override object createmodel(controllercontext controllercontext, modelbindingcontext bindingcontext, type modeltype) { var typevalue = bindingcontext.valueprovider.getvalue("viewtype"); va

Android Facebook SSO Login failed -

i'm trying use facebook sso on android app. got hash key keytool , saved on facebook app setting developers. then, succeeded sso login. however, deleted app on facebook app setting users. then, failed sso login. below logcat info. the issue not work after deleting app on user app setting. in advance. 03-08 03:46:49.074: d/facebook-authorize(23658): login failed: invalid_key:android key mismatch. key "pu3yrmsnag22uvh1x5cizkxxwci" not match allowed keys specified in application settings. check application settings @ http://www.facebook.com/developers add key in logs list of hash keys on facebook developer app account.

javascript - jquery table dynamic cell filtering and repositioning -

i have table displays names , each row contains 3 cells. i filter names , using jquery it. it works: 1) cells not match hidden script 2) cells match displayed script 3) cells match realigned horizontally, displayed left right continuously.. good the last thing trying achieve redistribuite matching cells 1 after other, no matter row located before filtering them! so if row contains 1 match , row below contains 0 matches , row after contains 2 matches, want 3 matches shown in same row! for example if go here: http://jsfiddle.net/ycr73/1/ and type "a" in search field, 2 results. won't them in same row, after filtering cell "fffaaa" near "aaafff", not below it! i don't know there's particularly reasonable way tables/table cells. able splice quick jsfiddle replacing table set-width div , table-cells floated div s. way hiding other 'cells' automatically re-aligns 'rows'.

design patterns - The Tell, don't ask principle - should I apply it here? -

lets have sort of graphical animation code have 2 classes: sprite , spriteanimator. spriteanimator responsible moving sprites @ regular intervals. sprite has property can lock movement though. i first implemented use case this: public class sprite { public bool locked; public void moveto(int x, int y){} } public class spriteanimator { private list<sprite> sprites; public void domovement() { foreach (sprite sprite in sprites) { if (!sprite.locked) moveto(newx, newy); } } } ...but remembered tell-don't ask principle , , feel i'm asking state, making decision , tell them - principle forbids me. recode this: public class sprite { private bool locked; public void moveifnotlockedto(int x, int y) { ... } } public class spriteanimator { private list<sprite> sprites; public void domovement() { foreach (sprite sprite in sprites) { moveifnotlo

android - How to send a Parcelable object to a DialogFragment? -

i'm able send data activity1 activity2 typical.. intent intent = new intent(activity1.this, activity2.class); intent.putextra("state", getintent().getparcelableextra("state")); intent.putextra("schools", temp); startactivity(intent); and works fine once i'm @ activity2 , issue how make work activity1 dialogfragment ? how send parcelable objects , retrieve them once i'm coding dialogfragment ? example available out there can point me at? i think this can help. using setarguments() , later getarguments() in dialog's oncreate() .

scala - Strange type mismatch when using member access instead of extractor -

given tuple elements of type a , type parametrised in a : trait writer[-a] { def write(a: a): unit } case class write[a](value: a, writer: writer[a]) and use site: trait cache { def store[a](value: a, writer: writer[a]): unit } why following work expected, using tuple's extractor: def test1(set: set[write[_]], cache: cache): unit = set.foreach { case write(value, writer) => cache.store(value, writer) } but following fails: def test2(set: set[write[_]], cache: cache ): unit = set.foreach { write => cache.store(write.value, write.writer) } with error message found : writer[_$1] type _$1 required: writer[any] cache.store(write.value, write.writer) ^ can fix second form ( test2 ) compile properly? edit departing ideas owen tried out if can make work without pattern matching @ (which wanted in first place). here 2 more strange cases, 1 working, other not: // not work def test3(s

flash - Actionscript 3.0: In what ways can the Kernel interact with objects in my application? -

im learning flash actionscript @ local college , have been asked find out 3 ways how kernel interact application when creating actionscript project. ive done research , looked through page after page online cant seem find easy understand answers build knowledge on. could help? edit: sorry question rather vague. kernel class being linked swf. weve been asked find out how kernel can effect , interact application. this class thats been created: public class kernel extends movieclip { public function kernel() { var ball1 = new myball(); // creates instance of ball addeventlistener(event.enter_frame, update); addchild(ball1); // adds instance stage } private function update(e:event) { ball1.update() } } if you're talking pixel bender kernel, i'm not quite sure there 3 ways these kernels can interact application. however, there 2 different ways can used sur

java - android parsing json from URL -

this line in oncreate function jsonobject cat = getjsonfromurl("http://localhost/2010/hkinterview/index.php?op=androidcat"); the following code method found on web parsing json data url public static jsonobject getjsonfromurl(string url){ //initialize inputstream = null; string result = ""; jsonobject jarray = null; //http post try { httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(url); httpresponse response = httpclient.execute(httppost); httpentity entity = response.getentity(); = entity.getcontent(); } catch (exception e) { log.e("log_tag", "error in http connection "+e.tostring()); } //convert response string try { bufferedreader reader = new bufferedreader(new inputstreamreader(is,"iso-8859-1"),8); stringbuilder sb = new stringbuilder(); s

Handling CDATA escaped XML in Freemarker -

i'm using freemarker in project transform 1 xml document another. due crappy design or choice of canonical message format our supplier has chosen embed xml in cdata escaped fields, chosen message standard not handle types of extensions. whatever reason need dig field , xpath queries. say ie: <invoice> .. <note><![cdata[<?xml version="1.0" encoding="utf-8"?><a><b>value</b></a>]]></note> </invoice> anyone has idea how value "a/b/text()" in kind of scenario? i've thought trying clean cdata section manually , parse xml, hopes freemarker me. freemarker doesn't parse xml, calls usual api-s that, freemarker can't here. have load xml file string ( char[] or whatever), remove cdata "tags", parse resulting string dom tree javax.xml.parsers.documentbuilder , , pass freemarker. want call nodemode.simplify(thedomtree) before however.

c# - Emit Mapper Flattering and property name mismatch -

how map user class usermodel class using emit mapper? public class user { public guid id { get; set; } public string firstname { get; set; } public string lastname { get; set; } public ilist<role> roles { get; set; } public company company { get; set; } } public class usermodel { public guid id { get; set; } public guid companyid { get; set; } public string firstname { get; set; } public string lastname { get; set; } public ilist<rolemodel> roles { get; set; } } there several problems: i need flatten object such have companyid instead of company object. company object has property id, in usermodel have companyid corresponds company id, property names not match. i need map list<role> list<rolemodel> to flattened model check this example . seems default has convention of having sub class property name prefix in target.

objective c - Customize right click highlight on view-based NSTableView -

Image
i have view-based nstableview custom nstablecellview , custom nstablerowview. customized both of classes because want change appearance of each row. implementing [nstablerowview draw...] methods can change background, selection, separator , drag destination highlight. my question is: how can change highlight appears when row right clicked , menu appears? for example, norm: and want change square highlight round one, this: i'd imagine done in nstablerowview calling method drawmenuhighlightinrect: or something, can't find it. also, how can nstablerowview class doing if customized, in subclass, of drawing methods, , don't call superclass? drawn table itself? edit: after more experimenting found out round highlight can achieved setting tableview source list. nonetheless, want know how customize if possible. i'd take @ nstablerowview documentation . it's class responsible drawing selection , drag feedback in view-based nstableview .

SAS: column position rearrangement -

i rearange variable column poistion depending on ft value: example. if ft =1, put o2 , o5 @33 , 34. if ft=2, put o2 , o5 @35 , 36 , on... think got loop , array incorrect below. can point out did wrong? data fttry1; input ft m1 o2 m3 m4 o5; datalines; 1 2 3 4 5 6 2 7 8 9 10 11 3 12 13 14 15 20 4 16 17 18 19 21 ; run; data fttry2; set fttry1; file print notitles; put @10 ft @30 m1 @31 m3-m4; ft =1 4; array ftposition[2] o2 o5; i=1 2; l=33 34 2; put @l ftposition[i]; end; end; end; run; does work? data fttry1; input ft m1 o2 m3 m4 o5; datalines; 1 2 3 4 5 6 2 7 8 9 10 11 3 12 13 14 15 20 4 16 17 18 19 21 ; run; data fttry2; set fttry1; file print notitles; cnt + 1; put @10 ft @30 m1 @31 m3-m4 @; o2_loc=(ft+cnt) + 32; o5_loc=(ft+cnt) + 33; put @o2_loc o2 @; put @o5_loc o5 ; run; edit this link indicates trailing @ sign prevent newline after put statement.

php - How to give somebody a link to something that nobody else can have? -

usually when send link someones social profile ask create account see it. didn't want that, rather wanted give them link not indexed search engines , rather complicated guess person can see content on link, thinking like: www.domain.com/user/content/private/secured/90989834093/testcontent.php how achieve securely? instead of doing that, can generate one-off random access token , use in querystring. token stored in database know if has been accessed or not. when page hit, token checked against database, , if still active content served. as truth has commented below, work in conjunction session or cookie continue serve authenticated user page after access token has been used.

wpf - How do I break a large XAML file into sub-XAML files and maintain communication between the parent and child objects? -

i'm new wpf. i'm attempting modify project visualstudiolikepanes book wpf 4 unleashed. because panes hidden default until run project, decided nice place pane i'm working on separate xaml file can see changes make pane without needing launch executable. so, based on posts read here on stackoverflow few days ago, added new usercontrol sample project , plopped content of pane in question that. here usercontrol attributes in 'child' xaml file: <usercontrol x:class="sample.settingspanel" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:ignorable="d"> to include control parent, added xmlns:sp namespace 'parent' xaml file: <window

How can I compare a "MM/DD/YYYY" date with the Date() function in Javascript? -

how can compare date input of format "mm/dd/yyyy" date() function in javascript? for example: if (inputdate < todaysdate){ alert("you entered past date") } else if (inputdate > todaysdate){ alert("you entered future date") } else if (inputdate = todaysdate){ alert("you entered present date") } else{ alert("please enter date") } convert string date using new date(datestring) . normalize today's date omit time information using today.sethours(0, 0, 0, 0) . can compare dates have above: var date = new date(dateinput); if (isnan(date)) { alert("please enter date"); } else { var today = new date(); today.sethours(0, 0, 0, 0); date.sethours(0, 0, 0, 0); var datetense = "present"; if (date < today) { datetense = "past"; } else if (date > today) { datetense = "future"; } alert("you entered " + d

php - Link with GET parameter -

in link can append parameters. if want add new parameter url has one. example: old: example.php?hi=hello new: example.php?hi=hello&hello=hi is there other way of doing way: echo '<a href="'. $_server['request_uri'].'&hello=hi">'; the caveat detecting whether or not question mark exists or not. if doesn't, you'll need add it. quick , dirty way strpos : if (strpos($_server['request_uri'], '?') === false) { $qspart = '?'; } else { $qspart = '&'; } $oldurl = $_server['request_uri']; echo '<a href="' . $oldurl . $qspart . 'hello=hi">'; a more robust method breaking down request_uri , rebuilding after inspection using parse_url , http_build_query may beyond scope.

Drupal 7 step by step tutorial for the begineers -

am beginner of learning drupal.what best step-by-step tutorial druapal 7.x? how can create custom modules , how can create custom themes. need examples learn drupal myself. 1.need several examples dynamic web form,changing themes, customize navigation menus etc. please me out thanks there bit of learning curve drupal, because online information fragmented (and still refers drupal 6). however here quick tips learning how "drupal 7". install fresh drupal 7 download. install basic theme "sites/all/themes/basic" , read readme.txt file. look @ templates folder , .php files inside. html scaffolding drupal pages. custom templates can applied duplicating template file , adding new naming convention (page--front.tpl.php example). learn drupal blocks blocks how page constructed. read this guide modules, teaches basics. move on there @ own pace. drupal has such large amount of learning do, should started.

Chrome JavaScript developer console: Is it possible to call console.log() without a newline? -

i'd use console.log() log messages without appending new line after each call console.log(). possible? no, it's not possible. you'll have keep string , concatenate if want in 1 line, or put output elsewhere (say, window).

playframework 2.0 - Secure reverse routing -

what's equivalent of @{admin.login().secure()} in play 2.0 ? for reference, if route file was get /login admin.login admin.login().secure() return https://myserver/login note https routes.admin.login().absoluteurl(secure = true)

differential equations - 2nd order ODE undetermined coefficients -

is equation solvable? , how? y" = ay + b a , b (real) constants. tried doing undetermined coefficients didn't work out me. homogeneous part easy enough. thanks. you can start assuming solution has form y(x) = m*exp(sqrt(a)*x) + n*exp(-sqrt(a)*x) + c since exponential parts solution homogeneous equation. now can substitute our differential equation , try solve c. y" = m*a*exp(sqrt(a)*x) + n*a*exp(-sqrt(a)*x) m*a*exp(sqrt(a)*x) + n*a*exp(-sqrt(a)*x) = a*(m*exp(sqrt(a)*x) + n*exp(-sqrt(a)*x) + c) + b 0 = a*c + b c = -b/a. therefore: y = m*exp(sqrt(a)*x) + n*exp(-sqrt(a)*x) - b/a. this example worked because it's constant being added our equation, other inhomogeneous differential equations can still solved using green's function , once have solution corresponding homogeneous equation.

caching - how to use php stream to block DWOO compile the cache files everytime? -

i code thread talking blocking dwoo using php streams can't understand how use code. can tell me how use it? recent problem: i've got serious problem storage on web hosting because of lot of cache files created on @ cache/dwoo/compiled folder. developed website using codeigniter framework. want disable feature (auto created cache files @ cache/dwoo/compiled folder), because using lot of space on storage. this code: include 'lib/dwooautoload.php'; include 'dwoo/compiler.php'; $dwoo = new dwoo(); stream_wrapper_register('dwoomem', 'dwoo_template_memory_streamwrapper'); $dwoo->addresource('memory', 'dwoo_template_memory'); $tpl = new dwoo_template_memory('test.html'); $dwoo->output($tpl, array('foo'=>'foo', 'bar'=>'bar')); class dwoo_template_memory extends dwoo_template_file { protected $chmod = null; public function getcompiledfilename(dwoo $dwoo) {

Trivial Chrome pageAction extension not working -

i'm trying write trivial chrome pageaction extension change anchors on page 1 domain another... can't quite seem work, , i'm having trouble debugging it. am misunderstanding how kind of extension needs built? or misusing api? manifest.json : { "name": "theirs2ours", "version": "1.0", "description": "changes 'their' urls 'our' urls.", "background_page": "background.html", "permissions": [ "tabs" ], "page_action": { "default_icon": "cookie.png", "default_title": "theirs2ours" }, "content_scripts": [ { "matches": ["http://*/*"], "js": ["content.js"] } ] } background.html : <html> <head> <script type='text/javascript'> chrome.tabs.onselectionchanged.addlistener(function(tabi

java - Error while building project in Netbeans -

i transferring project source 1 pc another. when click clean , build main project run menu of netbeans, got error: init: deps-clean: updating property file: e:\backup\my documents (backup)\netbeansprojects\accountstatuschanger\build\built-clean.properties deleting directory e:\backup\my documents (backup)\netbeansprojects\accountstatuschanger\build clean: init: deps-jar: created dir: e:\backup\my documents (backup)\netbeansprojects\accountstatuschanger\build updating property file: e:\backup\my documents (backup)\netbeansprojects\accountstatuschanger\build\built-jar.properties created dir: e:\backup\my documents (backup)\netbeansprojects\accountstatuschanger\build\classes created dir: e:\backup\my documents (backup)\netbeansprojects\accountstatuschanger\build\empty created dir: e:\backup\my documents (backup)\netbeansprojects\accountstatuschanger\build\generated-sources\ap-source-output compiling 2 source files e:\backup\my documents (backup)\netbeansprojects\accountstatuschang

perl - Bugzilla Extension: Modifying "Assigned To" field using set_assigned_to in bug_end_update -

i trying modify assigned field on bug (to reporter) when status set resolved. current code looks this: sub bug_end_of_update { ($self, $args) = @_; $bug = $args->{ 'bug' }; $changes = $args->{ 'changes' }; # check if status has changed if ( $changes->{ 'bug_status' } ) { ($old_status, $new_status) = @{ $changes->{ 'bug_status' } }; # check if bug status has been set resolved if ( $new_status eq "resolved" ) { # change assignee original reporter of bug. $bug->set_assigned_to( <reporter obj> ); # add changes tracking $changes->{ 'assigned_to' } = [ <assigned obj>, <reporter obj> ]; } } } i looking 2 things: 1) in bug_end_of_update how reporter user object , assigned user object? 2) changes array looking user objects or login info? thanks! this work: sub bug_end_o

Java Methods determine how many times to output char based off of paramaters -

i've done searching , cannot determine how looking do. i have method rounding numbers takes paramaters numbertoround , decimalplaces right hardcoded round 4 decimal places need dynamic. if called round(3.1415926536, 3) round 3 decimal places rather 4 cannot figure out how java take 3 , understand want 000 printed or handled anyways. any ideas on how this? below sample code have typed hard coded 4 places since nothing trying compile right public class round { public static void main(string[] args) { system.out.println("pi rounded 3 places " + roundpi(3.1415926536, 3)); } public static double roundpi(double numbertoround, int decimalplaces) { numbertoround= (double)math.round(numbertoround*10000)/10000; return numbertoround; } } current output pi rounded 3 places 3.1416 i considered doing math function of kind 10*100 1000 round 3 if need 4 or 5 decimal places or 2 still need figure out how figure out needs multiply without har

Unable to put a Boost Thread asleep -

os: win7 ide: visual studio 2010 boost version: 1.47 i'm new boost , i'm trying simple. i've created single thread in header file , tried putting sleep. can't working. here code , compilation errors main.h - #pragma once #include <conio.h> #include <boost\thread.hpp> boost::posix_time::seconds worktime ( 120 ); boost::this_thread::sleep ( worktime ); main.cpp #include "main.h" void main ( void ) { _getch(); }; output - error c4430: missing type specifier - int assumed. note: c++ not support default-int error c2365: 'boost::this_thread::sleep' : redefinition; previous definition 'function' error c2491: 'boost::this_thread::sleep' : definition of dllimport data not allowed error c2482: 'boost::this_thread::sleep' : dynamic initialization of 'thread' data not allowed using following code now, in main.cpp: #include <boost\thread.hpp> #include <conio.h>

Custom php code in joomla component , pages -

how can use php code in joomla.like available component , plugin , module. you can use jumi, it's plugin/component/module allows precisely that. link: http://extensions.joomla.org/extensions/edition/custom-code-in-content/1023

objective c - Is there a simpler way to capture bytes from an iOS device's camera? -

i'm working on image processing using opencv in ios 5.1. have libraries detect markers , other stuff. what need take each frame of video camera process further using opencv. have found sample code, example @ https://developer.apple.com/library/ios/#qa/qa1702/_index.html , seems unnecessaryily difficult. mean, need write 500 lines of code capture frame , push view? can please give me hint start? //update simplest captureoutput:didoutputsamplebuffer:fromconnection: method i've been able code. - (void)captureoutput:(avcaptureoutput *)captureoutput didoutputsamplebuffer:(cmsamplebufferref)samplebuffer fromconnection:(avcaptureconnection *)connection { @autoreleasepool { cvimagebufferref imagebuffer = cmsamplebuffergetimagebuffer(samplebuffer); cvpixelbufferlockbaseaddress(imagebuffer, 0); uint8_t *baseaddress = (uint8_t *)cvpixelbuffergetbaseaddress(imagebuffer); cgrect videorect = cgrectmake(0.0f, 0.0f, cvpixelbuffergetwidth(imagebuffer

twig - Symfony2: How to set the root path in a Symfony CLI command -

edit: cut short: there way call $kernel->getrootdir(); within twig extension? or maybe di container? original question: i try scale images on server using imagine. works fine log don't try trigger rendering via command line: in case looks there wrong path set- i'm getting error: [twig_error_runtime] an exception has been thrown during rendering of template ("file ../web/documents/4f59ef3f76e74_test3.jpg doesn't exist") in "....:detail.html.twig" @ line 72. i'm using twig tag wrote myself: public function thumbnail($path,$width,$maxheight=0,$alt="",$absolute=false){ /* @var $imagine \imagine\gd\imagine */ $imagine = $this->container->get('imagine'); //$box = new \imagine\image\box($width, $height); /* @var $image \imagine\image\imageinterface */ $image = $imagine->op

html5 - Blend-created HTML/CSS running in browser? -

has had luck using blend visual studio 2011 beta create webpages? i'm designer coming using blend create xaml-based uis , freaking out there might not brilliant wysiwyg editor blend web out there :p -hoping- design things in blend , hand off developer code-behind in whatever hell use. blend create lot of ie10/windows 8 specific stuff in markup/styling or pretty standard stuff generates? cheers, nick html authoring in blend focused on creating metrostyle apps windows 8 in html , css, not on apps run in browsers. underlying windows html / css / javascript platform is, of course, standards-compliant, , therefore blend edits , generates standards-based html , css. here few points of interest: • blend design surface uses same renderer used windows 8 apps @ runtime (i.e., ie10). windows app runtime may render things differently other browsers do, different browser implementations have differences. it’s still standard html , css, wysiwyg editing based on windows 8 app run

ruby on rails - No log messages in production.log -

i wrote demo helloworld rails app , tested webrick (it doesn't use db, it's controller prints "hello world"). tried deploy local apache powered passenger. in fact test passenger working (it's first deploy on apache). i'm not sure passenger works, don't error on apache side. when fire http://rails.test/ browser shows rails 500 error page - assume passenger works. i want investigate logs, happens production.log empty! don't think it's permission problem, because if delete file, recreated when reload page. tried change log level in conf/environments/production.rb , tried manually write log file rails console production and rails.logger.error('asdf') it returns true nothing gets written production.log. path (obtained per rails.logger.inspect) correct, , remark file recreated if manually remove it. how can know what's going on? (i checked apache logs, plus set highest debug level passenger seems rails problem, not logged serv

php - CodeIgniter uri's - how to get multiple values? -

i using form submit filter parameters view. there multiple filters can selected, , filters multi-selects. however, prefer use post-redirect-view method, means have translate post data uri segments. with in mind, going use $this->uri->uri_to_assoc(n) method. however, not sure how working if of parameters can have multiple values. the method can think of join values each key unique character (say ‘—’), use $ this->uri->uri_to_assoc(n) parse each key-value pair, , explode() each of values (on ‘—’) again. best way it? in addition, how on issue 1 of values may have forward slash (’/’) in name? example: i have multi-select (named categories[]) posted , used filter parameters. user select 2 values multiselect: 'jim/bob' , 'sarah'. controller receives post, $this->input->post('categories') gives me array. want redirect same controller , use values $this->input->post('categories') parameters in uri. /controller/method/c

c# - Altering PDF through iTextSharp to Replace some existing text with a new text -

please tell me if there function in itextsharp dose replace(”xx”,”yy”) function in pdf file without altering remaining parts of file. short answer: no cannot itext. longer answer: pdf display format, when pdf rendered many decisions made page , character layout , positioning. chapter 6 of itext in action has great description in introduction of why not trivial task. can read chapter 6 free publisher's website .

Subclipse (1.8.5) requires cleanup / refresh cycle to detect changes made with TortoiseSVN (1.7.4) -

my problem: subclipse not update locked status overlay icons in eclipse after lock/unlock files tortoisesvn in windows explorer (and vice versa). is expected behaviour or missing setting? the files have svn property "svn:needs-lock" set. i can sync subclipse again first clicking "team - refresh/cleanup" , "refresh f5". i not 100% sure think subclipse 1.6.x , tortoisesvn 1.6.x able hit f5 in eclipse, , status refreshed correctly. thank time. i not think should have second f5, added team > refresh/cleanup option reason. with pre-svn 1.7.x releases change in working copy caused files in of hidden .svn folders modified. when hit f5 in eclipse, see these changed files , fire off notifications subclipse see , use refresh decorations. with svn 1.7, information consolidated in single location, , sounds not live inside eclipse project folder. f5 in eclipse nothing because no files on filesystem eclipse can see has been modified. ec

I want to output the unique item from specific c++ array -

i have created function count duplicate items in array . , fine . want output unique items , , problem . my function: void repeatedcounter(int n){ int i, j, temp, count= 0; int *numbers = new int[n]; for(i=0;i<n;i++){ cout << "enter number (" << i+1 << "): "; cin >> *(numbers+i); } cout << "---------------------\n"; for(i=0;i<n;i++){ temp = *(numbers+i); for(j=0;j<n;j++){ if(temp == *(numbers+j)){ ++count; } } if(*(numbers+i+1) != temp) cout << *(numbers+i) << "= " << count << endl; count= 0; } delete []numbers; } main function: int num_of_digits= 0; cout << "how many numbers: "; cin >> num_of_digits; repeatedcounter(num_of_digits); example: inputs 1 5 3 5 1 wrong result (current output)

Is there a way to launch custom application in fullscreen mode on android? -

basically i'm developing sort of restricted launcher. able open example native android date time settings android application in fullscreen mode(so notification bar not visible). if own activity - no problem - either xml or requestwindowfeature. but how if i'm launching intent? : startactivity(new intent(settings.action_date_settings)); any way pass in kind of flags? one way of doing use activitygroup : localactivitymanager mgr = getlocalactivitymanager(); intent = new intent(settings.action_date_settings); window w = mgr.startactivity("unique_per_activity_string", i); view wd = w != null ? w.getdecorview() : null; setcontentview(wd); this works fine, want mess android native settings, must have android.permission.write_secure_settings able save settings. , cannot acquire permission unless app runs system. any ideas?

iPhone : load local html in uiwebview via javascript -

it's little bit confusing know let's try. have uiwebview in iphone app , it's loaded html local file bundel .. want put html button in file can load local file using javascript ... possible?? there other approach .. any appreciated you can custom protocol bridge between web page , app following : in html page , may add following a tag example : <a href='tothepage2'>click here</a> and in app you'll handle event following code : webview.delegate = self; - (bool)webview:(uiwebview*)webview shouldstartloadwithrequest:(nsurlrequest*)request navigationtype:(uiwebviewnavigationtype)navigationtype { nsurl *url = request.url; nsstring *urlstring = url.absolutestring; if([urlstring isequaltostring:@"tothepage2"]) { [webview loadrequest:[nsurlrequest requestwithurl:[nsurl fileurlwithpath:[[nsbundle mainbundle] pathforresource:@"thenexthtmlpage" oftype:@"html"]isdirectory:no]]]; return no; } return yes; }

java - Checking the size of an Image with GWT -

i have gwt application generates svg files. i want embed image url svg, want resized keeping correct aspect ratio. i loading image using image class in gwt, , check height width, sums find height , width need in svg. i embed image svg follows: <image href="http://some.image/url.png" height="100" x="50" width="150" y="50"></image> the issue have when following: image image = new image(sourceurl); int width = image.getwidth(); int height = image.getheight(); .... the first time particular url value of width or height comes 0. unfortunately retrying in loop doesn't seem fix problem, if ask application generate svg again, works. any ideas? ok, sorry not answer, comments small put code. i tried following , worked perfectly. should try isolate issue in smaller piece of code: @override public void onmoduleload() { final image image = new image("https://www.google.com/images/srp

c++ - Function to check if string contains a number -

i'm working on project in c++ (which started learning) , can't understand why function not working. i'm attempting write "person" class variable first_name, , use function set_first_name set name. set_first_name needs call function(the 1 below) check if name has numbers in it. function returns false, , i'm wondering why? also, best way check numbers, or there better way? bool person::contains_number(std::string c){ // checks if string contains number if (c.find('0') == std::string::npos || c.find('1') == std::string::npos || c.find('2') == std::string::npos || c.find('3') == std::string::npos || c.find('4') == std::string::npos || c.find('5') == std::string::npos || c.find('6') == std::string::npos || c.find('7') == std::string::npos || c.find('8') == std::string::npos || c.find('9') == std::string::npos){// checks if contains number return

android - ContentProvider vs. using AIDL/Messenger -

i want develop application supports plugins , provides data these plugins. seems me correct way implement plugin-archtitecture on android 1 apk main app , 1 apk per plugin. but main app , every plugin in different apks can't pass (data) objects 1 other, applications run in different processes , if run in 1 process (which can achieved) have different classloaders , doesn't work. see 2 promising approaches getting data main app plugins: declaring main app contentprovider . seems me intended approach because want achieve: providing content/data process. making data objects parcelable , pushing them around aidl or - if not need multithreading - messenger -approach. in opinion, approach seems easier because can use orm-library cares database in background. never used contentproviders before @ first @ thought using contentprovider bit building sql-queries hand (please tell me if i'm wrong), , avoid work! now know if missed pros or cons , if there notable performanc

python - What graph should represent a dataset with 2 variables? -

say have following data: car_type, #rentals, amount class_1 350 $0.7m class_2 220 $1.3m class_3 55 $0.4m what graph use in order present data? 1 option pie-chart can see data, charts totally different --depends on emphasis: numer of rentals or amount. q: in general, having 2 variables 1 type should preferred graph. *i'm trying achieve in matlab (or python) concept more important actual implementation. many thanks! for 2 variables (x, y) associated each type (point) use scatter plot. prefer scatter plot if there lot of points (say 100). x-axis represent #rentals, y-axis represent amount, , intersections represent car types.

Android app getting data from a third-party JSP & Servlet -

i'm writing android app should data web application. web app based on servlets , jsp, , it's not mine; it's public library's service. elegant way of getting data? i tried writing own servlet handle requests , responses, can't work. servlet forwarding cannot done, due different contexts, , redirection doesn't work either, since it's post method... mean, sure, can write own form access library's servlet enough, result jsp page.. can turn page string or something? somehow don't think can.. i'm stuck. can in other way? php or whatever? or maybe jsp page on web server, , somehow extract data (with jquery maybe?) , send android? really don't want display jsp page in browser users, take data , create own objects it.. just send http request programmatically. can use android's builtin httpclient api this. or, bit more low level, java's java.net.urlconnection (see using java.net.urlconnection fire , handle http requests ). b

No cout printing in pthread starting function -

i'm new here , noob pthread programming. problem in c++ class, i'm trying create encapsulate thread. reading around i'd seen when create pthread, need pass c function pthread_create runs on startup... so, when pthread runs function doesn't cout message on stdout! but it's better if see code: (obviously it's copy , pasted internet tutorial ^^) void *runatstart( void *threadid) { long tid; tid = (long)threadid; printf("hello world! it's me, thread #%ld!\n", tid); pthread_exit(null); } thread::thread() { pthread_t threads[1]; int rc; long t; for(t=0; t<1; t++){ printf("in main: creating thread %ld\n", t); rc = pthread_create(&threads[t], null, runatstart, (void *)t); if (rc){ printf("error; return code pthread_create() %d\n", rc); // exit(-1); } } } in main call as: int main() { thread *th=new thread(); return 0; } the output gene

math - Finding Multiplier Matrix -

i trying find unknown matrix multiply matrix knowing matrix a*c=b where b defined vector, defined matrix 8x8, c unknown vector. i know, can not divide matrix solution situation ?? this system of simultaneous linear equations . can solve using gaussian elimination . as matrix "division", have in mind inverse matrix , i.e. matrix a -1 such that aa -1 =a -1 a=i where identity matrix . if invertible a*c=b equivalent c=a -1 b.

rails 3: using ID from many-to-many table to do another query -

i have table contacts, table events, , joining table contact_id , event_id map many-to-many relationship. i'm new ror , i'm used querying first table, building set of ids , running query on second table id in setofids. how done in ror well? here's have far: def view @contact = contact.find(params[:contact_id]) @contactevents = contacts_event.where(:contact_id => params[:contact_id]) s1 = set.new @contactevents.each |contactevent| s1.add(contactevent.event_id) end @contactevents_test = event.where(:id => @s1) end well 1 way looking @ has_and_belongs_to_many association (guide here) . idea when @contact = contact.find(params[:contact_id]) automatically pull of associated contacts_events 1 query.

c# - backgroundWorker and progressChanged not working -

i cant progress bar work! if execute following code bar remains empty if code gets executed reportprogress doesnt seem update anything..: namespace gpuz_2 { public partial class form1 : form { public form1() { initializecomponent(); gpuzdata test = new gpuzdata { }; //invio l'oggetto al thread backgroundworker backgroundworker1.runworkerasync(test); } private void backgroundworker1_dowork(object sender, doworkeventargs e) { // // e.argument contains whatever sent background worker // in runworkerasync. can cast original type. // gpuzdata argumenttest = e.argument gpuzdata; argumenttest.onevalue = 6; thread.sleep(2000); backgroundworker1.reportprogress(50); argumenttest.twovalue = 3; thread.sleep(2000); backgroundworker1.reportprogress(100); // // now, return values generated in method. //

jsf 2 - How do I combine JSF Ajax with Bookmark-able views? -

i have p:datatable , number of controls change content such page number, sort, , filter parameters. controls invoke ajax interaction each change invokes sql query end, updates table in client browser. that's way supposed be, right? what can't figure out best practice making view bookmark-able. easy enough bookmark parameters backing bean such as: <f:metadata> <f:viewparam name="orderno" value="#{bean.orderno}" /> <f:viewparam name="sortorder" value="#{bean.sortorder}" /> <f:viewparam name="showopenitems" value="#{bean.showopenitems}" /> <f:viewparam name="page" value="#{bean.page}" /> <f:viewparam name="pagesize" vlaue="#{bean.pagesize}" /> </f:metadata> so add radiobutton control change sortorder. might this: <p:selectoneradio value=

How to judge html's custom attribute has the one property in jquery -

i have define custom attribute called "data-children",use as: <div data-children=“test01 test02 test03”></div> but how can judge property has "test04": var $collection=$('div').attr('data-children') ……//then can do? since returns string, can use match method of string object. suggest using data method, though, if possible. if ($('div').data('children').match(/(^|\s+)test04(\s+|$)/)) { }

checkout - How can I skip the steps 2,3,4 in check out with opencart 1.5.1.3 -

when checking out in opencart 1.5.1.3, customers have go step 1 through 6 1 one: checkout options account & billing details delivery details delivery method payment method confirm order how can make payment simpler jumping straight step 1 step 5? don't need step 2,3,4! you can't remove of steps. opencart requires have data add order table, , such need it. it's used in payment gateways, , pretty integral whole of oc's system. in short, can't

javascript - save result to txt file on company shared folder -

Image
this problem cant save results driver x company shared folder , have permission write reason , can save on driver c. the messege show webpage error details message: automation server can't create object line: 93 char: 1 code: 0 uri: file:///x:/omrildocs/omrix%20public/all%20omrix%20public/training/index.html notic : can use javascript , no server side language allowd :( this code use alert(answertext); var fso = new activexobject("scripting.filesystemobject"); var s = fso.createtextfile("x:\omrildocs\omrix public\all omrix public\training\text.txt", true); s.writeline(answertext); s.close(); im using ie8 on xp 2 you need replace \ \\ . should like:- var s = fso.createtextfile("x:\\omrildocs\\omrix public\\all omrix public\\training\\text.txt", true); while running, gives popup window need allow create file. screenshot like:-

Attaching an drawable image to email in android -

i have list of drawable images in application , want send 1 of images through mail. code looks like intent sendintent = new intent(intent.action_send); sendintent.settype("image/*"); sendintent.putextra(intent.extra_subject, "picture"); sendintent.putextra(intent.extra_stream, uri.parse(lstphotos.get(newposition).getphotourl())); myactivity.startactivity(intent.createchooser(sendintent, "email:")); but in above code have problem since cannot image uri list of drawables. can me how send image because if use above code getting empty image of 0kb sent. you can saving image temporary location on internal/external cache directory image , use image's path in attachment using uri .