Posts

Showing posts from July, 2013

java - jdbc to hive connection refused -

i trying connect hive via jdbc. below code using: import java.sql.drivermanager; import java.sql.resultset; import java.sql.sqlexception; import java.sql.statement; import java.sql.connection; public class hivetojava { private static string drivername = "org.apache.hadoop.hive.jdbc.hivedriver"; /** * @param args * @throws sqlexception */ public static void main(string[] args) throws sqlexception { try { class.forname(drivername); } catch (classnotfoundexception e) { e.printstacktrace(); system.exit(1); } connection con = drivermanager.getconnection( "jdbc:hive://localhost:10000/default", "", ""); statement stmt = con.createstatement(); string tablename = "processed"; resultset res = stmt.executequery("describe " + tablename); while (res.next()) { system.out.println(

asp.net mvc - MVC layers and DAL & Data layers -

i've been developing multi-tier mvc application , reviewing i've done far. i've gone , done fair bit of reading again on multi-tiers/layers (there heaps of information out there no real consistency or standard), i'm questioning data layer. i suspect have implemented incorrectly (in line design) , may have gone off on tangent. here's i've done: webui includes controllers, view models, views bll includes service classes contain: in-memory manipulation code, e.g. collections... data access code, e.g. ef linq entities. data /models folder contains domain classes /dal folder contains dbcontext classes ... stepping back, , re-reviewing, here see, , i'm questioning: in bll, ef code not correct here. should in data layer. can please confirm? my data layer (i.e. data project) contains context classes, , domain models. i've read people separate data layer a) dal, , b) models. therefore guess dal layer contain context classes ,

How to send date and time to SQL using java -

i calling stored procedure in database. 2 of parameters requires date , time in sql date format. string x = new simpledateformat("mm-dd-yyyy").format(new date()) + " 00:00:00 am"; string y = new simpledateformat("mm-dd-yyyy").format(new date()) + " 11:59:00 pm"; date fromdate = null; date todate = null; try { fromdate = new simpledateformat("mm-dd-yyyy hh:mm:ss a").parse(x); todate = new simpledateformat("mm-dd-yyyy hh:mm:ss a").parse(y); } catch (parseexception ex) { } callablestatement proc_stmt = con.preparecall("{ call someproc(?,?) }"); proc_stmt.setdate(1, (java.sql.date) fromdate); proc_stmt.setdate(2, (java.sql.date) todate); i believe if send date(excluding time), code works, of no use me database not generate correct results. when run above code classcastexception:java.util.date cannot cast java.sql.date any solution? use java.sql.timestamp class holds date , time sql

css - Side navigation submenu flyout pushes down other menu items in IE7 -

Image
this problem showing in ie7. other browsers , ie8 , above work fine. i using sprite map ul side navigation. there fly-out submenu 1 of li elements uses sprite map ul downloading various pdfs. if @ image i've attached, submenu appearing in correct location, it's pushing down below it. (the word "music" should appear directly below word "menu".) i have tried various fixes using display: inline; element , position: static; element, attempts have failed. appreciate on this. website address is: http://www.graysonmain.com/ you use fixed height, height: 58px , display: inline-block li#nav_02 .

sql - Concat 2 column data through another column (group by) -

my table - education state code descr aa 001 aaaaaa aa 002 aaaabbb bb 003 qwerty cc 025 asdfg bb 014 zsedc aa 015 lknhj cc 084 uhygt cc 067 fdrda i want in below format: state code aa 001-aaaaaa,002-aaaabbb,015-lknhj bb 003-qwerty,014-zsedc** cc 025-asdfg,084-uhygt,067-fdrda i trying , succeded in getting column "code" in single row below query: select state, replace(wm_concat(code), ',', ',') code education group state order state; output: state code aa 001,002,015 bb 003,014 cc 025,084,067 and have got respective descr each code through below query: select state, concat(concat(replace(wm_concat(code),',',','), '-'),descr) code education group state,descr order state can me club-up queries desired output. thank in advance. wont ? select state, replace(wm_concat(code||'

sql - Adding constraints using subquery from other table -

i have 2 tables: messages ( id(pk), sender ) recievers ( id references message(id), reciever, pk(id, reciever) ) here's deal: a message can have 1 sender. done a message can have multiple receivers, receiver cannot receive same message more once. done a sender cannot send message himself. how do part? i tried this: update table recievers add constraint "recievers_ck_self_send" ( reciever not in ( select sender messages message.id=reciever.id)); on oracle database 10g xe, receive following error: sub query not allowed here one work-around can create materialized view containing query identifying "bad rows". create table messages( message_id number not null ,sender_id varchar2(20) not null ,primary key(message_id) ); create table receivers( message_id number not null ,receiver_id varchar2(20) not null ,primary key(message_id,receiver_id) ,foreign key(message_id) referenc

ios - Calculate the color at a given point on a gradient between two colors? -

Image
so method write (in objective-c/cocoa, using uicolors , i'm interested in underlying math): + (uicolor *)colorbetweencolor:(uicolor *)startcolor andcolor:(uicolor *)endcolor atlocation:(cgfloat)location; so example, have 2 colors, pure red , pure blue. given linear gradient between two, want calculate color that's at, say, 33% mark on gradient: if call method so: uicolor *resultingcolor = [uicolor colorbetweencolor:[uicolor redcolor] andcolor:[uicolor bluecolor] atlocation:0.33f]; i resulting color @ 'b', , similarly, passing 0.0f location return color 'a', , 1.0f return color 'c'. so question is, how go mixing rgb values of 2 colors , determining color @ 'location' between them? you linearly interpolate red, green, , blue channels this: double resultred = color1.red + percent * (color2.red - color1.red); double resultgreen = color1.green + percent * (color2.green - color1.green); double resultblue = color1.blue + per

html - Can i make views that cannot be hacked -

i want give user web application deploy on own server. want put on image (advertising) user must not able hack , remove. if give raw source code (php or asp.net), can circumvent code , remove logo , etc. have embed image resource (in asp.net), , dynamically load image page using code (c#/vb.net), , compile application, , distribute binaries. this way casual user wont able remove. experienced user can still decompile code or view resource files, , change it.

codeblocks - c++ what are the header files to include for using CP_UTF8 and WideChartoMultiByte -

which header files have include use cp_utf8 , widechartomultibyte i getting errors not in scope. i working on codeblocks in linux (debian) widechartomultibyte windows api. maybe should use std::codecvt . note there know issue partial on both gcc , vc . stuck on them few days ago.

java - Jmeter Testplan - empty test plan error -

while importing test plan, see error below: 2014/03/06 13:37:05 info - jmeter.gui.action.load: loading file: /users/kiwitech/desktop/load test jmeter/jouney_load_test .jmx 2014/03/06 13:37:05 info - jmeter.services.fileserver: set new base='/users/kiwitech/desktop/load test jmeter' 2014/03/06 13:37:05 error - jmeter.save.saveservice: conversion error com.thoughtworks.xstream.converters.conversionexception: com/jayway/jsonpath/invalidpathexception : com/jayway/jsonpath/invalidpathexception ---- debugging information ---- message : com/jayway/jsonpath/invalidpathexception cause-exception : java.lang.noclassdeffounderror cause-message : com/jayway/jsonpath/invalidpathexception first-jmeter-class : org.apache.jmeter.save.converters.testelementconverter.unmarshal(testelementconverter.java:100) class : org.apache.jmeter.save.scriptwrapper required-type : com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.jsonpathextractor conv

css - child div floating underneath its parent -

so basically, want 2 divs sit inside div. first 1 sitting inside no issues, second 1 floats underneath parent. when add overflow:hidden can't see div anymore. closest i've gotten solution add overflow:auto , creates scroll bar. have tried resizing, different positioning, overflow , clearfix far can't find solution. ideas guys? jsfiddle demo here http://jsfiddle.net/qlbgc/ help, it's been annoying me couple of days now. if you're looking have 2 divs side side here's fiddle that. http://jsfiddle.net/hastig/qlbgc/6/ i stripped out bunch of stuff wasn't sure needed or stuff throwing @ try , affect change. somebody mentioned missing float: left; in assume wanted left div. remember compensate margin , padding match container div. in example main container 500px wide. if set each float div 250px width when added 20px combined margins on divs total width goes 520px , pushes right div under left div you'll want each floated div @ 240px c

mysql - Detecting empty rows in associated table and print out dummy data -

i have 2 tables one-to-many relationship. table has columns - id - name table b associated table a. table b belongs table a. table b has columns - id - tablea_id_foreignkey - timechange - status i want write mysql query such when table b has no associated row entries table a, dummy data printed in output particular row in table a. result like; tablea_name 0000-00-00 00 one able tell row in table has no associated rows dummy data. thank help. select b.*, coalesce(a.name, '0000-00-00 00') dummy b left join on b.a_fk = a.id with left join rows b , regardless if there's matching row in a . if there's no matching row, null returned. coalesce() function returns first of parameters isn't null . update: understood question wrong... select a.*, 'hello' dummy /*with clause rows there's no match anyway*// b right join on b.a_fk = a.id b.id null

python - serialize datetime to json in Django -

hi how datetimefield mysql database in django in json format. got error when executed code 'date.time cannot serialized in json'(data holds lot of values) data = json.dumps(data) but fixed adding all_data = serializers.serialize("json", data, ensure_ascii=false) but 'str' object has no attribute '_meta' this solved problem. import json django.core.serializers.json import djangojsonencoder data = json.dumps(data, cls=djangojsonencoder)

Extracting content from html tags using java -

i extracted data html page , parsed tags containing tags tried different ways extracting substring etc extract title , href tags. it'snot working..can me. small snippet of output my code doc = jsoup.connect("myurl").get(); elements link = doc.select("a[href]"); string stringlink = null; (int = 0; < link.size(); i++) { stringlink = link.tostring(); system.out.println(stringlink); } output <a class="link" title="waf ad" href="https://www.facebook.com/waf.ad.54" data- jsid="anchor" target="_blank"><img class="_s0 _rw img" src="https: //fbcdn-profile-a.akamaihd.net/hprofile-ak-ash1/t5/186729_100007938933785_ 508764241_q.jpg" alt="waf ad" data-jsid="img" /></a> <a class="link" title="ana ga" href="https://www.facebook.com/ata.ga.31392410" data-jsid="anchor"

c++ - How To change the background color of a container using the Hex format? -

i'm developing blackberry 10 mobile application using momentics ide (native sdk). i want change background color of container using c++. unfortunately, relating [ link ], can define below : **creating color in c++:** color c1 = color::fromrgba(0.5f, 1.0f, 0.2f, 0.8f); color c2 = color::fromargb(0xff996633); for color, want use hex format ("#xxxxxx"). 1 can guide me on ? color c2 = color::fromargb(0xff996633); using hex 0x c++ representation of hex code . ff component, 99 r, 66 g , 33 b so if want use hex value #000099 no alpha then color::fromargb(0x00000099) the following code convert string hex value, need remove # string before hand however, , can pass string buffer object #include <iostream> #include <sstream> int main() { std::string hexstring("#ffffff"); hexstring.erase(hexstring.begin()); std::istringstream buffer(hexstring); int value; buffer >> std::hex >> value; std::c

wpf - Should ViewModel respond to each ProperyChanged event or is chunking better? -

here question: in cases model collection of other model objects, may changed calculation, better not use propertychanged per model item rather have propertychanged @ parent level? suppose have mvvm in wpf: model: public class model { public ienumerable<iitemmodel> items{ get;} } public class iitemmodel : inotifypropertychanged { private int m_value; public int value{ get{ return m_value; } set{ m_value = value; notifypropertychanged(()=>value); } } } and in viewmodel // baseviewmodel implements inotifypropertychanged etc public class myviewmodel: baseviewmodel { public myviewmodel(){ var items = new model.items items = new myobservablecolelction<itemviewmodel>(item => new itemsviewmodel(item), items); } public myobservablecollection<itemviewmodel> items { ; set; } } here, myobservablecolelction implementation of iobservablecollection has fa

Creating an XML document using Java -

i have seen many programs xml documents can created using java specified fields. yet come across 1 user gets decide names of rootelement's , childeelement's. know how go this? use xstream java code xstream xstream = new xstream(); xstream.alias("person", person.class); xstream.alias("phonenumber", phonenumber.class); person joe = new person("joe", "walnes"); joe.setphone(new phonenumber(123, "1234-456")); joe.setfax(new phonenumber(123, "9999-999")); string xml = xstream.toxml(joe); output xml <person> <firstname>joe</firstname> <lastname>walnes</lastname> <phone> <code>123</code> <number>1234-456</number> </phone> <fax> <code>123</code> <number>9999-999</number> </fax> </person> library: http://x-stream.github.io/tutorial.html

how to make child auto-resize (child is Pane, parent is VBox) in javafx -

i have 2 questions 1.in javafx application, want put child(crosshairarea) @ left-top corner of parent, 1/2 width , height well. think can via override parent function "layoutchildren" (vbox), there other way that? e.g. property binding? 2.initially vbox occupy full scene area, how make(relocate) half-bottom of scene? public class crossh extends application { public static void main(string[] args) { launch(args); } @override public void start(stage stage) { vbox root = new vbox(5); // root.setpadding(new insets(20,20,20,20)); root.setstyle("-fx-border-color:red"); pane crosshairarea = new pane(); crosshairarea.maxwidthproperty().bind(root.widthproperty()); crosshairarea.setstyle("-fx-border-color:black"); root.getchildren().add(crosshairarea); scene scene = new scene(root); stage.setscene(scene); stage.settitle("location

ruby - link_to works, but not button_to with parameter to pass -

i have link_to trying convert button. not sure how pass parameter plan_id in button_to call. per other threads on this, have used :get method inside button_to call. works: <%= link_to "sign up", new_subscription_path(:plan_id => plan.id) %> does not plan_id passed : <%= button_to "sign up", new_subscription_path(:plan_id => plan.id) , :class => "btn btn-primary btn-large", :method => :get %> please can tell me wrong? <%= link_to "sign up",new_subscription_path(:plan_id => plan.id),{ class:"btn btn-primary btn-large"} %> it make link button.

java - I can not open Eclipse -

i'm trying open eclipse workspace use, got error. here part log (any appreciated): !session 2014-01-22 10:01:39.699 ----------------------------------------------- eclipse.buildid=4.3.0.m20130911-1000 java.version=1.7.0_45 java.vendor=oracle corporation bootloader constants: os=win32, arch=x86_64, ws=win32, nl=en_us framework arguments: -product org.eclipse.epp.package.standard.product command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.standard.product continuation of log file d:\phd_svn\code\.metadata\.bak_0.log created time: 2014-01-22 15:17:42.504 !entry org.eclipse.ui 4 0 2014-01-22 15:17:42.507 !message unhandled event loop exception !stack 0 java.lang.reflect.undeclaredthrowableexception @ com.sun.proxy.$proxy15.mousemove(unknown source) @ org.eclipse.swt.widgets.typedlistener.handleevent(typedlistener.java:212) @ org.eclipse.swt.widgets.eventtable.sendevent(eventtable.java:84) @ org.eclipse.swt.widgets.wi

How can I transfer imformation from an Android app to a Ni myRio embedded hardware device -

i trying transfer instructions android app ni myrio embedded hardware device. can't seem find documentation. try starting this: android run android application in ide's built-in android mobile device emulator. have stream 'hello world' via udp port on localhost (say, 1234) labview rio run rio application against labview fpga emulator (right-click fpga target in project explorer , select 'run on -> emulator') have listen 1234 on localhost, , print output simple string buffer displays on vi's front panel*1 both of these have readily searchable tutorials*2, , remove hw equation, should able complete them successfully, , iterate past final solution (wifi?). if working on real hw, consider posting (brief) followup-answer question here. -justin *1: don't front-panel debug-hack in deployed fpga code! *2: check ni's example finder labview fpga udp tutorials.

php - Order Pages by Custom Field Value -

i have set several pages including custom field numerical value. when querying pages want display them ordered custom field numerical value lowest highest. this code using: <?php query_posts(array('showposts' => -1, 'orderby' => 'meta_value', 'meta_key' => 'price-medium', 'order' => 'asc', 'post_parent' => 1286, 'post_type' => 'page')); ?> for som reason sorting not working , pages being shown scattered not price order. can have idea or suggestions in how go ? i managed sort issue changing 'orderby' => 'meta_value' to 'orderby' => 'meta_value_num'

android - unregisterIRListener() is called & screen stop rotate -

i own rooted galaxy s4 i9505, on stock android 4.4 before changing on phone, except root, made titanium. i setup of program, , phone working well, lot of apps freezed titanium. i frooze them, because last time deleted them, met problem sensors. yesterday decided delete 6/10 of these frozen apps like: shealth, sensorservice (i thought related shealth), album, tripadvisor, samsung music, samsung books... and again, reach same problem, screen not rotating anymore, , proximity sensors seems not working also. shealth not working anymore (messagebox: shealth has stopped), has been restored titanium. seems shealth start automatically after reboot, same error messagebox. thinck shealth or sensorservice source of problem. if find automatically start, maybe solve. same before. last time reinstall phone, , ok. here tryed check again sensors apps, , sensors seems work physically. in alogcat every sec: abslistview(xxx): unregisterirlistener() called. seems have killing call of

string - Access Azure Storage Configuration Setting from class library -

i have azure project uses azure storage. connection string azure storage saved in configuration settings azure project. now have created class library. want able load connection string in class library. best way of doing this? for example, put connection string in app.config class library? if so, azure project override automatically when run solution? you may looking microsoft.windowsazure.cloudconfigurationmanager . getsetting method attempts pull setting cloud configuration, if role isn't available (for instance because you're in unit test), reads <appsettings> element inside app.config or web.config file. here's basic syntax: using microsoft.windowsazure; ... var settingvalue = cloudconfigurationmanager.getsetting("settingkey"); msdn[1] says syntax deprecated release of storage 3.0, class , method aren't attributed such, documentation may have bit of copy pasta in it. [1] http://msdn.microsoft.com/en-us/library/windowsazur

java - apache ivy and nested jar files in osgi bundles -

we have following scenario using osgi bundles: bundlea imports package "com.mypackage". bundleb exports package "com.mypackage", package nested jar file added bundleb classpath. in order compile osgi bundles , resolve dependencies automatically i'm using ant + ivy. i configured ivy:buildobr task , correctly builds obr file (checked manually). next configured actual build task. call ivy:resolve. can see ivy correctly resolves package "com.mypackage". call ivy:cachepath creates compile class path. call javac classpathref="compile.classpath" javac throws error because doesn't know package "com.mypackage". knows classpath indicating jar files, , doesn't know how interpret manifest.mf it's own classpath. the problem constructed class path. has no idea exported "com.mypackage" nested jar in bundleb. how solve kind of issue? manifest-version: 1.0 bundle-manifestversion: 2 bundle-name: bundl

cmd - Java Version in user profile without privileges -

i need cmd , java version . when type cmd java -version user profile without privileges ,the output diferent if typed cmd java -version administrator profile . updated java... seems user , administrator account have different path-variables pointing different java.exe-files...

Boolean query does not return expected data in Elasticsearch -

i have following document in elasticsearch reported kibana: {"deviceid":"c1976429369bfe063ed8b3409db7c7e7d87196d9","appid":"disneydigitalbooks.planesadventurealbum","ostype":"ios"} why following query not return success? [root@myvm elasticsearch-1.0.0]# curl -xget 'http://localhost:9200/unique_app_install/_search?pretty=1' -d ' { "query" : { "bool" : { "must" : [ { "term" : { "deviceid" : "c1976429369bfe063ed8b3409db7c7e7d87196d9" } }, { "term" : { "appid" : "disneydigitalbooks.planesadventurealbum" } }, { "term" : { "ostype" : "ios" } } ] } } }' here response elasticsearch: { "took" : 1, "timed_out" : false, "_shards" : { "

php - VLC quit with execution command -

i use execution command vlc plugin record live stream server , work fine. need message record finished. have tried command when record more 30 sec, error appear. this command : $file = 'vlc '.$inputstream.' --run-time='.$sec.' --sout "#duplicate{dst=display{noaudio},dst=std{access=file,mux=mov,dst='.$path.'}" vlc://quit '; echo exec($file); and error : fatal error: maximum execution time of 30 seconds exceeded in c:\wamp\www\iptvstream\target_2.php on line 14 kindly, can me how can use vlc quit execution command ? regards, use set_time_limit(0); before calling exec function. removes time limit

c++ - error C2143: syntax error : missing ',' before ':' -

i'm trying build opensource game keep getting error when trying build. have been searching last half hour nothing working here's code errors pointing to void duel::restore_assumes() { for(auto pcard : assumes) pcard->assume_type = 0; assumes.clear(); } and error is error 1 error c2143: syntax error : missing ',' before ':' c:\users\user\desktop\project source\ocgcore\duel.cpp 108 1 ocgcore (visual studio 2010) ms vc++ 2010 not support range based statement introduced in c++ 2011. has own language extension: for each . try change code void duel::restore_assumes() { for(auto pcard : assumes) pcard->assume_type = 0; assumes.clear(); } to void duel::restore_assumes() { each (auto pcard in assumes) pcard->assume_type = 0; assumes.clear(); } otherwise can use ordinary loop iterators of object assumes or standard algorithm example std::for_each

c# - Not found error in hosted environment -

we facing issue in webapi returning error 404: not found in iis7 (config – windows server 2012, .net 4.0 framework, adfs-wif integrated authentication) solution deployed @ root of site’s physical path in server. post authentication adfs, site redirected our application home page fails call webapi controller class. related code: // script on page load: function getfiltersdata() { var username = 'rohit.x.shukla'; var strdc = []; var data = { username: username, dc: strdc, }; // ajax call $.ajax({ url: "api/filtersdata", type: "post", contenttype: "application/json;charset=utf-8", data: json.stringify(data), success: showfilters }); } function showfilters(filtergroup) { //dropdown populating logic here alert(‘this alert never gets called’); } controller: public class filtersdatacontroller : apicontroller { private filtersdat

frameworks - Building an app with Yeoman + Laravel -

i build application using laravel backend , yeoman build , manage frontend. know quite few of these technologies. i did not found lot of worflows explain how communicate between separate laravel app , yeoman app (on different servers e.g). maybe cors option. is ever try separate backend , frontend (with these technologies)? yeoman not front end framework - rather application scaffold generating starting point front end. angular js preferred option when using laravel backend. can use yeoman set angular front end using this: https://github.com/yeoman/generator-angular an excellent tutorial series helped me lot when setting angularjs talk laravel here: https://github.com/davemo/end-to-end-with-angularjs included quite extensive explanation on angularjs security. the laravel backend should setup api in first instance accept requests, heres starting point setup basic api in laravel laracon 2013 https://github.com/akuzemchak/laracon-todo-api laracasts has gre

sql - Issue with dynamic execute immediate query -

i have code in procedure looks this. when execute code, error mentioned below. the error report got is: error report - ora-06553: pls-306: wrong number or types of arguments in call 'ogc_y' ora-06512: @ line 20 06553. 00000 - "pls-%s: %s" *cause: *action: the error has primary_flag = "y" <-- this. how else can write primary_flag = 'y' inside string? dynamic query required in case. my code is: declare p_assignee_id number := 10153; time_stamp timestamp := '12-dec-2011'; create_task_view_sql varchar2(4000); begin create_task_view_sql:= 'select unique cp.sub_last_name cs_sr_contact_points_v cp cp.incident_id = 55500 , cp.contact_phone not null , primary_flag = "y"';

woocommerce - How to call wordpress function directly from url? -

i have added custom payment method woocommerce , working fine . have 1 problem calls callback url saving transaction information db. have created new function in plugin file cant excess directly . how have done it: // add_action('wp_ajax_nopriv_payment_callback_action', 'payment_callback_action'); //function function payment_callback_action() { echo "its working!"; } i trying access : url:"<?=site_url( '/' );?>wp-admin/admin-ajax.php?action=payment_callback_action it seemd because of dnt have privillage use directly how can ?. # users not logged in add_action('wp_ajax_nopriv_payment_callback_action', 'dixipay_callback_action'); # users logged in add_action('wp_ajax_payment_callback_action', 'dixipay_callback_action'); # callback function dixipay_callback_action() { echo "its working!"; } read more: http://codex.wordpress.org/ajax_in_plugins

html - nth-child() and blockquote css -

i have html code <blockquote> <cite>oioik wrote:</cite> <blockquote> <cite>oioik wrote:</cite> <blockquote> <cite>oioik wrote:</cite> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. integer posuere erat ante.</p> </blockquote> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. integer posuere erat ante.</p> </blockquote> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. integer posuere erat ante.</p> </blockquote> and have css blockquote { font-size: 13px; background-color: blue; border: 0; padding-left: 50px; } blockquote:nth-child(even) { background-color: red; } then in example should have blue/red/blue background colors have blue/red/red there difference between child , descendant . so if had: <blo

ember.js - How to allow users to use custom domain name mapped to their user profile -

i building network platform user profiles follow url format of website.com/username. however, want allow premium customers able use custom domain names instead of website.com/username. premium user should able use external domain gets mapped sub-domain. using zend framework 2, emberjs, , amazon web services (route 53) , nginx. thanks in advance help! you have create own route-type that. there's routeinterface that. extend segment route that, you'll need segment. difference being segment needs match against database. alternatively, create normal segment route :username parameter , match controller internally checks if given username exists|ispremium , depending on result, either forward userprofile or return home route.

Redirect issue in laravel 4 -

i'm using laravel 4 , want add filter after route logic. filter executed redirect instruction not executed return redirect::to($pool->url . '/share')->with('poolurl' ,url::to($pool->url)); code : if(session::has('pool')){ $entry = session::get('pool'); // update pool userid $entry['user_id'] = auth::user()->id; $pool = pool::create($entry); // update pool url $pool->url = auth::user()->username . '/pool/' . str::slug($pool->beneficiary) . '/' . $pool->id; // update , redirect share page if($pool->save()) { return redirect::to($pool->url . '/share')->with('poolurl' ,url::to($pool->url)); } }

ios - How do i get device data? -

can other device related data other specified in uidevice in settings of iphone bluetooth, cellular data on off status ,total memory,left memory ,batery status...etc i able following using uidevice class : name model localized system, version, language ,country ,application version, systemname, uuid like there api helps me retrieve device data? what country in uidevice signify? used lang version or country in live bit confused. you should try alsystemutilities library made andrea lufino , provides information device's battery, disk, hardware, jailbreak, localization, memory (ram), network, processor, carrier, accessories.

javascript - Does jQuery validate work in IE8 at all? -

i'm trying use jquery validate plugin. tried using on own form, , found in ie8 not working. can't find definitive answer site or searching around. looking @ examples can see don't work in ie8 either. so, plugin work @ in ie8? looking @ example in ie11 in ie8 mode, wouldn't work. using vm ie8 did work, i'm noting here in answer own question.

objective c - I need to get array of bytes from image -

i'm trying byte array containing bytes of image, this: nsstring* filepath = [[nsbundle mainbundle] pathforresource:@"image" oftype:@"png"]; nsdata *data = [nsdata datawithcontentsoffile:filepath]; unsigned char *bytesarray = data.bytes; nsuinteger lengthofbytesarray = data.length; next, try copy these values array. if (data.length>0) { nsmutablearray *array = [[nsmutablearray alloc] initwithcapacity:data.length]; (int = 0; i<data.length; i++) { unsigned char bytefromarray = bytesarray[i]; [array addobject:[nsvalue valuewithbytes:&bytefromarray objctype:@encode(unsigned char)]]; } } finally in debug received array of empty objects. have memory address don't have value (nsconcreatevalue type). in debug area i've checked bytefromarray , `(unsigned char)'p'. did choose wrong way byte array image, or code wrong? try replacing (int = 0; i<data.length;

Jquery Ajax File Upload facebook style -

i have one: http://malsup.com/jquery/form/ ‎ .. works okay want upload progress system facebook, window loads while file uploading , upload progress shown @ left bottom corner of browser. there such jquery ajax form submission supports file uploading. you can xhrlistener. did similar before time, here's snippet of code used: jquery.ajax({ url: 'url/to/upload/to', data: formmediadata, datatype:'json', //return type, in case json type: 'post', xhr: function(){ // important part var xhr = new window.xmlhttprequest(); //the event listener call _very_ often, might want check // how big difference between last percentage , //percentage is, before needs long computing times(!) xhr.upload.addeventlistener("progress", function(evt){ //check if browser can determine complete size of data. if (evt.lengthcomputable) { var percentcomple

python - Delete a line from imported text file string -

i have imported 2 text files program- f = open("words.txt","r") words = f.read() f = open("solved.txt","r") solved = f.read() and involved in 'guess word' game making. at end of game, program checks users answers against real ones... print('checking words...') sleep(2) if (words) == (solved): print('>well done!') sleep(1) print('>all of answers right') else: print('not quite, keep trying!') sleep(1) menu() the words text file has carriage return on end of string, no matter user makes words string, never same solved string (with no carriage return on end), , therefore user can never win game. i have edit text files within program only, way delete carriage return end of words string, user can win game. words.txt- #+/084&" #3*#%#+ 8%203: ,1$& !-*% .#7&33& #*#71% &-&641'2 #))85 9&330* theres space here solved.txt- ac

visual studio - Windows Phone 8 Font (Quartz MS) only working in Designer -

i try use font "quartz ms" given font in fontlist (visual studio 2013 ultimate) - in designer looks awesome - when run app on device doesn't load font (standard font used) can me? (tested on lumia 820) thanks! here full list of supported fonts on windows phone (that come device): http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202920%28v=vs.105%29.aspx . for additional font want use, need manually add phone, see http://jeffblankenburgdotcom.wordpress.com/2010/10/24/31-days-of-windows-phone-day-24-embedding-fonts/ .

c - Reverse characters word in array -

for exemple need invers "paris" "sirap"... my main: int main(void) { char w1[] = "paris"; reverseword(w1); printf("the new word is: %s",w1); return0; } and function: void reverseword(char *str) { int counter=0; for(int i=0; *(str+i)!='\0'; i++) counter++; int length = counter-1; char temp[length]; for(int j=0; temp[j]=='\0'; j++) temp[j]=str[length-j]; } now have renverse word in temp[]. need put in pointer *str. how can it?? thanks if want use temp must function this void reverseword(char *str) { int i,j; if(str) { int length=strlen(str); char temp[length+1]; for( j=0; j<length; j++) temp[j]=str[length-1-j]; temp[j]='\0'; strcpy(str,temp); } } without using temp follows void reverseword(char *str) { int end= strlen(str)-1; int start = 0; while( start&l

java - Asynchronous websocket mechanism which pretend to be synchronous -

i not looking specific answer, idea or tip. have following problem: android application client web service. has thread, sends events (xml form request id) through http protocol , every request server sends confirmation, understand message right granted event id - server synchronizer few clients. want use websocket protocol send events through websocket little bit tricky - instead of http, don't expect response every request. moreover, incoming websocket messages parsed in other thread. primary mechanism it's little bit overgrown , don't want write scratch. i want make asynchronous websocket mechanism pretend synchronous. there idea - after send event through websocket wait no more e.g 5 seconds response processed in other thread (it's came xml) , regarding request id notify proper paused thread. worry condition.await() , condition.signal isn't best idea, think? according problem, i've realized have problems project kind of mechanism. have idea, can fin

c++ - strtok problems on different versions of Xcode -

when change xcode i'm using program in c behavior of following code changes same input data: char * aux = strtok (message,utilities::constants::serialization_separator); int i=0; while (aux != null) { spliteddata[i]=aux; i++; aux = strtok (null,utilities::constants::serialization_separator); } so in xcode 5 gives splitted string in xcode 4.2 doesn't. believe should has charset not know. message char * , parameter of function on code embedded. thanks in advance

ios - Application force kill callback when user taps the red (-) button on the app icon -

when user force kills ios application need reset data in app. according apple's documentation post ios sdk 4.0 applicationwillterminate callback method not called , application killed without being notified. appreciate if helps me find solution/ other way capture event. you should persist state by, in appdelegate , implementing - (void)applicationwillresignactive:(uiapplication *)application this called when the app enter background. read more in apple documentation here edit you can't know if app terminated user or system while running in background. if need clean stuff, when app launched in: - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions

php - zend form element inside a table -

Image
i'm looking way can add zend form element inside table, tried method below not working:i want element inside table below it.example pic below $name2 = new zend_form_element_text('search'); $name2->setlabel('search enterprise name:'); $name2->addvalidator('notempty') ->setdecorators(array( 'formelements', array('htmltag', array('tag' => 'table', 'id' => 't1')), 'form', )); <div class="col-md-6" style="margin-left: 0;"> <table class='spreadsheet datatable' cellpadding='0' cellspacing='' id="t1"> <thead> <tr role="row"> <th>enter service provider used</th> </tr> </thead> </table> <button type="button" onclick="alert('i work!')">

java - TestNG mvn run tests without group -

i using testng , maven surefire plugin run tests. have: @test(groups={"groupa"}) testa{} @test testb i have possibility run: mvn test should invoke test without group mvn test -dgroups=groupa should invoke groupa tests ( works default added here have working previous option ) i tried configure surefire like: <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-plugin</artifactid> <version>2.16</version> <configuration> <excludedgroups>groupa</excludedgroups> </configuration> </plugin> mvn test works expected, after mvn test -dgroups=groupa no tests executed edit i found solution here: https://labs.consol.de/blog/maven/citrus-and-testng-groups/ <!-- testng groups --> <testgroups></testgroups> <testgroupsexcluded>groupa</testgroupsexcluded> <!-- /testng groups--> ... <plugin> <groupid>org.ap

qt - What qmake variable is used for Objective-C compilation flags? -

qmake_cxxflags applied when compiling .cpp files, not applied .mm files. flag should use instead? those flags belong in qmake_objective_cflags ( not qmake_objective_cxxflags ). the flags used in precompiled header generation go qmake_objcxxflags_precompile , objective-c compilation handled qtbase/mkspecs/features/mac/objective_c.prf . objective_c compiler defined on-the-fly when objective c/c++ sources present. can glean other details there. the precompilation flags handled unix makefile generator: qtbase/qmake/generators/unix/unixmake.cpp , unixmake2.cpp . i offer no comment consistency of variable names , locus of implementation. don't shoot messenger.

What is groupItemMetaDataProvider in slickgrid? -

here code sets properties dataview groupitemmetadataprovider? ,is rows or columns? dataview= new slick.data.dataview({ groupitemmetadataprovider: groupitemmetadataprovider, inlinefilters: true, rowheight: 20 }); it serves functionality groups, total rows, collapsing/expanding , on. check slick.groupitemmetadataprovider.js file more details.

javascript - z-index on jquery dialog not working inside an iframe -

i'm using bootstrap, uses jquery dialog. if z-index of dialog set 1 or more works fine in stand alone script. however, when call same script inside iframe. dialog shows underneath other elements on same page. bizarrely enough, if try close dialog, can't because seems semi-transparent layer on top of dialog itself. ui-dialog { z-index:99999999 !important; } .ui-widget-overlay { position: fixed; z-index:99999999 !important; } .ui-dialog { z-index:99999999 !important; } .fixed-dialog { position: fixed; top: 50px; left: 50px; z-index:99999999 !important; } .ui-dialog-titlebar { border-left: 30px solid transparent; min-height:40px; background-color:#f09; background-image:url(images/yellow_alert_icon.png); background-position: -22px 8px; background-repeat:no-repeat; z-index:99999999 !important; } i'm stocked !!! updated clarification: iframe empty. doesn't contain other elements. use dialog. entire code ins

ios - Table cells appear empty -

i'm having problem populating tables. created custom view , in view created tableview. code uiview subclass given below . table appears , delegates called. 24 cells created per delegate , appear text or other cell contents don't appear. i'm not able change cell property including cell background color. - (id)initwithframe:(cgrect)frame andcellheight:(cgfloat)cellh{ self = [super initwithframe:frame]; if(self){ [self inittimearray]; [self inittable]; } return self; } - (void) inittable{ timeline = [[uitableview alloc]initwithframe:cgrectmake(0, 0, self.frame.size.width,self.frame.size.height )]; timeline.backgroundcolor = [ uicolor clearcolor]; timeline.separatorstyle = uitableviewcellseparatorstylenone; timeline.rowheight = cellheight; timeline.delegate =self; timeline.datasource = self; [self addsubview:timeline]; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsin

html - How to make div blocks not floating using CSS? -

layout.cshtml <section id="main"> <div id="sidebar"> @{html.renderaction("categorymenu", "store");} </div> <div id="content"> @renderbody() </div> </section> style.css ... #main { padding: 30px 30px 15px 30px; background-color: #fff; -webkit-border-radius: 4px 0 0 0; -moz-border-radius: 4px 0 0 0; border-radius: 4px 0 0 0; overflow: hidden; } #sidebar { display: block !important; width: 15%; float: left; font: bold 20px arial, verdana; background: green; height: inherit !important; } #content { display: block !important; float:none; } ... i tried set sidebar's height 100%, inherit. should make 2 blocks not floating each other? sidebar floating left, taken out of dom flow , set left.

sorting - Nonworking QuickSort with InsertionSort implemention in Java? -

i have tried write quicksort method implements insertion sort speed smaller arrays. my methods insertionsort , quicksort beautifully sorts arrays, when start mixing them lists numbers place switched when comparing sorted list. first quicksort : public class qsort implements intsorter { public enum order { random, first, last, mypivot } private final order order; private random random; public qsort(order order) { this.order = order; random = new random(); } public int[] sort(int[] v) { return qsort(v, 0, v.length - 1); } // sorts elements of subvector v[first..last]. protected int[] qsort(int[] v, int first, int last) { if(first >= last) // less 2 elements return v; int p = 0; // choose pivot element. if(order == order.first) p = v[first]; else if(order == order.last) p = v[last]; else if(order == order.mypivot) { //the median of first, middle , last element //chosen median if

spring - No tag “if” defined in tag library imported with prefix “c” -

i have jsp file in spring tags used. <%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> <%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <c:if test="${!empty employeelist}"> <table class="data"> <tr> <th>firstname</th> <th>lastname</th> <th>email</th> <th>telephone</th> <th>action</th> </tr> <c:foreach items="${employeelist}" var="emp"> <tr> <td>${emp.firstname}</td> <td>${emp.lastname}</td> <td>${emp.email}</td> <td>${emp.telephone}</td> <td><a href="delete/${emp.id}">delete</a>| <a href="update/${emp.id}">update</

.net - Parse and format message/http on Windows Phone -

i need format , parse content of mime type message/http as specified in rfc 2616 . more specific, need format http/1.1 request , parse http/1.1 response, without network communication. target platform windows phone 8. in java use apache httpcore library. there similar in .net can use in windows phone app? or maybe there other smart way doesn't include implement format scratch? there no built-in parser per-se leverage available through exposed .net apis in windows phone. write own parser or rely on such classes httpwebresponse , httpwebrequest have abstracted-out model of message.

javascript - Running multiple httpServer in one Node Process or each server in own node process -

i'm trying figure out what's better solution. i running 2 http servers in node app, server 1 @ port 3000, server 2 on port 3001. server 1 making main logic , database handling, while server 2 handles file requests. when start app node myapp.js both servers launched , listening ports. /* *fire servers */ http.createserver(app).listen(3000, function(){ console.log('http express server listening on port 3000'); }); http.createserver(fileserver).listen(3001, function(){ console.log('http fileserver listening on port 3001'); }); now question: know if make difference if write every server own node process, have run node myapp.js launches server 1, listening on port 3000 , run node myfileserver.js listens on port 3001. is there performance difference? or hints can read it? regards, martin depends on rest of code. if both servers have shared states it's better start them in same process. if there no shared state it's better h

PHP displaying tags in browser? -

when create php file , try echo browser including code shouldn't displayed. i'm wondering if have turned off apache modules or something. have idea ? example below display. php tags , echo command. file:///c:/wamp/www/training/text.php <?php echo "anthing"; ?> i think typing file location in browser. must use local web-server address. try typing in url bar of browser. localhost/training/text.php

windows - Copy directory and create upper directory structure -

in windows (desktop, batch file, xcopy, robocopy) there way copy directory , have structure above created on destination? for example, have directory of files @ c:\data\outlook\profiles\2013. i want copy 2013 directory c:\copy want this: c:\copy\data\outlook\profiles\2013. of course, can manually create structure before copy, looking in bulk. here routine should copy target full path. @echo off call :copywithpath "c:\data\outlook\profiles\2013" "c:\copy" exit /b %errorlevel% :copywithpath <source> <target> md "%~f2\%~p1" && copy "%~f1" "%~f2\%~p1" exit /b %errorlevel% example of command values md "c:\copy\data\outlook\profiles\" && copy "c:\data\outlook\profiles\2013" "c:\copy\data\outlook\profiles\"

rewrite - Remove html extension from urls return error 404 in yii -

my current user's page urls: http://mydomain.com/user/oxaefrta.html in order achieve these urls, set line in urlmanager: 'user/<aid:\w+>'=>array('/users/profile/view', 'urlsuffix'=>'.html') when attempt remove 'urlsuffix'=>'.html' , turn out error 404. how deal issue? //edit my .htaccess file: rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php/$1 [l]

javascript - jquery constraint div to max window height -

i using code achieve div browser (window) height $(document).ready(function(){ $('#div') .css({'height': (($(window).height()))+'px'}); }); but if want div constraint height user maximum window height(max device limit)? above code determine current window height, once user resizing window or not opening max window size, got change , failed. try : $(document).ready(function(){ $(window).resize(function(){ $('#div') .css({'height': (($(window).height()))+'px'}); }).trigger('resize') }); with that, binding event when screen resize. recalculate window height. the .trigger() part ensure happen once when dom ready (it trigger event resize).

asp.net mvc - Models are not being generated by Entity Data Model Wizard -

Image
i go through entity data model wizard, select existing database , select 2 tables (invoice_header , invoice_line). after completing wizard, empty diagram, , don't see models associated tables selected. invoicesmodel name typed in when going through wizard. expecting see models 2 tables. there no errors, , i've done several times, using several different databases , tables, same result. causes this? update: i'm having problem on teradata instance. problem not occur when use tables on sql instance. i found answer here: issues teradata provider database objects not included in model ado.net entity framework can't work types cannot used in tables. therefore, >database objects can included in model subject following >restrictions: table columns must based upon supported types. stored procedures must have parameters of supported types. if parameter has >unsupported type, stored procedure excluded model. tables must have in