Posts

Showing posts from August, 2012

python - django user creation form required keyerror -

i made custom registration form, inherits usercreationform . however, when try submit, 1 of fields empty, keyerror on required. seems happen somewhere in django source code, i'm pretty sure comes because of custom clean method. form: class registrationform(usercreationform): """ edit user registration form add emailfield """ class meta: model = user fields = ('username', 'password1', 'password2') def __init__(self, *args, **kwargs): super(registrationform, self).__init__(*args, **kwargs) #add custom errormessages self.fields['username'].error_messages = { 'invalid': 'invalid username' } self.fields['password2'].label = "confirm password" #make sure username lowered , unique def clean_username(self): username = self.cleaned_data.get('username') try: u

asp.net - I want to access controls of derive class from base class on onLoad() override in c# (Master page derive from one masterClass) -

i defined multiple master , has common functionality on form_load event. declare custommasterpage class derived system.web.ui.masterpage , put common functionality this. want override onpage_load() , want print controls of dervived class. suppose have 1 custommaster class class custommasterclass:system:web.ui.masterpage { override onload() { base(e) //i want use following child class controls(lblname) here print // lblname.text="" } } class child1:custommaster { //controls are.. //label:id=lblname; form_load() { lblname.text="test1 test1"; } } class child2:custommaster { //controls are.. //label:id=lblname; form_load() { lblname.text="test2 test2"; } } how that. please give me advice thanks in advance base classes don't know child classes. being said, can define base class having overridable methods derived class can use set s

javascript - WebPack io.js generators support -

i use webpack compile server-side scripts contain harmony (es6) generators. keep them , not use kind of polyfills or transpilers. webpack complains missing loader. webpack support compile straight forward generator please? stack: io.js webpack koa framework this is fixed of webpack 1.12 it's using esprima 2 .

sql - PostgreSQL concurrent transaction issues -

i'm building crawler. multiple crawling workers access same postgresql database. sadly i'm encountering issues main transaction presented here: begin isolation level serializable; update webpages set locked = true url in ( select distinct on (source) url webpages ( last null or last < refreshfrequency ) , locked = false limit limit ) returning *; commit; url url (string) source domain name (string) last last time page crawled (date) locked boolean set indicate webpage being crawled (boolean) i tried 2 different transaction isolation levels: isolation level serializable , errors could not serialize access due concurrent update isolation level read committed , duplicate url s concurrent transactions due data being "frozen" time transaction fir

swift - Universal class for Mac OS and iOS -

this question has answer here: how use appropriate color class current platform? 1 answer i want create class mac os- , ios-app. unfortunately, can't use nscolor ios , no uicolor mac os. actually have following code: #if os(ios) func myfunc(color: uicolor?) { self.myfuncx(color) } #elseif os(osx) func myfunc(color: nscolor?) { self.myfuncx(color) } #endif private func myfuncx(color: anyobject?) { #if os(ios) mycolor = color as! uicolor #elseif os(osx) mycolor = color as! nscolor #endif } is there better way? you should able use typealias color class, this: #if os(ios) typealias xcolor = uicolor #elseif os(osx) typealias xcolor = nscolor #endif func myfunc(color: xcolor?) { self.myfuncx(color) } the idea limit conditional compile type definition xcolor , , using type alia

c# - Passing data between ThreadPool threads -

i have c# webserver have been profiling using stackoverflow miniprofiler. because it's not asp.net server, each request typically executed on own thread, rigged miniprofiler use threadstatic storage track of profilers of incoming request start finish. worked well. recently we've converted use async/await , means continuations after await typically don't come onto same thread , threadstatic storage no longer works. what's best way pass small piece of data between different threadpool threads in case? there existing synchronizationcontext implementations useful this? what's best way pass small piece of data between different threadpool threads in case? using logical call context via static callcontext class. exposes 2 methods: logicalsetdata , logicalgetdata . call context stored , marshaled via executioncontext , in charge of sync context, etc. using class has 2 restrictions: you're limited use of .net 4.5 , above logical c

c# - The URL Specified () does not correspond to a valid directory. -

when trying run unit test error: test name: getmethodtest test fullname: quanser.codex.app.web.repository.unittests.documentscontrollertests.getmethodtest test source: c:\dev\engineering\mobile apps\software\codex\trunk\web\repository\unittests.repository\documentscontrollertests.cs : line 34 test outcome: failed test duration: 0:00:00 result message: url specified (' http://localhost:53364/ ') not correspond valid directory. tests configured run in asp.net in iis require valid directory exist url. url may invalid or may not point valid web application. this test case: [testmethod()] [hosttype("asp.net")] [urltotest("http://localhost:53364/")] public void getmethodtest() { // ... } i know there wrong line: [urltotest("http://localhost:53364/")] what should put url in attribute? note: need use these attributes testing rest api thanks those attributes testi

objective c - accessing image on Elastic Beanstalk server -

i obtained url associated account on elastic beanstalk in aws...how go seeing image? tried typing in chrome console doesn't show image...is url protected or something? don't understand. here's url: http://myappapi-dev.elasticbeanstalk.com/users/e2c97890-d1d0-4ca6-8950-0fa2ff3969c3/image i've changed few parts of url security measures. thank you.

javascript - Switching to Leaflet Map Doesn't Load -

i'm trying load standard leaflet map can overlay geojson file on it. map loads if use map, doesn't work leaflet. error get http://a.tiles.mapbox.com/v3/mapid/7/40/47.png 404 (not found) my assumption choosing different map not affect @ since i'm replacing canvas put geojson on (obviously i'm wrong). can explain me why doesn't work? code below , have commented changed maps <!doctype html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" /> <script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script> <script src="http://d3js.org/d3.v3.min.js"></script> <script src="http://d3js.org/queue.v1.min.js"></script> <script src="http://d3js.org/topojson.v1.min.js"></script> &

apache - .htaccess not working with some PHP files -

i have .htaccess file wont find php files find others. example, rewriterule ^test$ test.php will give 404 not found rewriterule ^custom$ test.php will work. its same rule add .php end of url. ideas? full file rewriteengine on rewriterule ^test$ test.php #doesn't work rewriterule ^custom$ test.php #works full directory(ls -a) . .. .htaccess index.html test.php thanks. make sure multiviews off it's not causing funny business trying match files. always use [l] stops processing rules when rule met. can cause issues down line continuing run other rules. should not matter if have trailing slash or not. measure can check conditions if it's not real file or not real directory process rule , won't 404. options -multiviews rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^test/?$ test.php [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule

javascript - TimelineJS:: How to insert links in events -

i'm doing timeline using timelinejs in json , want add link download/view pdf file in event. have tried use conventional methods insert html in json hasn't worked in library. relevant code: { "startdate":"2012,1,4", "headline":"sh*t broke people say", "text":"", "asset": { "media":"http://youtu.be/zyyalkhjsjo", "credit":"", "caption":"" } }

php - While loging in i am trying to validate values from 3 tables, but not working? -

this question has answer here: mysqli_fetch_array()/mysqli_fetch_assoc()/mysqli_fetch_row() expects parameter 1 resource or mysqli_result, boolean given 33 answers php & mysql: mysqli_num_rows() expects parameter 1 mysqli_result, boolean given [duplicate] 2 answers i getting these errors: warning: mysql_query() expects parameter 1 string, object given in h:\xamp\htdocs\newlogintry.php on line 12 warning: mysql_query() expects parameter 1 string, object given in h:\xamp\htdocs\newlogintry.php on line 13 warning: mysqli_num_rows() expects parameter 1 mysqli_result, null given in h:\xamp\htdocs\newlogintry.php on line 18 but php code wrote it, want check whether "type" of account either teacher account or pupil account if among them pass main page

inheritance - Can redefined function have different signatures in C++? -

is possible in c++ redefined function have different signatures? overriding function or method requires signature match. can, however, create function overload different signature, , call original function it.

php - How to store JSON data in mysql database -

json data {"level":{"primary":"1","university":"3"},"sub":{"5":"literature","2":"bi","3":"maths"},"rate2":{"5":"20","6":"","7":"","9":"","2":"30","3":"50"},"name":"jessie","action":"test"} i need split data above , 3 tables. 1) tbl_user -columns(name) 2) tbl_user_level-columns(level,name) 3) tbl_subject_rate-columns(name,level,subject,rate) basically need looping store them.how access json data , store them in mysql please? i'm new json, detailed explanation , appreciated..thanks in advance. edited: i manage see array looks via var_dump($data) after decoding. shows below: array (size=5) 'level' => array (size=2) 'primary' => string '1

