Posts

Showing posts from May, 2015

Recover code repository in Github? -

i inherited project used setup github version control. however, due lack of communication original developer, i'm left code base lives on production. question have if it's possible recover code repo in github given have .git folder contains git related files? if there's existing .git folder, it's existing git repository. follow instructions adding existing project github , way.

sql - What should I use triggers or constraints? -

in sql developer created table bill (id,nr,cost,days,total -all integers) and need create constraint (or trigger -what best) act if nr > 10 total = total -5 (total = nr * cost * days ). create or replace trigger discount after insert or update on bill update bill set total = nr * cost * nr - 5; when (nr_slide > 10 ) can use update inside triggers? constraint can prevent putting wrong value table. if use constraint, need calculate correct value total , insert table, otherwise no rows inserted. means need trigger. create or replace trigger discount after insert or update on bill each row -- added here begin if :new.nr > 10 :new.total = :new.nr * :new.cost * :new.days - 5; end if; end; if educational project - no problem (of course, problem - quite bad example education). in applications real life use advise of ash burlaczenko.

formatting - How to diplay MATLAB output in readable format? -

i using matlab symbolic calculations. give output of mathematical expressions in 1 line not readable example- >> syms x y z >> int(sin(y*cos(x)),y) >> ans = -cos(y*cos(x))/cos(x) is there way readable output how read in text books. use pretty : syms x y z s = int(sin(y*cos(x)),y); pretty(s)

php - Whats the best / recommended way to authenticate users using rest in Symfony? -

i developing rest apis in symfony application. right apis used application on frontend (ajax requests angularjs). in future expose same apis third party applications well. also having have android, iphone apps etc in future. i have integrated fosoauthserverbundle, , have tried grant type workflows. working. confused can these used application or 3rd party applications integrate application ? i understand how these workflow can used 3rd party apps. can't understand how can authenticate native application users ? i want know how use bundle authenticate users on website through rest apis frontend app ? currently usnig fosuserbundle , form_long authenticate user changing frontend use angularjs , rest based. ideally authentication should work form_login authentication should rest based. i did research on , people suggest use "resource owner password credentials" needs client secret exposed in javascript may not secure it should work e.g. user submits user...

android - State Loss Management -

i've activity contains login fragment , activity b contains home fragment. i've start b login fragment after succesfully login request (async). i've callback listener inside login fragment: onsuccess(result) { startactivity(b); } today met nice bug: getting exception "illegalstateexception: can not perform action after onsaveinstancestate" . i think that's not bug, anyway don't know how workaround that. this blog post suggests avoid transaction inside async callback methods, yeah how? commitallowingstateloss() should used last resort: in case, should use inside home fragment transaction in activity b creation method? basically, should start activity after async callback? you should use onpostexecute(result) in asynctask: private class logintask extends asynctask<parameters,...> { ... protected void onpostexecute(long result) { //if result successful start activityb } } onpost fires after asynctask complete....

ios - Alternate LaunchImage for different application start -

i have developed application new launchimage.xib feature of xcode 6. launchimage blank view color of upcoming rootviewcontroller. works fine normal application startup. the application can started open in... option when tapping on file in other applications (such dropbox, or mail attachment) , given file processed in appdelegate.didfinishlaunchingwithoptions . may take time depending on size of file. kind of application start show alternate launchimage informs user file being processed. what have seen far can have 1 launchimage.xib , there no way work custom class execute code in appdelegate such showing/hiding labels on screen. are there ideas on how can accomplish this?

performance - Time measurement for getting speedup of OpenCL code on Intel HD Graphics vs C host code -

i'm new opencl , willing compare performance gain between c code , opencl kernels. can please elaborate method among these 2 better/correct profiling opencl code when comparing performance c reference code: using queryperformancecounter()/__rdtsc() cycles (called inside gettime function) ret |= clfinish(command_queue); //empty queue gettime(&begin); ret |= clenqueuendrangekernel(command_queue, kernel, 2, null, global_ws, null, 0, null, null); //profiling disabled. ret |= clfinish(command_queue); gettime(&end); g_ndrangepureexectimesec = elapsed_time(&begin, &end); //performs: (end-begin)/(clock_per_cycle*clock_per_cycle*clock_per_cycle) using events profiling: ret = clenqueuemarker(command_queue, &evt1); //empty queue ret |= clenqueuendrangekernel(command_queue, kernel, 2, null, global_ws, null, 0, null, &evt1); ret |= clwaitforevents(1, &evt1); ret |= clgeteventprofilinginfo(evt1, cl_profiling_command_start, sizeof(cl_long), &begi...

