Posts

Showing posts from September, 2015

c - Run time Error with scanf -

i new programming . tried implement sample program gives me run time error.but height property float type one. format ‘%f’ expects argument of type ‘float *’, argument 2 has type ‘double’ #include<stdio.h> #include<string.h> struct user { char name[30]; float height; /*float weight; int age; char hand[9]; char position[10]; char expectation[10];*/ }; struct user get_user_data() { struct user u; printf("\nenter name: "); scanf("%c", u.name); printf("\nenter height: "); scanf("%f", u.height); return u; }; int height_ratings(struct user u) { int heightrt = 0; if (u.height > 70) { heightrt =70/10; } return heightrt; }; int main(int argc, char* argv[]) { struct user user1 = get_user_data(); int heighrate = height_ratings(user1); printf("your height ", heighrate); return 0; } your scanf() calls have...

winforms - Remove axis line from chart c# -

Image
i want remove axis line chart in c#. want have point there. how that? here result here code: public chartbuilder(ref chart chart, double minvalue, double maxvalue) { this.chart = chart; this.chart.series.clear(); chart.chartareas[0].axisx.minimum = minvalue; chart.chartareas[0].axisx.maximum = maxvalue; chart.chartareas[0].axisy.minimum = minvalue; chart.chartareas[0].axisy.maximum = maxvalue; chart.chartareas[0].axisx.minorgrid.enabled = false; chart.chartareas[0].axisx.majorgrid.enabled = false; chart.chartareas[0].axisy.minorgrid.enabled = false; chart.chartareas[0].axisy.majorgrid.enabled = false; chart.chartareas[0].axisy.majorgrid.linewidth = 0; chart.chartareas[0].axisx.labelstyle.enabled = false; chart.chartareas[0].axisy.labelstyle.enabled = false; chart.chartareas[0].axisx.interval = 1; chart.chartareas[0].axisy.interval = 1; chart.chartareas[0].axisx.linecolor = color.transparent; chart.char...

javascript - How to update a get parameter in a url with jquery -

here code: <input type="date" name="date" id="date_input" value="<?php echo $_get['date']; ?>" class="date"> <a href="shopping_list.php?page_id=1&title=<?php echo $_get['title']; ?>&date=" id="back_button">back</a> i need user puts date input put "date" part of url on shopping_list.php without page refreshing , needs changed live. thanks in advance! one solution jsfiddle: $("#date_input").on("change", function(){ $("#back_button").attr("href", "shopping_list.php?page_id=1&title=<?php echo $_get['title']; ?>&date="+this.value); }); hope helps!

jsf - custom boolean converter to set style class -

a converter defined in faces-config.xml changes boolean string "yes" or "no" <converter> <converter-id>booleanconverter</converter-id> <converter-class>com.example.booleanconverter</converter-class> </converter> this works fine using <h:outputtext value="#{bean.booleanvalue}" converter="booleanconverter" /> but if intention style surrounding div element possible using converter? example if converter defined return string "booleantrue" , "booleanfalse" (which defined in css) <converter> <converter-id>booleanstyleconverter</converter-id> <converter-class>com.example.booleanstyleconverter</converter-class> </converter> could like: <div class="#{booleanstyleconverter.getasstring(null,null,bean.booleanvalue)}"> <h:outputtext value="#{bean.booleanvalue}" converter="booleanconverter...

amazon web services - How to determine the state of an AWS instance -

i'm trying determine how remove instance several applications (freeipa, chef, service discovery) within aws autoscaling group i'm finding there's no reliable way determine if instance stopping (sometimes our admins take instance out of asg analysis) vs terminating. if instance stopped retain ability have stay connected our ldap , other systems. know way this? is instance ebs backed or using instance store? if instance store, cannot stop (only terminate it) have looked @ ec2 api (via aws-sdk maybe)? (looks describe-instances , looking @ reservations should trick here) http://docs.aws.amazon.com/awsec2/latest/apireference/api_describeinstances.html

android - Upgrading to API 22 breaks test suite -

i attempting upgrade existing project compile , target api 22. changed following lines in build.gradle: android { compilesdkversion 22 ... defaultconfig { ... targetsdkversion 22 } ... dependencies { ... compile 'com.android.support:appcompat-v7:22.2.0' compile 'com.android.support:support-v4:22.2.0' ... } } note these only changes in entire project. suddenly, many of tests fail. of failing tests use robotium , call solo.clickonactionbaritem() . however, button on action bar never seems clicked. when watch test running, not see expected behavior button click. what reasons failure of solo.clickonactionbaritem() not click action bar item? more importantly, how can figure out problem when appears in third-party library using?

