Posts

Showing posts from June, 2010

Access Query to multiply -

year month exchange rate 2014 54 2015 60 year amount 2014 5000 2015 6000 i want multiply amount in every year exchange rate corresponding year. select currency.[year month], currency.[echange rate], loss.[year], loss.[amount] newamount=currency.[echange rate]*loss.[amount] [currency],[loss] thank help newamount calculated field. part comes after multiplication, , there no =. use related fields, primary key , foreign key, ??related_field?? parts. [year] , [month] should separate fields. select [currency].[year month], [currency].[exchange rate], [loss].[year], [loss].[amount], [currency].[exchange rate]*[loss].[amount] newamount [currency] left outer join [loss] on [currency].[??related_field??] = [loss].[??related_field??]

ios - Error in UnitTests Swift -

hi i'm doing unittests in ios swift project, after run says: class nurse implemented in both projectname , projectname.tests 1 of 2 used. 1 undefined. i found there's error after every test case: could not cast value '<project_name>.<class>' '<project_name_tests>.<class>' i've tried remove test build doesn't work, should do? thanks.

python - imported function calling function from original file -

this question has answer here: two python modules require each other's contents - can work? 2 answers i have python program a imports program b . program a has function foo , main classes , global variables etc. program b has function bar . program a 's main function ran user input during runtime bar, a calls bar: b.bar(stuff) . b.bar() tries call a.foo() . proper way of doing this? the proper way avoid doing as possible, e.g. have third script c containing foo avoid circular. one workaround otherwise write b so: def bar(): import foo foo() and not import a @ top level. way import happens when bar called a loaded , won't import error.

jquery - Javascript fails while trying to declare nested object -