javascript - How display Wikipedia search? -

i have started programming in javascript , have create own wikipedia page using wikimedia api can't understand when search clicked how pull data text box , display result. <!doctype html> <html> <body> <h1>wikipedia</h1> <div id="search1" /> <input type="text" name="search" /></b> <button id="s1">search</button> </div> <p id="display"></p> <script> var xmlhttp = new xmlhttprequest(); var url = "https://community-wikipedia.p.mashape.com/api.php" ; xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate == 4 && xmlhttp.status == 200) { myfunction(xmlhttp.responsetext); } } xmlhttp.open("get", url, true); var key = "ocdv3mjlj1mshtyixwbvzbqrkty9p1xjniajsn1vscetyvlwk3"; req.setrequestheader("x-mashape-key", key); xmlhttp.send(); function function(response) { var = json.pa...

javascript - Hierarchical JSON into flare.json format for use in Bilevel Partition -

Image
i have csv want convert hierarchical json use bilevel partition . the bilevel partition wants json data in format similar flare.json file . leaf nodes have name , size properties , in between has name , children properties. here code attempting convert csv file hierarchical json. code var root = { "key": "leeds ccgs", "values": d3.nest() .key(function(d) { return d.ccgname; }) .key(function(d) { return d.practicename; }) .key(function(d) { return d.diagnosisname; }) .rollup(function(leaves) { return d3.sum(leaves, function(d) { return d.numpatientswithdiagnosis; }) }) .entries(data) } the above code works far giving data required hierarchical structure, but labels wrong. instead of name , children , size gives me key , values only, way leaf nodes, similar this file . so read around, , found this question on so, isn't bilevel partition , thought same principle apply, since both layouts need hierarchical json...

MySQL: Changing foreign key column - but keep data references intact -

i have problem concerning changing of foreign key reference , keeping data references intact. i have 1 table containing comments, these comments created users, users stored in seperate table , referenced comments table foreign key. have lot of data in database, can't discard. at first had made own login system unique id each user (their username - know, past me douche , didn't use integers ids), id referenced, , have changed users need facebook use page. problem lies - want comments foreign key changed facebook id instead of username, don't want loose data relation between comments , users. i have following setup of tables , columns: commentstable: [commentid] [comment] [userstable_username] userstable: [userid] [(varchar) username] [(int) facebookid] what want instead: commentstable: [commentid] [comment] [userstable_facebookid] userstable: [userid] [(varchar) username] [(int) facebookid] i tried creating additional foreign key in commentstable - didn...

html - Child divs won't respond to percent height -

