Posts

Showing posts from April, 2011

ASP.net disallow name to be in Password Field -

i need user entry in tbname (textbox) to not allowed possible password in password text box. tbpass (textbox) how go this? have validation in password field 8 characters, 1 uppercase etc, need not allow users name part of password creating. use comparevalidator notequal option <asp:textbox id="tbname" runat="server" /> <asp:textbox id="tbpass" runat="server" /><br> <asp:requiredfieldvalidator runat="server" controltovalidate="tbname" errormessage="name required"/><br> <asp:requiredfieldvalidator runat="server" controltovalidate="tbpass" errormessage="pass required"/><br> <asp:comparevalidator runat="server" controltovalidate="tbname" controltocompare="t...

Android : How to use registerReceiver in BroadcastReceiver -

i want perform task when action_boot_completed intent, i'm using following code check if device plugged in method undefined type bootreceiver @ registerreceiver . can find solution? here i'm doing. public class bootreceiver extends broadcastreceiver { @override public void onreceive(final context context, intent intent) { if (intent.getaction().equalsignorecase(intent.action_boot_completed)) { if(ischarging()) dosomething(); //something perform after boot if plugged in } public boolean ischarging() { intentfilter filter = new intentfilter(intent.action_battery_changed); intent batterystatus = registerreceiver(null, filter); //getting error here boolean strstate; int chargestate = batterystatus.getintextra(batterymanager.extra_status, -1); switch (chargestate) { case batterymanager.battery_status_charging: case batterymanager.battery_status_full: strstate = true; break; ...

android - Can not locate config makefile for product "cm_oneplus2" -

i've been trying build asop rom oneplus two. i've made working-dir folder in ubuntu's home . installed required tools , scripts like, java, python, make, git , lib files. i've downloaded compressed sources(no .repo folder included), i've aosp5.1.0 folder me. i've downloaded them form here. ( heavily compressed android sources ). extracted them working-dir using terminal. i've cloned device tree repository https://github.com/krishna422/android_device_oneplus_oneplus2 working-dir/device/oneplus/oneplus2 i've cloned kernel source repository https://github.com/krishna422/android_kernel_oneplus_msm8994 working-dir/kernel/oneplus/oneplus2 i've cloned vendor tree repository https://github.com/krishna422/proprietary_vendor_oneplus working-dir/vendor/oneplus/oneplus2 so files in working-dir are, aosp5.1.0, device, kernel, vendor files in aosp5.1.0 files in aosp5.1.0 screenshot i've copied working-dir/...

Inheritance with abstract classes in Hibernate -

i have following situation, article can have several types of content (e.g. text, images, sourcecode, ...). therefore designed simple class structure: this source of abstract articlecontent class: @entity @table( name = "article_contents" ) @inheritance( strategy = inheritancetype.table_per_class ) public abstract class articlecontent extends abstractentity { private article article; @manytoone @joincolumn( name = "article_id", nullable = false, updatable = false ) public article getarticle() { return article; } public void setarticle( article article ) { this.article = article; } @column( name = "content", columndefinition = "text", nullable = false ) public abstract string getcontent(); public abstract void setcontent( string content ); } the getcontent() , setcontent() methods marked abstract, because return content displayed (e.g. plain text, <img src="..." /> , ...). i started ...

c# - Confused with error handling in ASP.net 5 MVC 6 -

i have 1 error page depending on query string provided displays different error message user. i have noticed following code in the startup.cs file when creating new asp.net 5 project. if (env.isdevelopment()) { app.usebrowserlink(); app.usedeveloperexceptionpage(); } else { app.useexceptionhandler("/home/error"); } i have been able display correct error page when exception occurs. issue seems catch errors have not been handled in application i.e. status code of 500 . correct? to handle 404 errors using following code: app.usestatuscodepageswithreexecute("/error/{0}"); with controller implemented as: [httpget("{statuscode}")] public iactionresult error(int statuscode) { return view(statuscode); } this seems catch 404 errors , displays correct status code. if update code in above if statement use same action example: if (env.isdevelopment()) { app.usebrowserlink(); app.usedeveloperexceptionpage(); } else { ...

How to Integrate SpagoBI server in Grails or Java application -

i want integrate spagobi server in grails or java applications. have developed report in spagobi server , working fine. same reports want display in grails or java applications. you can use spagobi sdk integrate in web application (especially java). take here: http://wiki.spagobi.org/xwiki/bin/view/spagobi_sdk/

javascript - Snap SVG - Can I use multiple variables initialising snap.svg to point to different svg ID's in the markup? -

essentially build red , blue template in main.js have different colour versions of same set of shapes (for time being) using snap.svg. my idea build 1 snap initialising variable "b" points svg id of #svg-red, , create snap initialising variable "r" point #svg-blue id. blue , red variables have own separately drawn circles , attributes. that would've presumably allowed me switch between templates changing id of svg div in markup. this whenever define snap command more 1 variable used, shapes dissapear. any other simple svg/js/snap ideas welcome (i newbie!) :) main aim assign templates id's can switched in svg tag in markup. window.onload = function(){ // blue template should point #svg-blue var b = snap("#svg-blue"); var cir_1 = b.circle(50,50,50); var cir_2 = b.circle(150,150,50); var cir_3 = b.circle(250,50,50); cir_1.attr({ fill:'lightblue' }); ...

javascript - Eventlistener for child window opened by extjs -

i have extjs code create window var window = ext.create('ext.window.window',{ title : headermsg, width : 350, height : 250, layout : 'fit', plain : true, buttonalign : 'center', items : [{ xtype : 'box', autoel : { tag : 'iframe', src : 'some.asp', height : '100%', width : '100%', style : 'cursor:pointer;top:10px' } } ] }); window.show(); } })); in some.asp have button <button class="stdbutton" onclick="windowclose();" id=button2 name=button2> i dont know how create asp in fiddle created extjs please check followinf link : https://fiddle.sencha.com/#fiddle/14bj imagine have button(button id: button2) on src : 'ccc.de';, , when click button should catch event in js thank i should not made changes in asp adding onclick() function..etc what tried ...