c - Using while(getchar()!='\n') I empty the stdin, but I have to push on Enter key -

i'm using while(getchar()!='\n') empty stdin, if want go on, need push on enter key , computation continue... why? i'll post part of code: while(1){ if(fgets(buffer,max_dimension,stdin)==null){ perror("error"); exit(1);} }else{ printf("not correct term\n"); while(getchar()!='\n'); sleep(1); } } thanks! @iharob if set max_dimension=1240 , send input: string > 1024 remains on stdin, have use while(getchar()!='\n') 2 issues: 1: code has } . // here if(fgets(buffer,max_dimension,stdin)==null){ perror("error"); exit(1);} }else{ // or @ beginning 2: assuming above not issue, @unxnut answered, typically fgets() contains '\n' , there no need empty stdin . yet when line excessively long , '\n' not read fgets() , makes sense read until end found. if (fgets(buffer, max_dimension, stdi

How to create a Unbounded task flow in Oracle Maf -

when create task flow maf-features.xml , bounded task flow created . how should create unbounded task flow go parent task flow. , use of adfc-mobile-config.xml unbounded task flow created automatically when create maf application. from docs : maf amx application feature contains 1 unbounded task flow, provides 1 or more entry points application feature. entry point represented view activity. default, source file unbounded task flow adfc-mobile-config.xml file. consider using unbounded task flow if following applies: ■ there no need task flow called task flow. ■ maf amx application feature has multiple points of entry. ■ there no need designated activity run first in task flow (default activity). an unbounded task flow can call bounded task flow, cannot called task flow. unbounded task flows there allow navigate amx page , call bounded task flow there more detailed work. i not understand mean by: "so go parent task flow" unbounded task flows cannot cal

