Posts

Showing posts from May, 2012

.net - If one product belong to two or over categories. How show the category Breadcrumbs at product page? -

i meet question: if customer view 1 product under category, product belong 2 categories, show first [0] category name @ breadcrumbs. how show product breadcrumbs, if customer browse products under category2, @ breadcrumbs show home/category2/productname, not home/category1/productname, think customer feeling strange that, saw website greatfactoryz.com , product breadcrumbs show categories home/[category1] [category2]/productname, don't think solution, has solution ideas?

javascript - Typescript, NodeJS, ES6 - findIndex on array -

so have issue using findindex es6 function on array in typescript , nodejs. the error message i'm getting is: requesttype.findindex not function this code: let weatherstates:array<string> = ['current', 'forecast']; let requesttype:string = 'current'; requesttype.findindex(weatherstates); and error gets thrown, i'm able use sorts of other es6 functionalities though, arrow functions etc. it looks polyfill available in lib.core.d.ts typing though. here mytsconfig.json setup: { "compileroptions": { "module": "commonjs", "target": "es6", "sourcemap": true }, "exclude": [ "node_modules", "typings" ] } i'm new typescript appreciated! requesttype not array in example. string.

javascript - React-Redux connected component not passing updated props to child component -

child components (mapleftnav, map) not rerendering when application state changed. has parent component (mapview) , several siblings. assumptions: 1) app state changing , being tracked redux the action showing in redux dev tools, updated fields; i'm logging vehiclesstate in parent component (mapview), changing; 2) reducer not mutating state ( gist here ) -redux dev tools , parent ( connect ed compoent) happily picking changes case new_messages: return reducevehiclemessagestovehicles(state, action.payload) and function returns: return { vehicles: updatedvehicles, traces: updatedtraces, vehiclemessagesloading: messagesloading, } 3) parent component ( mapview, gist here ) receiving new props not child mapleftnav i console.log props , change in parent component i write fake componentwillreceiveprops (nextprops) {console.log(nextprops)} , function never fired child mapleftnav component. <mapleftnav mapstate={mainmap} push={push} vehicles

android - onItemClickListener stops working after changing visibility of item child -