i trying build jquery based simple mail template system. nested array supposed like: templates[1] = { "name":"product damage claim", "def":{ {'customer name?','delivery_name',1}, {'date information should provided customer?','',1}, {'order id','orders_id',0} }, "tpl":'mail content goes here' }; now if write above, javascript fails. seems, doing wrong in defining def object, idea what? as def contains list of values, should array of arrays templates[1] = { "name": "product damage claim", "def": [ ['customer name?', 'delivery_name', 1], ['date information should provided customer?', '', 1], ['order id', 'orders_id&#

swift - Can't display user current location Mapbox iOS API -

Image
i want display user's current location after open app. use mapbox ios sdk. doesn't work @ all. don't know what's wrong. can see irrelevant map after open it. import uikit import mapbox import corelocation class viewcontroller: uiviewcontroller, mglmapviewdelegate, cllocationmanagerdelegate { @iboutlet weak var mapview: mglmapview! let locationmanager = cllocationmanager() override func viewdidload() { super.viewdidload() self.locationmanager.delegate = self self.locationmanager.desiredaccuracy = kcllocationaccuracybest self.locationmanager.requestwheninuseauthorization() self.locationmanager.startupdatinglocation() } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } // mark: location delegate methods func locationmanager(manager: cllocationmanager, didupdatelocations locations: [cllocation]) { let location = locations.last let mapview = mglmapview(fr

how to loop and read from a file, a particular integers or strings using index in python? -

i have in file one.txt: 99999 5286 88888 3478 i want read numbers 99999, 88888 not other numbers using loop , write file two.txt. str.split split string on whitespace, eg, "a b c d" become ["a", "b", "c", "d"] the docs on split: https://docs.python.org/2/library/stdtypes.html#str.split solution example: with open('one.txt', 'r') in_file, open('two.txt', 'w') out_file: in_string in in_file.readlines(): out_file.write(in_string.split()[0]) out_file.write('\n')

java - Server returned HTTP response code: 400 for URL: https://gcm-http.googleapis.com/gcm/send -

i searched lot, didn't find way solve problem below. enviando post para o gcm response code: 400 java.io.ioexception: server returned http response code: 400 url: https://gcm-http.googleapis.com/gcm/send @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) @ sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:62) @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:45) @ java.lang.reflect.constructor.newinstance(constructor.java:422) @ sun.net.www.protocol.http.httpurlconnection$10.run(httpurlconnection.java:1890) @ sun.net.www.protocol.http.httpurlconnection$10.run(httpurlconnection.java:1885) @ java.security.accesscontroller.doprivileged(native method) @ sun.net.www.protocol.http.httpurlconnection.getchainedexception(httpurlconnection.java:1884) @ sun.net.www.protocol.http.httpurlconnection.getinputstream0(httpur

Weighted random tensor select in tensorflow -

i have list of tensors , list representing probability mass function. how can each session run tell tensorflow randomly pick 1 tensor according probability mass function. i see few possible ways that: one packing list of tensors in rank 1 higher, , select 1 slice & squeeze based on tensorflow variable i'm going assign correct index. performance penalty approach? tensorflow evaluate other, non-needed tensors? another using tf.case in similar fashion before me picking 1 tensor out of many. same question -> what's performance penalty since plan on having quite few(~100s) conditional statements per 1 graph run. is there better way of doing this? i think should use tf.multinomial(logits, num_samples) . say have: a batch of tensors of shape [batch_size, num_features] a probability distribution of shape [batch_size] you want output: 1 example batch of tensors, of shape [1, num_features] batch_tensors = tf.constant([[0., 1., 2.], [3., 4., 5.

Error building C/C++ project in Eclipse: undefined referenced functions -

i making c/c++ project in eclipse generating makefile automatically. errors: /home/globalcom/desktop/eclipse/bi3000_testapplication/default/../functions/functions.c:22: undefined reference bi3000_clearlines' /home/globalcom/desktop/eclipse/bi3000_testapplication/default/../functions/functions.c:25: undefined reference to bi3000_writedisplay' /home/globalcom/desktop/eclipse/bi3000_testapplication/default/../functions/functions.c:28: undefined reference bi3000_writedisplay' /home/globalcom/desktop/eclipse/bi3000_testapplication/default/../functions/functions.c:31: undefined reference to bi3000_writedisplay' /home/globalcom/desktop/eclipse/bi3000_testapplication/default/../functions/functions.c:34: undefined reference `bi3000_writedisplay' where default folder generated eclipse , saves makefile. have include paths of in project->properties->c/c++ general->paths , symbols defined , #include in project seems recognised, getting compiling error. the

r - ggplot displaying expression in x axis -

Image
below, have r code plots grouped bar plot. group_name = c('a_1x', 'a_1x', 'a_2x', 'a_2x', 'a_3x', 'a_3x', 'a_4x', 'a_4x') mydata2 <- data.frame(mygroup = group_name, mysubgroup = factor(c("yes", "no"), levels = c("yes", "no")), value = c(60,40,90,10,55,45,88,12)) ggplot(mydata2, aes(mygroup, value, fill = mysubgroup)) + geom_bar(position = "dodge", width = 0.5, stat = "identity")+ coord_flip() currently, plot looks below. however, want show expressions in x axis shown in below picture. i have tried this: group_name = c(expression(a[1*x]),expression(a[1*x]), expression(a[2*x]),expression(a[2*x]), expression(a[3*x]),expression(a[3*x]), expression(a[4*x]),expression(a[4*x])) but gives following error: err

rust - Aliasing trait inheritance with generics -

i starting play rust new library. i'm trying wrap head around possible ways implement following. what follows more of desired expression not real syntax. of ways i've tried express either don't compile, or don't compile when go implement 1 of alias traits. struct concretetype; struct commontype; trait handler<rin, rout = rin>{ fn handle_event(&self, msg: &rin); } // alias handler 1 of types defined common case trait handlertomessage<m> : handler <concretetype, m>{ fn handle_event(&self, msg: &concretetype) { // default implementation of parent trait // example simplified, forget how rout/m used self.decode(msg) } // method implement fn decode(&self, msg: &concretetype) -> m; } // alias common case rin/rout concretetype, commontype trait handlertocommontype : handlertomessage <concretetype, commontype>{ fn decode(&self, msg: &concretetype) -> commonty

python - Use alias for column name in SQLAlchemy -

suppose if have sqlalchemy table follows - class employee(base): id = column(integer, primary_key=true) employee_desgination = column(string) i remember going through docs once , seeing way of using aliases long column names , use shorter ones instead. example, in above table instead of calling employee.employee_designation i'd use employee.emp_d or similar. wasn't able find example again :/ think declare alias() in table definition, not sure of syntax. you can specify actual column name (if different attribute name) first argument column : emp_d = column("employee_desgination", string)

javascript - Angularjs http post won't send data if all form fields are populated -

i using anglarjs. have select tag on form. on change call function sends http post , retrieves data. works when before everthing select value select box,then gets data. if populate 1 other field , change dropdown list value,it won't send http post. don't understand problem. here part of form: . . . <div class="form-group" > <label>num<span class="error">*</span></label><span data-ng-show="user.userform1.num.$touched && user.userform1.num.$invalid " class="error">required</span> <input type="text" class="form-control" name="num" data-ng-model="user.num" required data-ng-pattern="/^[0-9]{13,13}$/" data-ng-value="num"/> </div> <div class="form-group" > <label class

python: Dowloading and caching XML files - how to handle encoding declaration? -

from urllib.request import urlopen lxml import objectify i trying write program download xml files cache , open them using objectify . if download files using urlopen() can read them in using objectify.fromstring() fine: r = urlopen(my_url) o = objectify.fromstring(r.read()) however, if download them , write them file, end encoding declaration @ top of file objectify doesn't like. wit: # download file my_file = 'foo.xml' r = urlopen(my_url) # save locally open(my_file, 'wb') fp: fp.write(r.read()) # open saved copy open(my_file, 'r') fp: o1 = objectify.fromstring(fp.read()) results in valueerror: unicode strings encoding declaration not supported. please use bytes input or xml fragments without declaration. if use objectify.parse(fp) works fine- soo-- go through , change client code use parse() instead, feel not right approach. have other xml files stored locally .fromstring() works fine-- based on cursory review appear hav

powershell - How to declare an array of strings (on multiple lines) -

why $dlls.count return single element? try declare array of strings such: $basepath = split-path $myinvocation.mycommand.path $dlls = @( $basepath + "\bin\debug\dll1.dll", $basepath + "\bin\debug\dll2.dll", $basepath + "\bin\debug\dll3.dll" ) you should use like: $dlls = @( ($basepath + "\bin\debug\dll1.dll"), ($basepath + "\bin\debug\dll2.dll"), ($basepath + "\bin\debug\dll3.dll") ) or $dlls = @( $($basepath + "\bin\debug\dll1.dll"), $($basepath + "\bin\debug\dll2.dll"), $($basepath + "\bin\debug\dll3.dll") ) as answer shows, semicolons work because marks end of statement...that evaluated, similar using parenthesis. alternatively, use pattern like: $dlls = @() $dlls += "...." but might want use arraylist , gain performance benefits... see powershell array initialization

c# - ASP.NET5 MVC6: Pass object from view to controller always null -

edit: able pass plain data if use type: 'get' in ajax call , [httpget] in controller. however, complex datatypes summary class still not working , either 0 or null. i have following class: public class summary { public int total { get; set; } public double average { get; set; } public int issues { get; set; } public int fixed { get; set; } public double fixedpercentage { get; set; } public double totalpercentage { get; set; } public list<issues> issueslist { get; set; } } public class issues { public string name {get; set;} public int code {get; set;} } and following action on controller: [httpget] public iactionresult getsummary(summary summarybysource) { json(new { summary = "hi" }); } lastly, ajax call using return object controller: $.ajax({ type: 'get', datatype: 'json', url: '/summary/g

php - Paypal IPN simulator inconsistently works -

the paypal ipn simulator seems buggy. the handshake between listener , simulator comes verified , invalid of other times. i using ipn script handshake: $listener = new ipnlistener(); $listener->use_sandbox = true; $verified = false; try { $listener->requirepostmethod(); $verified = $listener->processipn(); } catch(exception $e) { error_log($e->getmessage()); exit(0); } if ($verified) { // stuff database } else { error_log($listener->getreport()); // when handshake invalid, goes here } this kind of report get: [10-jun-2016 18:30:09 america/denver] -------------------------------------------------------------------------------- [06/10/2016 6:30 pm] - https://www.sandbox.paypal.com/cgi-bin/webscr (curl) -------------------------------------------------------------------------------- http/1.1 200 ok date: sat, 11 jun 2016 00:30:08 gmt server: apache x-frame-options: sameorigin set-cookie: c9mwduvptt9gimypc3jwol1vslo=pbw-3qmnqq_

html - Align content on left edge of page -

i having trouble placement. want make 's set links eventually, aesthetic purposes want border lines start @ left edge of page , go whole width of page. instead content lined 5-10px right of left edge, , when content set 100% width makes page have horizontal scroll bar. want fit on 1 page no scroll bars. appreciated! html: <input id="searchbar" type="search" placeholder="search" /> <div id="search" class="accommodation">accomodation<img class="arrowtwo" src="../images/arrow.png" alt="accommodation"/> < /div> <div id="search" class="activities">activities<img class="arrowtwo" src="../images/arrow.png" alt="activities"/> </div> <div id="search" class="facilities">facilities<img class="arrowtwo" src="../images/arrow.png" alt="facilities"/> &

appcelerator - Hide keyboard on ios titanium -

on titanium app have form many fields (textfield etc...), when focus on textfield shows ios keyboard , want hide when click somewhere on window : <alloy> <window id="home" > <view id="form"> <require type="view" id="myviewform" src="form/etape_1" /> </view> </window> </alloy> inside myviewform : <alloy> <view> <textfield id="name" hinttext="name"/> <textfield id="telephone" hinttext="téléphone"/> </view> </alloy> note : see have textfield id "telephone" show numbers. on controller home file : /*----------------------------------------- | | event listener click on window -------------------------------------------*/ $.home.addeventlistener("click", hidesoftkeyboard); /*----------------------------------------- | | hide keyboard ------------

c# - UUID of Android and desktop app -

i making 2 apps: 1 pc (a server made c# using 32feet lib), , android (the client using bluetooth adapter , socket). i know how make connection between 2 devices, don't know how enter uuid in android app , in desktop app. what must entered in uuid field on both mobile , pc?

objective c - NSScrollView: Override system display settings? -

Image
i have nsscrollview , set to: mynsscrollview.hashorizontalscroller = yes; mynsscrollview.hasverticalscroller = yes; mynsscrollview.autohidesscrollers = yes; mynsscrollview.scrollerstyle = nsscrollerstyleoverlay; i noticed when if there's no trackpad connecting os x, , default, nsscrollview ignore settings in code , force scrollers shown: i can either change system settings " when scrolling " or set hashorizontalscroller etc. no hide it, , later disable mouse scrolling not result want. by default (automatically based on mouse or trackpad) display scroller if user has no trackpad, when content size not exceed frame size. if have trackpad, overlay style no matter scroller shows or not, it's above content. the difference between 2 "legacy" style take spaces in scrollerview. it'd problem if relaying on visiablerect value calculation, or contents needs remain aspect-ratio via constraints. is there way force hide them without disabling the

oracle - Challenge in Migrating Huge Table with LOB Data -

we're trying migrate around 230 gb oracle ec2 hosted database rds. challenge db there 1 150gb table has lot of lob data. when try migrate data using oracle import/export (data pump) takes around 9.5hrs export 150 gb table , has lob data , 2hrs import dump rds whereas other tables migrated quickly. we're using instance highest configurations still don't see improvement in performance. just see time difference exported 150gb dump again on ec2 , in second run took 3hrs time. please suggest me better approach reduce export/import time. ps: tried use redgate tool identify schema , data differences between oracle databases tool failed perform comparison on huge lob tables. quickest way found migrate large volumes of lobs follows: extract write customer extract (java) process given range of id values. write non-lob data each row csv, , lob file , reference file in csv each row. run many extracts in parallel (these external java processes should not blocked

java - Spring mvc The current request is not a multipart request -

i error whenever try access "/uploadfile" etat http 500 - request processing failed; nested exception org.springframework.web.multipart.multipartexception: current request not multipart request here method in controller @requestmapping(value = "/uploadfile", method = requestmethod.get) public @responsebody string uploadfilehandler(string name,multipartfile file) { if (!file.isempty()) { try { byte[] bytes = file.getbytes(); // creating directory store file string rootpath = system.getproperty("catalina.home"); file dir = new file(rootpath + file.separator + "tmpfiles"); if (!dir.exists()) dir.mkdirs(); // create file on server file serverfile = new file(dir.getabsolutepath() + file.separator + name); bufferedoutputstream stream = new buf

c# - Make textbox default value equals to 0 -

i have set textbox = 0 <p>credit balance: </p><asp:textbox id="txtcredit" runat="server" style="width:70px" text = "0"></asp:textbox> and code behind this: scn.open(); sqlcommand cmd = new sqlcommand("select creditrequest userdata username=@username", scn); cmd.parameters.add("@username", sqldbtype.nvarchar).value = session["new"]; object value = cmd.executescalar(); if (value != null) { txtcredit.text = convert.todecimal(value).tostring("#,##0.00"); } what want happen if has value, display it. if none, default value equal 0. receiving error object cannot cast dbnull other types. i suspect, value coming dbnull , guard against dbnull using convert.isdbnull method. if (!convert.isdbnull(value)) { txtcredit.text = convert.todecimal(value).tostring("#,##0.00"); }

java - Unable to do PHP+MySQL login with POST request -

i creating app , when click login in android simulator says unfortunately app has stopped checked code multiple times , don't see errors code . following tutorial should correct because works guy doing tutorial . mainactivity.java : import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.view.view; import android.widget.edittext; public class mainactivity extends appcompatactivity { edittext usernameet, passwordet; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); usernameet = (edittext)findviewbyid(r.id.etusername); passwordet = (edittext)findviewbyid(r.id.etpassword); } public void onlogin(view view) { string username = usernameet.gettext().tostring(); string password = passwordet.gettext().tostring(); string type = "login"; backgroundworker backgroundworker = new backgroundworker(this); backgroundwor

php - display result of field using *** at first 3 characters when condition is met in sql query -

i have table : username | status aaa | pending bbbbbbb | pending cccc | cancelled dddddddd | cancelled eeeeee | approved ffffff | approved the result i'd show @ end : status | username pending | ***aaa, ***bbbb cancelled | ***cccc, ***ddddd approved | ***eee, ***fff i've tried select query select distinct status,case when length(username) >=6 group_concat(replace(username, left( username, 3 ) , '***') separator ', ') else group_concat('***',username separator ', ') end username table group status however, result of bbbbbbb query won't work because there 3 characters username @ first row. so, result become : status | username pending | ***aaa, ***bbbbbbb // wrong (it should ***aaa , ***bbbb) cancelled | ***cccc, ***ddddd // true approved | ***eee, ***fff // true how perform query show result expected?. thank before as understand, need move case ins

programming languages - where to learn php langauge for creating site -

i want learn php language creating site . , web designing creating successfull site fb suggest me class free of cost or site give me full knowlegde of programming , php langauge create site need. thankyou learning php not difficult, can use online tutor codeacademy https://www.codecademy.com/learn/php , best video tutor can refer teamtreehouse.com https://teamtreehouse.com/library/topic:php

Not debugging properly in C (Eclipse Mars) -

i'm beginner c language , eclipse ide . i've downloaded , installed eclipse ide c/c++ developers i.e. mars 2.0. i've created new project , selected appropriate compiler , typed following code: #include <stdio.h> int main() { printf("hello, world! \n"); return 0; } after, when click build project creates .exe file me , when click on debug debugs shutdowns automatically within fraction of second . from you've told us, correct. if want step through code, have set breakpoint. should able double-click in margin on "printf" line set breakpoint there.

Alternative to CASE in SQL Server -

i have following 2 tables: create table [dbo].[tab1]( [coil_id] [varchar](25) not null, [coil_date] [datetime] null, [grade] [float] null, [quality] [float] null, [furnace_num] [float] null, [fm_gauge] [float] null, [fm_width] [float] null, [fintemp_aim] [float] null, [slab_gauge] [float] null, [slab_width] [float] null, [slab_length] [float] null, [do_temp] [float] null, [gap_reference_pr1_1] [float] null, [gap_reference_pr1_2] [float] null, [gap_reference_pr1_3] [float] null, [gap_reference_pr1_4] [float] null, [gap_reference_pr1_5] [float] null, [gap_reference_pr1_6] [float] null, [gap_reference_pr1_7] [float] null, [gap_reference_pr1_8] [float] null, [gap_reference_pr1_9] [float] null, [gap_reference_pr1_10] [float] null, [gap_reference_pr1_11] [float] null, [gap_reference_pr1_12] [float] null, [gap_reference_pr1_13] [float] null, [gap_reference_p

c# - How can I display contents in the top of a table cell? -

i have contentpage has gridview display details. in masterpage have placed contentplaceholder in table cell. want display gridview adjacent top of cell. gridview displayed in middle. here code (master page): <asp:panel id="panel3" runat="server" backcolor="white" width="100%"> <table width="100%" style="text-align:center;"> <tr> <td style="width: 90%"> <table width="100%"> <tr > <td style="width: 20%;text-align:center;background-color:#eeeeee"> <div id="nav" class="menu"> <ul> <li id="li1" class="liall" runat="server"><a href="business

javascript - Different builds for web and mobile with Meteor -

i want write app meteor js have 3 main modules, web admin panel, web app version , mobile app version. want have 3 apps in same meteor project ¿how can this? the simplest way create 3 separate projects , share server side code between them using symbolic links ( ln -s ). solution simple, crude , may hard maintain. so there way: split app packages. more complicated, easier maintain. way described here .

How to zoom in android Layout Editor? -

this how layout editor looks when click on preview screen sizes xml layout editor clicking on + , - nothing , how can zoom in , zoom out see preview ? without zooming can't see preview on screen sizes :frowning: is issue android studio or doing wrong way? tried find solution on google not find :(

c# - show selected value from grid view row using check box asp.net -

is there wrong in code? want show value of row 8 in gridview. have code , not working out me. no errors not show value expecting see. protected void button1_click(object sender, eventargs e) { string str = string.empty; string strname = string.empty; foreach (gridviewrow gvrow in gridview1.rows) { checkbox chk = (checkbox)gvrow.findcontrol("chkrow"); if (chk != null & chk.checked) { str += gridview1.datakeys[gvrow.rowindex].value.tostring() + ','; strname += gvrow.cells[8].text + ','; } } strname = strname.trim(",".tochararray()); lblrecord.text = "<b>credit request: </b>" + strname; } tried debug it. not getting cell value @ all. missing here? updated output update!: manged make work. masterpage cause why not working. here code: protected void btmdisplay_click(objec

cakephp - How to allow action using security component? -

i getting error call undefined method securitycomponent::allowedactions() when try allow singup action in controller this public function beforefilter() { parent::beforefilter(); $this->security->allowedactions(array('sign-up')); $this->auth->allow('login','signup','index','activate','logout','forgot','reset','display'); if($this->auth->user('id')) { $this->set('logged_in', true); } else { $this->set('logged_in', false); } } public $components = array('requesthandler'); if remove $this->security->allowedactions(array('sign-up')); when submit signup form, shows request has ben blackholed there no such method, allowedactions property of securitycomponent . http://book.cakephp.org/2.0/en/core-libra

Django development server showing Error 61 Connection Refused with Redis -

i trying follow tutorial on read docs django channels. in settings.py file trying change inmemory backend redis backend following code: channel_layers = { "default": { "backend": "asgi_redis.redischannellayer", "config": { "hosts": [("localhost", 6379)], }, "routing": "chan.routing.channel_routing", }, } however, moment this, console running runserver command shows following error: connectionerror: error 61 connecting localhost:6379. connection refused. how can fix this? please make sure if redis installed on system , running. check if redis running use redis-cli then take redis console, if type ping return pong if redis running or not. if don't have redis in system, please visit redis quick start. for mac os x: go terminal , type brew install redis .

How to define Gradle's home in IDEA? -

i trying import gradle project intellij, , when gradle home textbox, not automatically populated, nor typing in path of gradle home result in valid location - have gradle_user_home environment variable set (to think is!) correct path, , have been able import same project eclipse. suggestions? you can write simple gradle script print gradle_home directory. task gethomedir << { println gradle.gradlehomedir } and name build.gradle . then run with: gradle gethomedir if installed homebrew, use brew info gradle find base path (i.e. /usr/local/cellar/gradle/1.10/ ), , append libexec .

How to insert date selected separately into mysql using Java(JSP) -

in project want save date read separately day,month,year using select box. code used is <% string value=null; string[] h=null; h=request.getparametervalues("qns[]"); string expert=request.getparameter("expert"); int sday=integer.parseint(request.getparameter("sday")); int smonth=integer.parseint(request.getparameter("smonth")); int syear=integer.parseint(request.getparameter("syear")); int eday=integer.parseint(request.getparameter("eday")); int emonth=integer.parseint(request.getparameter("emonth")); int eyear=integer.parseint(request.getparameter("eyear")); string start=syear+"-"+smonth+"-"+sday; string end=eyear+"-"+emonth+"-"+eday; for(int i=0;i<h.length;i++) { s.savetask(h[1],expert,start,end); } %> the savetask function is public int savetask(string

php - Warning: mysql_fetch_array() expects parameter 1 to be resource sql -

i'm having trouble inserting new post in database. ran on shared host , there no problem, on vps gives me following error: warning: mysql_fetch_array() expects parameter 1 resource, boolean given in /home/sam/public_html/admin/include/functions.php on line 37 warning: mysql_fetch_array() expects parameter 1 resource, boolean given in /home/sam/public_html/admin/include/functions.php on line 46 warning: mysql_fetch_array() expects parameter 1 resource, boolean given in /home/sam/public_html/admin/include/functions.php on line 55 here code (functions.php) : <?php include("../../connections/confing.php"); function offset_time($time,$ofset) { $time_array = explode(":",$time); $am = ""; $hours = $time_array[0]; $minutes = $time_array[1]; $new_hour = $hours +10; if($new_hour>24){ $new_hour = $new_hour - 24; $am = "am"; }else{ $am = "pm"; } if ($new_hour>12){ $new_hour = $new_hour -12; } $offset_time = $ne

angular - Set default host and port for ng serve in config file -

i want know if can set host , port in config file don't have type ng serve --host foo.bar --port 80 instead of just ng serve as of recent versions of angular cli ( v1.0.0-rc.0 @ least perhaps earlier) can set these directly in angular-cli.json underneath defaults element: { "defaults": { "serve": { "port": 4444, "host": "10.1.2.3" } } }

javascript - Hide an API key (in an environment variable perhaps?) when using Angular -

i'm running small angular application node/express backend. in 1 of angular factories (i.e. on client side) make $http request github return user info. however, github-generated key (which meant kept secret) required this. i know can't use process.env.xyz on client side. i'm wondering how keep api key secret? have make request on end instead? if so, how transfer returned github data front end? sorry if seems simplistic relative novice, clear responses code examples appreciated. thank you unfortunately have proxy request on backend keep key secret. (i assuming need user data unavailable via unauthenticated request https://api.github.com/users/rsp?callback=foo because otherwise wouldn't need use api keys in first place - didn't need guess). what can this: in backend can add new route frontend getting info. can whatever need - using or not secret api keys, verify request, process response before returning client etc. example: var app = require

How can I automatically login to a website using vbscript? -

on error resume next: const page_loaded = 4 set objie = createobject("internetexplorer.application") call objie.navigate("http://172.25.25.32:8090/") objie.visible = true until objie.readystate = page_loaded : call wscript.sleep(100) : loop objie.document.all.username.value = "ashishgi" objie.document.all.password.value = "apac2015#" if err.number <> 0 msgbox "error: " & err.description end if call objie.document.all.gaia_loginform.submit set objie = nothing the gaia_loginform "form id" of gmail. have here: http://i.imgur.com/45h7pkp.jpg . now think should form name/id of site (by viewing source) script can hit login button.

Split string at first space and get 2 sub strings in c# -

i have string this inixa4 agartala inagx4 agatti island i want split such way inagx4 & agatti island if using var commands = line.split(' '); it splits inagx4, agatti, island if there 4 space give 4 array of data.how can achieve 2 substring since have 2 space, split(' ') generates array 3 elements. based on example, can index of first white space , generate strings substring based on index. var s = "inagx4 agatti island"; var firstspaceindex = s.indexof(" "); var firststring = s.substring(0, firstspaceindex); // inagx4 var secondstring = s.substring(firstspaceindex + 1); // agatti island

scala - Prediction.io training unresponsive -

i using similarproduct template of prediction.io inserted 16 thousand products, 70 thousand users , 1.6 million view events. pio build done in pio train goes unresponsive @ stage 13 since have tried 3 times @ waited 6 7 hours stuck @ stage 13 below logs [info] [console$] using existing engine manifest json @ /home/dau/predictionio/similar_product/manifest.json [info] [runner$] submission command: /home/dau/predictionio/vendors/spark-1.6.0/bin/spark-submit --class io.prediction.workflow.createworkflow --jars file:/home/dau/predictionio/similar_product/target/scala-2.10/template-scala-parallel-similarproduct-assembly-0.1-snapshot-deps.jar,file:/home/dau/predictionio/similar_product/target/scala-2.10/template-scala-parallel-similarproduct_2.10-0.1-snapshot.jar --files file:/home/dau/predictionio/conf/log4j.properties,file:/home/dau/predictionio/vendors/hbase-1.1.2/conf/hbase-site.xml --driver-class-path /home/dau/predictionio/conf:/home/dau/predictionio/lib/postgresql-9.4-1204

javascript - Ember.js - List values from store -

from route or component, want create array of values store data. e.g. have project model , want list of project names can use in select boxes, table headings... i've tried following , looked @ computed properties, can't working? // user route model() { let projects = this.store.findall('project').then((projects) => { return projects.mapby('name'); }); ... update: // users.new route import ember 'ember'; export default ember.route.extend({ projectnames: [], aftermodel: function () { this._super(...arguments); return this.store.findall('project').then((projects) => { this.set('projectnames', projects.mapby('name')); }); }, setupcontroller: function (controller) { this._super(...arguments); controller.set('projectnames', this.get('projectnames')); }, model() { let user = this.store.creat