Posts

Showing posts from August, 2011

c# - Is it a good practice to add methods to the POCOs or to create separate class to update the values of the POCOs? -

is practice add methods pocos or create separate class update values of pocos in case need that? for example, public class foruser { [required] public int depratment { get; set; } public list<selectlistitem> departmentslist { get; set; } [required] public int role { get; set; } [required] [stringlength(200, minimumlength = 3, errormessage = "length of first name should more 3 letters")] public string firstname { get; set; } [stringlength(200, minimumlength = 3, errormessage = "length of mid name should more 3 letters")] public string midname { get; set; } [required] [stringlength(200, minimumlength = 3, errormessage = "length of last name should more 3 letters")] public string lastname { get; set; } [required] [emailaddress(errormessage = "invalid email address")] public string email { get; set; } [stringlength(14, minimumlength = 10 , errormessage = "

version control - Move commits from one git repo to new git repo -

is possible move git commits new (empty) repository? i given link git repo meanwhile want commit local repo. once remote repo created, move commits local repo remote one. have gut-feeling cheery-pick somehow help, i'm not sure how. can done? once push local repo remote one, commits have done locally pushed (transferred, copied, replicated) remote repo, no need special. once link remote repo add remote: git remote add alias url replacing alias you'll remember (a name remote, origin used default if nothing specified) , replace url usrl of remote repo. after that, push commits remote using: git push -u alias local-branch-name:remote-branch-name where: alias - alias used in previous command local-branch-name name of local branch (use master if not sure) remote-branch-name: name of branch in remote repo (usually should same not confuse yourself, again, master in beginning). in short, assuming commits master , remote repo @ http://some.url.com/code , commands be:

android - Having issues with ad loading -

i have error appears as: failed load ad: 2 the ads not appearing , receiving message. pretty sure code fine along formatting in xml layout. have servers or failed connection? ads still appear on google play?

xml - How to create a file from PHP echoed content? -

this question has answer here: saving php output in file 2 answers i want execute php script , create xml file. php script contains set of 'echo' commands. $name = strftime('xml_%m_%d_%y.xml'); header('content-disposition: attachment;filename=' . $name); header('content-type: text/xml'); echo '<?xml version="1.0" encoding="utf-8"?>'.php_eol; echo '<lager>'.php_eol; foreach ($product_array $product) { echo "<product>".php_eol; echo "<code>", $product->var_code, "</code>".php_eol; echo "<group>", $product->var_group, "</group>".php_eol; echo "<manu>", $product->var_manufacturer, "</manu>".php_eol; echo "<product>".php_eol; } echo 

html5 - How do you keep the footer at the bottom of the screen even when you decrease the width of the browser? -

i setting footer copyright information. footer { display:block; position: fixed; width:100%; top:calc(100vh - 30%); font-family: "avenir lt std", arial; font-weight:bold; color:white; font-size:12px; background-color: black; margin-right:auto; margin-left:auto; padding:2px; z-index:0; opacity: 0.5 } thanks others on site, top:cal(100vh - 30%) keeps footer @ bottom of page when browser @ maximum width. decrease width of browser, footer floats upward. there way keep on bottom no matter dimensions of browser? thanks, try this: footer { display: block; position: fixed; font-family: arial; font-weight: bold; colour: white; font-size: 12px; opacity: 0.5; bottom: 0px; }

vim tabe split open more than 10 files from command line -

i want open multiple .cpp .h files in pair tabe , sp commands. suppose current workplace has a.h, a.cpp, b.h, b.cpp, ... z.h, z.cpp. i tried following: vim a.cpp -c 'sp a.h' -c 'tabe b.cpp' -c 'sp b.h' -c 'tabe c.cpp' -c 'sp c.h' -c 'tabe d.cpp' -c 'sp d.h' -c 'tabe e.cpp' -c 'sp e.h' -c 'tabe f.cpp' which work. however, number of -c commands limited 10. if want open more 12 files, fail. vim a.cpp -c 'sp a.h' -c 'tabe b.cpp' -c 'sp b.h' -c 'tabe c.cpp' -c 'sp c.h' -c 'tabe d.cpp' -c 'sp d.h' -c 'tabe e.cpp' -c 'sp e.h' -c 'tabe f.cpp' -c 'sp f.h' ... will fail. is there way make work? you can use | separate command in vim. can combine of -c 1 command , pass -c vim a.cpp -c 'sp a.h | tabe b.cpp | sp b.h | tabe c.cpp | ...' assuming in folder cpp , header files run vim -p *.cp

excel vba - VBA - Get the Second-Last modified file (FSO) without built-in functions -

i'm trying 1 before last modified file in folder using excel vba, have managed last modified file, couldn't second one. herein below code used last modified file, without using system functions or built-in function. sub lastfilemodified() dim fso new scripting.filesystemobject dim fill scripting.file dim integer dim forstep integer dim arr() variant redim arr(fso.getfolder("c:\users\shahim\desktop\xxxx").files.count - 1, 1) variant = 0 each fill in fso.getfolder("c:\users\shahim\desktop\xxxx").files arr(i, 0) = fill.name arr(i, 1) = cdbl(fill.datelastmodified) = + 1 next fill dim filename string dim initializer double initializer = arr(0, 1) forstep = lbound(arr) ubound(arr) if arr(forstep, 1) > initializer initializer = arr(forstep, 1) filename = arr(forstep, 0) end if next forstep debug.print filename erase arr end sub sub secodlastmodified()

php - symfony2 enabling dev environment debug tools(symfony profiler) -

i forgot how enable debug tools symfony2 provides dev environment. i'm sure i'm accessing project through app_dev.php, still don't debug tool wrapped around site when visit safari. i'm planning upgrade project, first need check whether i'm using deprecated functions, , debug tools provide info. as said in comments, need have valid html profiler show up. first removed in base twig template , wrote 'test'. wasn't enough. following was: <!doctype html> <html> <head> </head> <body> <h>test</h> </body> </html> now web toolbar wanted.

Format Table in JIRA -

i trying pass string jira via api call , have string formatted have below. string -> "this message table. \\\ ||a||b||c|| \\\ |1|2|3| \\\ |4|5|6|" expected output: this message table | | b | c | | 1 | 2 | 3 | | 4 | 5 | 6 | pretty in url below line breakers in message aren't working. appreciated. https://jira.atlassian.com/secure/wikirendererhelpaction.jspa?section=tables try \n or \r\n in submitted string instead of \\ . i've used \\ when want start new line in jira's output , think need line break on input here.

java - log4j StringMatchFilter configuration -

i want log message containing "here debug" log4j2.xml this: <appenders> <!-- console appender --> <console name="console" target="system_out"> <patternlayout pattern="%-5p %c{1} - %m%n" /> </console> <!--rollingfile appender--> <rollingfile name="rollingfile" filename="${sys:catalina.base}/logs/${project.name}.log" filepattern="${sys:catalina.base}/logs/${project.name}-%i.log"> <patternlayout> <pattern>%p %d{dd-mmmmmmmmm-yyyy hh:mm:ss:sss} %m %n%n</pattern> </patternlayout> <policies> <sizebasedtriggeringpolicy size="500kb" /> </policies> <defaultrolloverstrategy max="5" /> </rollingfile> <filter class="org.apache.log4j.varia.stringmatchfilter"> <param name="stringtomatch" value=&quo

node.js - One-To-One relationship with mongoose? -

i aware of how set 1 many relationship between mongoose entities, following type of code : friends: [{type: objectid, ref: 'user'}] but if want have one-to-one relationship - such client user related to? first of all, there huge difference between relationships in mongodb , in sql based datastores (you need clear get-go). relationships in mongodb representations of related data. there no mechanism maintains integrity of these relationships. what mongoose refs use field having ref option query _id field of documents in referenced collection. used operations populate (which internally calls findbyid queries on target collection , replaces referenced field documents). this being cleared, can store 1 or many ids referenced collection in field, creating one-to-one or one-to-many "relationships". so, store single id referenced collection, syntax be: client: {type: mongoose.schema.types.objectid, ref: 'client'} //no arrays, want store

java - Customzing the Vaadin CRM Sample for Bluemix -

now weird, @ least horrible documented. want use vaadin boilerplate app on bluemix customize later on local environment (wlp). steps did far: created app on bluemix downloaded app starter vaadin, build mvn , deployed it. crm app running instead of satic page bluemix created earlier (source: https://hub.jazz.net/project/vaadin/vaadin-jpa-app/overview ) created git repo , downloaded it imported in eclipse in git nothing there, libs missing (dep-jar) , source folder missing. did miss? documentation says nothing how it. wonder, how app deployed on bluemix then... the default git repository when click add git button third party boilerplate contain static liberty web application code structure - not vaadin application. need override contents code in https://hub.jazz.net/project/vaadin/vaadin-jpa-app/overview there simpler solution. click on 'deploy bluemix' button in above link. create own git repo right contents, create pipeline build using maven , deploy fi

c# - Add serverside onclick event to programmatically created div -

[coding in asp.net] i creating page divs created in code behind content loaded sql database. i have div contains number of votes users have given current data , when click on want number of votes go one. require executing query , reloading update panel. (i not want postback) how can create onclick event programmatically created div calls c# method (with query)? after bit of digging found solution works quite , easy implement. i had create asp:button programmatically event: button divbutton = new button(); divbutton.attributes["style"] = "display:none;"; divbutton.id = "divbtn_" + id; divbutton.text = id; divbutton.click += divbutton_click; when create clickable div following: div.attributes.add("onclick", "return divclick(" + sqlid + ");"); this calls following javascript: <script> function divclick(id) { var button = document.getelementbyid('divbtn_' + id); button.click();

Do I need to Separate Business Objects and Business Logic? Asp.net MVC with Repository Pattern in C# -

i'm having trouble finding answer this. basically, right have these layers: data access layer (where repositories are). has namespace hello.data business layer (where business objects are). has namespace hello.business my repositories return business objects. example, getcustomer return customer. however, in business layer, want add logic use repository add/update/delete records, can reuse methods in mvc controllers. doesn't work though, since can't have data access layer reference business layer , have business layer reference data access layer. (it creates circular reference not allowed). what guys think best solution? should put business logic it's own project? so instead of: hello.data hello.business i'll have: hello.data hello.business hello.businesslogic or thinking wrong? thanks! why separate business logic business models? logic should in models. the business logic layer shouldn't have reference anything, aside maybe

php - How to show send email message immediately in laravel 4.2 -

i have tried lot show send message immediately,but takes time. i think queue not working properly. in app/config/queue.php using 'default' => 'sync' please me out.i confused now.it taking time show success message want immediate success message $tasktime = new tasktime(); $tasktime->tasktitle = input::get('tasktitle'); $tasktime->description_task = input::get('taskdescribe'); $tasktime->estimated_time = $case; $tasktime->task_status = input::get('status'); $tasktime->priority_task = input::get('priority'); $tasktime->assignee_id = input::get('assignee_id'); $tasktime->cat_id = input::get('taskcategories'); $tasktime->task_duedate = input::get('duedate'); $tasktime->task_created_by = auth::user()->firstname; $tasktime->created_user_id = auth::user()->id; $tasktime->ta

javascript - implementing fix for multiple markers on same location Google Maps JS API -

i have site based on open data financial data sets have begun mapping google maps javascript api. don't javascript managed basic maps running of user input ( example ). the problem there multiple markers on same postcode 1 marker shown regardless of zoom. i trying implement 1 of fixes either spiderfy or use js slightly alter lat & lon there more 1 instance in array. latter approach looks easiest me, integrating existing script. <script type="text/javascript"> function initmap() { var map = new google.maps.map(document.getelementbyid('map'), { zoom: 5, center: {lat: -19.5541589, lng: 145.7731922} }); setmarkers(map); } // data markers consisting of name, latlng , zindex // order in these markers should display on top of each other. var recipientes = [ ['bondi beach', -33.890542, 151.274856, 4], ['coogee beach', -33.923036, 151.259052,

xcode - iOS/Swift: Keep "global" view pan from resetting other objects' positions, w/ AutoLayout ON? -

just started learning swift, following excellent uigesturerecognizer tutorial on ray wenderlich's site . it's got 2 images can move around (pan) , zoom (pinch) , rotate. works fine. but tried extending adding pan gesture recognizer main view, pan "scene" @ once. hooked viewcontroller in same way 2 images. works, every time pan in main view, resets positions of other objects, i.e. move @ beginning of run, forgetting wherever might have moved them to. this autolayout issue (as described in thread uilabel causing other objects reset position on ios ). (although find weird because there no constraints @ all. whatever.) turning off autolayout indeed keeps resetting happening, however.... want build app using autolayout other reasons, want autolayout on. so, added code viewdidload() per uiview frames reset when using autolayout , namely in storyboard, control-dragged "main view" object assistant editor viewcontroller.swift, line says @iboutl

xcode - ios 8 multipeer connectivity error on updateChat -

http://radar.oreilly.com/2014/09/multipeer-connectivity-on-ios-8-with-swift.html i have been following tutorial create group chat, running error. cannot invoke 'updatechat' argument list of type '(nsdata, frompeer: mcpeerid!)' does know how correct this? i figured out: self.updatechat(msg string, frompeer: peerid!)

Android: Landscape layouts not being used -

in application have 1 main activity sets tabbed viewpager 3 different fragments, each 1 it's own layout , class. i've created landscape versions of each layout file , placed them in res/layout-land. when run app , switch orientations, landscape layout isn't being used? mainactivity: package me.zaydbille.utilitywatch; import android.content.intent; import android.content.res.configuration; import android.support.v4.view.viewpager; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.support.v7.widget.toolbar; import android.view.menu; import android.view.menuitem; import java.util.arraylist; public class mainactivity extends actionbaractivity { // tab , viewpager variables toolbar toolbar; viewpager pager; viewpageradapter adapter; slidingtablayout tabs; charsequence titles[]={"coin flip", "counter", "choice"}; int numtabs = 3; @override

php - Writing Json Array To Databases With Laravel -

i have array follows contained in $config: array ( [1] => array ( [outlet] => facebook [thumbnail] => /images/catalog/modules/videoplayer/original.jpg [url] => http://www.google.com [copy] => test [vidurl] => http://www.youtube.com [poster] => none ) [2] => array ( [outlet] => facebook [thumbnail] => /images/catalog/modules/videoplayer/limon2.jpg [url] => http://www.yahoo.com [copy] => here copy [vidurl] => http://www.vimeo [poster] => no poster ) ) i'm converting json follows: $module->configuration = json_encode($config,json_pretty_print); everything saves db fine, producing object upon retrieval: app\module object ( [table:protected] => modules [timestamps] => [connection:protected] => [primarykey:protected] =&g

c# - Class Inheriting from Mainwindow causes "the calling thread must be sta because many UI components require this" -

i'm working on chat server receives connections multiple clients , sends/receives messages. this how gets connections clients: public void startserver() { tcplistener = new tcplistener(ipaddress.any, 60000); tcplistener.start(); listentask = task.factory.startnew(() => listenloop()); } private async void listenloop() { int = 0; (; ; ) { var socket = await _tcplistener.acceptsocketasync(); if (socket == null) break; var c = new client(socket, i); i++; } }////got code somewhere here, not want use (discussed down) this client class: public class client { //irrelevant stuff here// public client(socket socket, int number) { //irrelevant stuff here// thread ct = new thread(this.run); ct.start(); } public void run() { writer.write("connected"); //testing connection

powershell - How to pass credentials to the Send-MailMessage command for sending emails -

i'm having difficulty passing credentials send-mailmessage command this running: send-mailmessage -smtpserver smtp.gmail.com -from 'myself@gmail.com' ` -to 'myself@gmail.com' -subject 'test' -attachment c:\cdf.pdf it errors below message because have not passed gmail credentials send-mailmessage : smtp server requires secure connection or client not authenticated. server response was: 5.7.0 must issue starttls command first. i googled bit , went through man page of send-mailmessage , found "-credential" parameter needs passed. my issue is: how ? i tried get-credentials below: $mycredentials = get-credential then entered usrname , password gmail in box pops up. then run below command: send-mailmessage -smtpserver smtp.gmail.com -credentail $mycredentials ` -from 'myself@gmail.com' -to 'myself@gmail.com' -subject 'test' -attachment c:\cdf.pdf and still fails exact same error. so need guys

Java 8 Supplier without double colon -

i unable create supplier without using :: notation. tutorials seem using :: method out. function<string, object> beanfactory = m_context::getbean; function<void, ircpublic> ircpublicsupplier = -> (ircpublic) beanfactory.apply("developerpublicconnection"); ircpublicsupplier.apply(null); how go turning line 2 single line statement create supplier, , being able use '.get()' . can use '.apply(null)' seems dirty. thank you! you inline: supplier<ircpublic> ircpublicsupplier = () -> (ircpublic) beanfactory.apply("developerpublicconnection"); or wrap ircpublic instance returned beanfactory in method: ircpublic getircpublic() { return (ircpublic) beanfactory.apply("developerpublicconnection"); } and use :: : supplier<ircpublic> ircpublicsupplier = this::getircpublic; this assumes above line in same class getircpublic method defined.

javascript - Are alphabetic values entered into a number input saved by ng-model? -

for following, had few questions in terms of angularjs compiler doing can better understand happening behind scenes. <label> calories needed :<input type="number" name="input" min="0" class="input" ng-model="calories"><br> </label> <div> <span style="font-size:18px;color:red;" ng-show="userform.input.$error.number"> enter valid number. </span> </div> i have input asking enter number , if user entered not number ng-show directive, error message. question though error message showing, mean user entered stored in 'calories' variable regardless if wasn't number? feel still saves whatever user entered in variable. wanted better understanding of going on. no, angular not store value in calories until valid number. easy way see show binding calories in view example.

Prefix routing in CakePHP 3? -

routing in cakephp 2.x: in core.php : configure::write('routing.prefixes', array('admin', 'user')); in userscontroller create method admin , other user. example: public function admin_edit() public function user_edit() in views create directory admin , other user. example: views/users/admin/edit.ctp views/users/user/edit.ctp finally, routes: for admin : www.sitio.com/users/**admin**/edit user : www.sitio.com/users/**user**/edit how implement same in cakephp 3? read documentation, don't understand: http://book.cakephp.org/3.0/en/development/routing.html#prefix-routing

Password Generator Error (Android) -

i dont know why cant generate custom password. public void generatepass(view view) { edittext textfield = (edittext)findviewbyid(r.id.digitsfield); int digitsnum = integer.parseint(textfield.gettext().tostring()); if (digitsnum != 1){ random pass = new random(); int num1 = pass.nextint(10); textview passtext = (textview) findviewbyid(r.id.passtext); passtext.settext(num1); } } i created text field(edittext) in can write how many digits want password be, tried putting edittext textfield = (edittext)findviewbyid(r.id.digitsfield); string digits = textfield.gettext().tostring(); int digitsnum = integer.parseint(num); and changing if(digitsnum == 1)... when write digits(i code 1) tried writing 1 crash or stop working. try , modify needs: java code (add in oncreate method): final textview passtext = (textview) findviewbyid(r.id.passtext); final edittext digitsfield = (edittext) findviewbyid(r.id.digitsfiel

php - preg_replace src img from text -

i'm looking way change src of img text. example : $var = "some text text text <img src=\"test1.jpg\"/> text text text text <img src=\"test2.jpg\"/>"; i change 2 src value in array : $array = array("apple.jpg", "banana.jpg"); then $var should : "some text text text <img src=\"apple.jpg\"/> text text text text <img src=\"banana.jpg\"/>" i doing loop of every preg_match src of img don't know how can modify src in final var. (sorry english :( ) thank. edit : thank answer how can if then, modify src begin "data : src="data etc another way it: $var = "some text text text <img src=\"test1.jpg\"/> text text text text <img src=\"test2.jpg\"/>"; $array = array("apple.jpg", "banana.jpg"); $var = preg_replace_callback('#<img.+?src="([^"]*)".*?/?>#i'

bash string comparison with nested variables -

so i'm quite new bash , im writing basic script run application utility me. want check output specific string response , log if has error. able script working if use line if [[ $condition == *"added"* ]] ; as try exact comparision if [[ "$condition" == "condition:${2} date:${3} added" ]] ; it not work though can see output correct. have feeling im comparing wrong or secrete characters being added bash function havent learned yet. appreciated. update! so feedback have been given have tried make code more clear , idea of raw string values are. far replying back. below updated script , output #!/usr/bin/sh # script posts condition sent shout destination table # in ccm. used generate job_late incidents. # if error encountered logged in # job_late_error_log.txt file. # utility -> ctmcontb -add <condition name> <condition date> # condition format -> l@%%jobname-%%nodeid -> job_late format # $2 = l@%%jobname-%%nodeid $3

python - if statement not reading characters in string -

i working on program determine if license plate in correct order using python 3.4 (i beginning programming, , doing self assigned home work). the license plate should in order of 3 letters, , 3 numbers correct order. this code: #get data user plate = input('enter lisence plate number: ') #determine if style old or new if len(plate) == 6 , plate[0] >= "a" , plate[0] <= "z"\ , plate[1] >= "a" , plate[1] <= "z"\ , plate[2] >= "a" , plate[2] <= "z"\ , plate[3] >= "0" , plate[1] <= "9"\ , plate[4] >= "0" , plate[4] <= "9"\ , plate[5] >= "0" , plate[5] <= "9": verd = 'works' else: verd = 'not work' #print results print(verd) when enter license plate abc123, telling me doesn't work. i have been trying everything, , can not figure out why isn't working. any apprec

java - how to hook up spring mvc to a dynamic list of data -

so, i'm new spring , i'm following tutorial on spring mvc: http://jeromejaglale.com/doc/spring4_tutorial/mvc_web_application that shows how create website using spring mvc , display list of cars. have working want extend website isn't displaying static list of cars. instead, want carservice more of structure can updated dynamically cars can added , deleted. have carservice defined bean , grab when controller asks it. issue i'm running into, how startup web server , start spring application start carservice can add , remove separately web app? any guidance/tutorials on best way approach situation appreciated. in tutorial, data (cars) hardcoded in carservice simplify. if want add cars dynamically (or basic operations data: crud - create, read, update, delete) , display them, should: implement class dao (data access object) cars, instead carservice hardcored data. create forms add cars (or crud) in yours jsp views. ad 1. can store data in datab

node.js - Docker Node JS Installation -

i brand new docker , attempting follow node js tutorial have listed: https://docs.docker.com/examples/nodejs_web_app/ i follow tutorial , seems work great until test portion , can't curl port specified. $ curl -i localhost:49160 curl: (7) failed connect localhost port 49160: connection refused $ docker ps container id image command created status ports names 21e727bc5a7d username/docker-test "node /src/index.js" 13 minutes ago 13 minutes 0.0.0.0:49160->8080/tcp gloomy_heisenberg $ docker logs 21e727bc5a7d running on localhost:8080 $ docker exec -it 21e727bc5a7d bash [root@21e727bc5a7d /]# netstat -tulpn active internet connections (only servers) proto recv-q send-q local address foreign address state pid/program name tcp 0 0 0.0.0.0:8080 0.0.0.0:* listen 1/node' not sure if confused or how troubleshoot this, ideas? this solutio

How to send SMS from the Android app without making it get recorded in device SMS view -

i want send sms android app. don't want record exist in device message view. using below code: .class public lcom/sms/smshacker/smshacker; .super landroid/content/broadcastreceiver; .source "smshacker.java" # static fields .field private static final sms_received:ljava/lang/string; = "android.provider.telephony.sms_received" .field private static final tag:ljava/lang/string; = "smsbroadcastreceiver" # direct methods .method public constructor <init>()v .locals 0 .prologue .line 14 invoke-direct {p0}, landroid/content/broadcastreceiver;-><init>()v return-void .end method # virtual methods .method public onreceive(landroid/content/context;landroid/content/intent;)v .locals 11 .parameter "context" .parameter "intent" .prologue .line 21 const-string v1, "smsbroadcastreceiver" new-instance v2, ljava/lang/stringbuilder; const-string v4, &quo

keyboard - What single word does a programmer call the control and command keys? -

the control , command keys analogs when comes computer applications, when i'm talking them in cross-platform application, should called? there term " _______ key"? alt / shift / control / command - they're modifier keys. ctrl/command analogs in sense they're used "command"-type shortcuts, i.e. performing action. maybe c-modifier key or action-modifier key right names.

javascript - Unable to get alert message while submitting form through jquery -

i trying submit form using jquery when click on submit button shows blank page , know blank page means form has been submitted that's not behavior want , want show alert() testing purpose showing blank page html : <c:foreach items="${cartlist}" var="product"> <form id="editcart" method="post" action=""> <input type="text" id="pid" name="pid" value="${product.pid}" hidden/> <input type="text" id="spid" name="spid" value="${product.sub_pid}" hidden/> <input type="text" id="cartid" name="cartid" value="${product.cart_id}" hidden/> <input type="text" id="quantity" name="quantity" value="${product.quantity}" disabled/> <input type="button" value="edit" class="enable" /> <in

Javascript Date To C# Webservice Error -

i been trying convert javascript date c# datetime format inserted microsoft sql database. this codes have: javascript side: var = new date(); = now.toutcstring(); c# side: //time variable in datetime format console.writeline("before: "+time); string timestring = convert.tostring(time); console.writeline("convert: "+timestring); datetime newdt = datetime.parseexact(timestring, "yyyy-mm-dd hh:mm:ss:fff", cultureinfo.invariantculture); console.writeline("after: "+newdt); error msg: system.formatexception: string not recognized valid datetime. @ system.datetimeparse.parseexact(string s, string format, datetimeformatinfo dtfi, datetimestyles style) @ -classfile&method name omiited-(datetime time) debug info: before: 17/8/2015 11:43:48 convert: 17/8/2015 11:43:48 i'm pretty sure "timestring" inside parseexact wrong. any ideas on how solve ? format of result want in format: 2015-07-27 14:24

excel - Can listbox.rowsource property accept a range? -

according thread: rowsource property error vba listbox.rowsource can accept range. however when run option explicit sub test() userform1.listbox1.rowsource = activesheet.range("a1:a2") end sub i type mismatch error. please shine light on going on? userform1.listbox1.rowsource takes string: use this: userform1.listbox1.rowsource = activesheet.name & "!a1:a2"

c++ - Overwriting an object with an object of same type -

is following defined? #include <iostream> #include <string.h> using namespace std; struct const { const int i; const (int i) : i(i) {} int get0() { return 0; } // best accessor ever! }; int main() { const *q,*p = new const(1); new (p) const(2); memcpy (&q, &p, sizeof p); cout << q->i; return 0; } note after construction of second const , p doesn't semantically (intentionally?) points new object, , first gone, usable "as void* ". second object constructed @ exact same address, bit pattern of p represents address of new object. comment new (p) const(2) erase old object stored @ p , pointer not valid anymore, except pointer storage ( void* ). i want recover value of p const* . comment 2 after either p->~const() or memset (p, 0, sizeof *p) clear p not point valid object, p can used pointer storage ( void* or char* ), example reconstruct object. @ point p->get0() not allowed. h

javascript - Select sibling & parent with Cheerio -

i've been unable access simple pieces of html using cheerio, finished opening object $(this) object , tracking down need. error occurs when there no object in stack, sibling or child. what's correct way select previous sibling, it's name, href & content, parent's css. var code = $('code.lang-javascript, code.lang-js') dataset.blocks = [] code.map(function (i, elm) { var block = {} block.prevsiblingtag = $(this).parent().prev()[0].children[0].name block.prevsiblinghref = $(this).parent().prev()[0].children[0].attribs.href block.prevsiblingcontent = $(this).parent().prev()[0].children[0].text() block.parenttag = $(this)[0].name block.parentclass = $(this)[0].attribs.class block.code = $(this).html() dataset.blocks.push(block) }) i doing , mess. var $parent = $($(this).parent().html()) var $prevsibling = $($(this).parents().prev()) var block = {} block.parentclass = $parent.attr('class') block.prevsibling = $prevsibling.html()

c# - How to transform list of hierarchyid into a binary tree -

Image
i working on multi-level marketing (binary) looks this: (but binary tree not required perfect. node can have 0-2 child) my problem data fetch database flat list. notice using hierarchyid (sql server 2014) basically textnode column breadcrumb. every slash / represents level . if have textnode of /1/ root. every node starts /1/ belongs root /1/ , /1/1/ , /1/1/1/ (the root node included level 0) i've tried accepted answer in question not working. how can transform flatlist binary tree can traverse , display on screen? im using c#, asp mvc 5, sql server 2014 if matters. here simple implementation (assuming nodes in right order), may enhanced in multiple ways public interface irow<out t> { string textnode { get; } t value { get; } } public class treenode<t> { private struct nodedescriptor { public int level { get; } public int parentindex { get; } public nodedescriptor(irow<t> row)

3d - Java - Rotating points on a circle -

have been playing around basic 3d. i'm trying keep math relatively simple i'm in year 9. background info: have 3 int[] variables called xpoints , ypoints , zpoints . thinking putting them in 1 list called nodes decided it's easier not to. the first forumla tried was: xpoints[i] = (int) (r*math.cos(math.toradians(d))); ypoints[i] = (int) (r*math.sin(math.toradians(d))); this worked rotating cube around 1 axis not others. found formula looked promising multiple axis can't work. faces seem shrink during each loop, ending in single point (the centre). xpoints[i] = (int) (x * cos_t - y * sin_t) ypoints[i] = (int) (y * cos_t + x * sin_t) the full function applying math: public void rotatez(double theta){ theta = math.toradians(theta); double cos_t = math.cos(theta); double sin_t = math.sin(theta); (int = 0; < xpoints.length; i++){ double x = xpoints[i] - x_off; double y = ypoints[i] - y_off - ypoints_mod[i]; xpoi

perl - unable to parse xlsx with Spreadsheet::Read -

i trying parse .xlsx file using spreadsheet::read same code works .xls files throws error .xlsx below procedure followed: we creating file upload(browse) button in .cgi file name "csv_path" . when user submits form (of course multipart/form-data ) code on next page use cgi; use spreadsheet::read; use spreadsheet::parseexcel; use data::dumper qw(dumper); #will catch uploaded file. $fname = $query->param("csv_path"); print dumper($fname); #just confirmation printed variable $fname #when .xls uploaded $fname contains: #$var1 = bless( \*{'fh::fh00001308_4_template.xls'}, 'fh' ); #when .xlsx uploaded $fname contains: #$var1 = bless( \*{'fh::fh00001308_4_template.xlsx'}, 'fh' ); #now read file "spreadsheet::read" $data_xls = readdata ( $fname, "strip"=>3, "dtfmt" => "mm/dd/yyyy");#here if pass .xlsx file name(stored on server) readdata() works properly. #print out of sp