bean io - Camel beanio mapping file outside the war -

i'm using camel beanio component marshal , unmarshal data inside file. <beanio id="mybeanio" mapping="classpath:beanio-mapping-file-config.xml" streamname="mystreamname" /> it working fine in tomcat not working in jboss. need keep beanio mapping xml outside war file. mentioning actual path of mapping xml file mapping attribute, working fine. need beanio mapping xml path environment variable or properties file. below changes, <beanio id="mybeanio" mapping="file:${env:env_var_name}/beanio-mapping-file-config.xml" streamname="mystreamname" /> or <beanio id="mybeanio" mapping="file:{{prop_name}}/beanio-mapping-file-config.xml" streamname="mystreamname" /> i'm getting org.apache.camel.runtimecamelexception: java.io.filenotfoundexception the environment variable/property not getting replaced actual value. camel version used ...

regex - Need help to find a regular expression for name and last name validation -

i tried find same problem, didn't find anything. i need 2 separate regular expressions, 1 names, , 1 last names. here rules names: a name can't start spaces, numbers or other symbol. a name must long @ least 3 characters, maximum of 15 characters. no symbols allowed. some allowed name examples: malcolm walter bob giovanni francesco steven here last names rules: a last name can't start spaces, numbers or other symbol. a last name must long @ least 3 characters, maximum of 15 characters. a last name can contains apostrophes, dots , dash. some allowed last names examples: d'addario berners lee berners lee o'riley. thanks in advance help! first name: [a-za-z.\-']+ last name: [a-za-z.\-' ]{3,15} combined: [a-za-z.\-' ]+ [a-za-z.\-']{3,15} keep in mind restriction on last names strict - you'll rule out many asian last names li or wu. also, i'm not sure, if wanted make last name option...

Build chromium in visual studio 2015 -

i'm following the chromium projects build chromium browser on windows. when go run post-sync hooks step , run gclient runhooks the following errors show, ________ running 'd:\chromium\depot_tools\depot_tools\python276_bin\python.exe src/build/landmines.py' in 'd:\chromium\chromium' traceback (most recent call last): file "src/build/landmines.py", line 147, in <module> sys.exit(main()) file "src/build/landmines.py", line 134, in main gyp_environment.setenvironment() file "d:\chromium\chromium\src\build\gyp_environment.py", line 33, in setenvironment vs_toolchain.setenvironmentandgetruntimedlldirs() file "d:\chromium\chromium\src\build\vs_toolchain.py", line 73, in setenvironmentandgetruntimedlldirs os.environ['gyp_msvs_override_path'] = detectvisualstudiopath() file "d:\chromium\chromium\src\build\vs_toolchain.py", line 139, in detectvisualstudiopath ' not found.') % (ve...

php - Autoloader for OOP project -

i'm busy big wordpress plugin consist of couple of classes , interfaces ( which use proper namespacing ). research , answers got previous questions, best option use interface injection ( dependency injection ) maintain soc. @ stage work intended. i'm left bringing 1 main class used contoller. @ moment, test everything, use require_once in order load classes , interfaces ( files in folder called functions ) example: require_once( '/functions/interfacea.php' ); require_once( '/functions/classa.php' ); require_once( '/functions/interfaceb.php' ); require_once( '/functions/classb.php' ); //etc i have heard autoloaders, not understand how use them in controller class. 1 issue need avoid class loaded before interface, because if load sequence wrong, fatal error stating interface not exist. my question: how make use of autoloader in controller class load classes , intefaces makes sure interfaces loaded before respective classes ...

r - Tensor smooths in gamm4 -

i trying extend model similar 1 described gavin simpson here include random effects. https://stats.stackexchange.com/questions/32730/how-to-include-an-interaction-term-in-gam where loc is replaced 4-level factor. fixed effects 2 categorical variables (a , b) , 2 continuous ones (c1 , c2) pairwise interactions. response 1s , 0s. e.g. gamm4(y~a*c1 + a*c2 + b*c1 + b*c2 s(yday, bs = "cc", k = 12) + s(yday, bs = "cc", = a, k = 12, m = 1) + s(hour, bs = "cc", k = 12) + s(hour, bs = "cc", = loc, k = 12, m = 1) + t2(hour, yday, = a, bs = rep("cc",2)), random = ~ (1 | id), family = "binomial"(link="logit"), data = dat) trying run got error error in x %*% diag(diagu[indi]) : non-conformable arguments from lurking around in code of gamm4() , gamm() seems related penalising smoo...

c# - Why does IDependecyResolver.Resolve<IUICompositionService>() method throw exception 'Catel.IoC.TypeNotRegisteredException'? -

i have exception 'catel.ioc.typenotregisteredexception' when try resolve iuicompositionservice interface. added reference catel.extensions.prism , installed loadassembliesonstartup.fody nuget wpf mvvm catel project , in app.xaml.cs in app.onstartup() method wrote following code: var servicelocator = new servicelocator(); servicelocator.registertypesusingdefaultnamingconvention(); in mainwindowviewmodel in command method wrote following code visualizing calibrationview view in application mainwindow: private void showcalibrationviewexecute() { var viewmodel = new calibrationviewmodel(); var dependencyresolver = this.getdependencyresolver(); var uicompositionservice = dependencyresolver.resolve<iuicompositionservice>(); uicompositionservice.activate(viewmodel, "mainregion"); } for view there calibrationmodel , calibrationviewmodel classes in application. when press showcalibrationview button in mainwindow toolbar , showcalibrationviewex...

java - Probelm with GridView using BaseAdapter in Android? -

i did gridview using baseadapter, having problem. when scrolling gridview , down, on third or fourth time gridview deleted , left empty screen. any suggestions on how resolve issue? here code adapterclass public class booksadapter extends baseadapter { string bookscategorylist[] = { "the world", "food & drink", "crime, mystery & thriller", "science fiction & fantasy", "family & health", "music, stage & screen", "language , linguistics", "fiction", "business & finance", "time periods in history", "special interest books", "romance & erotica", "children's books", "biography", "mind body & spirit", ...

c - From Compiler to assembler -

i have question regarding assembler. thinking of how c function takes multiple parameters argument transformed assembly. question is, there subroutine in assembly takes arguments parameter operate? code might this: call label1, r16. r16 subroutine input parameter. if that's not case means each time c function called, gets assembled subroutine parameters related specific call being substituted automatically in it. means whenever c function called, compiler transforms inline function sure not case either :d so right? alot! :) the compiler uses "calling convention" can specific 1 compiler 1 target architecture (x86, arm, mips, pdp-11, etc). architectures "plenty" of general purpose registers, calling convention starts passing parameters in registers, , uses stack, architectures not lot of registers stack if not used parameter passing , return. the calling convention set of rules, such if follows rules can compile functions objects , link them...

networking - java.net.SocketException when accessing docker host -

i'm new docker , need connect inside running centos docker container host running container using java socket. when trying connect socketexception occurs: [root@743fedf46128 test]# java sockettest 10.1.196.134 4444 127.0.0.1 0 trying connect using ip address using remote ip 10.1.196.134 using remote port 4444 using local ip 127.0.0.1 using local port 0 /10.1.196.134, 4444, /127.0.0.1, 0 java.net.socketexception: invalid argument or cannot assign requested address @ java.net.plainsocketimpl.socketconnect(native method) @ java.net.abstractplainsocketimpl.doconnect(abstractplainsocketimpl.java:339) @ java.net.abstractplainsocketimpl.connecttoaddress(abstractplainsocketimpl.java:200) @ java.net.abstractplainsocketimpl.connect(abstractplainsocketimpl.java:182) @ java.net.sockssocketimpl.connect(sockssocketimpl.java:392) @ java.net.socket.connect(socket.java:579) @ java.net.socket.connect(socket.java:528) @ sockettest.main(sockettest.java:54) t...

How to remove present color and get default color of an image using graphics in java -

i have image , use pre-defined position on create oval color. click on again remove oval , color . this i've done objective, imagepanel.java public class imagepanel extends jpanel{ private image img; public imagepanel(string img, string str){ //this(new imageicon(img).getimage()); } public imagepanel(string path){ image img = new imageicon(path).getimage(); this.img = img; dimension size = new dimension(img.getwidth(null), img.getheight(null)); setpreferredsize(size); setminimumsize(size); setmaximumsize(size); setsize(size); setlayout(null); try{ bufferedimage image = imageio.read(new file(path)); int rgb = image.getrgb(66, 52); system.out.println("colour is: "+rgb); }catch(ioexception e){ e.printstacktrace(); } } public void paintcomponent(graphics g) { g.drawimage(img, 0, 0, nu...

Excel vba paste from clipboard to another sheet only values -

i have workbook need paste data to. im trying achieve: workbook want paste data active sheet in workbook want paste data not active user activates workbook open selecting entire sheet , copies clipboard. user goes workbook data going pasted , runs macro pastes data empty sheet predefined sheet name. paste must paste values only, no formatting, no comments, shapes, no merged cells. values. and have tried alot of combinations .paste destination[...] , on. what im using today is: dim wb workbook dim wspt worksheet dim wsqd worksheet set wb = activeworkbook set wspt = wb.sheets("pastetemplate") set wsqd = wb.sheets("quotedata") wspt.cells.clear wspt.range("a1").pastespecial xlpastevalues the reason fails because clipboard doesn't contain pasted, due line: wspt.cells.clear when clear cells, clear copy-command issued prior. similarly, copy-command cleared if enter or modify information in cell, or if enter cell itself. i do...

Combine a "Select" insert for some rows and "Values" insert for other rows in same query - mysql -

i've looked answer can't seem find covers it. possible combine these 2 queries (which work individually) single query? qry 1) inserts $id (as variable) , name pulled tableb, (which corresponds id) tablea. creates single row in tablea. insert `tablea`(`id`,`name`) select $id, name `tableb` `id`='$id'; qry 2) inserts $id (as variable) , name (as text) tablea. creates single row in tablea. insert `tablea`(`id`,`name`) values ('$id','changeme!'); use column name in select statement instead of $id insert tablea(id,name) select tableb.id, tableb.name tableb tableb.id='$id' union select $id id,'changeme!' name; using union combine records.

f# - Use combinators to clean up mapJsonAsync in Suave.io -

in suave.io, there's function mapjson : let mapjson (f: 'a -> 'b) = request(fun r -> f (fromjson r.rawform) |> tojson |> successful.ok >=> writers.setmimetype "application/json") is there way make async version of using combinators? can write out hand follows let mapjsonasync (f: 'a -> async<'b>) (ctx: httpcontext) = async { let! x = f(fromjson ctx.request.rawform) let resp = successful.ok (tojson x) >>= writers.setmimetype "application/json" return! resp ctx } but nicer not have explicitly define ctx or intermediate values. i not see way around that. last expression can simplified little. let mapjsonasync (f: 'a -> async<'b>) = fun (ctx : httpcontext) -> async{ let! result = f (fromjson ctx.request.rawform) return successful.ok (tojson result ) ctx >>= writers.setmimetype "application/json" } ...

java - How to extract single column with Spring FixedLengthTokenizer -

in examples ranges looking similar below , supposed extract multiple colums. <bean id="fixedfiletokenizer" class="org.springframework.batch.item.file.transform.fixedlengthtokenizer"> <property name="names" value="producto , localidad, moneda, comp_instit, saldo, filler" /> <property name="columns" value="1-3, 4-9, 10-12, 13-15, 16-29, 30-31" /> </bean> but how should extract data single column? putting 16 not work. should 16-16 or 16-17 ? after testing have found out correct range extract single character 16-16 .

vba - Approach to transpose rows into columns in excel -

Image
i have excel file following structure (top) i convert top structure bottom, transpose columns rows. dataset has 5 friend fields, , approximately 200 lines long. what do manually cut , paste make data how want it. what do have process automated i new vba , trying way work it.

BizTalk error : Unable to process exec message -

i've been getting following error in production environment. please refer error in bottom. far able recreate problem letting orchestration suspend forcing db timeout in application db call, , resuming instance. after repeating action 2 rounds on same instance, third time instance suspended error below. reason behavior? biztalk error uncaught exception (see 'inner exception' below) has suspended instance of service '{orchestration name}(57adc083-7423-2bff-bd2d-ca813b8c0f4e)'. service instance remain suspended until administratively resumed or terminated. if resumed instance continue last persisted state , may re-throw same unexpected exception. instanceid: 1bca1f03-7780-4f45-af2e-020724c8a92d shape name: shapeid: exception thrown from: segment -1, progress -1 inner exception: unable process exec message. exception type: exception source: microsoft.xlangs.biztalk.engine target site: system.object[] get_args() following stack...

php - Using 2 or more needles when using strpos -

this question has answer here: using array needles in strpos 11 answers im running strpos on <a> tag see if contains either 1 of 2 urls. at moment im using bellow - how set check if - tumblr.com or google.com present ? function find_excluded_url ($url) { $find = "tumblr.com"; // or google.com .... $pos = strpos($url, $find); if ($pos === false) { return false; } else { return true; } } // set url $url = "<a href='http://tumblr.com/my_post' rel='nofollow'>this site</a>"; // call func $run_url = find_excluded_url($url); if ($run_url == true) { echo "url - " . $url . "<br>"; } you can't use 2 needles in strpos. can do, use twice, or: function find_excluded_url ($url) { return (strpos($url, "tumblr.com")!==fa...

java - JPA EclipseLink: How to Listen to Mysql Server changes in rows and data -

i have remote mysql server , java application connected server other hosts application works multiple client connected server my question how make java application client notify , changes ui according changes can happen server other clients connected server.

paypal buy now return -

input type="hidden" name="rm" value="0" after ending transaction paypal return @ url define in input type="hidden" name="return" without payment variables included in get, if set input type="hidden" name="rm" value="2" after ending transaction paypal return @ url define in input type="hidden" name="return" payment variables included in post, when browser alerts leaving secure connection if buyer doesn't click ok redirect always start without payment variables included in post... i need return url have payment variables included in get, what's wrong ? if wanting use method, betther method use here instead of setting return url , rm variable, use pdt. return variables method, , allow validate variables being returned, came paypal.

php always giving the same hashed string when using random variables and timestamp -

i using following random code can used reset password getting same value $encrypt surely rand , timestamp should make different each time? $randnumb = rand(1000000000000,999999999999); $timestamp = time(); $encrypt = md5($row['userid']+$timestamp+$randnumb); use . concatinate operator instead of + operator

qt - Qt5VSAddin for Visual Studio 2013 - where are the Settings saved to? And/or how to disable addin? -

i'm working visual studio 2013 professional , qt 5, installed qt5vsaddin, working intended (i can choose installed qt version; meta compiling etc working; creating new vs qt project works charm). however use same project , solution files on different machines, qt isn't installed in same directory. at moment, qt addin changes content of project's .vcxproj.user file , adds line <qtdir>directorypath</qtdir> "directorypath" being path i've chosen in qt5->"qt options"->"qt versions" of addin. if compile on machine, qtdir in .user changed machine's qt installation directory, meaning i'll destroy project file else trying compile project on machine (maybe without addin). what want change qt version information path relative environmental variable, <qtdir>$(my_qtdir)</qtdir> or <qtdir>$(my_dev_environment)/qt/</qtdir> . unfortunately, qt5vsaddin not allow create qt versions environmental...

plsql - Need an autonomous transaction procedure for below scenario -

on report generation screen (front-end), after filling form desired data, on submit, call procedure generates report. before data sent report generation, have table in entered form data has inserted. , has done using autonomous transaction procedure. consider below example tables , suggest. example: table in logs inserted : rep_log_tabl (user_id, app_id, cur_date, param1, param2, param3,.... param10) table has app_id details: rep_app_tabl (app_id, field_name, x,x,x,x) table has user_details : rep_user_detl (user_id,x,x,x,x,x) example form: date: 1/1/2016 (text) date: 1/15/2016 (text) type: actual / latest (drop down field) , table rep_log_tabl holds data below: user_id | app_id | cur_date | param1 | param2 | param3 | param4 | . . . . | param10 | --------------------------------------------------------------------------------------------------------- u1234 | axx-01 | 1/27/2016 | 1/1/2016| 1/15/2016| actual | null | . . . . | null...

Why is nginx displaying the wrong website on my server? -

i have 2 websites: default-website.com, second-website.com. when go second-website.com seeing default-website.com. not understand why happening. note default-website.com displays normal. this setup: dns set both point @ same ip address. they both have own unique websites: /var/www/default-website.com/public_html/index.html /var/www/second-website.com/public_html/index.html this contents of /etc/nginx/sites-enabled: lrwxrwxrwx root root default-website.com -> /etc/nginx/sites-available/default-website.com lrwxrwxrwx root root second-website.com -> /etc/nginx/sites-available/second-website.com this contents of /etc/nginx/sites-available/default-website.com: server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /var/www/default-website.com/public_html; index index.html index.htm; server_name default-website.com; location / { try_files $uri $uri/ =404...

java - Decompile and edit multiple interdependent jar files -

hey new java , trying learn it. have learned best way learn reading , seeing how other software working , implement better way in own app. have started decompiling know jd-gui , used decomppile or edit jar files. have multiple jar files , interdependent, tried google not find good. great. main question. how edit or decompile multiple interdependent jar files. i not trying illegal or wrong want learn

How to read an excel file on web from its download URL using HTML and javascript automatically (without having to download it) -

i have url, abc.com/download?fileid=123&entity_id=456&sid=101 which downloads excel file when click link. instead of downloading it, want read contents html & javascript in order process information automatically. is there way that? not familiar web programming therefore not sure how proceed. have tried following, nothing happened. var excel = new activexobject("excel.application"); var excel_file = excel.workbooks.open("url here"); var excel_sheet = excel_file.worksheets("sheet1"); var data = excel_sheet.cells(1,2).value; alert(data); edit: question different linked 1 trying figure out how initial raw data parsed once variable (however simple answer might be, not find anywhere else , first practice web couldn't find way around). can code above access file in url? not know how test , writing alert(data) returns no result. how know have data work with, before start parsing? edit2: following returns when urlstring="www....

html - Notice: Undefined index: picCat in E:\xampp\htdocs\Evako\admin.php on line 313 -

this question has answer here: php: “notice: undefined variable”, “notice: undefined index”, , “notice: undefined offset” 23 answers if not in form choose category returns error : notice: undefined index: piccat in e:\xampp\htdocs\evako\admin.php on line 313 code: form <form class="form" method="get"> <input type="text" id="nmpic" name="nmpic" placeholder="име на снимката" onfocus="this.placeholder = ''" onblur="this.placeholder = 'име на снимката'"></br> <input type="text" id="price" class="pricefrom" name="pricefrom" placeholder="цена от" onfocus="this.placeholder = ''" onblur="this.placeholder = 'цена от'"> ...

javascript - Upload files from <input type="file" multiple/> via appending to FormData -

i have form file input <input type="file" id="fileinput" multiple /> and try upload files server. server-side code this: [httppost] public actionresult index(httppostedfilebase[] files) { ... process ... } for send post request use $.ajax var formdata = new formdata($('#formid')[ formdata.append("files", $('#fileinput')[0].files); $.ajax({ url: "/default/index", type: "post", data: formdata, contenttype: false, processdata: false, success: function() { alert("success"); } }); and doesn't work. if add name="files" attribute input (for native bind) , remove instruction formdata.append("files", $('#fileinput')[0].files); code works fine. so difference between theese ways , how can pass files via appending data formdata? note: in work can't bind form via name attr...

vb.net - Visual Basic - Counting the occurrence of numbers from a random array -

i need use arrays , strings. program should search 1 number user enter (0-9). here code below. uses array random number, , it's testing occurrences each number. it's not working, don't need test every number anyway. the program must test 1 number user requests. if random number that's generated say.. '7417', , user user has chosen '7', program report there have been 2 sevens. i'm going use textbox 'txtenter' users number search for. can me? thanks! private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click randomize() dim arraynum(1) integer arraynum(0) = int(rnd() * 100000) lbldisplaynumber.text = arraynum(0) dim num integer txtenter.text = num dim counts = c in num.tostring() group c group select digitgroup = new {.count = group.count(), .digit = c, .group = group} order digitgroup.coun...

javascript - undefined $scope variable inside function in jasmine test -

i started learn unit test angular apps. , faced problem. can not take scope variable inside executed function. here factory code angular.module('app').factory('authenticationservice', authenticationservice); authenticationservice.$inject = ['$http']; function authenticationservice($http) { var service = {}; service.login = login; return service; function login(data, callback) { $http({ method: 'post', url: config.geturl('auth/login'), data: data }).then(function (response) { callback(response); }, function (error) { callback(error); }); } part of controller file. yet wan test login function function authctrl($scope, $location, authenticationservice) { var vm = this; vm.login = login; vm.datalogin = { user_id: '', password: '', }; function login() { vm.dataloading = true; authe...

css - font-size scaled in IE8? -

in ie8 in ie7 , other browser both page scaled in 100%.i found font-size in ie8 , in ie8 bigger other browser.is can tell me reasion , solution ? here html , css: <div class="a_ticket-box"> <a href="" class="a_ticket" id="a_ticket_en"> <img id="a_ticket_btag_en" src="../img/tag-en.png" alt=""> <h4 id="en-buy">purchase ticket</h4> <p id="en-p">newly added march 5-6 fifth floor ticket</p> </a> </div> thx i don't see css code. see in html don't have specified font size inside paragraph. browsers can interpretate default font size in < p> different. should set font size in css like: #en-p { font-size: 1em; } or inline inside paragraph like: <p id="en-p" style...

using stored procedure in code first -

i have code first model 2 table : public class company { public int companyid { get; set; } public string companyname { get; set; } public string companyaddress { get; set; } public virtual icollection<user> user { get; set; } } public class user { public int userid { get; set; } public string username { get; set; } public string password { get; set; } public virtual int companyid { get; set; } public company company { get; set; } } i want select company user object stored procedure select a.*,u.* [dbo].[companies] inner join dbo.users u on u.companyid=a.companyid companydb c = new companydb(); var cc = c.database.sqlquery<company>("dbo.company_select") my problem : cc.user null ??? first, have virtual in wrong place user: public class user { public int userid { get; set; } public string username { get; set; } public string password { get; set; } public int companyid { get;...

Global Stylesheet -

what's best way of implementing global stylesheet effects directories of website? know it's possible link stylesheet in above directory via href="../style.css", there must better way of doing this messy when you've got number of levels website. thanks in advance

python - Django Celery cache lock did not work? -

i trying use django cache implement lock mechanism. in celery offical site , claimed django cache work fine this. however, in experence, did not work. experience if there multiple threads/processes acquire lock in same time (close ~0.003 second), threads/processes lock successfully. other threads acquire lock later ~0.003 second, fails. am person experienced this? please correct me if possible. def acquire(self, block = false, slp_int = 0.001): while true: added = cache.add(self.ln, 'true', self.timeout) if added: cache.add(self.ln + '_pid', self.pid, self.timeout) return true if block: sleep(slp_int) continue else: return false # set django backend cache localcache caches = { 'default': { 'backend': 'django.core.cache.backends.filebased.filebasedcache', 'location': '/dev/shm/django_cache', ...

how to return data from php to jquery AJAX -

i'm new ajax, want learn. have set form (formidable pro) submitted via ajax. in submit button have on onclick function: <div class="frm_submit"> <input id="btn-max-hyp" onclick="add_customer()" type="submit" value="[button_label]" [button_action] /> <img class="frm_ajax_loading" src="[frmurl]/images/ajax_loader.gif" alt="sending"/> </div> my custom js file: jquery(document).ready(function($){ $('#form_maxhyp').on("submit", add_customer); function add_customer () { var form_maxhyp = $(this).serialize(); $.ajax({ type:"post", url: frontendajax.ajaxurl, data: form_maxhyp, success: function(data) { $("#test").html(data); } }); return false; } }); and last code in function.php <?php add_action( 'wp_enqueue_scripts', 'add_frontend_ajax_javascript_file' ); function add_fronte...

How to avoid one Spark Streaming window blocking another window with both running some native Python code -

i'm running spark streaming 2 different windows (on window training model sklearn , other predicting values based on model) , i'm wondering how can avoid 1 window (the "slow" training window) train model, without "blocking" "fast" prediction window. simplified code looks follows: conf = sparkconf() conf.setmaster("local[4]") sc = sparkcontext(conf=conf) ssc = streamingcontext(sc, 1) stream = ssc.sockettextstream("localhost", 7000) import custom_modelcontainer ### window 1 ### ### predict data based on model computed in window 2 ### def predict(time, rdd): try: # ... rdd conversion df, feature extraction etc... # regular python code x = np.array(df.map(lambda lp: lp.features.toarray()).collect()) pred = custom_modelcontainer.getmodel().predict(x) # send prediction gui except exception, e: print e predictionstream = stream.window(60,60) predictionstream.foreachrdd(predict...

PyQt5 - How to change PluginsPath with QLibraryInfo.PluginsPath -

is possible modify pluginspath via qlibraryinfo.pluginspath ? i want know if forced use qt.conf. i use python3.4 pyqt5 , build script py2exe.

Deleting Node in Linked List C++ -

so i've been searching forums, im still new language , linked lists can barely decipher results. basically made delete function linked list. can create list, traverse list, sort list, search list, , insert before node in linked list. recycled code insert locate point in list delete. main point of confusion how link previous points node after 1 deleting. i won't write whole new linked list implementation can point out of problems code you. the trick stay 1 node ahead of 1 want delete. i have renamed entry current clarity nodetype *current , *first, *next; int akey; // line search start second element. // current =start->ptr; // should current = start; // not needed. assuming last node has null value '->ptr' // last=start; next = current->ptr; cout<<"input data delete"<<endl; cin>>akey; // check if first node contains data // assuming list have @ least 1 element. i.e. current not null while (current->...

java - IText : Add an image on a header with an absolute position -

i want place header on each page of pdf. text part of header done can't find way place image. public static class header extends pdfpageeventhelper { public void onendpage(pdfwriter writer, document document) { try{ pdfcontentbyte cb = writer.getdirectcontent(); /* code place text in header */ image imgsoc = image.getinstance("c:\\...\\logo.jpg"); imgsoc.scaletofit(110,110); imgsoc.setabsoluteposition(390, 720); columntext ct = new columntext(cb); ct.addtext(new chunk(imgsoc,0,0)); ct.go(); }catch(exception e){ e.printstacktrace(); } } } i'm not sure i'm doing right way. there 2 answers using tables. tables can helpful create dynamic layout of different header parts (document title, document version, page number, logo, ...). but if don't need that, have ...

monitoring - Read sniff browser url from java -

i have java stand-alone app needs monitor browser traffic. i have tried using jpcap , sniffing packets, problematic https sites youtube of facebook because cannot decode content read url it. have tried jna try reading opened window titles, title not show url. how monitor/read urls person visiting? thank you, georgian selinium webdriver might viable alternative - while need install relevant software, allows full control on browser. in api docs example: https://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/webdriver.html#getcurrenturl-- there guide on how connect existing browser session here: how use/attach existing browser using selenium?