Tuesday 15 June 2010

angularjs - CSS transition not correctly working -



angularjs - CSS transition not correctly working -

i have weird problem. have css flip animation 2 images.

the problem on first transition, image hidden first not transition instead shows instantly @ end of transition.

however, after first transition problem disappears , working correctly afterwards.

though application written in angularjs, think css problem. how solve this?

i've created fiddle explains problem:

fiddle

html:

<table> <tr> <td ng-click="flipcard()"> <div class="card-container"> <div class="card" ng-class="{'flipped': !deckvisible}"> <img class="front" ng-src="http://dummyimage.com/128x96/000/fff.jpg&text=3"> <img class="back" ng-src="http://dummyimage.com/128x96/000/fff.jpg&text=5"> </div> </div> </td> </tr> </table>

css:

.card-container { position: relative; width: 220px; height: 147px; -webkit-perspective: 800px; -moz-perspective: 800px; -ms-perspective: 800px; -o-perspective: 800px; perspective: 800px; } .card { width: 100%; height: 100%; -webkit-transition: -webkit-transform 1s; -moz-transition: -moz-transform 1s; -ms-transition: -ms-transform 1s; -o-transition: -o-transform 1s; transition: transform 1s; -webkit-transform-style: preserve-3d; -moz-transform-style: preserve-3d; -ms-transform-style: preserve-3d; -o-transform-style: preserve-3d; transform-style: preserve-3d; } .card.flipped { -webkit-transform: rotatey(180deg); -moz-transform: rotatey(180deg); -ms-transform: rotatey(180deg); -o-transform: rotatey(180deg); transform: rotatey(180deg); } .card img { position: absolute; display: block; height: 100%; width: 100%; -webkit-backface-visibility: hidden; -moz-backface-visibility: hidden; -ms-backface-visibility: hidden; -o-backface-visibility: hidden; backface-visibility: hidden; } .card .back { -webkit-transform: rotatey(180deg); -moz-transform: rotatey(180deg); -ms-transform: rotatey(180deg); -o-transform: rotatey(180deg); transform: rotatey(180deg); }

demo

.card .back { -webkit-transform: rotatey(180deg); -moz-transform: rotatey(180deg); -ms-transform: rotatey(180deg); -o-transform: rotatey(180deg); transform: rotatey(180deg); -webkit-transform-style: preserve-3d; -moz-transform-style: preserve-3d; -ms-transform-style: preserve-3d; -o-transform-style: preserve-3d; transform-style: preserve-3d; }

you forgot set preserve-3d in image

css angularjs css3 css-animations

c++ - Does derived class allocate memory for member variable? -



c++ - Does derived class allocate memory for member variable? -

#include<cstdio> #include<iostream> using namespace std; class { public: int x; }; class b: public { }; int main() { b b; b.x=5; cout<<b.x<<endl; homecoming 0; }

i have above code.it's okay.but want know when inherit class b class fellow member variable x declared in class b or class b access fellow member variable x of class ? there 2 variables same name in 2 different classes or there 1 variable , objects of both classes have access ? if there 2 different variables same name in 2 different classes why, when object of derived class declared constructor of base of operations class called ?

when create object of derived class, base of operations class sub-object embedded in memory layout of derived class object. so, question, there's on variable part of derived object. since, taking non-static members here, each derived object gets base-class sub-object laid out in memory. when create base of operations class object, different piece of memory representing different object , has nil derived object created earlier.

hope clarifies doubt!

this great book understand c++ object model:

http://www.amazon.com/inside-object-model-stanley-lippman/dp/0201834545/ref=sr_1_1?ie=utf8&qid=1412535828&sr=8-1&keywords=inside+c%2b%2b+object+model

c++ class inheritance

obd ii - OBD ll (elm327) data exchange over Bluetooth -



obd ii - OBD ll (elm327) data exchange over Bluetooth -

i develope android application can read(and send) info obd2 , show in real time. question optimal frequency reading info , sending commands obd? example, when create initialization of obd 4 commands 1 after another, init fails. can executed successfuly... if create init 500ms delay between commands ok. now, when send command obd, how much time suppose wait reply sure getting ok? there way know or seek different delays in real time? thanx

optimal frequency sending commands depends on obd-ii device, depends on auto using. not create much sense optimize that. take safe time when testing , play hard-coded delay.

a improve way solve this, send command. wait response, obd-ii device busy handling command. when receive response, that's trigger utilize send next command in queue.

the obd-ii device handles 1 command @ time, more stable , effective method send data.

obd-ii elm327

java - retain specific elements in an array from an array that are in another array -



java - retain specific elements in an array from an array that are in another array -

let's have 2 array;

integer[] array= { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 200, 5, 6, 5 }; integer[] array2= { 12, 2 ,3, 2, 200, 5 };

im trying create method homecoming array element removed except in nowadays in array2, output of method should be

{2 ,3, 5, 200, 5, 5 }

i dont want utilize info construction , have no thought how code im trying do, im not sure how can determinate resulting array length

thanks

if understand question, begin creating contains(integer[], integer) method. iterate array , homecoming true if array contains value.

private static boolean contains(integer[] a, integer v) { (integer t : a) { if (t.equals(v)) { homecoming true; } } homecoming false; }

then can leverage iterate arrays twice. 1 time perform count, , sec time populate newly created array count number of elements. like,

public static integer[] retainall(integer[] a, integer[] b) { int count = 0; (integer val : a) { if (contains(b, val)) { count++; } } integer[] out = new integer[count]; count = 0; (integer val : a) { if (contains(b, val)) { out[count++] = val; } } homecoming out; }

then test it,

public static void main(string[] args) { integer[] array = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 200, 5, 6, 5 }; integer[] array2 = { 12, 2, 3, 2, 200, 5 }; system.out.println(arrays.tostring(retainall(array, array2))); }

output requested

[2, 3, 5, 200, 5, 5]

of course, utilize arrays.aslist(t...) , retainall() like

public static integer[] retainall(integer[] a, integer[] b) { list<integer> al = new arraylist<>(arrays.aslist(a)); al.retainall(arrays.aslist(b)); homecoming al.toarray(new integer[al.size()]); }

java arrays retain

multithreading - CSemaphore in MFC C++ doesn't work -



multithreading - CSemaphore in MFC C++ doesn't work -

i'm trying create semaphore multiple threads, need run 1 thread @ time. i'm declaring semaphore in dialog file

ghsemaphore = createsemaphore(null, 1, 1, null); // 1 thread @ 1 time

before start tread call

waitforsingleobject(ghsemaphore, 0l);

before thread ends call:

releasesemaphore(ghsemaphore, 1, null);

it starts treads instead of 1 tread once. thought please ? lot!

you "before start thread..(you acquire semaphore)" - in same (main) thread? think, semaphore restrict acquisition one thread (which here main thread), acquisition needed placed within (child) threads, allow 1 of them run concurrently.

you have create single 1 semaphore in parent thread , pass reference kid threads. 1 time 1 kid thread released wait..() semaphore blocks concurrent threads until first 1 releases semaphore , next kid thread allowed run. however, kid threads run concurrently until phone call of wait..().

btw: why create multiple threads if want 1 thread run @ time (until terminates)?

regarding scope create semaphore: info provided looks ok have 1 single semaphore @ application level. however, recommend pass kid threads parameter @ thread start (instead of referring global variable), kid threads independent of selection of scope. if ever need handle multiple, independent bunches of such kid threads, can switch create 1 semaphore each bunch before created (the other alternative mentioned). if create semaphores on fly, sure release it, 1 time threads have terminated.

so, now, best create 1 application-wide semaphore ("global").

multithreading

c - Print from pointer? -



c - Print from pointer? -

ok, have assignment gives me constant:

const char *suits[] = {"hearts", "diamonds", "clubs", "spades"};

basically table pointer points 4 words! simple right?

then have import each word table!

so create new table:

char table[30];

in main structure, , want somehow import within word "diamonds"! on pointer's table word on sec place. suits[1].

well when seek print sec word using command:

printf("%s", *suits[1]);

i error. using command

printf("%c", *suits[1]);

i "d", first letter. have ideas on how able print whole word "diamonds", , how can re-create table create in main form?

(i need re-create word suits[1] new table , able print table)

thank much!!!

i'm not clear on mean "copy table", on printing string, can help there.

executive summary: printf("%s", suits[0]); // prints diamonds what string in c, , memory like?

we have code:

const char *suits[] = {"hearts", "diamonds", "clubs", "spades"};

in memory is:

suits[0] -> pointer memory contains {'h', 'e', 'a', 'r', 't', 's', '\0'} suits[1] -> pointer memory contains {'d', 'i', 'a', 'm', 'o', 'n', 'd', 's', '\0'} ...

a string in c refers pointer null terminated piece of memory. when want print string, do:

printf("%s", <a pointer null terminated string>);

in case, pointer found @ suits[0], do:

printf("%s", suits[0]); thoughts on copying table.

if want store string "hearts" in array, perhaps you're looking for:

snprintf(table, sizeof(table), "%s", suits[0]);

or

strncpy(table, sizeof(table), suits[0]);

c pointers

php - get title tag value using DOMDocument -



php - get title tag value using DOMDocument -

i want value of <title> tag pages of website. trying run script on website domain, , pages links on website , , titles of them.

this code:

$html = file_get_contents('http://xxxxxxxxx.com'); //create new dom document $dom = new domdocument; //parse html. @ used suppress parsing errors //that thrown if $html string isn't valid xhtml. @$dom->loadhtml($html); //get links. utilize other tag name here, //like 'img' or 'table', extract other tags. $links = $dom->getelementsbytagname('a'); //iterate on extracted links , display urls foreach ($links $link){ //extract , show "href" attribute. echo $link->nodevalue; echo $link->getattribute('href'), '<br>'; }

what is: <a href="z1.html">z2</a> z1.html , z2.... z1.html have title named z3. want z1.html , z3, not z2. can help me?

you need create own custom function , phone call in appropriate places , if need multiple tags pages in anchor tag, need create new custom function.

below code help started