What is the ~> (tilde greater than) operator used for in Swift? -

swift 1.1 includes declaration of ~> operator: infix operator ~> { associativity left precedence 255 } what used in swift? appears declared no functions defined leverage it. other developers have used reactive patterns , marshaling closures between queues, wondering why it's defined in standard framework. surmise it's there "reserve" custom operator developer use, given has highest precedence possible. since swift has been open-sourced can see actual reason including ~> in stdlib: as workaround method specialization in child protocol in swift 1.x . // workaround <rdar://problem/14011860> subtlf: default // implementations in protocols. library authors should ensure // operator never needs seen end-users. see // test/prototypes/genericdispatch.swift documented // example of how operator used, , how use can hidden // users. infix operator ~> { associativity left precedence 255 } a detailed example can found in test/proto

domain driven design - In DDD, how do you handle a conceptual object that is somewhere between an Entity and a Value Object? -

in domain model, how treat conceptual object somewhere between entity , value object? i.e, not small ; has many attributes, doesn't have identity or meaning in-and-of (i.e. equality based on attributes). because needs have attributes edited via ui, can't see how can made immutable--constantly being destroyed , recreated every time user changes attribute. furthermore, hybrid object intended become entity of either 1 type or another, depending on role in system. example: recipe class. purpose encapsulate set of instructions carried out machine. 2 different recipe objects equal if collective instructions identical. recipe intended take on 2 entity roles in system: to used in mastersequence , list of recipe objects executed in sequential order. in case recipe conceptually take on addition attributes such stepnumber , isactive . each of these recipies carries identity (i.e. recipe in step 1 might have identical attributes 1 in step 2, conceptually distinct). a recipe ca

regex - Vim EX command to remove non-duplicate records -

