Posts

Showing posts from June, 2015

mysql - PHP Like Function with combination code -

<form method="post" action="post.php"> <input type="text" name="code"/> </form> <?php $code = $_post['code']; include ("db.php"); $query = mysql_query("select * t_code code '$code'"); if(mysql_num_rows($query)) { echo "got data"; } else echo "no data"; } in table t_code code_id | code 1 | gg125-0015 2 | ba512-1152 now want when user have combination code : gg1250015--0021255 or ba5121152--52211554, echo got data, because see code include on database. so how can set sql using ? advice ? $code=substr($mainsub,0,5)."-".substr($mainsub,5,4); $query = mysql_query("select * t_code code='$code'");

java - Same Method for Client and Server slightly different behavior -

most of classes have different behavior if client or server side. (client: gui, server: connection stuff) have common behavior. want know what's best way this. example content of class: public class example{ private void commonmethod(){ //common code } public void clientmethod(){ commonmethod() //client code } public void servermethod(){ commonmethod() //server code } } what want: 1 method way specify client or server readable code what allowed: still have 3 private methods : server, common , client what want avoid: case (unless readable / short) if things thinking of: enums (to specify client , server) , case (better use meaningless ints or booleans) annotations (@clientside) (@serverside) edit: my classes loaded in api, example client/server method init. in main class need run method classes need initialization. if (and if understand needs) use common interface imple...

css - When to exactly use position relative -

i not expert in css. did not give position , have css like #myid{ margin-left: 10px; margin-top: 10px; } #myid{ position: relative; left: 10px; top: 10px; } both did wanted. when should use relative position exactly. advantage or disadvantage on other? case 1 you have inner element positioned absolute , want element stick it's parent. apply position: relative parent element. default absolute element pops out dom flow , takes position closest relative element (html default) case 2 you want move element still keep in dom flow. apply position: relative , move left / right / top / bottom properties. case 3 you want place 1 element on another. static elements not take effect of z-index that's why need set it's position relative , static or fixed there may other use cases .a { background-color: #ddd; left: 50px; top: 150px; position: relative; width: 200px; height: 200px; text-align: cent...

how to fetch data from table using php and mysql -

i trying fetch email particular row or based on id_code people table... is, enter id_code = 456 , if id code exists email of specific id_code has retrieved, , generate token number , insert token number people table. after token generated , inserted, url link has sent token , id. how since beginner, can tell me going wrong? here did far: <?php error_reporting(1); session_start(); include 'includes/db.php'; include 'includes/token.php'; //global $id_code = strtoupper(trim($_post['id_code'])); if ($_post["submit"] == "submit") { $sql = "select * people id_code = :id_code"; $stmt = $pdo->prepare($sql); $stmt->bindvalue(':id_code', $id_code); $stmt->execute(); $result = $stmt->fetch(pdo::fetch_assoc); if (!empty($_post['id_code'])) { $sql = "select email people id_code = $id_code"; ...

mysql - Database Design - Is redundancy better than adding more relationship? -

hi wonder 1 of these database designs better: i have shopping db, has 2 tables: categories , brands . both of tables have columns: name , description , , image_url . so okay keep duplicate column? or should create table stores information? to visualize better, here's chart the redundant one | categories | | brands | | - name | | - name | | - description | | - description | | - image_url | | - image_url | or adding new table? | categories | | informations | | brands | | |--->| - name |<-----| | | - info_id | | - description | | - info_id | | - image_url | thanks in case it's not same information. it's category_name, category_description, brand_name , brand_description. creating table keep generic information many things bad idea. when comes discussion (de)normalisation it's considered better design ...

php - MySQL - Can 'INSERT INTO - ON DUPLICATE KEY UPDATE' cause data loss -

i have caching script requests bunch of data soap api using php (cron job every 5 minutes). script requests , stores customer id , name . the table api information stored in has 3 columns: 'id' = int, primary_key 'name' = varchar(255) 'paying' = bool there around 10 (in 80) customers bool paying set true. however, every once in while customer's paying columns revert 0 . so... can following query cause paying column change under circumstances? insert customer(`id`, `name`) values ('$escapedid','$escapedname') on duplicate key update `name`='$escapedname' this query couldn't change 'paying' field state. therefore, reason other code either setting value 0, or deleting records.