<?xml version="1.0" encoding="utf-8"?> <relativelayout /* not important */> <textview /* not important */ /> <textview /* not important */ /> <relativelayout /* not important */ android:id="@+id/detaillayout" android:visibility="gone"> <textview /* not important */ /> </relativelayout> </relativelayout> . private class itemclicklistener implements adapterview.onitemclicklistener { @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { relativelayout detaillayout = (relativelayout) view.findviewbyid(r.id.detaillayout); int detaillayoutvisibility = detaillayout.getvisibility(); if(detaillayoutvisibility == view.gone) { detaillayout.setvisibility(view.visible); } else { detaillayout.setvisibility(view.gone)

c++ - gcc-5.2 cilk plus offload to intel gfx hardware -

can offload graphics hardware using cilk plus gcc-5.2 g++ -std=c++14 -wall -o3 -march=native -fcilkplus vec_add.cpp -o vec_add vec_add.cpp:6:0: warning: ignoring #pragma offload target [-wunknown-pragmas] #pragma offload target(gfx) pin(out, in1, in2 : length(n)) the compiler gives above warning following test code: #include <iostream> #include <cilk/cilk.h> void vec_add(int n, float *out, float *in1, float *in2) { #pragma offload target(gfx) pin(out, in1, in2 : length(n)) cilk_for(int = 0; != n; ++i) { out[i] = in1[i] + in2[i]; } } static int ar_sz = 100000; int main (int argc, char **argv) { float foo[ar_sz]; float bar[ar_sz]; float out[ar_sz]; for(int = 0; != ar_sz; ++i) { foo[i] = + ar_sz * 10; bar[i] = i; } vec_add(ar_sz, out, foo, bar); for(int = 0; != ar_sz; += 100) { std::cout << "foo[" << << "] =" << foo[i] << "\t|\tba

mysql - One to Many Join with Aggregate Function (Max) -

i have 2 tables. table 1: +---------+---------+ | lead_id | deal_id | +---------+---------+ | 2323 | null | | 2324 | 1199 | | 2325 | null | | 2326 | null | | 2327 | 1080 | +---------+---------+ table 2: +---------+-------------+-------------+------------+ | deal_id | stage_from | stage_to | changedate | +---------+-------------+-------------+------------+ | 1199 | incoming | stage1 | 01-dec-14 | | 1199 | stage1 | incoming | 05-dec-14 | | 1199 | incoming | stage1 | 12-dec-14 | | 1080 | incoming | unqualified | 06-dec-14 | | 1080 | unqualified | stage2 | 07-dec-14 | i add "changedate" each deal_id has record in table 2 stage changed "incoming" "stage1". in cases stage changed "incoming" "stage1" multiple times, want maximum date i.e. december 12, 2014 in example rather december 1, 2014. resulting table should be: +---------+---------+-

.htaccess - Why does my Url doesnt drop the current page instead it adds it with the new Link -

Image
hi have written htaccess rule based on sources problem wanted have clean url have done problem doesn't work see image below i'm on service page atmt if wanted go page the url doesnt drop 1st link instead goes next page adding new link causing not found error.. i've been having hard time finding solution 1 can please tell me did go wrong rule on htaccess doing this? here .htaccess rewriteengine on rewritebase / rewritecond %{http:x-forwarded-proto} !https rewritecond %{https} off rewriterule .* https://%{http_host}%{request_uri} [l,r=301] rewritecond %{http_host} !^www\. rewriterule ^ https://www.%{http_host}%{request_uri} [l,r=301,ne] rewritecond %{the_request} \s/*(.*?)/index\.php [nc] rewriterule ^ %1/ [r=302,l] rewritecond %{the_request} \s/+(.+?)\.php[\s?] [nc] rewriterule ^ /%1/ [r=302,l] rewritecond %{request_filename} !-f rewriterule ^[^.]*?[^/.]$ %{request_uri}/ [l,r=302] rewritecond %{request_filename}.php -f rewriterule ^([^.]+?)/?$ $1.php [l]

python - compiled calling config file -

i'm compiling python application using pyinstaller. the structure - d:\app\myprog.exe d:\app\config\settings.conf if run myprog.exe --switch value d:\app runs fine, if try run anywhere else c:\windows it's not finding settings.conf file complaining message: traceback (most recent call last): file "<string>", line 284, in <module> file "<string>", line 218, in main file "configparser.py", line 330, in configparser.nosectionerror: no section: 'database' myapp returned -1 database being first line in config file i'm trying reference. i'm referencing base_dir app here - # global path , config info try: base_dir = os.path.dirname(os.path.abspath(__file__)) except nameerror: # main py2exe script, not module base_dir = os.path.dirname(os.path.abspath(sys.argv[0])) so can config file - config = rawconfigparser() config.read(os.path.join(base_dir, 'config/settings.conf'))

php - How to get mysqli error in different environments? -

in local/dev environment, mysqli query performing ok . however, when upload on webhost environment, got error; fatal error: call member function bind_param() on non-object in... here code: global $mysqli; $stmt = $mysqli->prepare("select id, description tbl_page_answer_category cur_own_id = ?"); $stmt->bind_param('i', $cur_id); $stmt->execute(); $stmt->bind_result($uid, $desc); to check query, tried execute query via control panel phpmyadmin , result ok . if there lacking information, please tell me can provide. first of all, have line before mysqli connect in all environments: mysqli_report(mysqli_report_error | mysqli_report_strict); after mysql errors transferred php exceptions. uncaught exception, in turn, makes php fatal error. thus, in case of mysql error, you'll conventional php error, instantly make aware of error cause. stack trace lead exact spot error occurred. note have able see php errors in general . ,

android - Fragment content gets cut off -

Image
i developing android game. have problem content inside fragment. content gets cut off , not able find problem. use resource directory, define different layouts. why know problem lies in layouts. first thought has fact used android:layout_height="match_parent" . found solution on stackoverflow , hoped solve problem. did not me @ all. i have activity_game.xml . there have placeholder current displayed fragment . content following: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/a

tokenize - How to replace a token on deploy through TFS 2015 Release hub on Web Access? -

i have team working on windows service project , need have environment specific configurations set in *.exe.config file. have set transformations leave behind token if build made release configuration. now need create release definition using new integration in release hub through web access; have come across multiple solutions based on server/client solution microsoft used release management have found no analogue in tfs 2015 web access. so, there out of box task replace tokens on services configuration file? or need create powershell script capable of said functionality, copy target server , run replace manually? i'm working deploy manager , have access agents , tfs server through website access. the tokenizer task not available out of box in tfs 2015.2. tfs 2015 supports installing extensions , can install tokenizer task marketplace. it comes part of release management utility tasks download vsix package. while downloading show instruction on how install

junit - No EJBContainer provider available: no provider names had been found -

i'm getting following exception on running test case, service class. javax.ejb.ejbexception: no ejbcontainer provider available: no provider names had been found. @ javax.ejb.embeddable.ejbcontainer.reporterror(ejbcontainer.java:216) @ javax.ejb.embeddable.ejbcontainer.createejbcontainer(ejbcontainer.java:146) @ javax.ejb.embeddable.ejbcontainer.createejbcontainer(ejbcontainer.java:102) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.junit.runners.model.frameworkmethod$1.runreflectivecall(frameworkmethod.java:47) @ org.junit.internal.runners.model.reflectivecallable.run(reflectivecallable.java:12) @ org.junit.runners.model.frameworkmethod.invokeexplosively(frameworkmethod.java:44) @ org.junit.internal.runners.statements.runbefores.evaluat

android - How AccountManager knows what Google account to use? -

i trying implement google rest api drive v3 in android. but getting autherror { "error":{ "errors":[ { "domain":"global", "reason":"autherror", "message":"invalid credentials", "locationtype":"header", "location":"authorization" } ], "code":401, "message":"invalid credentials" } } i use accountmanager token user, , think access wrong console account. how know account access? this accountmanager code, user token. invalidate before accountmanager.invalidateauthtoken bundle options = new bundle(); options.putstring(accountmanager.key_android_package_name, context.getpackagename()); accountmanager.getauthtoken(account, scope, options, context, callback, null); as per account manager doc

Grails spring security not working: Local Auth (No LDAP) -

i trying log in database user created in bootstrap file, keep getting error: sorry, not able find user username , password. i've checked various tutorials working 2.4 plugin of spring, , don't know i'm missing. please me...i need figure out :s my models are: user: class user { transient springsecurityservice string username string password boolean enabled = true boolean accountexpired boolean accountlocked boolean passwordexpired static transients = ['springsecurityservice'] static constraints = { username blank: false, unique: true password blank: false } static mapping = { password column: '`password`' } set<role> getauthorities() { userrole.findallbyuser(this).collect { it.role } set } def beforeinsert() { encodepassword() } def beforeupdate() { if (isdirty('password')) { encodepassword() } } string tostring() { return username } protected void encodepassword() { password =

Sort records based on country from xml using php -

i have 1 excelsheet write data , export in xml data , got xml format below parse record using php usign below code have 1 country dropdown want display record based on selected country means display record in post using php dropdown,but no parent child relation ship can there way so? <row> <cell><data ss:type="string">dr. nair</data></cell> <cell><data ss:type="string">12121 brok blvd. </data></cell> <cell><data ss:type="string">west indies</data></cell> <cell><data ss:type="string">wi</data></cell> <cell><data ss:type="number">90025</data></cell> <cell><data ss:type="string">310-444-1212</data></cell> </row> <row> <cell><data ss:type="string">dr. july</data></cell> <cell><data ss

python - YIN algorithm to find fundamental frequency -

Image
i try find fundamental frequency several algorithms. i found yin algorithm( http://audition.ens.fr/adc/pdf/2002_jasa_yin.pdf ) i follow steps , write code. the autocorrelation function document is: and expected graph : so sample code is: def auto(lag, samples): window_size = 1100 total_index = len(samples) zero_padded = np.append(samples, np.zeros(window_size)) corr = [] t in range(total_index): r = 0 j in range(t+1, t+window_size): r += zero_padded[j] * zero_padded[j+lag] corr.append(r) plt.plot(corr) plt.show() but got graph: how should edit code?

onitemclicklistener - Search in ListView android -

i'm using following class search in listview of countries package com.androidhive.androidlistviewwithsearch; import java.util.arraylist; import java.util.hashmap; import java.util.list; import android.app.activity; import android.content.context; import android.content.intent; import android.database.cursor; import android.os.bundle; import android.text.editable; import android.text.textwatcher; import android.view.inputmethod.inputmethodmanager; import android.view.view; import android.widget.adapterview; import android.widget.adapterview.onitemclicklistener; import android.widget.arrayadapter; import android.widget.edittext; import android.widget.listview; import android.widget.simplecursoradapter; public class mainactivity extends activity { private listview lv; simplecursoradapter cursoradapter; arrayadapter<string> adapter; edittext inputsearch; private sqliteadapter mysqliteadapter; arraylist<hashmap<string, string>> productlist; public static f

servlets - undertow + Spring WebApplicationInitializer - Double initialization -

i migrating old web app. written old web.xml -style, want programmatically build servlet. this spring mvc app, deployed war module in ear under wildfly 10.0.0.final. i wrote implementation of spring's webapplicationinitializer (still using spring xml config @ moment, preceed step step - next step migrate javaconfig). though i'm stuck here because servlet initialized twice, , second time initilization fails due filter's name conflict - nullpointerexception after filter creation. this initilizer: public class mywebapplicationinitializer implements webapplicationinitializer { private static final logger log = loggerfactory.getlogger(mywebapplicationinitializer.class); /** * @see org.springframework.web.webapplicationinitializer#onstartup(javax.servlet.servletcontext) */ @override public void onstartup(servletcontext container) throws servletexception { log.debug("******* initializing web app *******"); xmlweba

Cannot Close Android App - React Native -

i have created android app react native plays radio using module. https://github.com/estebanfuentealba/react-native-android-audio-streaming-aac i have used following code in function, aacstreamingandroid.seturlstreaming(channel); aacstreamingandroid.play(); i cannot close app once start radio , stop it.the app continues stay in background. can help?

How to add data along with dojo get request -

here example of dojo post request require(["dojo/request", "dojo/domready!"], function (request) { request.post("newjsp.jsp", { data: { color: "blue" } }).then(function (response) { alert(response); }, function (error) { alert(error); }); }); in code have attched attribute color data how in dojo request require(["dojo/request", "dojo/domready!"], function (request) { request.get("newjsp.jsp", { data: { color: "blue" } }).then(function (response) { alert(response); }, function (error) { alert(error); }); });

oop - Go: Ensuring embedded structs implement interface without introducing ambiguity -

i'm trying clean code base doing better job defining interfaces , using embedded structs reuse functionality. in case have many entity types can linked various objects. want define interfaces capture requirements , structs implement interfaces can embedded entities. // entities implement interface type entity interface { identifier() type() } // interface entities can link foos type foolinker interface { linkfoo() } type foolinkerentity struct { foo []*foo } func (f *foolinkerentity) linkfoo() { // issue: need access identifier() , type() here // foolinkerentity doesn't implement entity } // interface entities can link bars type barlinker interface { linkbar() } type barlinkerentity struct { bar []*bar } func (b *barlinkerentity) linkbar() { // issues: need access identifier() , type() here // barlinkerentity doesn't implement entity } so first thought have foolinkerentity , barlinkerentity implement entity interface. // implementation o

ios - UIDatePIcker TouchUp Events programmatically in swift -

the following code using swift language not worked touchup events uidatepicker. var datepickerview : uidatepicker! self.datepickerview = uidatepicker.init(frame: cgrectzero) self.datepickerview.addtarget(self, action: #selector(ndsignupviewcontroller.dateaction(_:)), forcontrolevents: uicontrolevents.touchupinside) self.dateofbirthtextfield.inputview = self.datepickerview func dateaction(sender: anyobject) { //... } use uicontrolevents.valuechanged instead of uicontrolevents.touchupinside . hope :)

node.js - update multiple records using mongoose in node with dynamic query -

i gone through below answers:- update multiple records using mongoosejs in node update multiple docs different values but in case query dynamic , means need query dynamically based on obj, not sure if foreach goof solution there better alternative same, taking time in each time. req.body.foreach(function (obj) { mymodel.find( { country: obj.country, product: obj.product, month: parseint(obj.month), } ).update({ $set: { value: parseint(obj.value), 'lastmodified': date.now() } }, { upsert: true}, function (err) { //callback(); if (err) { return res.status(500).send(err); } return res.status(200); } ); don't know if helpful looked weren't sure parsing req.body find documents. pseudo code. maybe give idea. app.put("/post",

java - Custom button drawable state_pressed and state_checked not working on CheckBox or RadioButton - Android -

i setting custom drawable checkbox button, android:state_checked="true" , android:state_checked="false" seem work. other states aren't working. i unable set custom drawable on pressed state. this selector using: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true" android:drawable="@drawable/radio_btn_selected" /> <item android:state_checked="false" android:drawable="@drawable/radio_btn_normal" /> <item android:state_pressed="true" android:drawable="@drawable/radio_btn_pressed" /> <item android:state_focused="true" android:drawable="@drawable/radio_btn_pressed" /> <item android:drawable="@drawable/radio_btn_normal"/> <!-- default --> </selector> this how setting

matlab - Export an 3000x2512 complex double to tiff file -

i created 3000x2512 complex double matrix each cell represent value. want export matrix tif file can further image processing in application (arcmap). what's best way ? please note, i'm not matlab user usually. tried use (i = matrix): imwrite(i, 'my_graphics_file.tif','tif'); but output blank tif file. know matrix works because when try display figure, can view successfully. thank much! you can not expect tiff file complex matrix. maybe want create 2 images, 1 real part: imwrite(real(i), 'my_graphics_file_real.tif','tif'); and 1 imaginary part imwrite(imag(i), 'my_graphics_file_imag.tif','tif'); or alternatively absolute value , phase. aware imwrite double matrix input assumes value within [0,1].

php - OpenCart 2 - Show Category Title on Product Page -

i searched , found results, modules , solution open cart 1, want open cart 2. in product.tpl <ul class="list-unstyled"> <?php if ($manufacturer) { ?> <li><?php echo $text_manufacturer; ?> <a href="<?php echo $manufacturers; ?>"><?php echo $manufacturer; ?></a></li> <?php } ?> <li><?php echo $text_model; ?> <?php echo $model; ?></li> <?php if ($reward) { ?> <li><?php echo $text_reward; ?> <?php echo $reward; ?></li> <?php } ?> <li><?php echo $text_stock; ?> <?php echo $stock; ?></li> </ul> i want show category title in list. not find option in admin panel decided manually. know must in product.php no idea how product name $data['category_title'] = $this->request->get['category_title']; thanks in advance pedram, website url should index.ph

Custom validation in yii2 -

i have custom validation in model [['abc1','abc2','abc3','abc4', 'skiponempty' => false,], 'required', 'when' => function ($model) { if ($model->xyz == 1){ return true; }else{ return false; } }, 'skiponempty' => false, ], where $model->xyz dropdownlist. validation working fine due validation forms not working well, specially use session. please tell me other way kind of validations

windows 10 iot core - IOT: Only one usage of each socket address (protocol/network address/port) is normally permitted -

i'm trying run first iot on raspberry pi 3. but using code .... public void startserver() { task.run(async () => { listener = new streamsocketlistener(); listener.control.keepalive = true; listener.control.nodelay = true; await listener.bindservicenameasync(port.tostring()); }); } i error @ bindservicenameasync... exception thrown: 'system.runtime.interopservices.comexception' in mscorlib.ni.dll winrt information: 1 usage of each socket address (protocol/network address/port) permitted. in appmanifest have checked "internet (client & server)". any idea why error? thanks most port trying use being used process. try different port.

Visual Studio Reports (RDLC): html tags are ignored -

i'm using visual studio reports render html text, using built-in option set placeholder html text. now, works 1 thing: have problem <font> tags. in particular, if set size in points, like: <font size="5pt"> text </font> or even: <font style="font-size:5pt">5pt line</font> this gets ignored completely. should note both above examples work fine in web browsers, , <font> 1 of officially supported tags in rdlc. what's going on here?? the font tag doesn't seem supported, using span tag work. set following expression value of placeholder , render correctly: ="<span style='font-size:5pt'> text </span>" also, ensure 'markup type' set 'html' in placeholder properties. https://msdn.microsoft.com/en-us/library/cc645967.aspx

python - Exact user defined expressions in Sympy derivatives -

Image
i using sympy calculate derivative of complicated potential. have defined x, y, d0, e, c, k, d, b sympy symbols. go on following definitions: import sympy sm x, y, d0, e, c, k, d, b = sm.symbols("x, y, d0, e, c, k, d, b") phi = sm.atan2(y,x) d = d0 + e*d0*sm.sin(k*phi) rho = sm.sqrt(x**2 + y**2) u = (2**b)/((2*d-d)**b)*(d - rho)**b the symbol "u" stands 2d potential. now when differentiate vs. x using: sm.simplify(u.diff(x)) i extremely long answer: as can see, in answer there explicitly full expression e.g. d : d0 + e*d0*sin(k*phi) . also, instead of sin(phi) sin(atan2(x,y) , same happens of defined expressions. is there way result automatically show definitions instead of long versions, without having need use subs method every single user-defined variable? e.g. instead of d0 + e*d0*sin(k*phi) sympy automatically uses symbol d ? when write phi = sm.atan2(y,x) , assigns python variable result of atan2(y, x) . if want phi symbol,

jquery - When hovering over one image, change another 2 images -

i have stupidly shaped nav bar , proving incredibly hard use onmouseover effects. basically, when hover on button, i'd 2 images either side change image mouse hovering over. possible? my navbar code: <div align="left" id="navbar"> <ul class="navbarlist"> <li><a href="news.html"><img src="images/news.png" onmouseover="this.src='images/newshover.png'" onmouseout="this.src='images/news.png'"></a></li> <li><img src="images/newsspace.png"></li> <li><a href="print.html"><img src="images/print.png"onmouseover="this.src='images/printhover.png'" onmouseout="this.src='images/print.png'" ></a></li> <li><img src="images/printspace.png"></li> <li><a href="design.html"><img s

reading a specific file from sdcard in android -

how read specific file sdcard. have pushed file in sdcard through ddms , trying read though way give me exception. can tell me how point on file? my code this. string path = environment.getexternalstoragedirectory().getabsolutepath(); fileinputstream istream = new fileinputstream(path); you trying read directory... need file! this... then, can read file want. file dir = environment.getexternalstoragedirectory(); file yourfile = new file(dir, "path/to/the/file/inside/the/sdcard.ext");

Giving command line arguments to java program over git-bash -

i'm working on program zip , unzip files/directories , behaves kind of weird when call on git bash. the program takes 3 arguments (zip/unzip, inputpath, outputpath). example: java -jar zip_unzip.jar --zip h:\\zip_test h:\\test5\zip_test_4.zip everything works fine when call on eclipse or cmd. creates directory structure if doesn't exist , zips input folder newly created output folder. when call on git bash in example above somehow "ignores" backslash , instead of creating folder called test5\ , creates zip-archive called test5zip_test_4.zip here's snippet of code takes care of creating directory structure, zippedfolder outputpath-parameter: file directorytozip = new file(inputfolder); string targetzippedfolder = zippedfolder; targetzippedfolder = targetzippedfolder.replace("\\", "/"); //create directory store archive in, if doesn't exist file destdir = new file(targetzippedfolder.substring(0, targetzippedfolder.lastindexof(&q

android - AS3 Moving vertical and on a random point -

i have code here should have linked movie clip generated randomly on top of stage. generate randomly not on top. items generated supposed move down , disappear, doesn't. i making game designed android smartphones.. multitouch.inputmode = multitouchinputmode.touch_point; //create enemies array var enemies:array; enemies = new array(); makeenemies(); moveenemies(); //call function how many enemies want make... function makeenemies():void { var tempenemy:movieclip; //make sure library item linkage set enemy... tempenemy = new enemy(); tempenemy.speed = 20; tempenemy.x = math.random()* 800; tempenemy.cacheasbitmapmatrix = tempenemy.transform.concatenatedmatrix; tempenemy.cacheasbitmap = true; trace("enemy"); addchild(tempenemy); enemies.push(tempenemy); tempenemy.addeventlistener(mouseevent.click, killenemies); } function killenemies(event:mouseevent):void { trace("tap"); } //create enemies array if no

Azure site-to-site VPN -

we trying set connection azure client of ours. need connect site on existing vpn have our office. connection should this. azure --> our site --> client site. we have working vpn azure , client. telnet or ping not working client site. configured routing between 2 vpn's , looks good. think wrong config on azure site. maybe know be? or how set up? azure config info: azure resource manager model local network gateway configured right subnets vpn in azure policy based. thanks in advanced! two issues @ on azure side: 1. on s2s vpn settings, @ addressprefix configured local network gateway. prefix client side included? look @ routing, did create custom route table? if yes, make sure has route client site prefix. hope helps.

javascript - PhpStorm HTML inspection issue -

Image
i can't figure out why phpstorm ide treating src html attribute javascript code (or kind of regular expression). after code inspection error assigned "javascript validity issues". have resolved error before? can solve other way turning off inspection? as @lazyone wrote, solution issue uncheck xml: img/@src language injection in settings/preferences | editor | language injections :

c# - Validate content-length before model binding ASP.NET Web Api -

i wondering how can validate content-length before request body read model binder in asp.net web api. i can in action it's waste of resources because stream has been read? var contentlength = request.content.headers.contentlength; if (contentlength > 1024*1024*20) { throw new httpresponseexception(httpstatuscode.requestentitytoolarge); } is ok in action filter? if using owin hosting api, , want globally apply restriction requests, make check in simple owin middleware executed before web api in owin pipeline: app.use(async (c, n) => { var request = c.request; if (request != null) { string[] headervalues; if (request.headers.trygetvalue("content-length", out headervalues)) { var lengthvalue = headervalues.first(); if (convert.toint64(lengthvalue) > 1024 * 1024 * 20) { c.response.statuscode = (int)httpstatuscode.requestentitytoolarge; re

ember.js - tinyMCE plugin with Ember -

i writing own tinymce plug-in needs access ember context, such service. it seems tinymce loads plugins @ load time, before have chance intervene or override anything. is there more elegant alternative exporting ember application global , accessing within plugin? is feasible avoid tinymce's plugin loading architecture altogether , add own call tinymce.pluginmanager.add within ember code? i solved problem writing ember service calls tinymce.pluginmanager.add @ initialization time.

unity3d - Stack overflow with C# and Mono, recursive function -

i'm using unity3d based on mono framework , c#. function below throw stack overflows. cannot figure out these come from; nowadays tends happen infinite loops, mine isn't. works fine 8x8x16 voxels, crashes @ 16x16x32 voxels. put lock in because figure might happen function fired second time before first finished. int floatingvoxelsflood(int x, int y, int z, ref bool[] voxelsattached) { if (getpixel(x, y, z).a > 0.5f) return 0; int id = getpixelid(x, y, z); if (voxelsattached[id]) return 0; voxelsattached[id] = true; int count = 1; int minx = x-1; int maxx = x+1; if (minx >= 0) count += floatingvoxelsflood(minx, y, z, ref voxelsattached); if (maxx < volumewidth) count += floatingvoxelsflood(maxx, y, z, ref voxelsattached); int miny = y-1; int maxy = y+1; if (miny >= 0) count += floatingvoxelsflood(x, miny, z, ref voxelsattached); if (maxy < volumeheight) count += floa

Can I view a colleague's calendar over API for Google Calendar for business? Want to use this for detecting possible times to schedule meetings -

i can see calendars on web when sign on, can retrieve api? hope able build intelligent meeting assistant. as seen in calendar resource api docs right now: the google data calendar resource api deprecated , scheduled sunset in january 2017. apps should instead use directory api 's calendar resource object. as suggested directory api , think use resources.calendars.get described in docs (with parameters): retrieves calendar resource. parameters : calendarresourceid - unique id of calendar resource retrieve. customer - unique id customer's google account . account administrator, can use my_customer alias represent account's customer id. -- think can specify user specific calendar from. hope helps give idea or something. luck. :d

javascript - automaticly genereated Set of values in a Array? -

how make array contain data values of varible random on time. im getting distance value varible ' rssi ' on time. save each postion along others in array ' arr ' this should done in javascript. var express = require('express'); var app = express(); var server = require('http').createserver(app); var io = require('socket.io')(server); var port = process.env.port || 8000; var rssi = {}; server.listen(port,function(){ console.log('server listening @ port %d', port); }); // routing app.use(express.static(__dirname + '/public')); // server configuration var scanner = io.of('/scanner'); scanner.on('connection',function(socket){ console.log('scanner connected'); socket.on('devicedata1',function(msg) { var rssi = msg.rssi; var arr = [];

ruby on rails - Modify Nested_Field before adding association Cocoon -

after user submits form, before association added, possible modify nested field during time? for example nested fields may like: <div class='nested-fields'> <div class="field"> <%= f.label :count %> <%= f.number_field :count %> </div> <%= link_to_remove_association "remove section", f %> </div> say want multiply count x 2 before adding association (after user submits form). possible? or more complex example, might want convert integer string save association. link issue: https://github.com/nathanvda/cocoon/issues/361 (i told post on so) yes, can modify permit params: def some_params params.require(:some).permit(:count).tap |white_list| white_list[:count] = 2 * params[:some][:count].to_i end end

php - How can I set POST data to null if not alphanumeric? -

i posting allot of form data query. want set post data null or remove special characters if not alphanumeric , rest keep there values? is there quick way can in bulk? if (!isset($_post) || !ctype_alnum($_post)){ // post equals null }else{ // nothing } foreach($_post $key => $value) { if (empty($value) || !ctype_alnum($value)) { // remove non alphanumeric chars $_post[$key] = preg_replace("/[^[:alnum:]]/i","",$value); } }

html - How to deal with BEM in large modules? -

i'm working on first project using bem. i'm loving there's 1 thing can't head around: nesting solutions larger modules. have search lot , there many topics on stackoverflow, examples obvious. in 'real' world not can seen seperate modules. for example: i'm building big timeline module. consists of timeline bar, contains bullets , labels. each bullet has article block consist of image, title, subtitle , link. the bem code seams inefficient me: timeline timeline__bar timeline__bullet timeline__label-year timeline__label-month timeline__article timeline__article-image timeline__article-title timeline__article-subtitle timeline__article-link now understand can split in different sub-modules. this: timeline timeline__bar timeline__bullet timeline__label-year timeline__label-month timeline__article article article__image article__title article__subtitle article__link but relevant when article own 'thingy'. in case specific timeline-only ar

angularjs - PhantomJS exited unexpectedly with exit code 3221225477 -

i'm using phantomjs combined grunt , jasmine run unit tests angularjs application. i'm experiencing strange behavior when unit tests become many. in case 754/755 unit tests. unit tests run fail following message running phantomjs...error 0 [ '' ] warning: phantomjs exited unexpectedly exit code 3221225477. use --force continue. aborted due warnings. when comment out old tests, number become less 754/755 works fine. when tests becomes many(more 754/755) error appears. believe memory allocation of phantomjs, couldn't find connected error code - 3221225477 , couldn't sure. haven't find solution workaround commenting unit tests. problem occurs on windows 7 machine, same test build works on macos without problem, no matter how many unit tests there, connected os. i appreciate suggestions it, thanks! i believe phantomjs has run out of memory. download , extract phantomjs 2.x http://phantomjs.org/download.html set

jquery - How to override ajax base url? -

i'm developing 2 projects under 1 solution api , web application. i'm using visual studio 2012 , ports each project different when debugging, e.g. localhost:32335 , localhost:21890 , each time need use api need set localhost port. i come solution set default port example 1337, , in host file set example.com localhost:1337 , need use example.com/api/someaction . what want set base url in ajax don't have retype example.com in code, need type /api/someaction , ajax call use example.com default, not localhost:33181. start work iis . create different application different domain name , edit hosts file use address. don't use cassini. each application , create application in iis. add binding , , create different domain names in hosts file.

python - How to pass variables into next function without using global -

i'm looking how can take variables i've saved next function. illustrate mean, i'm getting latest version number online such: try: webversion = urllib2.urlopen( "http://www." + server + "/version").read().rstrip() if webversion > version: update_files() elif version >= webversion: print "[system] have latest version: v." + version in update_files() function, take variable i've gained ( webversion , possibly version ) on next function. i'm thinking of setting variable global: try: global webversion webversion = urllib2.urlopen( "http://www." + server + "/version").read().rstrip() if webversion > version: update_files() elif version >= webversion: print "[system] have latest version: v." + version is there better way/smarter this? just pass arguments function: function definition:

c# - Parsing web page with HtmlAgilityPack and simulate a click -

i scraping web page using hap, , want access submit button on page problem don't know how done in hap , c#, there way this? the html agility pack not browser, while can parse html file, there no way interact it. can find submit object, read properties , forth, can't make anything. you have 2 options: either read form, build http request object matches forms fields , post method , send server. manual work. agility pack helps list fields on form , properties if need interact page you'll need browser. there headless browsers, phantomjs, load page, parse javascript , run what's sent server. there wrappers around wrappers c#, 1 of such examples awesonium . it's similar html agility pack in allows parse html documents, takes 1 step further, running without ever showing browser screen.

winforms - Email id address issue in c# code -

i wrote simple program in c# winforms sending email , code mentioned below:- public partial class form1 : form { public form1() { initializecomponent(); } public mailmessage rtnmail() { string = txt_to.text; string = txt_from.text; string subject = txt_subject.text; string body = txt_body.text; mailmessage message = new mailmessage(from, to, subject, body); return message; } //button click event private void btn_send_click(object sender, eventargs e) { smtpclient smtp = new smtpclient("smtp.gmail.com"); smtp.port = 587; smtp.credentials = new system.net.networkcredential("myanotherid@gmail.com", "password"); smtp.enablessl = true; smtp.timeout = 500000; smtp.send(this.rtnmail()); } } when run code

javascript - Json Login with multiple user credentials -

i trying login form using json, below code: <html> <head> <title> login form</title> <script> function validate(){ var username = document.getelementbyid("username").value; var password = document.getelementbyid("password").value; var userlist = [{"username":"asdf", "password":"123"}, {"username":"zxc", "password":"123"}] var jobj = json.parse(userlist); (var i=0; < jobj.length; i++) { if ( username == jobj.username && password == jobj.password) { alert ("login successfully"); } else{ alert("invalid username , password"); } } }