i have large file trying reduce neighboring duplicated record id lines. (it's been sorted already) example: ab12345 10987654321 andy male ab12345 10987654321 andrea female cd34567 98765432100 andrea female ef45678 54321098765 bobby tables should remove lines 3-4 leaving lines 1-2. the following regex pattern finds duplicate lines successfully, subsequent command removes not of non-matching lines. :/\v^(\a{2}\d{5}\s{2}\d{11}).*\n(\1.*)+ :g!/\v^(\a{2}\d{5}\s{2}\d{11}).*\n(\1.*)+/d why aren't non-matching lines being deleted? not vim solution, should work: $ fgrep -f <(awk -v ofs=' ' '{print $1, $2}' data.txt | sort | uniq -d) data.txt the <(...) bashism, , osf=' ' has 2 spaces.

android - Google Play/App Store in-app purchase policies -

Image
i heard on app store, sell or user buys, apple must have 30% on it. imply if open web page within app , accept donation, apple must have percentage. otherwise have redirect user make donation outside of app - instance, calling browser. so, if it's true, wanted know if google holds same policies. couldn't find specific answer in documentation, info in-app purchase (but i'm considering scenario purchase within app, not in app (sorry if sounds confusing). taking groupon example. if buy coupon, "in-app purchase"? don't believe google take 30% on buy there, wanted make sure according rules. the app i'm working on have both donation , coupon purchase sponsors (walgreens, etc). ok if through webview, or have call browser? sorry if concept of "in-app purchase" blurred. any information on topic appreciated. edit: from understanding, in-app purchase (for both google , apple) api use process these payments. find confusing that, instance

visual studio - Jenkins to build only modified files when checkout happens from subversion when build is scheduled -

i have configured subversion , jenkins microsoft visual basic 6 project. subversion contains more 4000 files. every time build triggers, jenkins compiles 4000 files, if few files have changed. have written batch script compile visual basic 6 files search *.vpb files in every folder. if *.vpb , present compile files present in folder @echo off del "d:\buildfiles\log_file.txt" /r "d:\jenkins_setup\workspace\project" %%a in (*.vbp) ( "c:\program files\microsoft visualstudio\vb98\vb6.exe" /make %%a /outdir "d:\buildfiles" /out d:error_log.txt echo %%a >> "d:\buildfiles\log_file.txt" ) pasted script in jenkins. if files few folders have changed, want script compile files, not 4000 files present in jenkins workspace. make work, else need add script? jenkins doesn't compile. process handed whatever build software use. example, if have c or c++ project, jenkins call make , pass makefile . if have java proj

android how to show a fragment taking a list of object -

button b = (button) findviewbyid(r.id.button); b.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { log.i("hi","onclick()"); fragment f = productlistfragment.newinstance(productarray); fragmenttransaction ft = getsupportfragmentmanager().begintransaction(); ft.replace(r.id.fragment, f); ft.commit(); } }); this in main activity letting user click button create fragment containing productarray data. import android.support.v4.app.fragment; import android.os.bundle; import android.support.annotation.nullable; import android.util.log; import android.view.gravity; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.gridview; import java.util.arraylist; public class productlistfragment extends fr

azure - How to consent an app and its dependent services in AAD -