$html = my_curl_function('http://www.anchorartspace.org/'); $doc = new domdocument(); @$doc->loadhtml($html); $mytag = $doc->getelementsbytagname('title'); //get , display need: $title = $mytag->item(0)->nodevalue; $links = $doc->getelementsbytagname('a'); //iterate on extracted links , display urls foreach ($links $link) { //extract , show "href" attribute. echo $link->nodevalue; echo "<br/>".'my anchor link : - ' . $link->getattribute('href') . "---title--->"; $a_html = my_curl_function($link->getattribute('href')); $a_doc = new domdocument(); @$a_doc->loadhtml($a_html); $a_html_title = $a_doc->getelementsbytagname('title'); //get , display need: $a_html_title = $a_html_title->item(0)->nodevalue; echo $a_html_title; echo '<br/>'; } echo "title: $title" . '<br/><br/>'; function my_curl_function($url) { $curl_handle = curl_init(); curl_setopt($curl_handle, curlopt_url, $url); curl_setopt($curl_handle, curlopt_connecttimeout, 2); curl_setopt($curl_handle, curlopt_returntransfer, 1); curl_setopt($curl_handle, curlopt_useragent, 'name'); $html = curl_exec($curl_handle); curl_close($curl_handle); homecoming $html; }

let me know if need more help

php html scrape

c# - await not using current SynchronizationContext -



c# - await not using current SynchronizationContext -

i'm getting confusing behavior when using different synchronizationcontext within async function outside.

most of program's code uses custom synchronizationcontext queues sendorpostcallbacks , calls them @ specific known point in main thread. set custom synchronizationcontext @ origin of time , works fine when utilize one.

the problem i'm running have functions want await continuations run in thread pool.

void beginningoftime() { // mycustomcontext queues each endorpostcallback , runs them @ known point in main thread. synchronizationcontext.setsynchronizationcontext( new mycustomcontext() ); // ... later on in code, wait on something, , should go on within // main thread mycustomcontext runs has queued int x = await someotherfunction(); weshouldbeinthemainthreadnow(); // ********* should run in main thread } async int someotherfunction() { // set null synchronizationcontext because function wants continuations // run in thread pool. synchronizationcontext prevcontext = synchronizationcontext.current; synchronizationcontext.setsynchronizationcontext( null ); seek { // want continuation posted thread pool // thread, not mycustomcontext. await blah(); weshouldbeinathreadpoolthread(); // ********* should run in thread pool thread } { // restore previous setsynchronizationcontext. synchronizationcontext.setsynchronizationcontext( prevcontext ); } }

the behavior i'm getting code right after each await executed in seemingly-random thread. sometimes, weshouldbeinthemainthreadnow() running in thread pool thread , main thread. weshouldbeinathreadpoolthread() running

i don't see pattern here, thought whatever synchronizationcontext.current set @ line utilize await 1 define code next await execute. wrong assumption? if so, there compact way i'm trying here?

there mutual misconception await, somehow calling async-implemented function treated specially.

however, await keyword operates on object, not care @ awaitable object comes from.

that is, can rewrite await blah(); var blahtask = blah(); await blahtask;

so happens when rewrite outer await phone call way?

// synchronization context leads main thread; task<int> xtask = someotherfunction(); // synchronization context has been set // null someotherfunction! int x = await xtask;

and then, there other issue: finally inner method executed in continuation, meaning executed on thread pool - not have unset synchronizationcontext, synchronizationcontext (potentially) restored @ time in future, on thread. however, because not understand way synchronizationcontext flowed, quite possible synchronizationcontext not restored @ all, set on thread (remember synchronizationcontext.current thread-local...)

these 2 issues, combined, explain randomness observe. (that is, manipulating quasi-global state multiple threads...)

the root of issue await keyword not allow scheduling of continuation task.

in general, want specify "it not of import code after await on same context code before await", , in case, using configureawait(false) appropriate;

async task someotherfunction() { await blah().configureawait(false); }

however, if absolutely want specify "i want code after await run on thread pool" - that should rare, cannot await, can e.g. continuewith - however, going mix multiple ways of using task objects, , can lead pretty confusing code.

task someotherfunction() { homecoming blah() .continuewith(blahtask => weshouldbeinathreadpoolthread(), taskscheduler.default); }

c# .net synchronizationcontext

javascript - If Element ID exists then Hide Other Element -



javascript - If Element ID exists then Hide Other Element -

i have ecommerce website has multiple prices given item. trying set bit of script hide price, if lower cost class nowadays on page.

<table> <tbody> <tr> <td> <font> <div class="product_listprice">199.99</div> </font> <font> <div class="product_productprice">179.99</div> </font> <b> <div class="product_saleprice">159.99</div> </b> <font> <div class="product_discountprice">139.99</div> </font> </td> </tr> </tbody> </table>

essentially need script hide .product_productprice if .product_saleprice exists on page, , hide both .product_saleprice , .product_productprice if .product_discountprice exists.

here's i've come far google digging.

<script type="text/javascript"> $(document).ready(function(){ if ( $(".product_discountprice").size() ) $(".product_saleprice, .product_productprice").hide(); }); }); </script>

however, doesn't seem working. ideas? i'm jquery novice, i'm sure there improve way out there...

// need script hide .product_productprice // if .product_saleprice exists on page... if ($('.product_saleprice').length) { $('.product_productprice').hide(); } // ...and hide both .product_saleprice , .product_productprice // if .product_discountprice exists. if ($('.product_discountprice').length ) { $('.product_saleprice, .product_productprice').hide(); }

update adds new class name, instead of hiding:

if ($('.product_saleprice').length) { $('.product_productprice').addclass('some-class'); } if ($('.product_discountprice').length ) { $('.product_saleprice, .product_productprice').addclass('some-class'); }

javascript jquery

objective c - Why does my view controller inside a UIPopoverPresentationController take up the whole screen? -



objective c - Why does my view controller inside a UIPopoverPresentationController take up the whole screen? -

i in process of upgrading app ios 7 ios 8, , 1 of areas having problem new uipopoverpresentationcontroller. reason, whenever nowadays view controller using class, view controller not appear in popover, instead presents beingness pushed onto nav stack (takes whole screen). i'm sure i'm missing obvious, between apple's documentation , numerous swift answers on missing it. here's code:

-(void)createandsizepopover:(nsstring*)tablename { //create picklist self.picklistpopoverviewcontroller = nil; //note wspicklistviewcontroller uiviewcontroller self.picklistpopoverviewcontroller = [[wspicklistviewcontroller alloc] initwithnibname:nil bundle:nil withpicklistitem:self.densityunits andpicklisttablename:tablename isslimline:yes]; self.picklistpopoverviewcontroller.showsearchbar = no; self.picklistpopoverviewcontroller.modalpresentationstyle = uimodalpresentationpopover; ((wspicklistviewcontroller*)self.picklistpopoverviewcontroller).picklistitemdelegate = self; //size popover nsinteger rowscount = [self.picklistpopoverviewcontroller.allobjects count]; nsinteger singlerowheight = 35; nsinteger totalrowsheight = rowscount * singlerowheight; nsinteger fourrowsheight = 6 * singlerowheight; nsinteger height = (totalrowsheight >= fourrowsheight) ? fourrowsheight : totalrowsheight; cgfloat largestlabelwidth = 0; (wspicklist* pickitem in self.picklistpopoverviewcontroller.allobjects) { cgsize labelsize = [pickitem.name sizewithattributes:@{nsfontattributename: [uifont fontwithname:@"helveticaneue" size:20.0], nsforegroundcolorattributename : [uicolor blackcolor]}]; if (labelsize.width > largestlabelwidth) { largestlabelwidth = labelsize.width; } } cgfloat popoverwidth = largestlabelwidth + 50; [self.picklistpopoverviewcontroller setpreferredcontentsize:cgsizemake(popoverwidth, height)]; } -(void)showorhidepopover:(id)sender withtablename:(nsstring*)tablename { //show/hide popover if (self.popover != nil) { [self.picklistpopoverviewcontroller dismissviewcontrolleranimated:yes completion:nil]; self.popover = nil; self.picklistpopoverviewcontroller = nil; return; } else { [self createandsizepopover:tablename]; } [self presentviewcontroller:self.picklistpopoverviewcontroller animated:yes completion: nil]; self.popover = self.picklistpopoverviewcontroller.popoverpresentationcontroller; self.popover.permittedarrowdirections = uipopoverarrowdirectionright; self.popover.sourceview = sender; if ([sender iskindofclass:[uibutton class]]) { self.popover.sourcerect = ((uibutton*)sender).bounds; } else if ([sender iskindofclass:[uicollectionviewcell class]]) { self.popover.sourcerect = ((uicollectionviewcell*)sender).bounds; } }

i'm ok reply in either objective-c or swift (since need larn anyway). in advance help provided!

after several days of google'ing , testing theories, found several issues in code.

first, presentation cannot come before setting popoverpresentationcontroller. know flies in face of apple's documentation, states seems "counterintuitive" nowadays view controller before setting popover controller, still worked me.

second, implementation of adaptivepresentationstyleforpresentationcontroller: wrong. returning uimodalpresentationpopover should have been returning uimodalpresentationnone follows:

-(uimodalpresentationstyle)adaptivepresentationstyleforpresentationcontroller:(uipresentationcontroller *)controller { homecoming uimodalpresentationnone; }

hope helps else.

objective-c swift ios8 uipopover

java - finding closet value in another list -



java - finding closet value in another list -

please allow me know if question not clear. can provide more info. have next musical notes in arraylist

arraylist<string> noteslist = new arraylist<>(); noteslist.add("a"); //0 noteslist.add("a#"); //1 noteslist.add("b"); //2 noteslist.add("c"); //3 noteslist.add("c#"); //4 noteslist.add("d"); //5 noteslist.add("d#"); //6 noteslist.add("e"); //7 noteslist.add("f"); //8 noteslist.add("f#"); //9 noteslist.add("g"); //10 noteslist.add("g#"); //11

i have 2 sub lists, 1 ascending , 1 descending. both of them contain notes part of noteslist.

arraylist<string> ascendlist = new arraylist<>(); arraylist<string> descendlist = new arraylist<>();

ex:

ascendlist = c, d, e, f#, g //indices in noteslist = 3,5,7,9,10 descendlist = a, c#, e, f, g, g# // indices in noteslist = 0,4,7,8,10,11

i need generate patterns going through ascending list , descending vice versa. example:

d, e (from ascending list), e, c# (from descending list) c,d,e,f#

(ascend), f,e,c#,a (descend)

f e c# (descend), d, e (ascend)

there status doing this. when want connect descending pattern @ end of ascending pattern, need find next note equal or below lastly ascending note, in descending list.

ex: if f# lastly note in 1 of pattern of ascending type, f should first note in descending pattern. if e lastly note in ascending pattern, 1 time again e first note in descending pattern since e nowadays in both ascend , descend. when generate ascending pattern @ end of descending pattern, need find next note equal or higher lastly descending note.

i not figure out how this. 1 method tried go indices both ascending , descending corresponding noteslist , thought of mapping , using map.higherkey, map.lowerkey, etc methods. unable proceed because not map them.

enum note { c, c_, d, d_, e, f, f_, g, g_, a, a_, b; public note above() { homecoming ordinal() != values().length - 1 ? note.values()[ordinal() + 1] : note.values()[0]; } public note below() { homecoming ordinal() > 0 ? note.values()[ordinal() - 1] : note.values()[note.values().length - 1]; } } interface scale { listiterator<note> joinafter(note note); } scale ascending = new scale() { list<note> notes = aslist(c, d, e, f_, g); @override public listiterator<note> joinafter(note note) { homecoming notes.listiterator(notes.contains(note)? notes.indexof(note) : notes.indexof(note.above())); } }; scale descending = new scale() { list<note> notes = aslist(a, c_, e, f, g, g_); @override public listiterator<note> joinafter(note note) { homecoming notes.listiterator(notes.contains(note)? notes.indexof(note) : notes.indexof(note.below())); } };

i'd recomend add together own iterator wrapper phone call previous next in descendingscale (if don't want reason reverse notes there) , more importantly allow infinitely loop through scales.