so working on website when came across problem of footer not staying @ bottom of container div (the footer not inside of container, placed after in html). realized because of child divs floated, had put overflow:auto on container--however, because needed children have percentage heights, had height @ 100%, , know overflow:auto + specified height = scrollbar . having min-height wouldn't allow child divs height. having both doesn't work. i recreated problem in separate testing files, getting rid of unnecessary css (although i'm sure still remains) visualize problem without clutter. it's on jsfiddle currently. have height commented out currently, because ideally won't using it. here's container div css: #container { position: relative; width: 70%; /*height:100%;*/ min-height: 100%; overflow: auto; margin: 0 auto; background-color:#ffda8a; } and 1 of child divs needs percentage height: .featured { position: relative; ...

jquery - fancybox: title for next and prev item -

i need make navigation 'prev' , 'next' need title of them next it. ex: < prev | 'previous post title'                                     'next post title' | next > i wasn't able find relevant post anywhere , hoping genius me out problem. i've looked thumbnail helper pulls next , previous photo, i'm not savvy enough pull title code.(not sure direction right) help! you use fancybox tpl option customize navigation like jquery(document).ready(function ($) { $(".fancybox").fancybox({ tpl: { next: '<a title="next" class="fancybox-nav fancybox-next" href="javascript:;"><span>next post title | next &gt;</span></a>', prev: '<a title="previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span>...

c# - Error with binding my cascading dropdownlist -

i facing error message when move page in c# application page contain cascading dropdownlist. didnt know how can fix please me it. the parameterized query '(@country nvarchar(4000))select state state country =' expects parameter '@country', not supplied. protected void page_load(object sender, eventargs e) { httpcookie cookie = request.cookies.get("location"); if (!ispostback) { if (cookie != null) { datatable statedt = new datatable(); using (sqlconnection con2 = new sqlconnection(configurationmanager.connectionstrings["beravaconnectionstring"].connectionstring)) { // create selectcommand. sqlcommand command = new sqlcommand("select state state country = @country", con2); command.parameters.addwithvalue("@country", (cookie["location"])); ...

osx - How to use PipeViewer(pv) on Mac OS with dd -

i'm trying copy .img of ubuntu 14.04.1 bootable usb using command sudo dd if=~/documents/targetubuntu.img of=/dev/rdisk1 bs=1m it's taking long , can't see progress. i'm trying use pv using command sudo dd if=~/documents/targetubuntu.img | pv | dd of=/dev/rdisk1 bs=1m im getting error: dd: /dev/rdisk1: permission denied . if do ctrl-c in first scenario taking long tells me copied on x amount of bytes in x secs , that's it. when try boot usb, says "isolinux.iso missing or corrupt". want make sure file copying on , want using pv check progress, keep getting error. solutions? i suspect because sudo being used first command in pipe, using dd read image file. see answer on over unix se or can try instead like: sudo "pv -tpreb myubuntu.img | dd of=/dev/sdc per post greg kroah-hartman on g+

redhat enterprise 6.1 Linux compatible softwares -

i planning install j2ee, spring rest based application on red hat enterprise linux 6.1. want know software version compatible. not sure whether new versions compatible in rel 6.1. the list of software's need install are j2ee apache tomcat springrest mysql the rhel 6.1 can updated latest versions of java, tomcat. latest mysql, if there dependencies not present in rhel 6.1 try either adding or updating them (using yum or building source). j2ee: download oracle java sdk download page [i believe want jdk since j2ee dependencies provided tomcat such servlet etc] apache tomcat: download binaries tomcat apache website [ http://tomcat.apache.org/] . should enough started. if later on use openssl or apache portable runtime setup well. tomcat documentation has useful documentation set up. springrest: believe referring java archives it. can use maven download necessary dependencies or use spring boot ( https://spring.io/guides/gs/rest-service/ ) or search google man...

local - Pass a common variable to a subroutine in Fortran -

i'm customizing commercial code uses common block define global variables. what pass 1 of variable subroutine, not making include, because don't need other several variables defined common. the way found has been define new local variable, assign value of global variable, , pass new variable subroutine, don't way of proceed.. is there solution tell fortran convert variable local when passing subroutine? here 1 example: main program: integer :: real :: y(20) common /vars/ y, integer :: res, transfer_var transfer_var = call sub_test(transfer_var, res) ... subroutine: subroutine sub_test(var1, var2) integer, intent(in) :: var1 integer, intent(out) :: var2 var2 = 1 + var1 return end this minimal working example of code does not exhibit behavior describe. a assigned in main, passed common sub_one, used directly subroutine argument. implicit none integer :: a,res common /vars/ a=41 call sub_one() end subroutine sub_one() integer :: a,res...

Don't have option to create unit test in my VS 2013 -

i don't have option create unit test in vs 2013. in menu bar have menu called test , there have run sub menu. if right click on methods have "run tests" option. not "create unit tests". solution fix this? i have followed post, no luck. stackoverflow

html - How to put align a link right side in navigation bar -

i have following code, want align logout button right hand side , 3 modules (contact us, epm , modules) @ center, how can of bootstrap.thanks in advance. <div class="container-fluid"> <!-- brand , toggle grouped better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="home.jsp" style="color:purple;cursor: auto" id="wel">welcome admin</span></a> </div> <div class="collapse navbar-...

android - How to Highlight search results in ListView -

i not understand how can highlight search results. i tried of spannablestring here not know how implement in case. write error in line mtextview.settext(spannable) public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.search); // listview data final string[] products = new string[] { getresources().getstring(r.string.t1_2), getresources().getstring(r.string.t1_3), getresources().getstring(r.string.t1_4), }; lv = (listview) findviewbyid(r.id.list_view); inputsearch = (edittext) findviewbyid(r.id.inputsearch); mtextview = (textview) findviewbyid(r.id.product_name); // adding items listview adapter = new arrayadapter<string>(this, r.layout.list_item,r.id.product_name, products); lv.setadapter(adapter); lv.setvisibility(view.gone); // once user enters new data in edittext need text // , passing array adapter filter. inputsearch.add...

outlook - Exchange CDO library corrupts Content-Disposition field in SMTP messages -