javascript - Unable to load dynamic data into ui-grid dropdown -

Image
i using ui-grid angularjs (and mysql @ backend) project. got table gets data mysql database. rows (or cells) editable (as mentioned in example on ui-grid website). 1 column of table has dropdown. dropdown working hard coded data described in example. want populate database shows empty dropdown list everytime tried. fetching of data database done service injected controller intention run code gets data database (i.e. $http.get('/some/route')) have data table rows , dropdown list in hand before or @ time of page loading. but variable (sitesd) gets data dropdown when printed, shows undefined. here controller: angular.module('workersctrl', []).controller('workerscontroller', function($scope, $http, serverdata) { $scope.gridoptions = {enablehorizontalscrollbar: 1}; /* getting rows databse using "serverdata" custom service */ serverdata.getdata().then(function(response) { $scope.gridoptions.data = response.data[0]; $scope.sit...

java - Broadcast receiver on app closed (or in the background) -

i create simple alarms app , have 2 broadcast receivers registered in androidmanifest.xml (one receiving alarms , other rescheduling them on device boot). after scheduling alarms reboot device , "onboot" receiver rescheduling alarms well, first receiver doesn't recive them. if start app, schedule alarms , won't close it, receiver work fine, if close (not force stop) app or send background pressing home button , receiver never receive alarms! tested on several devices (htc, meizu, samsung) , got same problem. there 1 way found make receiver work kill app, because after start again, receiver working app closed, after reboot device again same problem. please, can me that? need rid of problem? i tried everything(changing pendingintent flags , request codes, running receivers in remote processes , setting intent-filters , extend wakefulbroadcastreceiver , many other) nothing has helped me. receivers in androidmanifest.xml <receiver android:...

ios - How do I set the background color of the editing accessory of a table view? -

Image
my app's theme color greenish color, has green, table view cell: the problem when click edit button, little minus sign pops on left of cell , isn't green: i don't understand why happens. code in cellforrowatindexpath let cell = uitableviewcell() cell.textlabel?.text = somestuff cell.textlabel?.backgroundcolor = uicolor(red: 0xca / 0xff, green: 1, blue: 0xc7 / 0xff, alpha: 1) cell.contentview.backgroundcolor = uicolor(red: 0xca / 0xff, green: 1, blue: 0xc7 / 0xff, alpha: 1) // look! here set color of editing accessory! cell.editingaccessoryview?.backgroundcolor = uicolor(red: 0xca / 0xff, green: 1, blue: 0xc7 / 0xff, alpha: 1) return cell as can see, i've set green, including text label, background, , editingaccessoryview ! thing isn't green! stays white can see above. is there else have set make green? you have in tableview:willdisplaycell:forrowatindexpath: method. can this: func tableview(tableview: uitableview, cellforrowatindexpath...

java - Primefaces - how to pass parameter between 2 ui:define -

i need pass parameter between 2 forms both being in separate ui:define. i have web site left part of tree table , center part form. want click node on left side , pass id center part use later on. the goal enable user add new categories left side treetable. came idea if user clicks '+' sign on treetable form displayed hidden until then. this main part of layout. <p:layoutunit position="west" size="600" header="categories" resizable="true" closable="false" collapsible="true"> <h:form> <ui:insert name="westcontent">west default content</ui:insert> </h:form> </p:layoutunit> <p:layoutunit position="center"> <h:form> <ui:insert name="centercontent">center default content</ui:insert> </h:form> </p:layoutu...

node.js - Windows 7 NODE_PATH global var set but not recognized in package.json -

i installed node v6.0.0, npm v3.8.6 on windows 7 x86. defined global variable node_path: c:\users\usr\dev\test>echo %node_path% %appdata%\npm\node_modules downloaded diferent projects start developing same error: 'node_path' not recognized internal or external command, operable program or batch file. tried different package scripts same error: package.json: "scripts": { "build-js": "node_path=. browserify -t [ babelify --presets [ es2015 ] ] src/client/index.js > public/app.js", "serve": "node_path=./dist node dist/src/server", } how node_path recognized global variable? use scripts definition in package.json links file: "scripts" : { "start" : "node server.js" } which contains process.env.node_path reference: process.env.node_path references npm-scripts process api: process.env

Android theme naming reference -

in res/values/styles.xml <style name="apptheme1" parent="theme.appcompat.light"></style> <style name="appthem2" parent="@android:style/theme"></style> <style name="apptheme3" parent="theme"></style> apptheme1 , apptheme2 correct, why apptheme3 error? there no "theme" ,you should add path android find it. "@android:style/theme" in "styles" file "theme.appcompat.light" in "values" file

javascript - How to upload multiple files to server using AJAX and php -

i used magento mvc framework , trying upload canvas todataurl image using ajax. here controller, public function uploadimgaction() { $mediaurl = mage::getbaseurl(mage_core_model_store::url_type_media); $message = ''; $filenames = array(); $imagename = ''; $successcount = 0; $time = date('m_d_y_hia'); if(isset($_post['email']) && !empty($_post['email'])) { $imagename = str_replace(array('@','.'), '_', $_post['email']).'_'; } else { $imagename = 'unknown_user_'; } if (isset($_files) && !empty($_files)) { foreach ($_files $key => $value) { try { $uploader = new varien_file_uploader($key); $uploader->setallowedextensions(array('png', 'jpg','gif')); $uploader->setallowrenamefiles(true); ...

python - Passing arguments in animation.FuncAnimation() -

how pass arguments animation() function? , tried dint worked. prototype of animation.funcanimation() class matplotlib.animation.funcanimation(fig, func, frames=none, init_func=none, fargs=none, save_count=none, **kwargs) bases: matplotlib.animation.timedanimation i have pasted code below , changes have make? import matplotlib.pyplot plt import matplotlib.animation animation def animate(i,argu): print argu graph_data = open('example.txt','r').read() lines = graph_data.split('\n') xs = [] ys = [] line in lines: if len(line) > 1: x, y = line.split(',') xs.append(x) ys.append(y) ax1.clear() ax1.plot(xs, ys) plt.grid() ani = animation.funcanimation(fig,animate,fargs = 5,interval = 100) plt.show() check simple example: # -*- coding: utf-8 -*- import matplotlib.pyplot plt import matplotlib.animation animation import numpy...

python - How to determine the minimum number to totally break a connected rings? -

it's question on checkio - break rings , can use bad way o(n*2^n) complexity testing possible break ways , find minimum one. the problem: blacksmith gave apprentice task, ordering them make selection of rings. apprentice not yet skilled in craft , result of this, (to honest, most) of rings came out connected together. he’s asking separating rings , deciding how break enough rings free maximum number of rings possible. all of rings numbered , told of rings connected. information given sequence of sets. each set describes connected rings. example: {1, 2} means 1st , 2nd rings connected. should count how many rings need break maximum of separate rings. each of rings numbered in range 1 n, n total quantity of rings. https://static.checkio.org/media/task/media/0d98b24304034e2e9017ba00fc51f6e3/example-rings.svg example-rings (sorry don't know how change svg in mac photo.) in above image can see connections: ({1,2},{2,3},{3,4},{4,5},{4,6},{6,5}). optimal solution here ...

c# - Another Messagebox -

i want customize message box. have created own messagebox. because basic message box, can not customize font (bold, color,..etc) the problem how can value if user clicks yes botton ? public partial class xtraform_message : devexpress.xtraeditors.xtraform { public xtraform_message() { initializecomponent(); } public xtraform_message(string clostlist, string chauffeur) : this() { labelcontrol_trans.text = clostlist; labelcontrol_chauffeur.text = chauffeur; } private void simplebutton_oui_click(object sender, eventargs e) { ?????? } private void simplebutton_non_click(object sender, eventargs e) { this.close(); } and call this: xtraform_message lemessage = new xtraform_message(closlistlib, chauffeurlib); lemessage.show(); if user click yes { ...... } you have use d...

Deserializing nested json object c# -

this question exact duplicate of: deserialize recursive json object [closed] 1 answer i have nested json object, this, "where": { "operator": "and", "left": { "operator": "=", "$fieldref": "requestor", "value": "@me" }, "right": { "operator": "=", "$fieldref": "state", "value": "closed" } }, i deserialize in c#, problem object can more larger depending on user, object can follows, and this, "where": { "operator": "or", "left": { "operator": "startswith", "$fieldref": "id" }, "right...

javascript - How to get the value of a select tag in ReactJs -

i building form var tableforbasictaskform = react.createclass({ getinitialstate: function() { return { taskname: '', description: '', empcomment: '', emprating: '' }; }, handletasknamechange: function(e) { this.setstate({ taskname: e.target.value }); }, handledescriptionchange: function(e) { this.setstate({ description: e.target.value }); }, handleempcommentchange: function(e) { this.setstate({ empcomment: e.target.value }); }, handleempratingchange: function(e) { this.setstate({ emprating: e.target.selected }); }, render: function() { return ( < div classname = "row margin-top" > < form classname = "col-md-12" > < div classname = "col-md-2" > ...

VIM E518: Unknown option: dark -

i configuring vim colorscheme these in .vimrc. "color scheme syntax enable set background = dark colorscheme solarized when open file vim, reports: error detected while processing /home/user/.vimrc: line 3: e518: unknown option: dark press enter or type command continue but works picture: dark background beacuse when comment in .vimrc: "set background = dark the monitor this: commented dark background . want know why happen , how fix it. valid syntax :set : set option=value set option= value valid syntax :let : let variable=value let variable= value let variable =value let variable = value it recommended use same syntax consistency. use: set option=value let variable = value

php - Update specific column equal to other table -

i have 2 tables, wich 1 of them appen other. i'am using opencart, , need update title products specific category. example: oc_product_description product_id language_id name 1 3 t-backs model 887 róża 2 3 t-backs model 912 róża 3 3 push model 3173 róża oc_product_to_category category_id product_id 1 1 2 1 3 1 and can't imagine query should use.. update oc_product_description set name = replace(name, 't-backs model', 'back') product_id = select product_id oc_product_to_category category_id = 54; thanks :) update oc_product_description set name = replace(name, 't-backs model', 'back') product_id in ( select product_id oc_product_to_category category_id = 54 ); this you.

android - Fragment enter and exit transitions are not executed at the same time -

running simple slide left animation both entering , existing fragment produces effect of entering fragment overlapping exit fragment. leads me think both transition not executed @ same time. clue or confirmation of behavior? the desired effect slide fragments left @ same time, without overlap. the code: fragment current = ...; fragment fragment = ...; transition slidein = transitioninflater.from(this) .inflatetransition(r.transition.fragment_indicator_enter) .setduration(300) .setinterpolator(new linearinterpolator()); fragment.setentertransition(slidein); currentfragment.setexittransition(transitioninflater.from(this) .inflatetransition(r.transition.fragment_indicator_exit) .setduration(300) .setinterpolator(new linearinterpolator())); getsupportfragmentmanager() .begintransaction() .replace(r.id.fragment_container, fragment) .addtobackstack(null) .commit(); the workaround know has been add setstartdelay(30) entering tran...

c# - MS Chart axes are drawn trough data points -

Image
i'm working ms charts, , somehow can't figure out way draw points on top of y-axis. can see in image below, points @ x = 0 (label 1998) below y-axis. recognize problem? has order of prepaint , postpaint events? edit: test custom drawn dots, until y-axis.. in chart datapoints go over gridlines under axes , tickmarks . to paint them over axes need owner draw them in 1 of paint events. this simple if charttype of type points , spline or line , markertype of circle or rectangle . for other types column or bar etc lot harder. here simple example points ; pick size better..! private void chart1_postpaint(object sender, chartpainteventargs e) { if (chart1.series.count == 0) return; axis ax = chart1.chartareas[0].axisx; axis ay = chart1.chartareas[0].axisy; chart1.applypalettecolors(); foreach (series s in chart1.series) foreach (datapoint dp in s.points) { float x = (float )ax.valuetopixelpos...

apache - HTAccess: Internal redirect directories (or symlink?) -

i'm struggelling following situation want solve htacess redirection. the main cms running in root directory /. in subdirectory /shop/.. there shop (based on system) till fine: main website rewritten /.htaccess , shop /shop/.htaccess now want access english version of shop /en/shop/.. calls should redirected shop-system in directory /shop (but url /en/shop/.. in browser) i tried following: rewriteengine on rewritecond %{request_uri} ^/en/shop/$ rewriterule ^(.*)$ /shop/$1 [l,qsa] which not working. my question is: can solve simple htaccess or more elegant solution make symlink /en/shop => /shop ? (are there performance differences between these solutions?) thanks in advance put following code @ root folder .htaccess file : rewriteengine on rewritebase / rewritecond %{the_request} !\s/+en/ [nc] rewriterule ^shop/ en%{request_uri} [r=302,l,ne] rewriterule ^en/(.*)$ $1 [l,nc]

scanning a 2D char Array in C++ -

i trying scan 2d char array in c++ program. problem code not scan entire array expected. ex if want scan 41*41 array reason stops @ 40th row , when press enter scans 1 remaining row. here simple piece of code. #include <iostream> char g[101][101]; int n,m; using namespace std; int main(int argc, const char * argv[]) { cin >> m >> n; cout << "m n scanned" << m << n << "\n"; (int t =0;t<m;t++) { (int j = 0;j<n;j++) { cin >> g[t][j]; cout << "scanned " << t << " " << j << "\n"; } } return 0; } compiling: testproj $g++ main.cpp -o main what missing here? edit : input 41 41 <2d char array of 41*41> expected output : scanned 40 40 actual output scanned 39 40 press enter .... scanned 40 40 works me. input file, gets piped executed code on standard input: 41 41 **************************...

Styling a TableView scroll-bar in CSS (JavaFX) -

Image
how can style "this" point in tableview? the styleclass looking .corner in applications .css file can apply style e.g. .corner {-fx-background-color: green;} when need know styleclass of component, can use css analyzer in scenebuilder (view -> show css analyzer), or scenicview more convenient

Python scraping with Mechanize, cookies (login) and proxies -

i scraping bad designed , managed government agricultural website application data requires me login , kicks me out , temporarily blocks ip (se asia, don't ask!)... trying use python , mechanize along proxy list ( http://proxy-hunter.blogspot.sg/2013/01/01-01-13-l1l2l3-http-proxies-1502.html ) work of scraping permits. however, can script login doesnot seem use proxies in set_proxies list... can why , suggest can fix it? found answer on stackoverflow answer "don't use mechanize"... well, got working script minus proxy aspect, isn't of helpful answer. current code (reading ip site test whether ip changes or uses proxies - doesn't prints real ip): import mechanize import cookielib beautifulsoup import beautifulsoup import html2text import urllib2 # mechanize browser/cookie stuff br = mechanize.browser() cj = cookielib.lwpcookiejar() br.set_cookiejar(cj) br.set_handle_equiv(true) br.set_handle_gzip(true) br.set_handle_redirect(true) br.set_handle_ref...

java - Android viewholder onclick updates more instances -

for android application i'm using viewholder pattern. whenever click on imageview in listview row updated other rows getting updated. whenever click "like" button other images receive image liked user. how possible? here viewholder code: public class myadapter extends arrayadapter<mymodel> { context context; int layoutresourceid; list<mymodel> data = null; public myadapter(context context, int layoutresourceid, list<mymodel> data) { super(context, layoutresourceid, data); this.layoutresourceid = layoutresourceid; this.context = context; this.data = data; } @override public view getview(int position, view convertview, viewgroup parent) { view row = convertview; final blockholder holder; if (row == null) { layoutinflater inflater = ((activity) context).getlayoutinflater(); row = inflater.inflate(layoutresourceid, parent, false); holder = new blockholder(); holder.imgicon = (...

Testing different Scenarios in “Selenium Cucumber with Java” without opening new Web browser -

i have feature file have 2 scenarios feature: login online store scenario: login successful valid credentials given user on home page when user navigates login page , user provides username , password message displays login scenario: user logout when user logouts application message displays logout every time run runfeatures.java file, after first scenario, driver open new browser execute next scenario. can use same browser execute 2nd scenario? below code: runfeatures.java package cucumbertest; import org.junit.runner.runwith; import cucumber.api.cucumberoptions; import cucumber.api.junit.cucumber; @runwith(cucumber.class) @cucumberoptions(features="src/test/java/features/" ,glue={"steps"} ,dryrun=false ,monochrome=false) public class runfeatures { } clientsteps.java: package steps; import java.util.concurrent.timeunit; import org.openqa.selenium.by; import org.openqa.selenium.web...

division - how to populate comma delimited string to checkboxlist in gridview -

protected void mygrid_rowdatabound(object sender, gridviewroweventargs e) { if (e.row.rowtype == datacontrolrowtype.footer) { dropdownlist ddlc = (dropdownlist)e.row.findcontrol("ddlcountry1"); dropdownlist ddls = (dropdownlist)e.row.findcontrol("ddlstate1"); if (ddlc != null) { bindcountry(ddlc, ddls); } } if (e.row.rowtype == datacontrolrowtype.datarow && mygrid.editindex == e.row.rowindex) { dropdownlist ddlc = (dropdownlist)e.row.findcontrol("ddlcountry"); dropdownlist ddls = (dropdownlist)e.row.findcontrol("ddlstate"); if (ddlc != null) { cmd = new sqlcommand("select * m_country", con); sqldataadapter da = new sqldataadapter(cmd); datatable dt = new datatable(); da.fill(dt); ddlc.datasource = dt; ddlc.datatextfield = "countryname"; ...

c# - Error while opening PDF -

Image
i getting " failed load pdf document " in chrome , " the file damaged , not repaired " in ie few files. the code below: pdfsteramer: if (pdf != null) { response.contenttype = "application/pdf"; response.addheader("content-type", "application/pdf"); response.addheader("content-disposition", "inline"); pdf.renderer.render(pdf, response.outputstream); response.flush(); } and in render class: using (filestream fs = new filestream(this._parentdocument.document.fullname, filemode.open, fileaccess.read)) { byte[] buffer = new byte[buffersize]; fs.read(buffer, 0, buffersize); using (stringreader reader = new stringreader(system.text.asciiencoding.ascii.getstring(buffer))) { decoder decoder = new uudecoder(stream, ""); string data; while ((data = reader.readline()) ...

php - How to call a RESTful API after drupal node in created, updated or deleted -

i using drupal 7 , wanted know how can call restful api after drupal node in created, updated or deleted in drupal. drupal supports "hook" funcitions system. is, implement function in module special name, clear cache, drupal notice function , in appropriate time calls it. i.e. https://api.drupal.org/api/drupal/modules!node!node.api.php/function/hook_node_update/7.x meaning, in module should make functions called mymodule_node_update() (where "mymodule" name of module, meaning have create module first) , when kind of node updated (saved) function called can stuff. same goes creating/deleting - search hook functions. https://api.drupal.org/api/drupal/modules!node!node.api.php/function/hook_node_delete/7.x https://api.drupal.org/api/drupal/modules!node!node.api.php/function/hook_node_insert/7.x

exception - Spinnaker Jenkins Integration unable to fetch jobs from Jenkins -

we have completed steps described in hello-spinnaker example below.we have used aws spinnaker image directly configure spinnaker in aws. www.spinnaker.io/docs/hello-spinnaker. i trying create sample pipeline noted in above example.but while create trigger in first step , select jenkins ,the jobs not getting populated , getting below error in browser. get http://localhost:8084/v2/builds/jenkins/jobs 429 (too many requests) the actual issue looks while retrofit trying map response jenkins getjobs joblist class finding attribute _class in jenkins response xml , not present in joblist groovy class.below how tried finding issue 1)login aws spinnaker instance 2)gate service exposed @ port 8084. curl http://localhost:8084/v2/builds/jenkins/jobs . {"failurecause":"retrofit.retrofiterror: 429 many requests","error":"too many requests","message":"429 many requests","status":429,"url":"http:...

npm - Getting "Invalid parameter: redirect_uri" trying NODE.JS authentication with KeyCloak -

Image
i'm using node.js (express) , npm called keycloak-connect connect keycloak server. when i'm implementing default mechanism described protect route: app.get( '/about', keycloak.protect(), function(req,resp) { resp.send( 'page: ' + req.params.page + '<br><a href="/logout">logout</a>'); } ); i referred keycloak, following error: " invalid parameter: redirect_uri " my query string is: (xx demonstration) https://xx.xx.xx.xx:8443/auth/realms/master/protocol/openid-connect/auth?client_id=account&state=aa11b27a-8a0b-4a3b-89dc-cb8a303dbde8&redirect_uri=http%3a%2f%2flocalhost%3a3002%2fabout%3fauth_callback%3d1&response_type=code my keycloak.json is: (xx demonstration) { "realm": "master", "realm-public-key": "miibijanbgkqhkig9w0baqefaaocaq8amiibcgkcaqeaws00kuah6ooernskfuwxebxx2ssqmhu9ovqips6nlp9fnqm0ck2lpnpphblzoozl6kivac4vzxg20f3zy7jrdc4u/xhgxjzvzuxxj0n...

c# - How to parse timestamp either as NTP timestamp or units? -

i need parse timestamp value can either given ntp time or short time string unit characters. examples: time = 604800 (can cast long, easy!) or time = 7d is there built-in date time parsing functionality in .net such cases? or have character not numeric (probably regex?). the following characters expected occur: d - days h - hours m - minutes s - seconds no regex needed such basic operation. public static int process(string input) { input = input.trim(); // removes leading , trailing white-space characters char lastchar = input[input.length - 1]; // gets last character of input if (char.isdigit(lastchar)) // if last character digit return int.parse(input, cultureinfo.invariantculture); // returns converted input, using independent culture (easy ;) int number = int.parse(input.substring(0, input.length - 1), // gets nu...

user interface - Multi-level ExpandableListView with CheckBoxes in Android -

Image
i'm trying implement 3-level expandablelistview in android. it looks this: level 1 level 2 level 2 level 3 level 2 level 1 level 2 level 2 level 2 , level 3 supposed have checkbox -es. , when checkbox in level 2 selected, children in level 3 selected well. i've done 2 adapters - both extends baseexpandablelistadapter . in end 2 inserted expandablelistview -s - 1 level 1 - level 2, , other level 2 - level 3. also have 2 separate layouts - 1 level 1 , 1 levels 2-3 (since same). it s a textview with id inside relativeview`. the questions: when i'm changing textview checkbox es , setting text them, cannot expand list third level. don't understand why it's happening , it, can me? how can hide indicators (those arrow showing expanded/collapsed state) level 2 items, have no children? i don't why expandablelistview doesn't want fit screen vertically, consumes 1/4 of it. i've tried change params in customexpandablelistvie...

javascript - How to animate just a single marker in Google Maps API -

i have designed google map aspx page showing multiple locations in form of markers. page appears pop-up aspx page. aspx page having 1 drop-down control user selects preferred branch-locations. branch-locations being coming database. requirement animate single marker in google map pop-up window, user selects drop down control previous aspx page. how animate single marker ? what solution ? appreciable. thanks in advance.... here documentation on animating marker: https://developers.google.com/maps/documentation/javascript/overlays#markeranimations you can set animation @ time of marker creation, or can call setanimation() on marker object after it's part of map.

swagger.io: Not a valid parameter definition on header required property -

Image
i'm documenting api on swagger.io. when try define session_token required string property in header, error: my definition matches sample in documentation i'm not sure s causing issue. snippet /customerverifylogin: post: summary: validate verification code sent authenticate login. returns session_token parameters: - name: authorization in: header type: string required: true default: basic ywrtaw46wdrcbzviwnztamlxu0hozdfmognpuhkyuerzekuwu3i= - name: session_type in: header type: string enum: - android - ios required: true - name: verificationcode in: body type: string required: true description: schema: type: object properties: phone: type: string description: mobile number verification sent. ...

Ctrl + Shift +R is not working in Eclipse -

ctrl + shift +r not working in eclipse project1 while working project2 on machine. while working both projects colleague. please me same. window - preferences - general - keys. if shortcut there , if not add it.

c# - updating DATAGRID row to save to SQL -

Image
hi guys trying understand how save , edited row db private void budgetgrid_roweditending(object sender, datagridroweditendingeventargs e) { sqlcommand gridcmd = new sqlcommand(); sqlconnection rwconn = null; rwconn = new sqlconnection("server=localhost;" + "trusted_connection=yes;" + "database=production; " + "connection timeout=30"); gridcmd.connection = rwconn; rwconn.open(); //gridcmd.commandtext = "select id, name, quantity, rate, time budget"; gridcmd.commandtext = "update budget set id = @id, name = @name, quantity = @qty, rate = @rte time = @time"; sqldataadapter gridda = new sqldataadapter(gridcmd); string strid = "@id".tostring(); int intid; bool bintid = int32.tryparse(strid, out intid); string strname = "@name".tostring(); s...