i created multi-tenant mvc application has dependency on 2 services in same directory. requiredresourceaccess section of manifest looks this: "requiredresourceaccess": [ { "resourceappid": "fc7ecdae-ec69-40a8-a88f-a859591fab07", "resourceaccess": [ { "id": "058901ac-c903-4772-8ccb-d746b94ac86b", "type": "scope" } ] }, { "resourceappid": "66d17ca1-0084-4865-baad-bd45e385ab46", "resourceaccess": [ { "id": "b92337f6-3727-4563-a1fd-2a7a065def89", "type": "scope" } ] }, { "resourceappid": "00000002-0000-0000-c000-000000000000", "resourceaccess": [ { "id": "311a71cc-e848-46a1-bdf8-97ff7156d8e6", "type": "sco

powershell - Regex replace contents of file and delete lines that don't match -

i have large log file want extract types of lines. have created working regex match these lines. how can use regex extract lines , nothing else? have tried cat .\file | %{ if($_ -match "..."){ $_ -replace "...", '...' } else{ $_ -replace ".*", "" } } which works, lines not of interest still remain blank lines (meaning lines of interested spaced far apart). the best way remove else clause altogether. if that, no object returned iteration of foreach-object block. cat .\file | %{ if($_ -match "..."){ $_ -replace "...", '...' } }

ExtJS TabPanel SetActiveTab Reverting back to 0 -

i have tabpanel can click button create new tabs. when button click creates new tab not issue, when call setactivetab appears nothing. when stepped through in chrome can see changing tab specified 1 switching original. great. here code: tab control: { xtype:'tabpanel', itemid:'tabctr1', width:785, hidden:true, items:[ { iconcls: 'btn-newtab', tabconfig: { listeners: { click: btnaddsensor_click } } } ] } click event: function btnaddsensor_click(sender,e,eopts) { //local variable declaration var parent = sender.up('tabpanel'); if (parent !== null && parent !== undefined) { var newtab = parent.add({ title: parent.items.length, layout: 'vbox', width:785, margin:'5 0 0 0', items:[ ] } ] }); parent.setactive

java - Spring MVC controller returns null data to the view -

i have controller returns list of users. when users exist, program works fine. however, when user not found, controller returns null jsp page, in case, got blank screen, none of "alert" in jsp page got printed. please let me know why alert("user doesn't exist") cannot printed , how handle situation when controller returns null jsp page. @requestmapping(value = "/usersearch", method = requestmethod.post, produces = "application/json") @responsebody public userlist search @requestparam string username) { userlist userlistobj = search(username); // search database if (userlistobj.getuserlist().size() > 0) { return userlistobj; } else { return null; } } jsp code: function ajaxusersearch() { var uname = $("#username").val(); if ( un

python - Why do I get a syntax error? -

sales = 1000 #def commissionrate(): if (sales < 10000): print("da") else: if (sales <= 10000 , >= 15000): print("ea") syntax error on if (sales <= 10000 , >= 15000): line. particularly on equal signs. you need compare sales against second condition also: in [326]: sales = 1000 ​ #def commissionrate(): ​ ​ if (sales < 10000): print("da") else: if (sales <= 10000 , sales >= 15000): print("ea") da you need this: if (sales <= 10000 , sales >= 15000): ^^^^ sales here additionally don't need parentheses () around if conditions: if sales <= 10000 , sales >= 15000: works fine you rewrite more compact: in [328]: sales = 1000 ​ if sales < 10000: print("da") else: if 10000 <= sales <= 15000: print("ea") da so if 10000 <= sales <= 15000: works also, @donkey kong addit

java - Validating collection using Bean Validation is not returning invalid elements properly -

i trying create bv constraint validator collections following example in answer of this link . public class constraintvalidatorfactoryimpl implements constraintvalidatorfactory { private validatorcontext validatorcontext; public constraintvalidatorfactoryimpl(validatorcontext nativevalidator) { this.validatorcontext = nativevalidator; } public <t extends constraintvalidator<?, ?>> t getinstance(class<t> key) { t instance = null; try { instance = key.newinstance(); } catch (exception e) { e.printstacktrace(); } if(validatorcontextawareconstraintvalidator.class.isassignablefrom(key)) { validatorcontextawareconstraintvalidator validator = (validatorcontextawareconstraintvalidator) instance; validator.setvalidatorcontext(validatorcontext); } return instance; } } here validator. public class cincodevalidator implements constrain

java - How to extract annotation arguments into external file? -

i have following class. public class multipartfilewrapper { @extensions({".jpg",".png",".gif",".bmp",".mp4"}) multipartfile multipartfile; ... } now want extract formats configuration file. don't understand how replace @extensions({".jpg",".png",".gif",".bmp",".mp4"}) i want rewrite this: public class multipartfilewrapper { @extensions(readformatsfromfile()) multipartfile multipartfile; ... } formats should takes external file following content: .jpg,.png,.gif,.bmp,.mp4 does java allow this? attribute values must constant. from java language specification, section 9.7.1 , emphasis mine: java not allow runtime annotation arguments: annotation parameters stored @ compile-time, , hence cannot dynamic. if t primitive type or string, , v constant expression (§15.28). v not null. if t cl

jquery - How to extend a Chosen drop down beyond the dialog that contains it -

i have html.dropdownlist styled chosen in jquery ui dialog. list of items long enough when opened list cut off border of dialog window. is there way extend dropped down portion of chosen drop down beyond border of dialog contains it? i want result similar this. html: <div class="ui-dialog" id="deletecontrol"> <div class="mws-form-cols clearfix"> <label>select document delete:</label> @html.dropdownlist("filename", model.filedropdown, "", new { id = "filedropdown", onchange = "$('#deletedocname').val($('#filedropdown').val())", style = "display:inline;" }) </div> <!--removed code button row here--> </div> javascript: $("select").chosen(); $("#deletecontrol").dialog({ autoopen: false, title: "remove documents", modal: true, resizable: false, width: &quo

c# - Azure Cloud Service role instances - auto-scaling - Changing event not firing -

i got cloud service deployment 4 worker roles, 1 of got auto-scaling enabled. auto-scaling occurs, instances of roles recycling. ideally, i'd stop roles recycling or @ least terminate work of other roles in controlled way. i found out, can react roleenvironment.changing event , cancel request graceful shutdown (i.e. make onstop being called). however, adding tracing output changing event handler, noticed changing event not fired, cancellation not being registered either. private void roleenvironmentchanging(object sender, roleenvironmentchangingeventargs e) { // tracing output not show in logs table. trace.traceinformation("roleenvironmentchanging event fired."); if ((e.changes.any(change => change roleenvironmentconfigurationsettingchange))) { // 1 neither. trace.traceinformation("one of changes roleenvironmentconfigurationsettingchange. cancelling.."); e.cancel = true; } if ((e.changes.any(change =

android - How to see where the user installed my app from -

how app installed, how track downloads coming from, through partner (advertising publisher)? for example, created ads in facebook or in admob. user saw ads, clicked on them, redirected google play store downloaded app. how can know user downloaded app clicking on facebook or admob ads? google analytics track , show info? you can set install tracking mobile apps: enable app install tracking in account. install tracking automatically enabled in google analytics android apps. don’t have anything! update google analytics sdk. you need change few lines in manifest file. refer developer guide android specific example on how this. set custom campaigns. custom campaigns google analytics feature add parameters url of marketplace page users download app. it’s these parameters tell google analytics marketplaces traffic comes from. overview of custom campaigns in google analytics , how work. must set custom campaigns each platform you’re using. analyze data usi

c# - Unit testing - how to emulate a delay -

we've got large c# solution multiple apis, svcs , on. usual sort of enterprisy mess after same code has been worked on years multiple people. anyway! have ability call external service , have unit tests in place use moq stub implementation of services interface. it happens there can large delay in calling external service , it's not can control (it's gds interface). we've been working on way streamline user experience part of our platform. the problem is, stub doesn't @ - , of course, lightening fast, compared real thing. we want introduce random delay 1 of stubbed methods, cause call take between 10 , 20 seconds complete. the naive approach do: int sleeptimer = random.next(10, 20); thread.sleep(sleeptimer * 1000); but gives me bad feeling. other ways people have of solving kind of scenario, or thread.sleep ok use in context ? thanks time! -russ edit, answer of comments: basically, don't want call live external service our test suit

excel - Method Range of object_worksheet failed 1004 -

i wrote code works should when debug it. when remove breakpoint , run code, give runtime error: runtime error '1004' method range of object_worksheet failed. it refers next line: set copyrange = sh.range("a" & & ":e" & & ",i" & & ":o" & & ",q" & & ",v" & i) 'name column in sheet = q but while debugging it, there isn't problem. maybe cache full? private sub btngetdevices_click() 'open every sheet after summary 'copy columns a,b,c,d,e,i,j,k,l,m,n,o, q,v summary dim sh worksheet dim copyrange range application.screenupdating = false sheets("summary").rows(4 & ":" & sheets("summary").rows.count).delete each sh in activeworkbook.worksheets if sh.name <> "database" , sh.name <> "template" , sh.name <> "help" , sh.name <> "overview" , sh.name &l

php - mySQL Access Denied Error After New User Created -

i made projects using mysql , there no problem. today friend show me how create user in mysql : create database cc; use cc create user 'testing'@'localhost' identified 'pass'; grant on cc.* 'testing'@'localhost'; now tried use project got following error : connection failed: access denied user ''@'localhost' database 'login' i deleted created user : drop user 'testing'@'localhost'; i managed delete user, checked user : select user mysql.user; testing account gone have 3 root accounts, didn't understand why. since deleted "testing" account, tried project again , got same error. why can't use default 'root' account anymore? edit : error part of php code : $servername = "localhost"; $username = "root"; $password = ""; $dbname = "login"; // error in following line $conn = mysqli_connect ( $servername, $username, $pass

visual studio 2013 - C4430: missing type specifier - int assumed. Note: C++ does not support default-int -

i'm using codeproject: http://www.codeproject.com/articles/4682/voice-chat-using-a-client-server-architecture class mysocket : public csocket { public: cdialog *dlg; cstring name; int closeflag; mysocket(); setparent(cdialog *dlg); //void onconnect(int errcode); void onreceive(int errcode); void onclose(int errcode); }; but error in numerous places: c4430: missing type specifier - int assumed. note: c++ not support default-int i think has me using latest version of visual studio (2013).

ruby - CodeSchool APIs with Rails - Asserting response location is the same as the specific URL -

i'm doing codeschool surviving apis rails , i'm stuck on challenge. question asks "now, assert location response header url points newly created human resource. need parse response body, check test/test_helper.rb file on secondary tab helper method can save time." error message "make sure assert response location same humans human_url!" below code have far. class creatinghumanstest < actiondispatch::integrationtest test 'creates human' post '/humans', { human: { name: 'john', brain_type: 'small' } }.to_json, { 'accept' => mime::json, 'content-type' => mime::json.to_s } assert_equal 201, response.status assert_equal mime::json, response.content_type human = json(response.body) assert_equal human_url(human[:id]), response.location end end you have right ... believe there's screwy code on particular challenge. i ran through , had click "check wo

python pycrypto: module' object has no attribute 'importKey' -

i'm working pycrypto , want import public key,but can not work , raise error: 'module' object has no attribute 'importkey'' use pycrypto in other script,it works well,so can not understand why can not work. code can't work following: crypto.publickey import rsa ............. ............. def task_name(task): username = task['user'] taskintid = task['taskintid'] data = '%s,%s' % (str(username), str(taskintid)) user_id = task.get('op_user_id', '') db = get_db() ssh_key = db.ssh_key.find_one({'user_id': user_id}) if ssh_key: try: public_key = rsa.importkey(ssh_key.get('ssh_key', '')) data = public_key.encrypt(data, 32)[0].encode('hex') except exception, e: print e return "task-%s-%s" % (data, task['repeat_num']) al

asp.net mvc - Is it wrong in MVC View Model -

i need little mvc view model. saw using mvc view model this. way writing more code. public class artist { public int artistid { get; set; } public string namesurname { get; set; } public int age { get; set; } } public class artistviewmodel { public int artistid { get; set; } public string namesurname { get; set; } public int age { get; set; } public string whatever { get; set; } public int iwant { get; set; } } copy of main class. work. ok. cant this public class artistviewmodel : artist { public string whatever { get; set; } public int iwant { get; set; } } or public class artistviewmodel { public artist artist { get; set; } public string whatever { get; set; } public int iwant { get; set; } } there lots of reasons doing separate view model domain objects here few can think of right now. => view model representatio

ajax - jQuery runs only once -

there simple solution issue. have index page partial view. partial view contains list of links views, "back list" link gets list of links partial view. index page has jquery script ajax prevents page redirection , returns result partial view. so, if click link first time, result displayed partial view of index page. click "back list", , click link second time script not working , page redirects. wrong? here code: model "linklist": using system; using system.collections.generic; using system.linq; using system.web; namespace ajaxtest.models { public partial class linklist { public int id { get; set; } public string label { get; set; } public string method { get; set; } public string controller { get; set; } public string htmllabel { get; set; } } } the controller has following code: using system; using system.collections.generic; using system.linq; using system.web; using system.web.