if school asignment improve stick numbers , don't mess lists of strings untill need print things out. btw array improve selection here.

java

windows - Scheduled Powershell Task, stuck Running -



windows - Scheduled Powershell Task, stuck Running -

i have problems when running powershell script in scheduled tasks. gets stuck in running, though transcript has logged out lastly row "done!" , looks has done want to. missing?

when running run in windows seems fine: powershell -file "d:\_temp\copy_bat\copy_one_reprint_folder.ps1"

seetings in task scheduler is:

run total priviliges run weither user logged on or not action, start programme powershell.exe -file "d:\_temp\copy_bat\copy_one_reprint_folder.ps1"

please see code below if needed.

# powershell reprint re-create first folder, sorted on lastmodified function timestamp { $ts = get-date -format s homecoming $ts } $fromdirectory = "d:\_temp\copy_bat" $todirectory = "d:\_temp\in_dummy" $extractguiddir = "" $doctypedir = "" # logging ######### $erroractionpreference="silentlycontinue" stop-transcript | out-null $erroractionpreference = "continue" start-transcript -path $fromdirectory\copy_one_reprint_folder.log.txt -append ########### write-host "" write-host (timestamp) "copy reprint extract started" write-host (timestamp) "============================" get-childitem -path $fromdirectory | ?{ $_.psiscontainer } | sort-object creationtime | ` where-object {$_.name -ne "_copied"} | ` select-object -first 1 | ` foreach-object{ write-host (timestamp) $_.name $extractguiddir = $_.fullname get-childitem -path $extractguiddir | ?{ $_.psiscontainer } | where-object {$_.name -match "purchase order \(-999999997\)" -or $_.name -match "logistics documents \(-1000000000\)" -or $_.name -match "specifications \(-999999998\)"} | ` foreach-object{ write-host (timestamp) " " $_.name } write-host "" write-host "these folders (document types), found not included" get-childitem -path $extractguiddir -exclude "logistics documents (-1000000000)", "purchase order (-999999997)", "specifications (-999999998)" | ?{ $_.psiscontainer } | ` foreach-object{ write-host (timestamp) " - " $_.name } write-host "" get-childitem -path $extractguiddir | ?{ $_.psiscontainer } | where-object {$_.name -match "purchase order \(-999999997\)" -or $_.name -match "logistics documents \(-1000000000\)" -or $_.name -match "specifications \(-999999998\)"} | ` foreach-object{ $temp_name = $_.fullname write-host (timestamp) "copying files " $_.fullname write-host (timestamp) " " $todirectory #copy-item ($_.fullname)\*.* $todirectory write-host (timestamp) " copying meta-files..." copy-item $temp_name\*.meta $todirectory -filter *.meta write-host (timestamp) " copying pdf-files..." copy-item $temp_name\*.pdf $todirectory -filter *.pdf if(test-path $temp_name\*.* -exclude *.meta, *.pdf) { write-host (timestamp) " warning/error not documents have been moved. pdfs moved!" write-host (timestamp) " check folder other document-types." } } move-item $extractguiddir $fromdirectory\_copied } write-host (timestamp) " done!" # stop logging stop-transcript

it solved.

it works, stupid me did not press f5(update) in task scheduler update status of task in gui.

actually quite did this, apparently not.

windows powershell scheduled-tasks

php - Access to many-to-many relation in array format, symfony2 -



php - Access to many-to-many relation in array format, symfony2 -

in symfony can access many-to-many relations getter functions homecoming objects of arraycollection type. illustration getting alex's students can phone call $alex->getstudens(), have access ale's studens object.

now question how can access alex's students id's in array, illustration calling $alex->getstudentsids() returns {1,5,7,12,..} , students's ids.

precisely how wrote it, add together function in entity

public function getstudentsids() { $students = $this->students; $studentids = []; foreach($students $student) { $studentids[] = $student->getid(); } homecoming $studentids; }

ideal solution add together such method repository , have query pupil ids given object simpliest solution possible.

php symfony2 doctrine2 dql

Is there any negatives to storing JSON in MySQL? -



Is there any negatives to storing JSON in MySQL? -

i building complex ordering scheme , struggling whether should store of more detailed info in single column json or if should create multiple tables , logic maintain json out of picture.

since each order have multiple required dates, ship dates, parts, kits (collections of parts), , more. seems easier store json of single 'order'row.

are there major downwards sides doing this?

json geared more towards short term storage send info 1 thing another. horribly inefficient space , computationally wise long term storage compared database. loose ability query info straight without parsing first (e.g "select * table orderdate < today"). you'll have develop own tools view data, since if seek view in database directly, run together.

in short, bad idea.

mysql json database laravel-4

c++ - Overriding the virtual functions with different return types raises error with private inheritance -



c++ - Overriding the virtual functions with different return types raises error with private inheritance -

in next code got next compilation errors:

1>c:\users\mittamani\desktop\06-10\over_riding_test\over_riding_test\over_riding_test.cpp(33) : error c2555: '_d1::fun': overriding virtual function homecoming type differs , not covariant 'base2::fun' 1> c:\users\mittamani\desktop\06-10\over_riding_test\over_riding_test\over_riding_test.cpp(28) : see declaration of 'base2::fun' 1> 'base1' : base of operations class not accessible 1>c:\users\mittamani\desktop\06-10\over_riding_test\over_riding_test\over_riding_test.cpp(37) : error c2555: '_d2::fun': overriding virtual function homecoming type differs , not covariant 'base2::fun' 1> c:\users\mittamani\desktop\06-10\over_riding_test\over_riding_test\over_riding_test.cpp(28) : see declaration of 'base2::fun' 1> 'base1' : base of operations class not accessible 1>build log saved @ "file://c:\users\mittamani\desktop\06-10\over_riding_test\over_riding_test\debug\buildlog.htm" 1>over_riding_test - 2 error(s), 0 warning(s)

here code:

class base1{ public: base1(){} virtual ~base1(){} }; class d1:base1{ }; class d2:base1{ }; class base2{ public: base2(){} virtual ~base2(){} virtual base1 * fun() = 0; }; class _d1:base2{ public: d1* fun(){} }; class _d2:base2{ public: d2* fun(){} };

by way, fresher c++.. plz help..thanks in advance..

assuming trying utilize covariance of homecoming types, attempts valid except fact types must using public inheritance:

