Posts

Showing posts from May, 2014

How can I let Arduino GSM shield respond only to authorized numbers? -

i working on project send '1' arduino gsm shield switch on led connected pin 13 , switch off sending '0', modify code in order gsm shield respond number specified. here code, in case used example phone number. when send message adminnumber led not switch on nor off. // include gsm library #include <gsm.h> // pin number sim #define pinnumber "" // initialize library instances gsm gsmaccess; gsm_sms sms; // array hold number sms retreived char sendernumber[20]; char adminnumber[20]="+123456789234"; void setup() { // initialize digital pin 13 output. pinmode(13, output); // initialize serial communications , wait port open: serial.begin(9600); while (!serial) { ; // wait serial port connect. needed leonardo } serial.println("sms messages receiver"); // connection state boolean notconnected = true; // start gsm connection while (notconnected) { if (gsmaccess.begin(pinnumber) == gsm_ready)

javascript - Encode image into URL parameter node.js -

This summary is not available. Please click here to view the post.

java - Android-App consume to much energy. Sockets maybe the reason -

in app use datagramsocket, 1 serversocket , several sockets. when app runs on android-device, phone hot on 1 area , needs lots of energy. think reason problem sockets. im not sure opperation energy-consuming: does cost energy create new sockets: socket = new socket(); ss = new serversocket( port ); msocket = new multicastsocket( port ); is importand close serversocket , other sockets if don't need anymore. does connecting cost energy? so.connect( new inetsocketaddress(ip, port ), 1000); and after connecting connection need energy?(is better disconnect when don't send datas long time) high amount of sockets need energy? i have several threads: beside main-thread , 3 binderthreads, have 3 more: 1st thread: listen incoming message on datagram-socket: datagrampacket packet = new datagrampacket(buffer, buffer. length); msocket .receive(packet); 2nd thread: listen incoming messages on several sockets: try { if (objectinputstreamlist .size() != 0){

cloud - RackSpace CreateImage API using curl is not working -

whenever m trying create image given api using curl -: curl -i -x post https://lon.servers.api.rackspacecloud.com/v1.1/xxxxxxxxx/servers/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx/createimage -h "x-auth-token: xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx" -d '{"createimage" : {"name" : "test_image"}}' -h "content-type: application/json" it throws me error -: {"itemnotfound":{"message":"an unexpected fault occurred.","details":"javax.ws.rs.webapplicationexception","code":404}}* closing connection #0 i need in this,how create server image using curl. other rackspace server api's working fine me. i trie same api version 1.0, 1.1 , 2.0 ni success. thanks this question answered on @ serverfault ( https://serverfault.com/questions/495087/rackspace-createimage-api-using-curl-is-not-working ). in summary, need change url posting

node.js - socket.io session does not update when req.session changes -

i working on basic app user needs authenticate (with passportjs) , send message server socket.io. here nodejs code: var express = require('express'); var path = require('path'); var favicon = require('serve-favicon'); var logger = require('morgan'); var cookieparser = require('cookie-parser'); var bodyparser = require('body-parser'); var expresssession = require('express-session'); var mongoose = require('mongoose'); var passport = require('passport'); var localstrategy = require('passport-local').strategy; var routes = require('./routes/index'); var api = require('./api/index'); var auth = require('./routes/auth'); var session = expresssession({secret: 'mysecret', resave: true, saveuninitialized: true}); var port = normalizeport(process.env.port || '3000'); var app = express(); var server = require('http').createserver(app); var io = require('soc

JQuery Ajax function called twice first call working, while second is not -

platform: spring i'm using ajax call same function, first blur function , click function. blur function working while click function not. changed name of function called , it's working fine. please me find solution. want send ajax call function 'isvalidpassword' on blur , and click function. on both click , blur have code below. if (oldpassword != "") { $.ajax({ url: 'isvalidpassword.html?oldpassword=' + oldpassword, type: 'get', contenttype: 'application/json; charset=utf-8', success: function (data) { if (data != "valid") $("#oldpassworderror").html(data); return false; } }); } edit: problem. i'm trying "change password" in page. first have check password entered same saved password. i'm using ajax call. if password entered not same old password have show error message in tab out(blur) , same message should shown

node.js - MySQL query WHERE with object as result -

i'm searching data.mesaj in mysql query connection running cause query isn't running, data.mesaj have, don't want this: data = { mesaj: '\nhello', uid: 'mustafa' } y=data.mesaj; var row = []; connection.query('select * yapay_zeka yapay_zeka.soru = y ', function (err, rows) { if (err) { console.log(err); } else { if (rows.length) { (var = 0, len = rows.length; < len; i++) { row[i] = rows[i]; console.log(row); } } } i found it: connection.query("select * yapay_zeka yapay_zeka.soru = ?',[data.mesaj]

postgresql - Show the count based on some condition -

i've asked question days back. here link. count() corresponding max() now same set of tables (sql fiddle) check different condition if first question count related max of status, question showing count based on next status of every project. explanation as can see in table user_approval,appr_prjt_id=1 has 3 different statuses namely 10,20 ,30. , next status 40 (with every approval status increased 10) , on. possible show there project status waiting 40? count must shown status corresponding 40 in output (not in statuses 10,20,30,...etc) desired output: 10 | 20 | 30 | 40 location1 0 | 0 | 0 | 1 not sure the next status 40 means. assuming status increased 10 every approval, following should work: select * user_projects pr exists ( select * user_approval ex ex.appr_prjt_id = pr.proj_id , ex.appr_status = 30 ) , not exists ( select * user_approval nx nx.appr_prjt_id = pr.proj_id , nx.appr_status >

javascript - Phone Number Rotating Script Not Working On Safari iFrames -

scope: we use phone tracking company dynamically rotate phone numbers on our site. phone tracking script targets specific phone numbers (we list specific "target numbers" in backend). script only dynamically rotates numbers if url parameter st-t=paid in url. working on phone numbers located @ top right of website. problem we <iframe> in landing pages. phone numbers on landing pages not rotating on safari. seems work on chrome , firefox, not on safari , ios. need phone numbers on "iframe" rotate when on "iframe host" - see terms below. welcomed. elements here components we're working with: iframe: http://static.personandpartnersleads.com/grn/dcjr/landers/new/specials/index.html iframe host : http://greenwaychryslerjeepdodge.com/web-new-vehicle-specials-ddc.htm?st-t=paid dynamic rotating script : var _stk = "862006920f1abc1afd13b8c08d2c7878c364ff54"; (function(){ var a=document, b=a.createe

jQuery button click to hide a div -

i have <div> hidden through jquery inital when page loads. have button, in on click event <div> gets visible. want <div> hidden on button click event also. have event on button click binding grid in asp.net. following code have tried in #dinner div , #bnextweek button. $(document).ready(function () { $('#dinner').hide(); $('#<%=bnextweek.clientid%>').live('click', function (e) { $('#dinner').hide(); }); }); try this $('#'+<%=bnextweek.clientid%>).live('click', function (e) { $('#dinner').hide(); }); or can try with $('#'+<%=bnextweek.clientid%>).live('click', function (e) { $('#dinner').css('display','none'); });

How to call jsp page from java class without using any servlet -

i want call jsp page simple java class don' t have request objects. without using servlet. forward jsp page java class. if not mis understood, looking jsp page opened in browser via java class? if yes, can use desktop api. you can following answers: open local html page - java getting java gui open webpage in web browser also keep in mind jsp page should placed in web container(tomcat etc.) , running when invoked or stuck finding out why jsp not opening.

php - A multiple choice is pulled randomly from mysql database. Use the correct answer on the grade page -

i have generated multiple choice question page, takes random question qbanktable in database. correctanswer question in qbanktable. here code question.php page <form action="grades.php" method="post" id="quiz"> <?php $servername = "localhost"; $username = "root"; $password = "root"; $dbname = "qbank"; $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } $sql = "select question, answera, answerb, answerc, answerd, answere, correctanswer qbanktable order rand() limit 1"; $result = $conn->query($sql); ?> <h3> <?php $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo $row["question"]; } } ?>

