Posts

sql server unique key for each partition -

i have table contain 3 columns: id int [primary key] branchref int [foreign key] code int i need [code] unique in each [branchref] like: id branchref code 1 1 1 2 1 2 3 2 1 4 2 2 5 1 3 i appreciate help add unique constraint. alter table mytable add constraint unique(branchref, code);

hadoop - Able to create Hive table using JSON objects but not all objects are being captured into respective attribute -

i able create hive table using json objects not objects being captured respective attribute. few absorbed 1 attribute. how break out remaining attributes respective "columns". most of below fields put table screen_name, name , location grouped number of other objects retweeted_status , user. retweeted_status , user appear long json string needs broken out table. need perform activity below, , if so, how that? appreciated. thanks, here script, create table bank_f001 (json string); load data local inpath 'banking-1-26-16.txt' table bank_f001; create table bank_f001_table select get_json_object(bank_f001.json, '$.text') text, get_json_object(bank_f001.json, '$.in_reply_to_user_id') in_reply_to_user_id, get_json_object(bank_f001.json, '$.id') id, get_json_object(bank_f001.json, '$.favorite_count') favorite_count, get_json_object(bank_f001.json, '$.coordinates') coordinates, get_json_object(bank...

Animation of Circle angle rotation using MATLAB -

i have circle , partition circle 3 sector(120 angle each).now want increase angle 50 degree 1 part , decrease 50 degree part , keep constant third part (like 170 degree first part,70 degree second , 120 degree third).i want make animation whole process using matlab. how can this? if have source code process using matlab, helps me much. i draw circle , divide 3 equal sectors , polt points circle.here, attached following code: x0=2; y0=1; r=1; teta=-pi:0.01:pi; x=r*cos(teta)+x0 y=r*sin(teta)+y0 plot(x,y) hold on scatter(x0,y0,'or') axis square %---------------------------------------- % divide circle n sectors n=3 tet=linspace(-pi,pi,n+1) xi=r*cos(tet)+x0 yi=r*sin(tet)+y0 k=1:numel(xi) plot([x0 xi(k)],[y0 yi(k)]) hold on p1=[1.5,0.4]; p2=[2,0.8]; p3=[2.5,0.2]; p4=[2.5,1]; p5=[1.5,1.6]; p6=[1.5,0.8]; p7=[2,1.2]; p8=[2,1.4]; p9=[1....

c# - Allow different parameters in action delegate -

i trying declare action-delegate allows set functions different paremeter. here minimal example: have different void function this: private void function1(string parameter) { ... } private void function2(int parameter) { ... } i want pass these functions in same constructor. not possible in way. main { aclass = new aclass(function1); aclass b = new aclass(function2); } how need define action (object not working) - don't want overload consturcor! public class aclass { public aclass(action<???> function) { ... } } thank helping me! typically either this: public class aclass<t> { public aclass(action<t> function) { ... } } ...or overload constructor. if have else in mind need provide more code show want do.

Retrieving Facebook User Details with PHP SDK -

i have application uses scope=email, publish_actions, publish_stream authorizes user email, among other details. problem cannot retrieve in way, no matter code use... have been stuck on over 4 hours. php sdk 3.2.2 version , yet examples comes not work. have in mind apps made last year (april 2012) not work either. has changed in graph api use? this example.php not work either // user id $user = $facebook->getuser(); // may or may not have data based on whether user logged in. // // if have $user id here, means know user logged // facebook, don't know if access token valid. access // token invalid if user logged out of facebook. if ($user) { try { // proceed knowing have logged in user who's authenticated. $user_profile = $facebook->api('/me'); $user_profile['name'] , $user_profile['email'] not return anything...

c# - FileSystemWatcher IncludeSubdirectories not working on network share -

i'm attempting watch network share folders file added share indicate upload complete. wanted use filesystemwatcher monitor share , subdirectories trigger file, shown below. filesystemwatcher fsw = new filesystemwatcher(share, triggerfilepattern); fsw.includesubdirectories = true; fsw.created += new filesystemeventhandler(oncreated); fsw.renamed += new renamedeventhandler(onrenamed); fsw.error += new erroreventhandler(onerror); if file created @ root of share, event triggers. if file created within subdirectory of share, event not trigger, , don't error either. if create new filesystemwatcher subdirectory, receive event when file created there. but, similar top level filesystemwatcher, won't events files created in further subdirectories. if change network share local directory testing, work expected. any ideas? have set wonky network share setting blocks recursive filesystemwatcher checks? can work around this, nice not have complicate code. edit: saw didn...

java - Code just finishes without thoroughly processing -

this beginner error new java , programming in general. anyways, thought placement of system.exit(0) in code, when switched elsewhere there error i'm sure it's right. code ask first joptionpane.showinputdialog. when enter yes response, code finishes processing , nothing else. causing code end instead of processing dice event? import javax.swing.joptionpane; /** fishing class simulates game of fishing. */ public class fishing { public static void main(string[] args) { string input = joptionpane.showinputdialog("would play round " + "of fishing? enter yes or no?"); while (input == "yes") { int score = 0; // sets player's score 0 int points = 0; // holds player's points final int die_sides = 6; // # of sides die //create instance of die class die die = new die(die_sides); //roll die once ,...