we using cdo + vbscript adding text outgoing smtp messages via event sink on exchange 2003. we have found if message contains attachment save method corrupts content-disposition field removing quotes around creation-date , modification-date attributes. this content-disposition field before saving. creation-date , modification-date quoted. content-disposition: attachment; filename="desktop.ini"; size=402; creation-date="wed, 30 oct 2013 14:17:14 gmt"; modification-date="wed, 30 oct 2013 14:17:14 gmt" this content-disposition after saving message. there no quotes anymore around date fields. content-disposition: attachment; filename="desktop.ini"; size=402; creation-date=wed, 30 oct 2013 14:17:14 gmt; modification-date=wed, 30 oct 2013 14:17:14 gmt this simple script used test behaviour. <script language="vbscript"> sub ismtponarrival_onarrival(byval omsg, istatus) omsg.datasource.sa...

c# - Add page number whle converting HTML to PDF -

i using pdf generator http://www.nrecosite.com/pdf_generator_net.aspx i add poge number well. following code: string htmlcontent = "...."; var generator=new nreco.pdfgenerator.htmltopdfconverter(); generator.orientation = nreco.pdfgenerator.pageorientation.landscape; generator.pageheaderhtml= "<img style='width:50px' src='"+httpcontext.current.server.mappath("~") +"/test.png' />"; generator.pagefooterhtml = "<h1>test </h1>"; var pdfbytes = generator.generatepdf(htmlcontent); system.io.file.writeallbytes(httpcontext.current.server.mappath("~") + "/hello2.pdf", pdfbytes); any idea? i added following code in html worked :) <html> <head> <script> function subst() { var vars = {}; var x = document.location.search.substring(1).split('&')...

jquery - calling server function from client side -

i need call method in code behind client side using json, method never got called, , error "c" blank. did wrong here? client side code: $.ajax({ type: "post", contenttype: "application/json; charset=utf-8", url: "mypage.aspx/checkitem", data: {item: item}, datatype: "json", success: function (result) { if (result) { errormessage.innerhtml = 'warning: item exists.'; return false; } }, error: function (a,b,c) { alert("error: " + c); } }); server side code: [system.web.services.webmethod] public static bool checkitem(string item) { datacontext dc = new datacontext(); var record = dc.mytable.where(x => x.item == item).firstordefault(); if (record != null) return true; else return false; } if want call method in asp page, you're going need add logic inside asp page call function. ...

javascript - Cant fetch json and viewing it in angular unless i edit the json -