node.js - NodeJS Logic Error? Program Stops as Soon as part of it is Executed? -

i pretty new nodejs , sorry :( gotta start somewhere. anyway, editing code trying finish, , came across challenge when trying make have 1 of commands (this bot) work. here's bit of code isn't working :/ steamfriends.on('friendmsg', (id, msg) => { if (msg == '') {} else { log(id + ' sent me ' + '"' + msg + '"') } if (config.get('admins').indexof(id) == -1) return; if (msg.indexof('!price') == 0) { var match = msg.match(/!price (director|audition) ([\.0-9]+)/); if (!match) steamfriends.sendmessage(id, 'usage: !price <director or audtion> <price> (e.g. !price director 3.77)'); else { steamfriends.sendmessage(id, 'successfully set price of '+match[1] + ' reels '+match[2] + '!'); prices[match[1] == 'audition' ? 0 : 1] = parsefloat(match[2]); changeprices(); } } else if(msg.indexof('!changestate')

Authentication options for API serving website and mobile app -

as part of wider learning process, looking build website , mobile application common api data storage , retrieval (think of simple cms). mobile app have additional functionality things offline storage (of draft articles example if offline) , accessing media/camera etc. there public facing home page secure area each member create/modify own content. i have done lot of reading around feedback on recommended architecture in terms of how handle authentication (i comfortable building app , website , api itself). let's @ point in future might open api third parties. there whole host of options out there can't seem find decent diagrams representing flows. pros , cons scenario , links diagrams of below options great. would rather not require users login every time access app (or website come that) , worried having private keys on mobile app also. this must common scenario nowadays , wondering experience people have each of these. oauth 1a oauth 2 hmac basic ssl apache shiro

windows - Hooking mouse input and moving cursor -

i'm setting global mouse hook: hmousehook = setwindowshookex(wh_mouse_ll, llmouseproc, getmodulehandle(0), 0); and hooking mouse move messages , moves mouse cursor. lresult callback llmouseproc(int ncode, wparam wparam, lparam lparam) { lpmsllhookstruct lpmh = reinterpret_cast<lpmsllhookstruct>(lparam); uint nmsg = static_cast<uint>(wparam); point ptscreen = { 0 }; if (ncode >= 0) { ptscreen = lpmh->pt; if (wm_mousemove == nmsg) { // ptscreen coordinates receiving in physical units (pixels) // convert them logical point logpos = { ptscreen.x, ptscreen.y }; convertphysicaltological(&logpos); // move mouse cursor new position // setcursotpos() requires coordinates in logical units setcursorpos(logpos.x, logpos.y); // don't want propagate message return 1l; } }

itextsharp - Image resizes when inserted in PdfCell -

Image
i'm trying create pdf using itextsharp. have added 1 table conataining 2 columns 1 containing text , other image. want have constant image size my image automatically resizes if text present in cell increases , image present in other cell has different sizes (int = 0; < visitinfo.visitsitecomplience.count; ++i) { cellprop.colspan = 1; cellprop.pharse = visitinfo.visitsitecomplience[i].compliencedescription; cellprop.basecolor = null; table.addcell(addcelltotable(cellprop)); yesicon.scaleabsolute(35f, 35f); noicon.scaleabsolute(35f, 35f); if (visitinfo.visitsitecomplience[i].status == "1") { statuscell.addelement(new chunk(noicon, 0, 0)); } else { // statuscell.addelement(new chunk(noicon, 0, 0)); } statuscell.fixedheight = 10; //headerleftcell.border = pdfpcell.no_border; table.addcell(statuscell); }

cordova - Android Phonegap Plugin not working for all version of android device -

i developed android phonegap plugin getting public album list , upload picasa. plugin working emulator , device. success callback isnot calling android device. on testing on emulator work version , on device version 2.3.6 working fine. when testing on android vesion 2.2 , 4.0 success callback , failure callback isnot call product upload on picasa. does have idea wrong when callback not getting invoked? android apps min sdk version of 8. thanks in advance

Is possible wake up tocuch screen on raspberry+iot -

i'm thinking start in raspberry world, in case, windows iot. i want assemble raspberry touch screen , doubt concrete feature: when app need show alert, how can wake-up screen? (i supose screen in sleep mode tiemout or similar) and, when want wake screen manage system, can handle touch events when screen sleeping? screen wake-up automatically when touch it? don't want use keyboard or other input method except touch. is scenario possible? thanks

c# - Menu Index onKey Issue -

language: c# description: making small game in xna. creating menu game. have 3 menu menu states. 1= options menu, 2= start menu, 3=load menu. goal when user presses "d" key menu index increments 1 , "a" key, menu decrements. problem using keydown in xna updating each tick. when increment/decrement index, updates way fast. want user able switch menus without flickering extremely fast. below code, please let me know of solutions. if(keyboard.iskeydown(keys.d)) { lyengine.game.menu_index++; if (lyengine.game.menu_index >= 3) { lyengine.game.menu_index = 1; } } else if (keyboard.iskeydown(keys.a)) { lyengine.game.menu_index--; if (lyengine.game.menu_index <= 1) { lyengine.game.menu_index = 3; } } inste

regex - Modify a regular expression to allow leading/trailing whitespace -

my validation expression : validationexpression="^(?:(?:(?:0?[13578]|1[02] )(\/|-)31 )|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30 )))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9] )$|^(?:(?:0?[1-9]|1[0-2])(\/|-)(?:0?[1-9]|1\d|2[0-8] ))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9] )$|^(0?2(\/|-)29 )(\/|-)(?:(?:0[48]00|[13579][26]00|[2468][048]00 )|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26] ))$" how can change allow whitespace @ start or end of string? try: validationexpression="^\s*(?:(?:(?:0?[13578]|1[02] )(\/|-)31 )|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30 )))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9] )$|^(?:(?:0?[1-9]|1[0-2])(\/|-)(?:0?[1-9]|1\d|2[0-8] ))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9] )$|^(0?2(\/|-)29 )(\/|-)(?:(?:0[48]00|[13579][26]00|[2468][048]00 )|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26] ))\s*$" \s* matches 0 or more whitespace characters. inserted @ start , end.

jQuery Easing in Chrome has a flicekring effect -

i using following script smooth easing effect navigate top/bottom within same page. got implemented in various browsers, when animation starts in chrome, page flickers. page goes top when clicked in flash , allows page execute animation. is there possibility rid off flickering effect in chrome? <script type="text/javascript" src="js/jquery.easing.1.3.js"></script> <script type="text/javascript"> $(function() { $('a').bind('click',function(event){ var $anchor = $(this); $('html, body').stop().animate({ scrolltop: $($anchor.attr('href')).offset().top }, 1500,'easeinoutquad'); /* if don't want use easing effects: $('html, body').stop().animate({ scrolltop: $($anchor.attr('href&

php - Rating and Like System Managment -

i'm trying integrate rating , system part of package send end user(with unknown progamming skill). problem how manage users(registered or not) have done action. at moment i'm using php session keep stored week information, isn't solution. is solution creating 2 tables (one rating , 1 like) store information? if use solution what's usefull , "correct" information retrive if user not registred? , user-friendly? i have thought store: username , ip thanks i extend members's table @ least 2 new columns, likes , rating or create new table (as said) including memberid reference(and index) store , select data. believe it's best way. unfortunately, in case non-members cannot press or rate, reason 1 register. –

python - Im trying to set the maximum profiles in my list but i dont know how. And I don't know how to repeat # Access to create an account -

this line of code confusing me. tried set list maximum amount of imputs, cant work. in addition dont know how repeat #access create accout # profile list print("how many profiles on database") profiles = input() while profiles < 100: max_profiles = [] accesap = input('would create profiel (yes or no)') # acces create account if accesap == 'yes': username = input('\nwhat want username be?') profiles.append(username.strip()) print('\nhello ' + username.title()) proidlook = input('\nwould id ' + username.title() + (' (yes or no)')) if proidlook == 'yes': print("\n" + username.title() + ' = ', str(username.index(username))) signout = input("\nnow you've created account, sign out.") if input == 'yes': create counter count every profile created. print("how many profiles on database") profiles = input() counter = 0 while c

sql - Need MySQL query to update/add record into table1 from table2 -

i want mysql query update/add table1 if data exist in table2 if record not exist in table1 add record (from table2) otherwise update it. thanking in advance. you can copy entries table2 table1 using following syntax, assuming id primary key of tables: insert table1 select * table2 id not in (select id table1); the update-query not generic: update table1 set <col>=(select <col> table2 table1.id=table2.id); you'll have perform above update query each column in tables.

php - How do I solve the 403 Forbidden when opening symfony2 installation on aws error? -

i used ebcli upload directly git repository, health status green on aws console. edit: added "/web/" config in aws seemed fix it. not sure understand why since had webroot set "/web" in parameters.yml i added "/web/" config in aws seemed fix it. not sure understand why since had webroot set "/web" in parameters.yml

open pdf in popup android -

iam developing android app, need open pdf file in popup window. code is: imageview brobutton=(imageview)layout.findviewbyid(r.id.imageview3); brobutton.setonclicklistener(new onclicklistener() { } }); already have developed app open pdf in emulator code: final string googledocsurl = "http://docs.google.com/viewer?url="; webview mwebview=new webview(subproducts.this); mwebview.getsettings().setjavascriptenabled(true); websettings websettings = mwebview.getsettings(); websettings.setpluginstate(pluginstate.on); mwebview.setwebviewclient(new webviewclient() {

php - delete data in codeigniter -

i unable delete data in codeiginter new please me.... my code view page is <?php foreach($item $field) { ?> <tr> <td><?php echo $field->facility_id; ?></td> <td><?php echo $field->facility_name; ?></td> <td><?php echo $field->facility_desc; ?></td> <td>edit</a></td> <td><?php echo anchor('http://localhost/alaris_health/index.php/admin_controller/delete_facility','delete',$field->facility_id);?></td> </tr> <?php } ?> and code controller is function delete_facility($fac_id) { $this->load->model('admin_model'); $this->admin_model->remove_facility($fac_id); $this->load->view('facility_view',$data); } and code model is function remove_facility($fac_id) { $this->db->delete('admin_facility_code', array('facility_id

HBase Configuration with Hadoop 1.0.3 -

Image
i installing hadoop-1.0.3 in widow-7 using cygbin . want install hbase please suggest me version of hbase compatible hadoop 1.0.3 ? here list of compatibility matrix between hadoop , hbase versions: above: s - supported, x - not supported, nt - not tested more info available here: http://hadoop.apache.org/releases.html

java - Notification Listener does not read all notifications posted -

following simple code read notifications public void onnotificationposted(statusbarnotification sbn) { string pack = sbn.getpackagename(); bundle extras = sbn.getnotification().extras; string title = (string)extras.getcharsequence("android.title"); string text=""; if (extras.getcharsequence("android.text") != null) { text =(string) extras.getcharsequence("android.text"); log.d("service1",text); } if(text.trim().equals("")) { if (extras.getcharsequencearray("android.textlines") != null) { log.d("service", "in 1st if"); charsequence[] chartext = extras.getcharsequencearray("android.textlines"); if (chartext.length > 0) { text = (string) chartext[chartext.length - 1]; log.d("service2", text); } } } if(text.trim().equals("

php - python how to write data into a single file with different call -

i have python script , php page on website. have create csv file , write data onto in following manner- php processes get requests , calls python script shell_exec , passing get variables it, json format. script here looks like- ... $var_a = $_get['a']; $var_b = $_get['b']; $var_c = $_get['c']; $post_data = array('item' => 'get-list', 'var a' => "$var_a", 'var b' => "$var_b", 'var c' => "$var_c" ); $json_data = json_encode($post_data); $temp = shell_exec('python process_data.py "' . $json_data .'"'); echo $temp; ... this script quite straight forward, collects get variables , forms json object of it. data passed process_data.py , processes data , saves data csv file, code is- import sys, json, time, csv json_data = json.dumps(sys.argv[1]) def scr(json_data): json_data = json_data count = 0 json_list = json_data.s

Access JSON elements using Javascript/Jquery -

i'm new json, webdevelopment, javascript ... i have following json file { "component": "a", "status": 0, "children": [ { "component": "aa", "status": 0, "children": [ { "component": "aaa", "status": 0, "children": [] }, { "component": "aab", "status": 0, "children": [] } ] }, { "

sql server - How Can I speed up my SQL Query -

i'm running query: select time_id, site_type_id, abandoned_id, worktype_id, sum (staging.dbo.incoming_measure.ring_time) ring_time, sum (staging.dbo.incoming_measure.hold_time) hold_time, sum (staging.dbo.incoming_measure.talk_time) talk_time, sum (staging.dbo.incoming_measure.acw_time) acw_time, count(*) callcount incoming_measure inner join datamartend.dbo.time_dim on incoming_measure.starttimedate between time_dim.time_start , time_dim.time_end inner join datamartend.dbo.site_type_dim on incoming_measure.dbid = site_type_dim.site_type_code inner join datamartend.dbo.abandoned_call_dim on incoming_measure.abandoned = abandoned_call_dim.abandoned_value inner join datamartend.dbo.work_type_dim on incoming_measure.dbid = work_type_dim.mig_site_id , work_type_dim.work_type_code = incoming_measure.queue , incoming_measure.starttimedate bet

javascript - get svg element from an xml response -

Image
when try access reponse xml errors. want access svg firstly , height , width of svg viewbox or alternative way. how can access svg response xml height , width? i want access height , width using javascript (maybe jquery) so: this._imagew = jquery(".svgimage").width(); this._imageh = jquery(".svgimage").height(); i using method download file , give me response in xml. idk how access elements withing xml reponse thought. this reponse above. tried in console doesn't work how can access height , width of svg element? you're going want parse string c html using jquery function $.parsehtml() . from that, have variable can accessed getelementbyx() calls , can find svg element want. var c = '<svg width="200px" height="100px" viewbox="0 0 100 50"> <path d="m50,35 a20,20 0 1,0 0,-20 a20,20 0 1,0 0,20z" fill="white" stroke="black"></path> </svg>

ruby on rails - I'm using raty.js star rating system, how do I show the equivalent integer value of star for my avg. rating? -

the code below show example: average rating ** based on 2 reviews so since it's average rating 2 stars, how show integer value "2"? like: ** 2 <h2 class="avg-rating">average rating</h2> <div class="average-review-rating" data-score=<%= @average_review %>></div> <span class="number-of-reviews">based on <%= @book.reviews.count %> reviews</span> <script> $('.average-review-rating').raty({ readonly: true, path: '/assets/', score: function() { return $(this).attr('data-score') } }); </script> why not just: <div class="average-review-rating" data-score=<%= @average_review %>> <%= @average_review %></div> this output average score literal value.

azure - Add VM to existing vnet and subnet -

i using json file create vm. works exception of vnet , subnet, every time created new vm, creates new vnet , subnet, how can create vms , assign them existing vnet , subnet using json template? am assuming json, mean arm template. you should able grabbing subnet reference existing subnet on existing vnet , associating new vm's nic subnet reference obtained. have @ sample here

javascript - What is wrong with the following code for Parse.com Parse.Cloud define and Run and callbacks -

re-asked question real code vs sudo code @ having problems code on parse.com's cloud code /* doing wrong here? i didn't want re-write code work parse.cloud.run decided make function me. error message: update failed not load triggers. error typeerror: object # has no method 'request' */ parse.cloud.define("httpx", function(request, response) { parse.cloud.httprequest({ url: request.params.url, method: request.params.method, headers: request.params.headers }, { success: function(httpresponse) { response.success(httpresponse); }, error: function(httpresponse) { response.error(httpresponse); } }); }); function sendrequest(path, method, callback) { if (!initialized) { throw 'not initialized, call initialize(username, password) first before calling api'; } // allows 2 paramiters passed if no method passed. if (typeof method ==

c# - Can i group a text file with Regex based on line patterns -

given file: timestamp: text , number 1 timestamp: text , number 33 timestamp: text , number 1 timestamp: text , number 22 totally different, maybe new pattern timestamp: text , number 4 timestamp: text , number 2 totally different, maybe new pattern totally different, maybe new pattern i groupings of line 1 4(type1) , line 5(type2), line 6,7(type1) , line 8,9(type2). can done in 1 regualar expression or should create 1 expression each type , check line line , if previous line same type? at end need return list of groupings pair(int start_char, int end_char) you can try this string[] lines = system.io.file.readalllines("your taext file"); var groups =( w in lines group w w[0] g select new { firstletterline = g.key, lins = g });

javascript - Highchart X-axis label too long [SOLVED] -

Image
please refer picture attached below: my x-axis labels long , highchart managed view 3 characters. code should add view entire label? edited, added in solution solution: very simple solution added in "marginbottom: 70" , able show full label. refer below. $(document).ready(function() { var options = { chart: { renderto: 'container', type: 'column', marginbottom: 70, marginright: 130 }, title: { text: 'all gantries instertions', x: -20 //center }, subtitle: { text: '', x: -20 }, xaxis: { categories: [], }, you can use lable formatter usehtml=true , inside use custom class. your xaxis node below. xaxis: { labels: { formatter: fun

How to set consistency level of column family using either cassandra-cli OR Hector -

i cannot seem find way this. there nothing in documentation (except cql examples or thrift examples). has done before? want set consistency read , write. or if tell me how pass consistency level each individual read / write, great. there exists way set consistency level when keyspace created. case keyspace exists , want update consistency level it. if can't done, why so, since should available. zanson correct - consistency level determined on query query basis. each read , write query execute have own consistency level specified. believe default set quorum. quorum calculated based on keyspace's replication factor. -> replication factor defined @ keyspace level. -> read / write consistency level defined @ point of querying.

android - how to display a listview in other class? -

i made custom animation sliding menu (like fb) , have insert listview in sublayout. listview in different class parsed through json using lazyadapter. this mainactivity package com.android.appslu; import android.annotation.suppresslint; import android.app.activity; import android.content.intent; import android.content.res.resources; import android.os.bundle; import android.util.log; import android.view.display; import android.view.motionevent; import android.view.view; import android.view.view.ontouchlistener; import android.view.viewgroup.layoutparams; import android.view.animation.animation; import android.view.animation.animation.animationlistener; import android.view.animation.translateanimation; import android.widget.button; import android.widget.listview; import android.widget.relativelayout; import android.widget.textview; import com.android.appslu.jsonparsing.jsonparsingactivity; public class mainactivity extends activity { private button buttonswitch; privat

ios - Replace custom UIViews arranged by Interface Builder with UILabels programmatically -

Image
using interface builder , have built long scrollview filled custom uiviews , regular uiviews , stackviews , uilabels , uibuttons , etc. for of custom uiviews, if not have data, want replace them uilabel says " no data available " , want able set margins , center text of uilabel. what's best/easiest way programmatically in viewcontroller given views arranged using interface builder? thanks in advance! you can adding uilabel, simple constraints, on views want cover instead of inside them if want ensure aren't messing controls don't, well, control. i set simple test app show how method can work this has stack view images in it, text view, , button trigger sample. you should able apply method views determine in code have no data show, , want show placeholder, in example i've set iboutletcollection has both stack view , text view in it, , running on both views when button pressed. all need provide placeholder text , view want replace

html - How do I set the background image of a div into two diagonally-separated images? -

Image
i have following html/sass structure: html <div id="games"> <a class="gameplate" href="#"> <h3>mia <span class="at">@</span> hou</h3> <h3>90&nbsp;&nbsp;-&nbsp;&nbsp;104</h3> <p>4th qtr</p> <p>4:55 </p> <div class="gameplate--padding"></div> </a> </div> css #games { border-bottom: 1px solid black; height: 130px; vertical-align: middle; text-align: center; } #games .gameplate { border: 1px solid gray; display: inline-block; width: 120px; text-align: center; margin: 5px 3px; color: #222222; text-decoration: none; } #games .gameplate h3 { margin-top: 10px; margin-bottom: -10px; } #games .gameplate h3 .at { font-size: 12px; color: #999999; } #games .gameplate p { margin-top: 5px; margin-bottom: -5px; font-size: 14px; } #games .gameplate--padding { height: 20p

sql server - Find the Record - Then Average the "X" Number of Previous Occurrences -

Image
what hope accomplish here to create t-sql find particular record , display appropriate projections particular record. , display average of 3 previous times record occurred. in query below, event occur on 10/7/2015 , had 2 projections of 23 , 23. select convert(date, dm.fromdatetime) 'drivedate', acct.internalname, dm.locationid, dpact.procedureprojection, dpact.productprojection dbo.drivemaster dm inner join dbo.accounts acct on dm.accountid = acct.accountid inner join dbo.driveprojectionandcollectedtotals dpact on dm.driveid = dpact.driveid inner join dbo.drivestatusdef stat on dm.statusid = stat.statusid acct.accountid = 17708 , dm.fromdatetime = '2015-10-07' here results - expected , appear correct: in second query, displaying 3 previous times same event occurred @ location , marked in complete status. select top 3 convert(date, dm.fromdatetime) 'drivedate', acct.internalname, dm.locationid, dpact.procedureprojection, dpact.productprojection h

iphone - Custom Separator Image disappears in UItableviewcell -

i loading custom separator image in uitableview cell. here code : - (uitableviewcell *)tableview:(uitableview *)atableview cellforrowatindexpath: (nsindexpath *)indexpath { static nsstring *cellid=@"cell" mytableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellid]; if (cell == nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:switchcellidentifier]; cell.selectionstyle = uitableviewcellselectionstylenone; uiimageview *aswitch = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"divider.png"]]; separator.frame = cgrectmake(0,50,320,1); [cell.contentview addsubview:seperator]; } if(cell.height == 22) { /// here setting frame uiimageview } but getting seperator image disappears 1 row out of 20 while scrolling. can please why loading this. if you've put separator uiimage out of bounds of cell, , set cell.clipstobounds = no; have separator im

asp.net - How a browser based Form POST becomes a Server Side event like Button_OnClick -

i have seen question in what great .net developers ought know -by scott hanselman i not sure, per knowledge button control gets rendered html input tag submit(with dynamic id). when post event fired asp.net uses dynamically generated button id , matches respective button click event @ c# side.... please let me know, if understanding correct. thought can wrong or out of context. update:- i did little google , came across this link states an asp.net button control in html html input element type attribute set "submit". submit button in html invokes post, using action attribute form element, which, asp.net, current page. since post, form variables populated of values input elements in form element, including value (name) of submit button. when post arrives @ server , parsed asp.net, acknowledge post initiated submit button, turned click event original asp.net button control. some 1 answer that: an asp.net button control in html h