class d1:public base1{ // ~~~~~^ }; class d2:public base1{ // ~~~~~^ }; class _d1 : base2{ public: d1* fun(){} // ok now, d1 inherits publicly base1 }; class _d2 : base2{ public: d2* fun(){} // ok now, d2 inherits publicly base1 };

just can't cast d2* base1* unless using public inheritance, same applies here.

demo

alternatively, have create classes friends, have access private base of operations class:

class _d1; class _d2; class d1 : base1{ friend class _d1; }; class d2 : base1{ friend class _d2; };

c++ standard reference:

§ 10.3 virtual functions [class.virtual]

the homecoming type of overriding function shall either identical homecoming type of overridden function or covariant classes of functions. if function d::f overrides function b::f, homecoming types of functions covariant if satisfy next criteria:

— both pointers classes, both lvalue references classes, or both rvalue references classes

— class in homecoming type of b::f same class class in homecoming type of d::f, or unambiguous and accessible direct or indirect base of operations class of class in homecoming type of d::f

— both pointers or references have same cv-qualification , class type in homecoming type of d::f has same cv-qualification or less cv-qualification class type in homecoming type of b::f.

c++ return-type method-overriding

c++ - Impossible Register Constraint in asm -



c++ - Impossible Register Constraint in asm -

i trying utilize code multiplication in c++ file.

ll mul(ll a, ll b, ll m) { ll q; ll r; asm( "mulq %3;" "divq %4;" : "=a"(q), "=d"(r) : "a"(a), "rm"(b), "rm"(m)); homecoming r; }

but showing impossible register constraint in asm error.

c++ assembly

web scraping - Different results when reading from text file and web in R -



web scraping - Different results when reading from text file and web in R -

let www.exampleweb.com website info that:

... -3.7358293e+000 7.6062331e-001 6.0701401e+000 -1.6897975e+000 -2.1088811e+000 2.7172791e+000 -2.5477626e+000 ...

1 column 1000 rows. i'm obtaining info website in 2 ways: 1.

con = url("www.exampleweb.com") data_from_html <- readlines(con) close(con)

now need convert data, because

str(data_from_html) chr [1:1000] " -2.9735888e+000" " -1.4757566e+000" " 8.6980880e-001" " 4.9502553e+000" ...

so:

converted <- as.numeric(data_from_html)

copying (ctrl+a) whole site, , pasting .txt file. saving "my_data.txt".

data_from_txt <- read.table("my_data.txt")

now, when utilize

summary(converted) min. 1st qu. median mean 3rd qu. max. -16.2800 -1.5030 -0.0598 -0.1809 1.2220 13.0100

but on other hand:

summary(data_from_txt) v1 min. :-16.2789 1st qu.: -1.5026 median : -0.0598 mean : -0.1809 3rd qu.: 1.2217 max. : 13.0112

i can't decide 1 better, sense there info loss in converting char numeric. don't know how prevent it. checked head/tail of these variables, they've got same values:

head(converted) [1] -2.9735888 -1.4757566 0.8698088 4.9502553 -4.3059115 0.9745958 > tail(converted) [1] -3.007217 -4.600345 -3.740255 2.579664 -2.233819 -1.028491 head(data_from_txt) v1 1 -2.9735888 2 -1.4757566 3 0.8698088 4 4.9502553 5 -4.3059115 6 0.9745958 > tail(data_from_txt) v1 995 -3.007217 996 -4.600345 997 -3.740255 998 2.579664 999 -2.233819 1000 -1.028491

how deal it? mean should never web scrap data? if i, reason, can't create .txt file? maybe jest need improve method info conversion?

r web-scraping text-files analytics data-loss

c++ - OS X fullscreen in wxWidgets 3.0 -



c++ - OS X fullscreen in wxWidgets 3.0 -

i contribute cross-platform application built using wxwidgets stable version - 3.0.2.

i enable app utilize native fullscreen scheme on os x lion , above. feature implemented in current development versions of wxwidgets, not in 3.0.2.

i understand should possible phone call native cocoa api within wxwidgets app enable fullscreen mode, can't work out how , can't find info online.

how can straight access nswindow class wxwidgets c++ code?

for reference, this question asks how same wxpython, , gets reply - python different plenty c++ can't work out how in standard wxwidgets.

you can utilize wxwindow::macgettoplevelwindowref() nswindow. see this commit can afterwards.

c++ osx cocoa wxwidgets

html - Ways to make a background image -



html - Ways to make a background image -

i trying put background image in content div , create image blur failed far. managed background-image show when code image in content div (code below). in other words without making additional div image. in case whole content becomes blur if, example, set filter: blur(...);

the sec method create background-image div. managed either force content right under image or set image somewhere behind content it's not visible.

how propose background-image , prepare issue? codepen - http://codepen.io/anon/pen/hgbja

css

h2 { font-family: open sans; color: #0099f1; padding-left: 20px; text-align: left; } #bizpartners ul { list-style-image: url ("http://www.peopletraining.co.uk/people_training_april_2012002002.jpg"); } .right { position: relative; float: left; margin-top: 50px; width: 100%; min-height: 400px; max-height: auto; z-index: 5; margin-bottom: 5px; background: rgba (255, 255, 255, 0.3); border: 1px solid #000000; background-image: url("http://www.worldswallpapers.org/wp-content/uploads/2014/02/nature-wallpapers-2014-2.jpg"); background-size: cover; filter: blur(5px); -webkit-filter: blur(5px); background-repeat: no-repeat; } .right p { margin-left: 30px; margin-top: 20px; text-align: center; }

i made quick, hope it's ok!

fiddle: http://jsfiddle.net/81yawoxg/

html

<div class="container"> <div class="background"></div> <div class="text">content here</div>

css

.container{ position: relative; width: 1280px; height: 700px; } .background{ position: absolute; top: 0; left: 0; width: inherit; height: inherit; z-index: 100; background-image: url("http://www.worldswallpapers.org/wp-content/uploads/2014/02/nature-wallpapers-2014-2.jpg"); filter: blur(5px); -webkit-filter: blur(5px); background-repeat: no-repeat; } .text{ position: absolute; top: 0; left: 0; width: inherit; height: inherit; z-index: 200; padding: 20px; }

html css background-image

opencv - How to store image from cam? -



opencv - How to store image from cam? -

i started processing.js.

the goal of programme adept image filter(opencv) video frame.

so thought (however found out not working in way :<) :

get video steam capture object in processing.video package. store current image(i hope can store pimage object). adept opencv image filter call image method filtered pimage object.

i found out how video stream cam, not know how store this.

import processing.video.*; import gab.opencv.*; capture cap; opencv opencv; public void setup(){ //size(800, 600); size(640, 480); colormode(rgb, 255, 255, 255, 100); cap = new capture(this, width, height); opencv = new opencv(this, cap); cap.start(); background(0); } public void draw(){ if(cap.available()){ //return void cap.read(); } image(cap, 0, 0); }

this code video stream , show gets. however, can not store single frame since capture.read() returns 'void'.

after store current frame transform pimage s opencv :

pimage grayness = opencv.getsnapshot(); opencv.threshold(80); thresh = opencv.getsnapshot(); opencv.loadimage(gray); opencv.blur(12); blur = opencv.getsnapshot(); opencv.loadimage(gray); opencv.adaptivethreshold(591, 1); adaptive = opencv.getsnapshot();

is there decent way store , transform current frame? (i think way - means show frame after save current image , transform - uses lots of resources depend on frame rate)

thanks reply :d

not sure want do, i'm sure solved already, useful anyway...

it seems can write capture object's name straight , returns pimage:

cap = new capture(this, width, height); //code starting , reading capture in here pimage snapshot = cap; //then can whatever wanted pimage snapshot.save("snapshot.jpg"); //actually seems work fine cap.save("snapshot.jpg");

opencv video processing video-capture imagefilter

c# - How to call Workstation.GetLocalWorkspaceInfo in a way that works for those who use VS2012 and those who use VS2013 without reflection? -



c# - How to call Workstation.GetLocalWorkspaceInfo in a way that works for those who use VS2012 and those who use VS2013 without reflection? -

workstation.current.getlocalworkspaceinfo(string) returns workspaceinfo object associated given local directory.

so, wrote simple programme displays workspace name given local directory name. works great on machine, not work on another.

the difference between 2 mine runs vs2012 , other 1 - vs2013. life of me, cannot understand it. both workspaces linked same tfs server 2010.

after reading tfs api: getlocalworkspaceinfo returns null replaced microsoft.teamfoundation.xxx references ones found on sec machine , worked again. but, of course, stopped working on machine.

it cannot right way. must doing wrong here.

i want single executable work both machines without resorting reflection. question simple - how?

the finish source code can found here - https://bitbucket.org/markkharitonov/tfsinsanity/src. basically, 2 projects sharing same source code, using different set of dependencies.

the main source code is:

private static workspace getworkspace(string wsroot, string wsname, string wsowner) { var coll = new tfsteamprojectcollection(new uri("http://torsvtfs01:8080/tfs/defaultcollection")); var vcs = (versioncontrolserver)coll.getservice(typeof(versioncontrolserver)); workspaceinfo wsinfo; if (wsroot == null) { console.writeline(workstation.current.name); wsinfo = workstation.current.getlocalworkspaceinfo(vcs, wsname, wsowner); if (wsinfo == null) { throw new exception(string.format("failed identify workspace {0};{1}", wsname, wsowner)); } } else { wsinfo = workstation.current.getlocalworkspaceinfo(wsroot); if (wsinfo == null) { throw new exception(string.format("failed identify workspace corresponding \"{0}\"", wsroot)); } } homecoming wsinfo.getworkspace(coll); }

here how works on machine (vs2012):

ps c:\work\getshelvedchangeset> tf workspaces collection: http://torsvtfs01:8080/tfs/defaultcollection workspace owner computer comment --------- -------------------- -------- ------------------------------------------------------------------------------------ canws212 dayforce\mkharitonov canws212 ps c:\work\getshelvedchangeset> .\bin\debug2012\getshelvedchangeset.exe --wsroot c:\dayforce\sharptop microsoft.teamfoundation.versioncontrol.client, version=11.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a workspace instance -784339741 comment: computer: canws212 effectivepermissions: 0 folders: [0] islocalworkspace: false lastaccessdate: 1/1/0001 12:00:00 name: canws212 options: 0 owneraliases: [0] ownerdisplayname: dayforce\mkharitonov owneridentifier: owneridentitytype: ownername: dayforce\mkharitonov owneruniquename: securitytoken: /canws212;34be4ed8-c4fd-4e9f-bdae-d1843df36b0f ps c:\work\getshelvedchangeset> .\bin\debug2013\getshelvedchangeset.exe --wsroot c:\dayforce\sharptop failed identify workspace corresponding "c:\dayforce\sharptop" ps c:\work\getshelvedchangeset>

and on other machine:

ps c:\tfs\dfgatedcheckintest2\build\2010\scripts> &"c:\program files (x86)\microsoft visual studio 12.0\common7\ide\tf.exe" workspaces collection: http://torsvtfs01:8080/tfs/defaultcollection workspace owner computer comment -------------------- ----------------- ------------ ---------------------------------------------------------------------------------------- 1733_torsvbuild10 dayforce\tfsbuild torsvbuild10 workspace created team build 1846_91_torsvbuild10 dayforce\tfsbuild torsvbuild10 workspace created team build 1846_92_torsvbuild10 dayforce\tfsbuild torsvbuild10 workspace created team build ps c:\tfs\dfgatedcheckintest2\build\2010\scripts> .\debug2012\getshelvedchangeset.exe --wsroot c:\tfs\dfgatedcheckintest2 failed identify workspace corresponding "c:\tfs\dfgatedcheckintest2" ps c:\tfs\dfgatedcheckintest2\build\2010\scripts> .\debug2013\getshelvedchangeset.exe --wsroot c:\tfs\dfgatedcheckintest2 microsoft.teamfoundation.versioncontrol.client, version=12.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a workspace instance 215494889 comment: workspace created team build computer: torsvbuild10 effectivepermissions: 0 folders: [0] islocalworkspace: false lastaccessdate: 1/1/0001 12:00:00 name: 1733_torsvbuild10 options: 0 owneraliases: [0] ownerdisplayname: dayforce\tfsbuild owneridentifier: owneridentitytype: ownername: dayforce\tfsbuild owneruniquename: securitytoken: /1733_torsvbuild10;f2899138-af14-4449-9f6d-78a0fbccebb8 ps c:\tfs\dfgatedcheckintest2\build\2010\scripts>

in case, method signatures should identical, need worry getting proper dll referenced in first place. should able link newer dll , utilize binding redirection load dll users have vs 2012 installed.

we used method in previous product provide tfs 2005 , 2008 compatibility.

in short, create custom assembly resolver. here effort load microsoft.teamfoundation.* dlls vs 2012 when fail load vs 2013 versions linked against:

appdomain.currentdomain.assemblyresolve += new resolveeventhandler(resolveassembly); public static assembly resolveassembly(object sender, resolveeventargs args) { string[] arguments = args.name.split(new string[] { ", ", "," }, stringsplitoptions.removeemptyentries); string assemblyname = arguments[0]; if(assemblyname.startswith("microsoft.teamfoundation.", stringcomparison.currentcultureignorecase)) { homecoming assembly.load(assemblyname + ", version=11.0.0.0"); } homecoming null; }

(note should check requested version number , pass civilization info loader, outlined in blog post, snippet should sufficient started.)

c# visual-studio-2012 tfs visual-studio-2013

performance - Android Bluetooth LE notifications with 100Hz - missing calls -



performance - Android Bluetooth LE notifications with 100Hz - missing calls -

i'm developing android app connects bluetooth le device , enables notifications specific characteristic. characteristic notifies smartphone 100hz. assume, oncharacteristicchanged() method called 100 times per second. not case!

using samsung galaxy s5 oncharacteristicchanged() method called 58 times per sec = 42% info loss using samsung galaxy s5 mini oncharacteristicchanged() method called 20 times per sec = 80% info loss using lg g3s = 40% info loss using lg g2 mini = 0.5% info loss (it's quite interesting g2 mini has best "throughput" "low-end hardware" compared other smartphones)

by using performance profiler noticed lg g2 mini smartphone has 6 binders instead of 4. may that's reason why processing notifications - how can number of binders increased?

does know, why android doesn't phone call oncharacteristicchanged() method 100 times per second? why there such huge differences accross various phones? is possible alter @ app or @ phone configuration decrease info loss?

thanks ben

android performance bluetooth-lowenergy

c# - Is it possible to disable authentication Filter on one action in an MVC 5 controller? -



c# - Is it possible to disable authentication Filter on one action in an MVC 5 controller? -

[authenticateuser] public class homecontroller : controller { // // get: /home/ public actionresult index() { homecoming view(); } [allowanonymous] public actionresult list() { homecoming view(); } }

how remove authentication action named list? please advise....

my custom filter coding follow.. have inherited filterattribute phone call well. please advise regarding

public class authenticateuserattribute: filterattribute, iauthenticationfilter { public void onauthentication(authenticationcontext context) { if (this.isanonymousaction(context)) { } if (user == "user") { // nil } else { context.result = new httpunauthorizedresult(); // mark unauthorized } } public void onauthenticationchallenge(authenticationchallengecontext context) { if (context.result == null || context.result httpunauthorizedresult) { context.result = new redirecttorouteresult("default", new system.web.routing.routevaluedictionary{ {"controller", "home"}, {"action", "list"}, {"returnurl", context.httpcontext.request.rawurl} }); } } }

the below code generate error message : error 1 best overloaded method match 'mvc5features.filters.authenticateuserattribute.isanonymousaction(system.web.mvc.authorizationcontext)' has invalid arguments c:\users\kirupananthan.g\documents\visual studio 2013\projects\mvc5features\mvc5features\filters\authenticateuserattribute.cs 16 17 mvc5features error 2 argument 1: cannot convert 'system.web.mvc.filters.authenticationcontext' 'system.web.mvc.authorizationcontext' c:\users\kirupananthan.g\documents\visual studio 2013\projects\mvc5features\mvc5features\filters\authenticateuserattribute.cs 16 40 mvc5features

if (this.isanonymousaction(context))

since custom filter, can extend handle allowanonymous (if don't want utilize allowanonymous, yoy can create own f.e. noauthentication):

public class authenticateuser : iauthenticationfilter { public void onauthentication(authenticationcontext filtercontext) { if (this.isanonymousaction(filtercontext)) { return; } // code } private bool isanonymousaction(authenticationcontext filtercontext) { homecoming filtercontext.actiondescriptor .getcustomattributes(inherit: true) .oftype<allowanonymousattribute>() //or attr. want .any(); } }

c# asp.net .net asp.net-mvc asp.net-mvc-5

asp.net - Best practices to fill view models with select lists and options for views' reusability in ASP MVC -



asp.net - Best practices to fill view models with select lists and options for views' reusability in ASP MVC -

i'm using view models on models. let's have edit form entity. let's form has field selected drop downwards list. best way fill list used generating drop downwards list? should done in action in controller or maybe in constructor of view model or somewhere else?

my next uncertainty view models "configuring". i'm trying reuse views when have edit form should possible utilize in add together , update scenarios. submit button should execute 2 different actions. okay parametrize view adding view model controller , action names?

finally when have view models storing info - "configuration" quite vast. there pattern logic out of controller? i'm using kind of builders, i'm not sure whether it's enough.

first of excuse me if won't exhaustive topic pretty vast. please read cum grano salis, nil rule written in stone things must adapted case case each specific scenario.

what best way fill list used generating drop downwards list? should done in action in controller or maybe in constructor of view model or somewhere else?

controller method(s). keep model (underlying model or view model) as simple possible (ideally simply entity) because model isn't place logic (even if can relaxed underlying model because in domain objects logic , info tied together).

moreover list items may added/removed according many factors , span logic across controllers , model.

imagine have next requirement: "design view user can pick film list, list populated using past history pick best candidates; provide dropdown filter movies category". there lot of logic here, search in history, kind of smart algorithm pick best candidates , function prepare list. of course of study if there isn't drama film wouldn't set item in list. if set something in model you'll have set everything there, leaving controller stupid entity simply create model instance , pick right view. little, because controller methods easy reused between views model classes pretty more specific.

moreover here move list out of model. maintain model focused on real objects, user see , selects (so, if need it, don't worry json serialize them). if have model classes logic , others without (because they're json results, example) you'll find search logic both in model , controller. pretty confusing. available options (like film categories in previous example) view specific details maintain in viewbag.

is okay parametrize view adding view model controller , action names?

yes it's ok per se should inquire if it's not improve extract partialview, they'll embedded in outer view , it'll automatic; assuming have typical pattern:

actionresult edit() { } [httppost] edit(model data) { }

...view models storing data... there pattern logic out of controller?

i can't give here decent reply because depends on case. if view logic complex may need introduce lean layer encapsulate these stuff (controller interact them , set things won't aware of logic specific details).

storing info (model <-> view model) somehow easier, (often? always?) oom automapper solve of problems (without issues have orms). mapping done convention , if follow won't need write more few lines of code (and complicated cases can configured).

asp.net asp.net-mvc asp.net-mvc-4

javascript - Chrome extension to reload page on load error -



javascript - Chrome extension to reload page on load error -

because it isn't possible utilize greasemonkey this, want write chrome extension reload page if failed load.

i know how write chrome extension, i've injected scripts , figured out how communicate pages, have basic knowledge of how tabs work , how build manifest.

what events looking , how can create work both , post requests?

use chrome.webnavigation.onerroroccurred or chrome.webrequest.onerroroccurred observe navigation errors. these apis cannot used in content script, have add together background page or event page extension.

i recommend utilize webnavigation api because these can used event pages (unlike webrequest api). here example, utilize chrome.tabs.reload instead of chrome.tabs.update want.

javascript google-chrome google-chrome-extension

Reproduce Php curl script in ASP.net -



Reproduce Php curl script in ASP.net -

i php developer, have few lines of php picks image upload form, sends off java servlet, wait response servlet , executes if...else if....else statement depending on servlet returns. need take dive asp.net need duplicate same client portal running on asp.net.

majorly, need y'all help explain me step step how to:

fetch image form using asp.net

save in asp.net variable.

how create arrays in asp.net

asp.net equivalent of php curl.

how utilize switch and/or if...else statement in asp.net

<?php $filename = $_files['file']['name']; $filedata = $_files['file']['tmp_name']; $bla = "xxxdddggg"; $blabla = 11; $postfields = array("bla"=> $bla, "blabla"=> $blabla, "filedata" => "@$filedata", "filename" => $filename); $url = "http://somewherecontainingmyjavaservlet"; $headers = array("content-type:multipart/form-data"); $ch = curl_init($filename); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_header, $headers); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, $postfields); curl_setopt($ch, curlopt_returntransfer, true); $guy = curl_exec($ch); curl_close($ch); $arr1 = str_split($guy); $returnvaal = $arr1[count($arr1)-1]; echo $returnvaal; ?>

thanks

php asp.net asp.net-mvc curl

python - How to load previously saved model and expand the model with new training data using scikit-learn -



python - How to load previously saved model and expand the model with new training data using scikit-learn -

i'm using scikit-learn i've saved logistic regression model unigrams features training set 1. possible load model , expand new info instances sec training set (training set 2)? if yes, how can done? reason doing because i'm using 2 different approaches each of training sets (the first approach involves feature corruption/regularization, , sec approach involves self-training).

i've added simple illustration code clarity:

from sklearn.linear_model import logisticregression log sklearn.feature_extraction.text import countvectorizer cv import pickle traintext1 # training set 1 text instances trainlabel1 # training set 1 labels traintext2 # training set 2 text instances trainlabel2 # training set 2 labels clf = log() # count vectorizer used logistic regression classifier vec = cv() # fit count vectorizer training text info training set 1 vec.fit(traintext1) # transforms text vectors training set1 train1text1 = vec.transform(traintext1) # fitting training set1 linear logistic regression classifier clf.fit(traintext1,trainlabel1) # saving logistic regression model training set 1 modelfilesave = open('modelfromtrainingset1', 'wb') pickle.dump(clf, modelfilesave) modelfilesave.close() # loading logistic regression model training set 1 modelfileload = open('modelfromtrainingset1', 'rb') clf = pickle.load(modelfileload) # i'm unsure how go on here....

logisticregression uses internally liblinear solver not back upwards incremental fitting. instead utilize sgdclassifier(loss='log') partial_fit method used although in practice. other hyperparameters different. careful grid search optimal value carefully. read sgdclassifier documentation meaning of hyperparameters.

countvectorizer not back upwards incremental fitting. have reuse vectorizer fitted on train set #1 transform #2. means token set #2 not seen in #1 ignored though. might not expect.

to mitigate can utilize hashingvectorizer stateless @ cost of not knowing features mean. read the documentation more details.

python machine-learning scikit-learn

javascript - test() regex function not working in IE? -



javascript - test() regex function not working in IE? -

i'm having problem figuring out why function works in chrome, not ie:

function isokpass(p){ var categories = 0; var anuppercase = /[a-z]/; var alowercase = /[a-z]/; var anumber = /[0-9]/; var aspecial = /[!|@|#|$|%|^|&|*|(|)|-|_]/; var obj = {}; obj.result = true; if(p.length < 8){ obj.result=false; obj.error="password not long enough!" homecoming obj; } var numupper = 0; var numlower = 0; var numnums = 0; var numspecials = 0; for(var i=0; i<p.length; i++){ if(anuppercase.test(p[i])) { numupper++; console.dir('uppper'); } else if(alowercase.test(p[i])) { numlower++; console.dir('loweerr'); } else if(anumber.test(p[i])) { numnums++; console.dir('number'); } else if(aspecial.test(p[i])) { numspecials++; console.dir('special'); } } if(numupper >= 1){ categories += 1; } if(numlower >= 1){ categories += 1; } if(numnums >= 1){ categories += 1; } if(numspecials >= 1){ categories += 1; } if(categories < 3){ obj.categories= categories; obj.result= false; obj.error= "password not complex enough!"; homecoming obj; } homecoming obj; }

the user enters password in input box , when click out of box string validated function. in chrome works fine, in ie appears test() behaving strangely.

i added debug messages , found when come in number in input box (and click out of it) ie displays "lower" debug message chrome displays "number" debug message expected. what's wrong code?

edit: after guys pointed out stupidity of how string beingness evaluated (i think grabbed script supposed record every type of character) i'm doing this:

if(auppercase.test(p)) { numupper++; }; if(alowercase.test(p)) { numlower++; }; if(anumber.test(p)) { numnums++; }; if(aspecial.test(p)) { numspecials++; };

javascript google-chrome internet-explorer

css - How to create a "clip-path" circle on IE and Firefox? -



css - How to create a "clip-path" circle on IE and Firefox? -

i have snippet cicrle-masking. works on chrome.

but how run on firefox , ie ? please no radius-borde solution...

class="snippet-code-css lang-css prettyprint-override">.circle { -webkit-clip-path: circle(100px @ 100px 100px); clip-path: circle(100px @ 100px 100px) } class="snippet-code-html lang-html prettyprint-override"><img src="http://cp91279.biography.com/leonardo-da-vinci_a-divine-mind_hd_768x432-16x9.jpg" width="1024" height="768" alt="" class="circle"/>

.circle { -webkit-clip-path: circle(50% @ 50% 10%); clip-path: circle(50% @ 50% 10%); }

well ie doesn't back upwards css clip-path @ , firefox supports url method solution pretty much dead end - http://caniuse.com/#feat=css-clip-path

however utilize inline svg clip image has great browser back upwards - http://caniuse.com/#search=inline%20svg

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewbox="0 0 200 200" xml:space="preserve" width="200px"> <defs> <!--defines shape utilize clipping--> <circle id="circle" cx="100" cy="100" r="100" /> </defs> <clippath id="clip"> <!--creates clipping mask shape--> <use xlink:href="#circle" overflow="visible"></use> </clippath> <!--group containing image clipping applied--> <g clip-path="url(#clip)"> <image overflow="visible" width="768" height="432" xlink:href="http://cp91279.biography.com/leonardo-da-vinci_a-divine-mind_hd_768x432-16x9.jpg"></image> </g> </svg>

working illustration - http://codepen.io/taneleero/pen/bnzjdj

css css3 internet-explorer firefox

How to make action bar in android full screen activity always visible -



How to make action bar in android full screen activity always visible -

i making app have total screen activity. action bar in total screen activity auto hiding default. want create action bar visible. tried toggling variables auto_hide, etc. of no use.

package com.bhargav.profiletimer; import com.bhargav.profiletimer.util.systemuihider; import android.annotation.targetapi; import android.app.activity; import android.content.intent; import android.os.build; import android.os.bundle; import android.os.handler; import android.view.motionevent; import android.view.view; /** * illustration full-screen activity shows , hides scheme ui (i.e. * status bar , navigation/system bar) user interaction. * * @see systemuihider */ public class timerslist extends activity { /** * whether or not scheme ui should auto-hidden after * {@link #auto_hide_delay_millis} milliseconds. */ private static final boolean auto_hide = true; /** * if {@link #auto_hide} set, number of milliseconds wait after * user interaction before hiding scheme ui. */ private static final int auto_hide_delay_millis = 3000; /** * if set, toggle scheme ui visibility upon interaction. otherwise, * show scheme ui visibility upon interaction. */ private static final boolean toggle_on_click = true; /** * flags pass {@link systemuihider#getinstance}. */ private static final int hider_flags = systemuihider.flag_hide_navigation; /** * instance of {@link systemuihider} activity. */ private systemuihider msystemuihider; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_timers_list); final view controlsview = findviewbyid(r.id.fullscreen_content_controls); final view contentview = findviewbyid(r.id.fullscreen_content); // set instance of systemuihider command scheme ui // activity. msystemuihider = systemuihider.getinstance(this, contentview, hider_flags); msystemuihider.setup(); msystemuihider .setonvisibilitychangelistener(new systemuihider.onvisibilitychangelistener() { // cached values. int mcontrolsheight; int mshortanimtime; @override @targetapi(build.version_codes.honeycomb_mr2) public void onvisibilitychange(boolean visible) { if (build.version.sdk_int >= build.version_codes.honeycomb_mr2) { // if viewpropertyanimator api available // (honeycomb mr2 , later), utilize animate // in-layout ui controls @ bottom of // screen. if (mcontrolsheight == 0) { mcontrolsheight = controlsview.getheight(); } if (mshortanimtime == 0) { mshortanimtime = getresources().getinteger( android.r.integer.config_shortanimtime); } controlsview.animate() .translationy(visible ? 0 : mcontrolsheight) .setduration(mshortanimtime); } else { // if viewpropertyanimator apis aren't // available, show or hide in-layout ui // controls. controlsview.setvisibility(visible ? view.visible : view.gone); } if (visible && auto_hide) { // schedule hide(). delayedhide(auto_hide_delay_millis); } } }); // set user interaction manually show or hide scheme ui. contentview.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { if (toggle_on_click) { msystemuihider.toggle(); } else { msystemuihider.show(); } } }); // upon interacting ui controls, delay scheduled hide() // operations prevent jarring behavior of controls going away // while interacting ui. findviewbyid(r.id.button1).setontouchlistener(mdelayhidetouchlistener); } @override protected void onpostcreate(bundle savedinstancestate) { super.onpostcreate(savedinstancestate); // trigger initial hide() shortly after activity has been // created, briefly hint user ui controls // available. delayedhide(100); } /** * touch listener utilize in-layout ui controls delay hiding * scheme ui. prevent jarring behavior of controls going away * while interacting activity ui. */ view.ontouchlistener mdelayhidetouchlistener = new view.ontouchlistener() { @override public boolean ontouch(view view, motionevent motionevent) { if (auto_hide) { delayedhide(auto_hide_delay_millis); } homecoming false; } }; handler mhidehandler = new handler(); runnable mhiderunnable = new runnable() { @override public void run() { msystemuihider.hide(); } }; /** * schedules phone call hide() in [delay] milliseconds, canceling * scheduled calls. */ private void delayedhide(int delaymillis) { mhidehandler.removecallbacks(mhiderunnable); mhidehandler.postdelayed(mhiderunnable, delaymillis); } public void startaddwizard(view view) { intent intent = new intent(this, addwizard.class); startactivity(intent); } }

your code:

private static final int hider_flags = systemuihider.flag_hide_navigation;

what need:

private static final int hider_flags = systemuihider.flag_layout_in_screen_older_devices;

problem solved.

android android-layout android-activity

vbscript - Moving Files by name -



vbscript - Moving Files by name -

i'm working on vbs determine following:

is file *.dbf? is file name numeric?

a yes both questions allow script move said file folder. here's have far:

set objfso = createobject("scripting.filesystemobject") objstartfolder = "d:\folder" set objfolder = objfso.getfolder(objstartfolder) set dirfiles = objfolder.files dim ofile each objfile in dirfiles if "dbf" = lcase(objfso.getextensionname(objfile.name)) if isnumeric(objfso.getbasename(objfile.name)) objfso.movefile drivespec,"d:\deletable\" end if end if next

for reason though i'm receiving error on line 9 files not beingness found. i'd added msgbox(objfile) , know much works enough, missing here?

objfso.movefile drivespec,"d:\deletable\"

change drivespec objfile.path

vbscript

angularjs - bind attribute to object property in isolated scope -



angularjs - bind attribute to object property in isolated scope -

i have directive (using isolated scope) makes utilize of directive changes flag hence had set container object. now, want able set flag outside. allow me "draw" you:

outerscope (outerflag1 = true, outerflag2 = true) directivescope (container.flag1 = false, container.flag2 = false) subdirectivescope (container.flag1 = false) subdirectivescope (container.flag2 = false)

the flag variables in directivescope , subdirectivescope same, because container prototypically inherited. want able set outside, synchronize outerflagx container.flagx.

with isolated scope definition can map property so:

scope: { outerflag1: '=flag1' outerflag2: '=flag2' }

however, need not allowed is

scope: { outerflag1: '=container.flag1' outerflag2: '=container.flag2' }

how can done?

i added plunker based on 1 mikko provided (thanks lot): http://plnkr.co/edit/ht6zip

it have been great see real-life utilize case, in form of plunker/fiddle. problem might go away not defining isolated scope in subdirective.

given have next controller , 2 directives

// controller app.controller('mainctrl', function ($scope) { $scope.model = null; }); // top level directive app.directive('onedirective', function () { homecoming { restrict: 'e', scope: { flag: '=' }, template: '<label for="one">one directive</label><br>' + '<input type="text" name="one" ng-model="flag">' + '<br>' + '<other-directive></other-directive>' }; }); // nested directive app.directive('otherdirective', function () { homecoming { restrict: 'e', template: '<label for="other">other directive</label><br>' + '<input type="text" name="other" ng-model="flag">' }; });

and related html template

<body ng-controller="mainctrl"> <h4>directive scopes</h4> <div> <label for="number">parent scope</label><br> <input type="text" ng-model="model" placeholder="enter something..." /> <hr> </div> <div> <one-directive flag="model"></one-directive> </div> </body>

that give liek

related plunker here http://plnkr.co/edit/7xhg8e

angularjs angularjs-directive angularjs-scope

java - Is it bad to import unused packages? -



java - Is it bad to import unused packages? -

for instance when work in team @ same file , have partial understanding of different packages imported needed code work. alter code in file , find out code become redundant because of that. delete part , not know if whole code still depends on packages or not.

[of course of study bad can objectified in many ways: speed, read-abilty etc.]

you should utilize few of imports necessary, , don't utilize finish bundle imports java.util.*. today's ide's back upwards "organize imports" operation during unused imports removed.

if have bunch of unused imports , modify code, there chance add/change code refers classes covered unused imports. won't notice accidentally utilized them though might not intent.

if have minimum imports, if add together code refers new class, compiler notify showing errors, , giving possibility take class intend use.

also if utilize imports beyond referenced in program, increment chance break programme future releases of java or libraries use.

example: if programme uses java.util.hashset still import java.util.* , utilize 3rd party library import com.mylib.*, code might compile. if in future release 3rd party library adds class named com.mylib.hashset, you're code might not compile anymore because compiler might not able tell class wanted utilize (e.g. java.util.hashset or com.mylib.hashset). have imported java.util.hashset , e.g. com.mylib.someutil in first place, code still compile new version of 3rd party lib.

java import packages

javascript - convert a JS function to PHP (math function) - no client base -



javascript - convert a JS function to PHP (math function) - no client base -

i need convert javascript calculusion functions php.

please help write 2 loops php

js: (a = 0; < 9; a++) z = z.replace(new regexp('\\' + ",-+@/. ;_".charat(a), 'g'), "ntj2m10ao".charat(a)); php: $st1 = ",-+@/. ;_"; $st2 = "ntj2m10ao"; for($a=0;$a<9;$a++){ z= preg_replace("\\$st1[$a]" ........ , $st2[$a],$z); }

and

js: var l = 128, o = (z.length) / 2, = ''; (a = ((k - 1) * l); < ((k) * l); a++) += string.fromcharcode(z.slice(a * 2, (a + 1) * 2)); php : .... ?

thanks helps pros

i solved myself

first loop :

$z="..........."; // string $st1=",-+@/. ;_"; $st2="ntj2m10ao"; for($a=0;$a<9;$a++) $z=str_replace($st1[$a], $st2[$a], $z);

second loop :

$l = 128; $o = (strlen($z)) / 2; $i = ''; ($a = (($k - 1) * $l); $a < ($k * $l); $a++) $i .= chr(substr($z,($a*2),2));

thanks @mawg , others

javascript php

android - Using Java 7 Source Level in Library Projects -



android - Using Java 7 Source Level in Library Projects -

using new gradle build tools can set source level of android code java 7 java 6. gives me access bunch of niceties <>, string switches, , collapsable seek catch.

i working on android library project. if utilize source level 7 in library , client uses source level 6 in app, there conflict?

you're fine long utilize source level 1.7 , don't utilize of apis introduced in java 7 (this why ide complain if don't have actual java 6 jdk if target java 6). create sure set target level 1.6.

java android gradle

oracle - Concatenate multiple rows into single column where data coming from multiple tables -



oracle - Concatenate multiple rows into single column where data coming from multiple tables -

i have info coming different tables there multiple rows of info in column want concatenate 1 column. this

select a.column1, b.column1, a.column3, c.column1, c.column4, d.column1 tablea a, tableb b, tablec c, tabled d a.id=b.id , b.id=c.id , a.code=d.code

the output

1 name table c info table d info 1 name b table c info table d info 1 name c table c info table d info 2 name d table c info table d info 2 name table c info table d info 2 name r table c info table d info 3 name f table c info table d info 4 name f table c info table d info 4 name e table c info table d info 4 name d table c info table d info 4 name c table c info table d info

except column b else repeating since column b having different data. want concatenate names 1 column don't other columns repetitive. tried using listagg function says not single-group function first row. please guide me how acheive this. want output

1 name a,name b name c table c info table d info 2 name d,name a, name r table c info table d info 3 name f table c info table d info 4 name f,name e,name d,name c table c info table d info

thanks in advance

this should work think

select a.column1,listagg(b.column1,',') within grouping (order b.column1), a.column3, c.column1, c.column4, d.column1 tablea a, tableb b, tablec c, tabled d a.id=b.id , b.id=c.id , a.code=d.code grouping a.column1, a.column3, c.column1, c.column4, d.column1;

oracle oracle11g

sql - How can I create a table that only allows data to insert if they are allowed -



sql - How can I create a table that only allows data to insert if they are allowed -

how can create table, allows set info in name, if info matches info want allowed in name. bla1 or bla2.

create table table1 ( name varchar(23) name has 1 of them: ('bla1', 'bla2') )

try this:

create table table1 ( name varchar(23) check( name in ('bla1','bla2') ) );

sql database oracle

IIS can't read data (HTTP GET requests) from node.js app -



IIS can't read data (HTTP GET requests) from node.js app -

i hired vps (windows server 2008) aim of hosting website. configured iis 7.5 run html website. website reads info (http requests) little node.js application running on same vps on port 3000.

on other hand, every phone call getting:

failed load resource server responded status of 404 (not found)

ok fault. needed alter http request

$.get( "/myfunction", function( info ) { });

to

$.get( "http://localhost:3000/myfunction", function( info ) { });

node.js get iis-7.5

c# - How can i draw a rectangle around the pictureBox1 borders? -



c# - How can i draw a rectangle around the pictureBox1 borders? -

in picturebox1 paint event tried draw rectangle around image in picturebox1:

private void picturebox1_paint(object sender, painteventargs e) { e.graphics.drawrectangle(new pen(brushes.red, 5), new rectangle(0, 0, picturebox1.image.width, picturebox1.image.height)); }

but this:

and tried draw rectangle aorund picturebox1 self:

private void picturebox1_paint(object sender, painteventargs e) { e.graphics.drawrectangle(pens.green, 0, 0 , picturebox1.width, picturebox1.height); }

but in case i'm getting thick greenish line on left , top right , bottom without green.

the picturebox1 in desinger it's property sizemode set stretchimage how can draw rectangles in both cases ?

and how property of top line called ? it's not height maybe top ? if want find , draw on top of picturebox how called ?

to draw within picturebox easy:

private void picturebox1_paint(object sender, painteventargs e) { float penwidth = 5f; pen mypen = new pen (brushes.red, (int)penwidth); e.graphics.drawrectangle(mypen, penwidth / 2f, penwidth / 2f, (float)picturebox1.width - 2f * penwidth, (float)picturebox1.height - 2f * penwidth); mypen.dispose(); }

to draw outside picturebox need know command underneath it. eg if form utilize form paint:

private void form1_paint(object sender, painteventargs e) { int linewidth = 5; brush mybrush = new solidbrush (color.green); e.graphics.fillrectangle(mybrush, picturebox1.location.x - linewidth, picturebox1.location.y - linewidth, picturebox1.width + 2 * linewidth, picturebox1.height + 2 * linewidth); mybrush.dispose(); }

i using fillrectangle because part under picturebox not visible , easier command width.

c# .net winforms

java - Gradle application plugin stuck at 96% when runs app? -



java - Gradle application plugin stuck at 96% when runs app? -

i'm using gradle application plugin run java service, , when ./gradlew myservice:run, runs service , shows console output, gradle process gets stuck @ 96%:

building 96% > :myservice:run

is way application plugin supposed work, or doing wrong here?

it 'stuck' here until quit application. myservice:run task runs application , waits until finishes. see 96% because that's estimation of build progress based on tasks in task graph has executed.

java gradle gradlew

java - How to determine completion time on different CPUs -



java - How to determine completion time on different CPUs -

i writing java app processes files (pdfs in case). give estimate when task finish.

while can give estimation of time needed on pc, same time not apply different pc, because have different cpu.

how can estimate how long programme run on machine with slower/faster cpu? can java rate cpu or that?

i understand similar cpus may perform differently, depending on programme needs cpu, looking rough estimate.

java pdf

Adding blur to an NSImage using Swift -



Adding blur to an NSImage using Swift -

i'm searching way add together blur effect nsimage using swift.

developing ios, uiimage provides method like

applylighteffectatframe:frame

... not find equal cocoa/an osx-app.

edit 1: tried utilize cifilter:

let beginimage = ciimage(data: responsedata) allow filter = cifilter(name: "cigaussianblur") filter.setvalue(beginimage, forkey: kciinputimagekey) filter.setvalue(0.5, forkey: kciinputintensitykey) // how can create nsimage out of ciimage? allow newimage = ??? imageview.image = newimage

i solved issue adding content filter nsimageview within interface-builder.

swift nsimage nsimageview

sql server - Error in creating tables in SQL -



sql server - Error in creating tables in SQL -

i'm trying create few tables in new database, when seek create them creates couple of errors. i'm using microsoft sql server management studio.

the errors seem in end of code i'm trying add together constraints foreign keys. help appreciated give thanks you.

here's code, it's meant generate 3 tables 1 table containing 2 foreign keys other tables matching column names.

create table customers ( customerid int not null primary key identity, contactname varchar(50) null, company varchar(45) null, phone varchar(12) null, ) create table shippers ( shipperid int not null primary key identity, company varchar(45) null, phone varchar(12) null, ) create table orders ( orderid int not null primary key identity, orderdate datetime null, shippeddate datetime null, shipperid int null, freight decimal null, customerid int null, constraint fk_orders_shippers foreign key shipperid references shippers(shipperid) on delete no action on update no action constraint fk_orders_customers foreign key customerid references customers(customerid) on delete no action on update no action )

and these errors get:

msg 102, level 15, state 1, line 21 wrong syntax near 'shipperid'.

msg 102, level 15, state 1, line 23 wrong syntax near 'action'.

msg 102, level 15, state 1, line 28 wrong syntax near 'action'.

any ideas problem is?

the error messages point couple of surplus commas, missing comma , improper foreign key syntax due missing parentheses.

this right version:

create table customers ( customerid int not null primary key identity, contactname varchar(50) null, company varchar(45) null, phone varchar(12) null -- surplus comma removed ) create table shippers ( shipperid int not null primary key identity, company varchar(45) null, phone varchar(12) null -- surplus comma removed ) create table orders ( orderid int not null primary key identity, orderdate datetime null, shippeddate datetime null, shipperid int null, freight decimal null, customerid int null, constraint fk_orders_shippers foreign key (shipperid) -- parentheses added references shippers(shipperid) on delete no action on update no action , -- comma added constraint fk_orders_customers foreign key (customerid) -- parentheses added references customers(customerid) on delete no action on update no action )

sql sql-server

java - Display JTable in JPanel -



java - Display JTable in JPanel -

i've been trying add together jtable jpanel, yet doesn't appear there. i've searched through other questions, solutions proposed there didn't help me.

the function below part of class extends jframe. "repaint" bufferedimage, "imagelabel" jlabel , "image" imageicon.

public void showtable() { seek { repaint = imageio.read(new file("filename.jpg")); } grab (ioexception e) { } graphics g = repaint.creategraphics(); g.setfont(font); g.setcolor(black); string[] columnsname = {"id","text"}; object[][] info = {{new integer(1),"text one"},{new integer(2),"text two"}}; jtable table = new jtable(data, columnsname); jscrollpane tablecontainer = new jscrollpane(table); image = new imageicon(repaint.getscaledinstance(sizex,sizey, image.scale_smooth)); imagelabel.seticon(image); imagelabel.add(tablecontainer,borderlayout.center); getcontentpane().add(imagelabel); pack(); setvisible(true); repaint(); revalidate(); }

what want accomplish display table on loaded image.

thanks in advance help :)

i'm not sure if understood correctly, want set table , image below it, right? create jpanel borderlayout, set image (jlabel) on bottom (page end) , table (that scrollpanel created) on center. if need help adding items jpanel borderlayout, see how on tutorial: http://docs.oracle.com/javase/tutorial/uiswing/layout/border.html

i hope helps.

java swing jtable jpanel jlabel

regex - Ruby Reg Ex Identify Pipe Within Quotes -



regex - Ruby Reg Ex Identify Pipe Within Quotes -

i want regex identify pipe characters within double quotes.

i using

\".+\|.+\"

which correctly matches on '1|some "quote | text"|4' , correctly not match on '1|some "quoted" text|4'

however, matches on '1|some "quoted" text|4|5|6|more "quoted" text|9' because there 2 sets of quotes - sees outer-most quotes , pipes between.

how alter regex not match in case?

update: turns out need match on multiple pipes within quotes. had been using:

/\"([^|]+)\|([^|]+)\"/

which works 1 pipe within quotes, such "1|some "quote | text"|4", need match on "1|some "quote | text | | pipes"|4".

any ideas???

instead of using .+ matches character, want match character except |. want [^|]+. based on have written, should want.

ruby regex

java - Reading Nashorn JO4 and NativeArray -



java - Reading Nashorn JO4 and NativeArray -

java calling code:

import jdk.nashorn.api.scripting.*; .... mycustomhashmap datastore = new mycustomhashmap(); scriptenginemanager sem = new scriptenginemanager(); scriptengine engine = sem.getenginebyname("nashorn"); engine.put("datastore",datastore); engine.eval(new java.io.filereader("test.js")); ((invocable)engine).invokefunction("jstestfunc", "teststr" );

javascript:

function jstestfunc (testparam) { datastore.a = [1,2,3]; datastore.b = {first:"john",last:"doe",age:37}; }

goal:

i need jsonify datastore after script execution no dependence on script assistance datastore.a -> jdk.nashorn.internal.objects.nativearray datastore.b -> jdk.nashorn.internal.scripts.jo4

for each map value, i've tried , failed with:

casting scriptobject or scriptobjectmirror casting map or list accessing jo4/nativearray methods directly scriptutils.wrap() / scriptutils.unwrap()

i've tried overriding hashmap.put() method, appears not converted scriptobjectmirror on assignments, on explicit function calls:

datastore.x = [1,2,3] ; -> jdk.nashorn.internal.objects.nativearray javahost.javafunc( [1,2,3] ); -> scriptobjectmirror

i need utilize mycustomhashmap (it timestamps changes , maintains alter list, etc), can't radically alter arrangement. can info out?

this bug.

with jdk8u40 onwards, script objects converted scriptobjectmirror whenever script objects passed java layer - object type params or assigned object[] element. such wrapped mirror instances automatically unwrapped when execution crosses script boundary. i.e., java method returns object type value happens scriptobjectmirror object, script caller see scriptobject instance (mirror gets unwrapped automatically)

https://wiki.openjdk.java.net/display/nashorn/nashorn+jsr223+engine+notes

with jdk8u40 access release

java:

public class myobject extends hashmap<string, object> { @override public object put(string key, object value) { system.out.println("key: " + key + " value: " + value + " class: " + value.getclass()); homecoming super.put(key, value); } }

javascript:

var myobject = java.type("my.app.myobject"); var test = new myobject; test.object = {test : "object"}; test.array = [1,2,3];

console:

key: object value: [object object] class: class jdk.nashorn.api.scripting.scriptobjectmirror key: array value: [object array] class: class jdk.nashorn.api.scripting.scriptobjectmirror

java javascript nashorn

javascript - addClass('open') is not working in jquery -



javascript - addClass('open') is not working in jquery -

i facing weird problem. trying add together "open" class on condition. using next code.

$('.stereo-nav-pos .login-register').addclass("open");

but not working. have tried debug , came know appending "open" class , going jquery.js file,at end of jquery.js execution removing "open" class dom.

then have tried add together class called "openn" , worked fine. figuring out issue why jquery.js file remove "open" class dom?

if seek run code in console working fine.

can tell me what's going wrong here?

thanks in advance

i'm not sure if work or not, had encountered similar problem while ago. i've done used settimeout().

so may seek this:

settimeout(function(){ $('.stereo-nav-pos .login-register').addclass("open"); },10);

this allow function add together class open after while doesn't gets removed other jquery function.

javascript jquery css css3

php - htaccess for links with ? and non numeric parameter -



php - htaccess for links with ? and non numeric parameter -

in .htaccess have:

<ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^name/body/test$ http://%{http_host}/new_name [l,r=301] #1 - ok rewriterule ^name-450$ http://%{http_host}/name450[l,r=301] #2 - ok rewriterule ^name.php?id=13&new_id=8$ http://%{http_host} [l,r=301] #3 - not working rewriterule ^data/others/aaa/all/bbb/all/ccc/750$ http://%{http_host}/new_data [l,r=301] #4 - not working rewriterule ^data/others/aaa/1/bbb/2/ccc/750$ http://%{http_host}/new_data [l,r=301] #5 - ok rewriterule ^?num=123$ http://%{http_host} [l,r=301] #6 - not working </ifmodule>

why 3, 4 , 6 not working? how can create it?

rules 3 , 6 end beingness follows:

rewriteengine on rewritebase / rewritecond %{query_string} id=13&new_id=8 rewriterule ^name.php$ http://%{http_host}/? [l,r=301] rewritecond %{query_string} ^num=123$ rewriterule .* http://%{http_host}/? [l,r=301]

rule 4 looks fine me can suggest you're not testing properly.

php apache .htaccess mod-rewrite

c++ - Using NtAllocateVirtualMemory() via GetProcAddress will not compile -



c++ - Using NtAllocateVirtualMemory() via GetProcAddress will not compile -

i'm trying utilize ntallocatevirtualmemory project , i'm sure others have had success w/it, not compile on vsc++ 2010 nor mingw. on both compilers says

farproc: many arguments call

does know how can code compile? time.

farproc ntallocatevirtualmemory; ntallocatevirtualmemory = getprocaddress(getmodulehandle("ntdll.dll"), "ntallocatevirtualmemory"); printf( "ntallocatevirtualmemory %08x\n", ntallocatevirtualmemory); returncode = ntallocatevirtualmemory(getcurrentprocess(), &baseaddress, 0, &regionsize, mem_commit | mem_reserve, page_execute_readwrite);

you need cast result getprocaddress function pointer of right type. in case:

typedef ntstatus winapi (*pntallocatevirtualmemory)(handle processhandle, pvoid *baseaddress, ulong_ptr zerobits, psize_t regionsize, ulong allocationtype, ulong protect); farproc navm = getprocaddress(...); pntallocatevirtualmemory ntallocatevirtualmemory = (pntallocatevirtualmemory)navm; ...

of course, much easier utilize virtualalloc.

virtualalloc(&baseaddress, regionsize, mem_commit | mem_reserve, page_execute_readwrite);

c++ winapi