bitmap - Android load image into imageview efficiently -

i have next problem: avoid outofmemoryerror i'm loading big images imageviews using picasso in such way: public static requestcreator picasso(final context context, final int resourceid) { return picasso.with(context) .load(resourceid) .fit() .centercrop() .nofade(); } and in activity or fragment, i'm loading image imageview final imageview backgroundimage = (imageview) root.findviewbyid(r.id.background_image); util.picasso(getactivity(),r.drawable.background_soulmap) .into(backgroundimage); however, have 2 problems: image loads delay (but need load immideatly) centercrop() not need in cases. how can implement topcrop() or bottomcrop()? i've tried https://github.com/cesards/cropimageview library, i'm getting nullpointerexception in setframe() method (getdrawable() returns null), because image did not load yet. in advance! image loads delay (but need load immideatly) you h...

How to use image-picker's customizable jquery callback options -

so i'm trying use http://rvera.github.io/image-picker/ the documentation section gives example of how use options, provides no example code of how insert callback functions. i tried adding anywhere didn't work. $( "select" ).clicked(function() { $( ).slideup(); //random execution }); i realize answer obvious familiar jquery, i'm relatively new, appreciated. i should configured other options: $("select").imagepicker({ hide_select : true, show_label : false, clicked: function() { console.log('image selected'); } });

c# - DownloadFileAsync Error -

i keep error while trying download file using webclient.downloadfileasync system.net.webexception: underlying connection closed: unexpected error occurred on receive. ---> system.io.ioexception: unable read data transport connection: established connection aborted software in host machine. ---> system.net.sockets.socketexception: established connection aborted software in host machine @ system.net.sockets.socket.endreceive(iasyncresult asyncresult) @ system.net.sockets.networkstream.endread(iasyncresult asyncresult) --- end of inner exception stack trace --- @ system.net.sockets.networkstream.endread(iasyncresult asyncresult) @ system.net.pooledstream.endread(iasyncresult asyncresult) @ system.net.connection.readcallback(iasyncresult asyncresult) --- end of inner exception stack trace --- @ system.net.httpwebrequest.endgetresponse(iasyncresult asyncresult) @ system.net.webclient.getwebresponse(webrequest request, iasyncresult result) @ s...

forms - django: raise an error similar to EmailField -

Image
when using email field, attempting submit form invalid email address raises , error this: what this: doesn't reload page, rather doesn't submit @ , instead displays error the look here able accomplish name , password (charfields) the "a name needed!" , "this field required" messages display after form submitted, not sleek displaying without form needing submitted. the popup see email not django validation. build in in-browser html5 email field checking (and older browsers not you). and can't kind of validation in html5, checking field presents can add required attribute rendered input field. there several ways add attibutes widgets in django. take how django forms show html required attribute? , select appropriate you.

hdfs - Unable to create file using Pail DFS -

newbie here. trying run code nathan marz's book big data dfs datastore using pail. doing wrong? trying connect hdfs vm. tried replacing hdfs file. appreciated. public class apptest { private app app = new app(); private string path = "hdfs:////192.168.0.101:8080/mypail"; @before public void init() throws illegalargumentexception, ioexception{ filesystem fs = filesystem.get(new configuration()); fs.delete(new path(path), true); } @test public void testappaccess() throws ioexception{ pail pail = pail.create(path); typedrecordoutputstream os = pail.openwrite(); os.writeobject(new byte[] {1, 2, 3}); os.writeobject(new byte[] {1, 2, 3, 4}); os.writeobject(new byte[] {1, 2, 3, 4, 5}); os.close(); } } get error - java.lang.illegalargumentexception: wrong fs: hdfs:/192.168.0.101:8080/mypail, expected: file:/// @ org.apache.hadoop.fs.filesystem.checkpath(files...

c# - Retrieving the TabItem hosting a nested WPF Control -

i have nested controls on wpf tabcontrol. need find specific tabitem parent of control. preferably using linq. ideas. a non-selected tabitem don't exist in visual tree, in logical tree. i've made small example on this: <tabcontrol x:name="tabcontrol"> <tabitem header="test 1"> <button content="click tabitem name" margin="100" click="btngetparent_click"/> </tabitem> <tabitem header="test 2"/> </tabcontrol> clicking on button inside tabitem should display tabitem's header meaning have access , able work need. i've kept code pretty simple here too: public partial class mainwindow : window { public mainwindow() { initializecomponent(); } private void btngetparent_click(object sender, routedeventargs e) { tabitem ti = tryfindparent<tabitem>(sender button); messagebox.show(ti.header...

ruby - DataMapper Error with Models(`fetch': key not found: :precision (KeyError)) -

really new programming , programming community, , second project programming ruby excuse me if i'm missing obvious or doing wrong. in project far, i'm trying create database using datamapper. database should include 3 objects: user, category, , class. user can have many category, , category can belong many users, why linked these 2 objects usercategory create many-many relationship. association between category , class, category object can have many classes, class can belong 1 category. database far: require "sinatra" require "data_mapper" if env['rack_env'] == 'production' datamapper.setup(:default, env['database_url']) else datamapper.setup(:default, "sqlite:online-arena.db") end class user include datamapper::resource property :id, serial property :username, string, :required => true, :unique => true property :password, bcrypthash, :required => true validates_...

Java terminology used for starting a new process -

i starting new process in java uses runtime.exec . copied on of code online, , classpath uses not seem work me if change name of class accessing. line of code: process process = runtime.exec( "java -classpath c:\\projects\\workspace\\testing\\bin program"); the class trying access program.java . there way make work computer, long have class named program ? so should write in area can refer class program in computer? the class trying access program.java. there way make work computer, long have class named program? you (or they) need compile program. (that no different c, c++ , numerous other programming languages.) they need have java installed on machine. they need invoke command correctly, depending on java installed, (compiled) program is, , on 1 . there various things can simplify end user. example, can implement installer installs software in standard place , provides launcher or wrapper script running it. launc...

ios - how to fix this layouts on xcode? -

Image
the thing is, i'm making app available iphones. it's portrait mode, got 2 issues: 1) imageview on iphone 3.5 inch not resizing (even though i'm using auto layout) 2) want make 2 lines of collectionview on iphone 5.5 inch here's previews: here's storyboard i solve sing more 1 storyboard, each 1 one device. it's not apple's recommendation, works fine when have display on many devices, , it's way easier auto layout. you can find tutorial here .

java - Null Pointer Exception with "getPackageName()" -

i have been stuck on problem past week , half. made game using "kilobolt" framework, , have been trying implement in app purchase's in app , i've tried every way possible keep getting same error, there null pointer exception. 06-13 21:40:18.991: e/androidruntime(16384): java.lang.nullpointerexception 06-13 21:40:18.991: e/androidruntime(16384): @ android.content.contextwrapper.getpackagename(contextwrapper.java:127) i have 1 activity have method leveltwobuttonclicked() , calling method java class, null pointer exception coming , because of getpackagename() . i have in try catch statement: skudetails = mservice.getskudetails(3, getpackagename(), "inapp", queryskus); . i have done research , read there issue context , calling getpackagename() havent been able figure out issue yet 1 can me resolve this! public abstract class androidgame extends activity implements game { public static context mcontext; iinappbillingservice mservice; ...

Android listview item click -

i'm trying listview items have different action when pressed, action depends on variable "state", problem items in same action, here code: for(int = 0; < json.length(); i++){ jsonobject c = json.getjsonobject(i); // storing json item in variable string codigo = c.getstring(tag_codigo); string asignatura = c.getstring(tag_nombre); int estado = c.getint("estado"); final int maxhoras = c.getint("maxhoras"); final string idprogramacion = c.getstring("programacionid"); // adding value hashmap key => value hashmap<string, string> map = new hashmap<string, string>(); map.put(tag_codigo, codigo); map.put(tag_nombre, asignatura); jsonlist.add(map); list=(listview)fi...

jquery - JavaScript Fade in, fadeout numbers also to center my images -

here have: javascript <script type="text/javascript"> $(document).ready(function() { $('#mixer').fadein(3000).delay(2000).fadeout(1500); $('#mixer1').delay(2000).fadein(3000).fadeout(2000); $('#turntable').delay(2000).fadein(3000).fadeout(1500); $('#turntable1').delay(2000).fadein(1500); }); </script> css #mixer, #mixer1, #turntable, #turntable1 { display: none; position: absolute; left: 50; right: 10; margin - left: auto; } basically want in middle fade in , out each other. use callbacks $(document).ready(function() { $('#mixer').fadein(function() { $(this).fadeout(); $('#mixer1').fadein(function() { $(this).fadeout(); ... }, 3000); }, 3000); });

iphone - IPhone6 app - IPhone5 -

i started making apps few weeks ago , when started, wasn't thinking put 1 on app store. problem is, made app iphone 6 , want put on app store, there way make iphone 5 well? problem iphone 6 larger iphone 5 parts cut out if put on it. there way change size , such depending on device in swift? thanks! try using auto layout won't problem iphone used . about autolayout auto layout system lets lay out app’s user interface creating mathematical description of relationships between elements. define these relationships in terms of constraints either on individual elements, or between sets of elements. using auto layout, can create dynamic , versatile interface responds appropriately changes in screen size, device orientation, , localization. try study following tutorial http://www.raywenderlich.com/83129/beginning-auto-layout-tutorial-swift-part-1 http://www.raywenderlich.com/50317/beginning-auto-layout-tutorial-in-ios-7-part-1 here example of a...

c# 4.0 - How to tell if the logged in user has a security role? -

i trying find out if logged on user has security role. i've looked on google (couldn't find answer) , sdk examples (they seemed way complicated). so, if know name of security role , user id, how check see if user has role? if browse folder structure of crm 2011 sdk (link: https://www.microsoft.com/en-us/download/details.aspx?id=24004 ) location find looking for: .\sdk\samplecode\cs\businessdatamodel\usersandroles\doesuserbelongtorole.cs it provides sample built c# console application. code work in asp.net long app pool user authorized access crm organization trying connect to. hope helps

vb.net - Filter RHS items in LINQ Group Join -

in linq, need left join ( group join ) 2 lists of objects using some criteria able expressed equijoins (so can use on clause), , other criteria relative. in sql, equivalent (using ludicrous example, want list each person of pets own born on or after owner's wedding date; note data in objects, not in sql): select pers.name, pers.address, pers.gender, pet.name, pet.species person pers left join pets pet on pers.name=pet.ownername , pet.birthdate >= pers.weddingdate here's i've got far - doesn't include restriction pets in list should have been born on or after owner's wedding date. dim res = ( p in person group join pt in pets on p.name equals pt.ownername petlist = group select p, petlist) first thought use where clause, individual pets in list aren't in scope @ point. then thought perhaps answer lambda function in pets list, like group join pt in pets.where(function(pt) pt.birthdate >= pers.weddingdate) but don...

java - Sqlite persist object containing collection of objects -

i keep getting error when persisting object in java collection of same type of objects inside. im using: ormlite sqlite mi class @databasetable(tablename="profile") public class profile { /** users username in system */ @databasefield( unique = true) private string usrname = null; /** users id */ @databasefield( generatedid = true) private integer usrid = null; /** users name */ @databasefield private string name = null; /**the users friends*/ @foreigncollectionfield private collection<profile> friends; am forgetting declare anything? found foreign field, set id , @foreigncollectionfield tag. supposedly profile stores other profiles, not profiles stored have references profile. thanks answers! :)

Getting 403 error while making a youtube analytics api call -

i have access channel , happening videos in channel. idea may reason ?? [com.spr.channel.error.accessforbiddenexception: exception while processing request accountid: 37393 channel type: youtube message: 403 forbidden { "code" : 403, "errors" : [ { "domain" : "global", "message" : "forbidden", "reason" : "forbidden" } ], "message" : "forbidden" } at com.spr.channel.error.translator.gplusexceptiontranslator.dotranslateexception(gplusexceptiontranslator.java:72) @ com.spr.channel.error.translator.abstractchannelapiexceptiontranslator.translateexception(abstractchannelapiexceptiontranslator.java:42) @ com.spr.channel.sn.youtube.youtubev3apiclientimpl.translateexception(youtubev3apiclientimpl.java:952) @ com.spr.channel.sn.youtube.youtubev3apiclientimpl.executequery(youtubev3apiclientimpl.java:154) @ sun.reflect.generatedmet...

Where do I file bugs for JavaFX? -

now javafx jira issue tracker has been moved jdk bug system , don't find option file new bug developers. rather, find information saying: everyone openjdk author status or above has jbs account may used create , edit bugs. without accounts can view bugs anonymously. as expected, openjdk author status have huge list of formalities need complete. i have never used jdk bug system before, rather irritating, compared earlier javafx jira issue tracker , 1 sign , create bug reports. i have been report bug or request feature page , adds irritation. does mean can no longer submit bugs javafx, unless use report bug page or missing something here? the default java jdk bug system on here: http://bugs.java.com/ it redirect bug creation page received new component "javafx". so in conclusion: yes, can no longer use jira issue tracker javafx issues.. further reference: https://www.mail-archive.com/openjfx-dev@openjdk.java.net/msg09098.html

ruby on rails - Change resources path -

i'm using rails 4 i have routes.rb file looks like: resources :books however, i'd urls in application end looking /b/101 instead of /books/101 . i realize go through , rename each resource path individually, there not way changing resources somehow? kind of how can change params doing resources :books, params: :new_id ? here can resources :books, path: 'b'

MySQL PHP statements is returning junk data included with the records -

lately newly created tables in mysql database returning " \r\n\r\n\r\n " on select statements along stored data. don't know junk data coming because not visible in phpmyadmin. happening in newly created tables, doesn't happen in old ones. i used phpmyadmin create table, here exact statement create it: create table if not exists `user_analysis` ( `project_id` int(11) not null, `ugroupid` int(11) not null, `user_address` text character set utf8 collate utf8_bin not null, `user_strengths` text character set utf8 collate utf8_bin not null, `user_weaknesses` text character set utf8 collate utf8_bin not null ) engine=innodb default charset=utf8; the table information this: type: innodb collation: utf8_general_ci here query i'm making: $query = "select user_strengths user_analysis `project_id` = ? , `ugroupid` = ?"; if($stmt = $mysqli->prepare($query)){ $stmt->bind_param("ii", $this->pid, $this->gid); ...

c# - How to get list of specific child instances from list of parent instances? -

the answer simple not find myself. my classes follows public class element { } public class lineelement : element { } public class circleelement : element { } in code want achieve this: list<element> elements = new list<element>(); list<lineelement> lines = elements.where( x=> ..........).tolist(); what way achieve without defining type specifying property (like string type ) in child classes? you need oftype() method. list<lineelement> lines = elements.oftype<lineelement>.tolist();

c - How to store result of type char in pointer? -

i want store result of type char in pointer i'm passing argument of function. this: #include<stdio.h> void try(char *); int main() { char *result; try(result); printf("%s",result); return 0; } void try(char *result) { result="try this"; } but i'm getting result : (null) could tell me what's wrong here? also way (no dynamic memory): #include<stdio.h> void try(char *); int main() { char result[100] = {0}; try(result); printf("%s",result); return 0; } void try(char *result) { strcpy(result,"try this"); } note: when got null, doesn't mean - had undefined behaviour there - because result not initialized. guess invoked ub before trying print result , namely when passed try . because copy made in method of pointer, try read value of original pointer - reading uninitialized variables undefined in c. hence initialize variables in c.

asp.net mvc 4 - Return to the same view when no image is selected -

i have upload control. if user didnt select image , press on upload button, user message he/she has go , try again, this: if (issavedsuccessfully) { return redirect(url.action("edit", "account") + "#tabs-2"); } else { return json(new { message = "error in saving file, go , try again" }); } but ofcourse not want. because message in seperate view, not in view self, can upload image. how show message in same view, upload image? this full method: [httppost] public actionresult editphotos(userprofile user, httppostedfilebase file) { bool issavedsuccessfully = true; try { if (file != null || file.contentlength > 0) { if (isimage(file) == false) { // invalid file type ...

matlab - Output argument "am" (and maybe others) not assigned during call to -

i trying use function in m file error(mentioned in question). seems correct , a, b , c defined in m file. thoughts? error: error in modal2 (line 8) [v,an]=eig(a); output argument "am" (and maybe others) not assigned during call "c:\users\cena\desktop\thesis\my codes\smc\modal2.m>modal2". function [r,am,bm,cm] = modal2(a,b,c) % function determines modal representation 2(am,bm,cm) %given generic state-space representation (a,b,c) %and transformation r modal representation %such am=inv(r)*a*r, bm=inv(r)*b , cm=c*r %transformation complex-diagonal form: [v,an]=eig(a); bn=inv(v)*b; cn=c*v; %transformation modal form 2: = find(imag(diag(an))'); index = i(1:2:length(i)); j=sqrt(-1); t = eye(length(an)); if isempty(index) am=an;bm=bn;cm=cn; else i=index t(i:i+1,i:i+1)=[j 1;-j 1]; end %modal transformation r=v*t; end the problem in if isempty(index) am=an;bm=bn;cm=cn; the assignment variables being done if conditional ...

ruby code not working under the "ui" class when using semantic-ui -

i want use semantic-ui ruby-on-rails project (here project: https://github.com/liyingtw/c9_booking/tree/filling-in-layout ) however, ruby code not work in html tag class = "ui". here code: <nav class="ui menu"> <a class="active teal item"> <i class="home icon"></i> <%= link_to "main", :controller => "order", :action => "index" %> </a> <% if @user.is_admin? %> <a class="active teal item"> <%= link_to "management - users", :controller => "admin", :action => "users_index" %> </a> <% end %> <div class="ui orange inverted right menu"> <a class="pink item"> <i class="sign out icon"></i> <%= link_to "logout", :controller => ...

xaml - WP 8.1 ToggleButton Change Icon when Checked / UnChecked -

Image
i have following xaml code windows phone 8.1 (non silverlight) : <grid> <togglebutton name="togbtn" verticalalignment="center" horizontalalignment="center" checked="togglebutton_onchecked"> <symbolicon symbol="play"></symbolicon> </togglebutton> </grid> the output of above code is: how can change icon stop icon when toggle button checked , play icon when unchecked? i thought easy find through google, apparently not. any appreciated. please change xaml this: <grid> <togglebutton x:name="togbtn" horizontalalignment="center" verticalalignment="center" checked="togglebutton_checked" unchecked="togglebutton_unchecked"> <symbolicon symbol="play"></symbolicon> </togglebutton> </grid> and please add .cs file: private void togglebutton_checked(object sender, r...

Running Python clicker based on keylogger inputs on the background in Windows -

i wanted write program in python windows act clicker, in according key user presses click made @ known location on screen. used automated option selection list in webpage. have clicking part working, wanted able make several clicks during execution, if there quiz multiple lists 1 after another. one option make while loop getch() msvcrt . thing after click outside cmd window no longer selected, rather window destination point located. therefore, script stops being active , user cannot choose location. workaround click cmd window return focus , able more clicks. solve this, necessary create service or, according @sanju, thread. the other option use keylogger such pyhook, seems way go. however, problem window want use in, webpage in flash or animations engine, causes error users have found using keylogger example in skype , being described here . in case, happens webpage , either when click made on window or when key pressed window selected. my base code presented below, click(...

node.js - Custom Model Validator SailsJS -

when using custom model validator checks record within model. return within spread doesn't seem end control flow. //post.js model /** * custom validator **/ types: { isuservalid: function(user_id) { var promise = require('bluebird'); promise.all([ user.findone({id: user_id}) ]) .spread(function(user) { console.log(user); if (user === null || user === undefined) { console.log('failed'); return false; }else{ console.log('passed'); return true; } }); } }, my response standard validation failed response. { "error": "e_validation", "status": 400, "summary": "1 attribute invalid", "model": "post", "invalidattributes": { "owner": [ { "rule": "isuservalid", ...

javascript - Uncaught RangeError: Maximum call stack size exceeded on jquery dialog -

i have been confusing week eror in javascript. have table 1 column anchor selection code. if view display on screen not problem, java script doing normal. if view display on jquery dialog ajax, when click anchor class "pilih" error: uncaught rangeerror: maximum call stack size exceeded i sorry can't explain well, because code mixed php , java script. anyone can access web , page problem in link http://femiola.com/public/cbarang/# there plus button > click it, appear bootstrap modal, blue button > click it, appear jquery dialog, when choosed 1 anchor in jquery dialog have error uncaught rangeerror: maximum call stack size exceeded my code here vbarang.php (screen page plus button) <script type="text/javascript"> $(document).ready(function() { $(".plihkel").on('click', function(e){ e.stopimmediatepropagation(); var ygdipilih = $(this).attr("id"); ...

Setting default value using SQL in ms access 2007 -

according w3schools can set default value in ms access way: alter table persons alter column city set default 'sandnes' but variant gives me "syntax error in alter table instruction". also doesn't work: "sandnes" (sandnes) i'm confused that. city column hasn't constraints or dependencies. ms access 2007. i'm doing wrong ? what important mention: should use sql view inside ms access set default value do have sql it? otherwise this: set default value table field in navigation pane, right-click table want change, , click design view. select field want change. on general tab, type value in default value property box. the value you can enter depends on data type set field. example, can type =date() insert current date in date/time field. save changes.

c# - Working on a project by the time -

is possible team programming group example 3 programmers work on project time ? possible tfs visual studio ? if how ? (c#) yes, both tfs , vso provide same capabilities developers working build single product. https://www.visualstudio.com/features/version-control-vs you best using git if starting out, or tfvc if have large legacy codebase. you best using vso (tfs online) easier setup , support.

c++ - How to export directly in a Makefile? -

i want export directly in makefile did rule 1 : export: export ld_library_path=./smthing/here and call rule in $(name) $(name): $(objs) $(cxx) -o $(name) $(objs) $(cxxflags) $(ldflags) $(export) $(objs) simple rule convert .cpp .o . $(cxxflags) compiling flags : -wall -werror -wextra and on $(ldflags) got point.. the problem here export rule done didn't exported expected. why ? can me ? i got if don't export hand in terminal : ./cutom_prog: error while loading shared libraries: custom_lib.so: cannot open shared object file: no such file or directory if want handle exporting makefile, try: $(name): $(objs) @export my_env_var=my_value; \ $(cxx) -o $(name) $(objs) $(cxxflags) $(ldflags) exporting work if called in same subshell command itself. however, solution not going work ld_library_path , because intention update parent process make , not possible. the workaround create wrapper script would: build a...

mysql - findOne doesn't get any record -

login: function (req, res) { var username = req.param('username'); var password = req.param('password'); user.findone({username: username}, function (err, user) { if (err || !user) { return res.status('401').send("user username \"" + username + "\" not found. registered?"); } ... gives me undefined user object , end in error statement. username variable has correct value. method, create records, works (so connection db alright), , when db, record there, correct data. i tried user.find().where({username: username}).exec(function (err, user) { no success... any suggestions can (debugging or smth) or might cause of problem? jonathan's comment inspect err pointed me in right direction. user model follows: attributes: { // relations passports: { model: 'passport' }, //... other attributes a...

WordPress PHP Extended Classes Refer to 'Wrong' Static Variables -

i have wordpress plugin 2 extended classes, area , loc, each of has helper function get. each class has static variables table_name. if call loc::get($id) directly, works expected. if, however, call loc::get($id) area, uses table_name area rather location. can explain how correct this? regards, class _base { function get($id) { $instance = new self(); $sql = "select * " . static::$table_name . " id=$id"; return $sql; } } class area extends _base { static $table_name = "area"; function getloc($id) { $sql = loc::get($id); return $sql; } } class loc extends _base { static $table_name = "loc"; } $sql = area::get(1); // -> "select * **area** id=1" $sql = loc::get(1); // -> "select * **loc** id=1" $sql = $area->getloc(1); // -> "select * **area** id=1" i think problem run non static method get static. when changed start w...

javascript - Modifying a model in directive -

a custom directive creates new modified model out of model display purposes using service method. the problem new model isn't registered @ all. boo custom attribute model appreciate kind help. fiddle https://jsfiddle.net/u24godsh/ https://jsfiddle.net/u24godsh/1/ using directive controller template : <section ng-app="myapp" ng-controller="mycontroller"> <div my-directive boo="model"> <div ng-model="newmodel"> <span>model: </span> <b>{{model}}</b> <br/> <span>new model: </span> <b>{{newmodel || 'undefined'}}</b> </div> </div> </section> directive app.directive('boo',['myservice', function (myservice) { return { restrict: 'a', scope: { boo: '=' }, link: function (scope, element, attrs) { ...

angularjs - angular loop through nested json array -

i have following json structure "bonds": [ { "name": "bond_0", "interface": [ "nic_0", "nic_1" ], "mode": "active_standby", "primary_interface": "nic_0" }, { "name": "bond_1", "interface": [ "nic_0", "nic_1" ], "mode": "active_standby", "primary_interface": "nic_0" } ] i need loop , display data in table. although can display values ihave trouble display interface array. tried ng-repeat="interface in bond.interfaces not working. appreciated @ view code <table class="table"> <tr> <th>name</th> <th>interface</th> <th>mode</th> <th>primary interface</th> </tr> <tr ng-repeat=...

javascript - Getting position of last child div within slides -

i using dragend plugin turn series of web pages slides. html looks this: <main id="swipe-page"> <div class="dragend-page"> <div class="page-content"></div> <div class="page-content"></div> <div class="page-content"></div> </div> <div class="dragend-page"> <div class="page-content"></div> <div class="page-content"></div> </div> <div class="dragend-page"> <div class="page-content"></div> <div class="page-content"></div> <div class="page-content"></div> <div class="page-content"></div> <div class="page-content"></div> </div> </main> some slides larger others, trying manually a...

java - Post with HTTPUrlConnection -

i'm using httpurlconnection connect web service have form , button. the part in source code is: <form action="main.php4?page=markt3art=uin=484504321483db0fc35d1e8e660b99c8&x=&y=filled=1" method="post"> <input type="hidden" value="" name="p"></input> <input type="hidden" value="1755219" name="buy2f8d0"></input> <input type="hidden" value="1755219" name="buy"></input> <input type="text" value="323" size="9" maxlength="16" name="teilkauf"></input> <img width="1" hspace="20" height="1" src="pics/leer.gif"></img> <input class="send" type="submit" value=" buy "></input> </form> what i'm doing is: (www w...

java - What is difference between Fields and Constants in android documentations? -

what difference between fields , constants in android documentations? example in view class have fields , constants.whiles, think constants in view class fields. because each variable in each class field. please example me ambiguity. when app compiled, constant values compiled directly application. using example @commonsware's comment, accessibility_live_region_assertive integer value 2. value continue used app if view class updated in future release of android, why can't put "what version of android running on" in constant. conversely, it's fine way record version of sdk app compiled against. the fields final, means can't change them, unless use jni, in case can. however, because compiler uses values directly whenever possible, changing value of final fields won't affect code -- unless accesses them through reflection. so distinction between "constant" , "field" may of importance. primitive types , strings may ...

ubuntu - C: Weird behaviour between client and server -

i'm writing server-client program in c. client sends command server in form of 5 bytes: first byte operation, , next 4 bytes key operation on. the server looks this: int nowread, key; while(1) { char buffer[1024]; int alreadyread = 0; { nowread = read(socket,buffer+alreadyread,5-alreadyread); alreadyread += nowread; } while((nowread > 0) && (5-alreadyread > 0)); if(nowread == -1 || nowread == 0) { printf("error reading client socket\n"); exit(1); } key = (((int)buffer[1])<<24 | ((int)buffer[2])<< 16 | ((int)buffer[3]) << 8 | ((int)buffer[4]) << 0); printf("%d, key server \n",key); // debugging //do command i've been testing program having client send 10 commands: op: 1, num: 645110 op: 2, num: 419811 op: 0, num: 115300 op: 2, num: 792023 op: 2, num: 146624 op: 1, num: 842346 op: 1, num: 450778 op: 0, num: 550046 op: 1, n...

running depend testng method using @factory -

scenario:- my testdata 1)string 2) string b 3) string c now have class in have data provider , factory , data provider has 3 value string public class testparent { public string tenant; @factory(dataprovider = "mylist") public testparent(string s) { tenant = s; } @dataprovider(name = "mylist") public object[][] mylist() { list<string> s = new arraylist<string>(); s.add("a"); s.add("b"); s.add("c"); object[][] objarray = new object[s.size()][]; (int = 0; < s.size(); i++) { objarray[i] = new object[1]; objarray[i][0] = s.get(i); } return objarray; } @test() public void setup() { system.out.print(tenant); system.out.print("\n"); } @test(dependsonmethod = setup) public void beforeclass() { system.out.print("hello"); s...

php - Read data from MySQL table and print only a specific item of each line in codeigniter view -

in model (model_users) have following : public function members_list() { $query = $this->db->get('users'); return $query->result(); } in controler have following function: public function members_list() { $this->load->view('members_list_view'); } in view file have following code: $this->load->model('model_users'); $membersarray = $this->model_users->members_list(); foreach ($membersarray $v1) { foreach ($v1 $v2) { echo "$v2\n"; } } my question following: how echo userid of each line of users table? with above code in view file got whole line of table. your double structure loop foreach ($membersarray $v1) { foreach ($v1 $v2) { actually runs on each row , on each element in each row, when echoing $vs should filed value, , @ end should fields of rows (maybe duplicates). ther...