i want access json exact same format: {"employees":[ {"firstname":"john", "lastname":"doe"}, {"firstname":"anna", "lastname":"smith"}, {"firstname":"peter", "lastname":"jones"} ]} script: phonecatapp.controller('phonelistctrl', ['$scope', '$http', function($scope, $http) { $http.get('employees/employees.json').success(function(data) { $scope.resources = data; }); if remove "employees" attributes inside [] iwill data. if left example above cant reach data. any appreciated. you need follow structure of json. since data entire json string array of employees accessible via employees key. try this: $scope.resources = data.employees;

php - Empty MySQL database table cell triggers "Content" switch -

i'm having weird problem mysql database. make sure wasn't make dumb mistake, tested without database... $content = 'hello world'; // $content = ''; switch ($content) { case '': echo 'no content 1'; break; default: echo 'content 1'; echo $content; echo '<br><br>'; break; } it works. when content equals 'hello world' echoes "content 1." when set $content = '', echoes "no content 1." but when delete first 2 lines , insert "hello world" in database, funny happens. actually, works correctly @ first. when delete content database, still displays "content 1," though there's no database content. (it doesn't echo value $content.) i checked database see if there might 0 (zero) in cell, there isn't. there isn't simple space. on whim, added value 0 switch: switch ($content) { case '': case 0: echo 'no content i'; br...

Grails custom validator syntax inside a command object -

i saw example following syntax used in customer validator inside logincommand object. password blank:false, validator: { val, cmd -> if(cmd.user && cmd.user.password != val) return "user.password.invalid" } my understanding here in if clause, checking 2 things. first, user exists, , second, password of user matches password held logincommand. doesn't seem redundant check if user exists? mean if user didn't exist wouldn't cmd.user.password null , hence test fail? why user check necessary? and if necessary, can't encapsulate first user existence check in second check using syntax cmd.user?.password != val ? i mean if user didn't exist wouldn't cmd.user.password null , hence test fail? no. if user didn't exist cmd.user.password throw nullpointerexception. and if necessary, can't encapsulate first user existence check in second check using syntax cmd.user?.password != val? you co...

asp.net mvc 4 - MVC foolproof validations with mvc4 -

i have tried use requiredif , requirediftrue, both not working. below code. when make value of ismedicalinsurance true/false, both other does'nt work. [required(errormessage="please update medical insurance")] public bool? ismedicalinsurance { set; get; } [requiredif("ismedicalinsurance", true, errormessage = "enter primary insuracne name")] public string primaryinsurance { set; get; } [requirediftrue("ismedicalinsurance", errormessage = "enter id number")] public string idnumber { set; get; } view code. <label class="radio-inline"> @html.radiobuttonfor(m => m.ismedicalinsurance, true, new { id="rdhaveinsur"}) yes </label> <label class="radio-inline"> @html.radiobuttonfor(m => m.ismedicalinsurance, false, new { id="rdhaveno"})no @html.validationmessagefor(m => m.ismedicalinsurance) </label> <div class="col-sm-7"...

ios - after updating at apple store some buttons are not visible in my app -

my app updated today. ( https://itunes.apple.com/tr/app/itu-kampus/id906666198?mt=8 ) buttons in app not visible. tried app on device simulator , device iphone 4s, app working wery vell before sending apple store. how fix problem ? thanks in replies before - after http://imgim.com/8803inciu4396627.png make sure when add images project select "copy if needed" checkbox in popup. otherwise can use asset.catalog ensure image resources copied project folder.

remove a textbox dynamically in jquery without using any javascript -

here code, tried create dynamically add/remove textbox. when click delete button deleted, should (or pls specify error in code.) want remove 1 one.. can tell me? in advance.. <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>dynamic add button</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"> </script> <script> $(document).ready(function () { $('<button/>').attr({ 'id': 'add' }).appendto("body"); $("#add").text("add field"); $('<div/>').attr({ 'id': 'items' }).appendto("body"); $('<div/>').attr({ 'type': 'text', 'name': 'input[]' }).appendto("#items"); $("#add").click(function (e) { //append new row of code "#items...

localization - xcode 6 iOS launchScreen.xib cannot be localized -

i localized launchscreen.xib below: /* class = "ibuilabel"; text = " copyright (c) 2014年 felix morgan. rights reserved."; objectid = "8ie-xw-0ye"; */ "8ie-xw-0ye.text" = " copyright (c) 2014年 felix morgan. rights reserved."; /* class = "ibuilabel"; text = "your girlfriend"; objectid = "kid-c2-rcx"; */ "kid-c2-rcx.text" = "your girlfriend"; /* class = "ibuilabel"; text = " copyright (c) 2014年 felix morgan. rights reserved."; objectid = "8ie-xw-0ye"; */ "8ie-xw-0ye.text" = " copyright (c) 2014年 felix morgan. rights reserved."; /* class = "ibuilabel"; text = "女 友"; objectid = "kid-c2-rcx"; */ "kid-c2-rcx.text" = "女 友"; but it's english text time; what's wrong? have same issue. asked few days ago - latest info 1 user: i not think launchscreen.xib workin...

c# - How to overload a method that has params object[] as parameter -

our database has primary key defined on every table existing of combined key short , int. therefore, using entity framework can try find element calling it's context.dbset<>.find(params object[] parameters) method. in our code like: public client findclient(short sqlid, int incid) { context db = new context(); client result = db.clients.find(sqlid, incid); return result; } however, in our code using structs store key values. our struct follows: public struct dbkey { private short _sqlid; private int _incid; public short sqlid { { return _sqlid; } } public int incid { { return _incid; } } public dbkey(short sqlid, int incid) { this._sqlid = sqlid; this._incid = incid; } and has other comparing methods etc. able call dbset.find method this: public client findclient(dbkey key) { context db = new context(); client result = db.clients.find(key); return result; } to able wrote extension overload method: public static partial cla...

What's good style for preconditions in Spock feature methods? -

in feature method, 1 specifies feature action in when: block, result of gets tested in subsequent then: block. preparation needed, done in given: clause (or setup: or fixture method). equally useful include preconditions: these conditions not subject of feature test (thus should not in when: - then: or expect: ) assert/document necessary conditions test meaningful. see example dummy spec below: import spock.lang.* class dummyspec extends specification { def "the leading three-caracter substring can extracted string"() { given: "a string @ least 3 characters long" def teststring = "hello, world" assert teststring.size() > 2 when: "applying appropriate [0..2] operation" def result = teststring[0..2] then: "the result 3 characters long" result.size() == 3 } } what suggested practice these preconditions? used assert in example many frown upon assert s in spec. i've been using...

android - rotate image by 360 degrees using ontouch -

i want rotate image 360 degrees using ontouch. code had used maximum rotation getting 120 degrees. code had used this code in ontouch event case motionevent.action_move: newrot = rotation(event); float r = newrot - d; matrix.postrotate(r, view.getmeasuredwidth()/ 2, view.getmeasuredheight()/ 2); and rotation method private float rotation(motionevent event) { double delta_x = (event.getx(0) - event.getx(1)); double delta_y = (event.gety(0) - event.gety(1)); double radians = math.atan2(delta_y, delta_x); log.v("", "=================xxxxxxxxxxxvvvxx==============" + math.todegrees(radians)); return (float) math.todegrees(radians); } with code getting 120 degrees rotation on both clockwisw , anti-clockwise. please suggest me, did need change in code or working code. this method might works me. public static bitmap rotate(bitmap b, int degrees) { if (degrees != 0 && b != null) { matrix m = n...

nancy - returning boolean value from Nancyfx -

i'm having tiny issue 1 particular item regarding nancy. should real simple. i'm missing something. when return property boolean, value returns string. so, object has 1 property setup "bool valid {get;set;}" and if code looks like: myobject o = new myobject(); o.valid = true; return response.asjson(o); the resulting json {"valid":"true"}. want {"valid":true}. there way enforce data types? thoughts? thanks.

css - Changing a form to responsive and positioning it -

i'm new here apologies in advance not break rules. hoping assistance position of , domain search form on webpage , method make responsive if posible @ present submit button move underneath text entry if page small , gets further away input if page large. i'm new @ css (apart changing colours etc) advice appreciated. i have positioned form @ present using: .dm-reg { position: absolute; top: 55%; left: 20%; height: 100%; width: 65%; z-index: 10; } will ensure screen size not affect position of form? have used jsfiddle , altered sizes , seems stay put, if ppossible centered horizontally @ times, without using left:20% possible? i have set demo: http://jsfiddle.net/dtorr1981/vp0zwxsu/ you want this: http://jsfiddle.net/vp0zwxsu/1/ the trick make wrapper wrapper 100% , center form within wrapper using margin: auto; .dm-reg { position: absolute; top: 55%; height: 100%; width: 100%; z-index: 10; } form { width: 65%; margin: aut...

c# - The conversion of a datetime2 to a datetime is out of range -

Image
have read number of posts issue haven't found works. our sql database has field set (data type of datetime ) the respective model property has following declarations [displayname("effective date")] [column(typename = "datetime")] [displayformat(dataformatstring = "{0:d}", applyformatineditmode = true)] public datetime? effectivedate { get; set; } yet if enter date of 11/11/1111 following error when program runs dbcontext.savechanges() the conversion of datetime2 data type datetime data type resulted in out-of-range value. statement has been terminated i not aware of, nor have found, range specifications in our asp mvc project or on sql table. appreciated. you have specified column type as: [column(typename = "datetime")] this map dateime type column in sql server, and not datetime2 . datetime has valid range of january 1, 1753, through december 31, 9999 value 11/11/1111 out of range....

Get new customers every week in SQL Server -

i have data related customers , number of transactions perform every day. see how many "new" customers each week. data looks following: custnum created revenue 1 2014/10/23 30 4 2014/10/23 20 5 2014/10/23 40 2 2014/10/30 13 3 2014/10/30 45 1 2014/10/30 56 in above (sample) data, can see customer custnum 1 has transactions in consecutive weeks, want new customers next week, ones have never done business in past. in other words, want number of totally new customers each week. result should be: custcount created 3 2014/10/23 2 2014/10/30 i tried using following query: select count(distinct custnum), dateadd(wk, datediff(wk, 0, created), 0) date orders created > '2013-01-01' group dateadd(wk, datediff(wk, 0, created), 0) order dateadd(wk, datediff(wk, 0, created), 0) but query gives me number of unique customers each week, want number of new customers every week. any appreciated. ...

meteor - Public static assets in module folders? -

i want organize meteor app in modules, i.e. having folder each specific section or functionality of app containing related files. this preferably include static assets such images special public/ folder seems work in project root. or missing something? for project, feels overkill (less clean, even) having overhead of creating proper package every little module of app. unfortunately way use package. can add static assets package, , file can accessed url: /packages/[package name]/[path file] . here's example of package.js hopscotch : package.describe({ summary: 'a framework make easy developers add product tours.' }); package.onuse(function(api) { api.versionsfrom('1.0.0'); api.addfiles('img/sprite-green.png', 'client'); api.addfiles('img/sprite-orange.png', 'client'); api.addfiles('css/hopscotch.css', 'client'); api.addfiles('js/hopscotch.js', 'client'); }); as can s...

c++ - Can QSignalMapper forward function arguments? -

how use qsignalmapper map multiple check box? signal check box use statechanged(int flag) . during process want keep int flag , send custom slot other mapped variables. how achieve this? using qt4. you cannot directly forward function arguments qsignalmapper . there 2 ways work around this. rewrite custom version of qsignalmapper takes appropriate function arguments , forwards them. connect check box signal directly slot want , check return value of sender() in slot see check box emitted signal.

wpf - Telerik sort and filter columns not working -

i have wpf model table "table1" composed "table1_column1", "table1_column2" , "table1_column3" , table "table2" composed "table2_column1", "table2_column2" , "table2_column3". i have 0..1 relation "table1" "table2", means object "table1" can related 0 or 1 "table2" object. now have create radgridview takes table1 objects itemssource. have following columns in radgridview: "table1_column1", "table1_column2", "table1_column3", "table2_column1" , working fine, except 2 problems: if try sort grid "table2_column1" or use filter on "table2_column1", no entry shown in table, headers. sorting , filtering on "table1_column1", "table1_column2" , "table1_column3" work fine. here radgridview code. <telerik:radgridview.columns> <telerik:gridviewdatacol...

Android custom font loading error -

i try use roboto black font in textview, tx.settypeface(tf); throwing error. says, " syntax error on token(s), misplaced construct(s) ", , @ (tf) " syntax error on token "tf", variabledeclaratorid expected after token ". here snippit of code i'm using change font: textview tx = (textview) findviewbyid(r.id.moomoo); typeface tf = typeface.createfromasset(getassets(), "roboto-black.ttf"); tx.settypeface(tf); to knowledge have change java file, while having font ttf file in assets folder, in child of assets folder called "fonts". need reference text view , can constructor of java class xml file's font i'm trying change, correct? logic flawed, doing wrong? android version 19. change typeface tf = typeface.createfromasset(getassets(), "roboto-black.ttf"); to typeface tf = typeface.createfromasset(getassets(), "fonts/roboto-black.ttf");

single sign on - OpenAM and ArcGIS -

i log arcgis portal open am. have follow arcgis documentation : http://doc.arcgis.com/en/arcgis-online/reference/configure-openam.htm when ssoredirect have folling error : libsaml2:11/14/2014 05:14:52:570 pm cet: thread[http-8080-1,5,main] ********************************************** libsaml2:11/14/2014 05:14:52:569 pm cet: thread[http-8080-1,5,main] error: idpssofederate.dossofederate: unable sso or federation. com.sun.identity.saml2.common.saml2exception: impossible de générer une valeur nameid. @ com.sun.identity.saml2.plugins.defaultidpaccountmapper.getnameid(defaultidpaccountmapper.java:143) @ com.sun.identity.saml2.profile.idpssoutil.getsubject(idpssoutil.java:1512) @ com.sun.identity.saml2.profile.idpssoutil.getassertion(idpssoutil.java:912) @ com.sun.identity.saml2.profile.idpssoutil.getresponse(idpssoutil.java:730) @ com.sun.identity.saml2.profile.idpssoutil.sendresponsetoacs(idpssoutil.java:422) @ co...

java - Reading number from a file and checking against a random generation -

objective: generate random integer (from 1-99) , use numbers.dat file (from last lab) determine if generated random number in file. not count number of times find random number, output it’s in file or not in file. possible pseudo-code: generate random # 1-99 declare , initialize boolean variable false loop until end of file or match found: read number. compare numbers. if match, set boolean var true if boolean true number found else not found. part 2. put code in part 1 inside for-loop part 1 runs 3 times. b. output – similar output below: the random number 35 in file. random number 10 not in file. random number 9 in file. my code: import java.util.*; import java.io.*; public class randomnumbermatch { public static void main(string[] args) throws exception { scanner num = new scanner (new file ("numbers.dat")); random ran = new random(); while(num.hasnext()) { int number = num.nextint(); int x = ran.n...

ios - UIButton width reporting incorrectly -

i'm trying create circular uibutton in xcode setting corner radius equal half button width. problem is, storyboard says width of button 200 , reports 46.0 when access in uiviewcontroller . i've tried getting width using button.bounds.size.width , button.frame.size.width , button.layer.frame.size.width , , button.bounds.width , they're same. the crazy thing didn't have trouble after created test project , added big button. major difference think of project used auto layout, adding width constraint didn't change anything. for reference, i'm using xcode 6.1, swift, , it's iphone-only app targeting ios 8. your button ending 46 points wide @ runtime, want 200 points? make sure 200 pt width constraint on button high priority, dial compression resistance , dial down content hugging (i'm assuming content naturally make smaller size seeing).

C++ access modifier auto indentation in visual studio 2010 slowly driving me crazy - can it be changed? -

when programming c++ in visual studio, insists on giving me these god-awful indendations on access modifiers - condolences if likes them way ;) (a joke folks!) public class myclass { public: myclass(); ~myclass(); int wowanint(); } needless say, want this: public class myclass { public: myclass(); ~myclass(); int wowanint(); } is there way achieve using (i've got resharper , highlighter) or perhaps vanilla vs? the closest can built-in visual studio editor settings change indenting mode "smart" "block" (tools -> options -> text editor -> c/c++ -> tabs -> indenting). when this, can indent like, lose "automatic indenting." basically, whenever press [enter] new line indented same number of tab stops / spaces previous line , won't automatically reformat lines them line up.

unit testing - How to use Moq to Prove that the Method under test Calls another Method -

i working on unit test of instance method. method happens asp.net mvc 4 controller action, don't think matters much. found bug in method, , i'd use tdd fix bug , make sure doesn't come back. the method under test calls service returns object. calls internal method passing string property of object. bug under circumstances, service returns null, causing method under test throw nullreferenceexception. the controller uses dependency injection, have been able mock service client have return null object. problem want change method under test when service returns null, internal method should called default string value. the way think use mock class under test. want able assert, or verify internal method has been called correct default value. when try this, mockexception stating invocation not performed on mock. yet able debug code , see internal method being called, correct parameters. what's right way prove method under test calls method passing particular para...

if statement - (c) expression must be a modifiable lvalue -

if (operation = '+' || operation = '-' || operation = '*' || operation = '/' || operation = '%')//error line { printf("enter first operand:\t\t"); getchar(); scanf("%d", &num1); printf("enter second operand:\t\t"); getchar(); scanf("%d", &num2); } it gives out error saying : error: expresion must modifiable value it gives me error on if line , on of arguments 1 says operation = '%' what problem ?? thank guys :) you made typo , instead of comparison operator == wrote assignment operator = instead of if (operation = '+' || operation = '-' || operation = '*' || operation = '/' || operation = '%') there must be if (operation == '+' || operation == '-' || operation == '*' || operation == '/' || operation == '%') you write if statemen...

Oracle: Trying to loop thru insert statement using dynamic list of table names -

i'm not quite understanding solution found here: selecting values oracle table variable / array? i have list of table names. loop thru them array, using values tables search from. tmp_dormant_filters physical table of table names. array below same list. lm_dormant_email list of email addresses. i want check existence of dormant email addresses in list of tables. realize write same query 12 times search each table. that's not going improve sql skills. here array attempt. in attempt, oracle doesn't way i'm calling array value in not exists sql: declare type array_t varray(12) of varchar2(25); array array_t := array_t('bt_abandoned_hist', 'bt_browsed_hist', 'bt_purchased_hist', 'cm_abandoned_hist', 'cm_browsed_hist', 'cm_purchased_hist', 'cm_page_views_hist', 'mb_abandoned_hist', 'mb_browsed_hist', 'mb_carted_hist', 'mb_page_views_hist', 'mb_purchased_hist'...

css - How do I make the text wrap around the image? -

i designing blog , using carrierwave , minimagic image file upload. of now, each article displays picture @ top. first tried resize picture rectangular shape seems when change dimensions under resize, picture displayed square. now, trying wrap text around image. more specifically, want the image displayed @ top-left of article , text on right of image , under image : -image---- -----text------- ---------text-------------- here articles index view : <%= will_paginate %> <% @articles.each |article| %> <div class="container1"> <h4><%= link_to article.title, article_path(article) %></h4> <%= image_tag article.picture.url if article.picture? %> <p> <%= article.body %></p> <p><small><strong> date:</strong> <%= article.created_at.to_s %></p></small> </p> </div> <br> <br> <% end %> <%= will_paginate %> <h6> ...