Posts

Showing posts from April, 2015

jquery - Fancybox different appearance -

please @ link below , click on each item. http://seerman.ir/index.php?page=products&cat=tableau&sid=43 once clicking on new thumbnail, fancybox works until wants show picture. while appearing picture, wrapper box move bottom. when want see same item again after click on it, appears correctly. how can solve problem ? i advice fix things on site : 1). use single instance of jquery. loading version 1.8.0 , 1.7.0 2). have several duplicated ids when should unique within same page change links this <a id="example1" href=pages/details.php?cat=tableau&id=35&code=1123>... into this <a class="example1" href="pages/details.php?cat=tableau&id=35&code=1123">... notice added missing quotes href=" " 3). fancybox doesn't know opening images because format of link ( href ) calculates position of box initial content , renders image position change this j("a#example1").fancybox();

java - JPA creating a trimmed down entity version of an existing Entity -

i have angular client , rest backend through spring rest/mvc. database mysql , i'm using jpa hibernate orm. some of front end views require me de-normalize domain-data on java side. have typical user domain object id,fname,lname etc.. user object points 'user' table in database. nothing unusual. the problem have object "simplecost" has following structure public class simplecost { private long id; private long userid; private long cost; } a collection of above objects utilized frontend generate view this userid cost 1 5.5 2 7.5 3 10.00 but view supposed name cost john doe 5.5 jane doe 7.5 rusty shackleford 10.00 so instead of sending userid simplecost object, need send fname , lname. to solve problem tried (failing miserably) following approach. created new domain object called "userbare". trimmed down version of "user". mean "userbare" has fname ,

hadoop - Datatype mismatch causing comparison failure? Python UDF in Pig -

i'm having trouble python udf use in pig scripts. believe problem assumed input deltas in format it's not in, i'm not sure how fix (python n00b). note: on cloudera (cdh4.3) distro of hadoop v.2.0.0, pig v.0.11.0, python 2.4.3. import org.apache.pig.impl.logicallayer.schema.schemautil schemautil @outputschema("adj:float") def cumrelfreqadj(deltas): # create bins of increment 0.01 = [i*-0.01 in range(100)] = a[1:len(a)] b = [i*0.01 in range(101)] a.extend(b) a.sort() bins = # build cumulative relative frequency distribution cumfreq = [0]*200 delta in deltas: bin in range(len(bins)): if delta <= bins[bin]: cumfreq[bin] += 1 cumrelfreq = [float(cumfreq[i]) / max(cumfreq) in range(len(cumfreq))] crf = zip(bins, cumrelfreq) relfreq in crf[:]: if relfreq[1] > 0.11: # 10%ile adj = relfreq[0] + 0.05 break return adj do need

php - Define a constant, then retrieve it from a different scope -

if define constant in wordpress on file_1.php define( 'something', location ); how can use in file_2.php? if define again sends "constant defined" error. if don't define it, doesn't know is. if detects exists, there must way access it. there way can access file_2.php? something = specific url, , i'm trying use in file_2,php load script,, "wp_register_script('script', . '/filename.css')" if don't define again , try use in "wp_register_script" says "use of undefined constant - assumed 'something'" thanks you'd need place define() in file every script come across in wordpress (i.e. file that's included, wp-config.php site-wide definitions). if define constant in 1 file, doesn't mean other pages automatically knows exists, until it's ' included '. at top of functions.php make sure it's going use something , can see if exists first: if ( !de

c# - Drag and Drop with a custom User Control -

i have make program has 3 forms , each form contains 2 custom user controls. i have make user controls switch places (one another). i'm using drag & drop event, mousedown event catch first user control, though, don't know how catch second control, mouse being dropped on. basically, iv'e created (in class) temp variable custom eventargs (derives eventargs), custom eventargs class contains 2 variables (usercontrol1 , usercontrol2) , in mousedown event iv'e initialized usercontrol1 sender object. so basically, question is- how intiazlize usercontrol2 variable usercontrol mouse being dropped on. note: have 6 controls - 3 forms- it's dynamic!! means, may want exchange control's places between forms- have save 2 controls want exchange between!. thanks!

php - Auto Load content on scroll down using ajax -

i've built application [php] loads content text & images on scroll down automatically using ajax. code works fine on localhost , when put on server loads & page dows not load @ or loads content @ once. there alternative can overcome issue? here's code snippet loads content other page $(document).ready(function(){ var inc=5; $(window).scroll(function() { if ($('body').height()-190 <= ($(window).height() + $(window).scrolltop())) { inc=inc+3; var datastring = inc; $.ajax({ type: "post", url: "two.php", data: {'limit': datastring}, success: function(data) { $('#a').html(data); } }); } }); }); assume image size 100kb & app loads 4-5 images on every scroll. content comes mysql databse through php & "two.php" file contains data being fetched. limit variable used set limit mysql query, i.e. h

javascript - Put dynamic table on chained select box using jQuery -

i have form purchase requisition , created 3 chained select box (category, subcategory, product description) reference create chained select boxes website http://www.yourinspirationweb.com/en/how-to-create-chained-select-with-php-and-jquery/ problem want request many products question how? , want put of requested in database. somehow found codes used javascript working row first row only. when select eg. category: office supplies of subcategory select box(rows) affected. here code: <html> <head> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("select#type").attr("disabled","disabled"); $("select#category").change(function(){ $("select#type").attr("disabled","disabled"); $("select#type").html("&

c# - using the loop to reach out to pictureBoxes -

i have picturebox1, picturebox2, picturebox3, .... in c# ,is there way can change 1st picturebox background color loop,and wait, , change background of picturebox2? would this private void button1_click(object sender, eventargs e) { foreach (var pb in this.controls.oftype<picturebox>()) { pb.backcolor = color.red; thread.sleep(2000); } } but error error 1 non-invocable member 'system.windows.forms.control.controls' cannot used method. c:\users\test\desktop\windowsformsapplication1\form1.cs 22 37 windowsformsapplication1 try using threadpool (as have noted, may cause threading exceptions, though didn't test or you... depend call code believe): threadpool.queueuserworkitem(_ => { foreach (var pb in this.controls.oftype<picturebox>()) { pb.backcolor = color.red; thread.sleep(2000); } }); in repsonse jeff bridgman: i surprised didn

image - Weird "java.lang.OutOfMemoryError: Java heap space" -

today did simple java application, should load .png files memory (total space of these files ~7mb), makes weird error: (my tiny command: java -xmx1024m -jar dist/pngimageloader.jar) loaded image (0) images/image_01000111100000011000000110100000 loaded image (1) images/image_00000101010101101101000111111101 loaded image (2) images/image_01001110110011110011111001000000 loaded image (3) images/image_01001111000111010110101101001111 loaded image (4) images/image_00011100000011100011001011011100 loaded image (5) images/image_01010010001010001010110110110110 loaded image (6) images/image_01101100010001000001000110101111 loaded image (7) images/image_01010111011011101010101110100010 loaded image (8) images/image_01101101110100001011001011101100 loaded image (9) images/image_01100010111110011011100001000011 loaded image (10) images/image_00011111011000111101101111101111 loaded image (11) images/image_00000100111001010110101001110001 loaded image (12) images/

c# - Get all running applications programmatically -

i want know programmatically how many applications running in background in windows phone 8. there api or methods available ? thanks help. it's not possible know that. all applications in sandbox , can't access informations that

testing - Python benchmark tool like nosetests? -

what want i create set of benchmarks python project. see performance of these benchmarks change introduce new code. in same way test python, running utility command nosetests , getting nicely formatted readout. what nosetests the nosetests tool works searching through directory structure functions named test_foo.py , runs functions test_bar() contained within. runs of functions , prints out whether or not raised exception. i'd similar searched files bench_foo.py , ran contained functions bench_bar() , reported runtimes. questions does such tool exist? if not starting points? of nose source appropriate this? the wheezy documentation has example on how nose . important part if want have timings use options -q quiet run, -s not capturing output (so see output of report) , -m benchmark run 'timing' tests. i recommend using py.test testing over. run example wheezy that, change name of runtest method test_bench_run , run benchmar

python - Gevent link crawler -

here have written code using python , beautiful soup parse links on page repository of links. next, fetches contents of of url repository created, parses links new content repository , continues process links in repository until stopped or after given number of links fetched. but code slow. how can improve using asynchronous programming using gevents in python ? code class crawler(object): def __init__(self): self.soup = none # beautiful soup object self.current_page = "http://www.python.org/" # current page's address self.links = set() # queue every links fetched self.visited_links = set() self.counter = 0 # simple counter debug purpose def open(self): # open url print self.counter , ":", self.current_page res = urllib2.urlopen(self.current_page) html_code = res.read() self.visited_links.add(self.current_page)

c# - EF access navigation properties in model -

i have entity below public class role { [key, required, databasegenerated(databasegeneratedoption.identity)] public int id { get; set; } [required, stringlength(30)] public string name { get; set; } public virtual icollection<user> users { get; set; } public virtual icollection<rolepermission> permissions { get; set; } public bool haspermission(string code) { foreach (var p in this.permissions) { if (p.permission.code.equals(code)) return true; } return false; } } and in controller, code run fine: for (var p in db.user.where(u => u.userid == 1).first().role.permissions) { printtodebug(); } but: user ur = db.user.where(u => u.userid == 1).first(); ur.role.haspermission("some_code_were_defined"); then permissions list in haspermission has 0 length, why , how solve? this occurring because of entity framework lazy loading. in first stat

asp.net mvc 4 - Initializing referenced objects in entity framework unit of work -

i have class in entity framework 5 (using mvc 4): public class jobfunction { public int id { get; set; } public string jobfunctionname { get; set; } public int statusid { get; set; } public status jfstatus { get; set; } } in onmodelcreating method, establish fk relationship status table follows: modelbuilder.entity<jobfunction>().hasrequired(a => a.jfstatus). withmany().hasforeignkey(u => u.statusid).willcascadeondelete(false); in controller, list of jobfunction objects follows: list<jobfunction> jflist = uow.jobfunctionrepository.getall().tolist<catalog>(); where uow unit of work object, , jobfunctionrepository defined. when examine jobfunction object in jflist, see following in watch window: id: 1 jfstatus: null jobfunctionname: "manager" statusid: 2 note jfstatus null. question is: provisions make in code initialize jfstatus appropriate status object (based on value of statusid), during getall c

hadoop - What is the difference between partitioning and bucketing in hive? -

this question has answer here: what difference between partitioning , bucketing table in hive ? 6 answers i not clear difference between partitioning , bucketing in hive , appreciate if can provide details example. here nice difference between buckets , partitioning. basically both partitioning , bucketing slice data executing query more efficiently on non-sliced data. major difference number of slices keep on changing in case of partitioning data modified, bucketing number of slices fixed specified while creating table. bucketing happen using hash algorithm , modulo on number of buckets. so, row might inserted of bucket. bucketing can used sampling of data, joining 2 data sets more , more.

javascript - Stay on one page with different pages -

i don't know how call this, can see example on page: http://www.madeinebor.com/other/features.html what want if click got new page, menu stays on page , don't load again. how this? do little research on ajax , jquery. ajax allows refresh portions of page without reloading entire page server (asynchronous). jquery library great manipulating parts of page using ajax. this, put event handlers on navigation links , update main content area when links clicked. there lot of examples , documentation here: http://jquery.com

sed - grep Trim txt file by certain line number -

i have txt file containing, let's say, 1000 lines. trim obtaining file 100 lines, composed lines 0, 10, 20, 30, etc of original file. is possible grep or something? thanks it done awk/sed one-liner: awk awk '!(nr%10)' file sed sed -n '0~10p' file or sed '0~10!d` file see below example: (sed 1 liner give same output) print first 10 lines: kent$ seq 1000|awk '!(nr%10)'|head -10 10 20 30 40 50 60 70 80 90 100 total lines: kent$ seq 1000|awk '!(nr%10)'|wc -l 100

Python prevent copying object as reference -

is possible copy object in python without copying reference? for example, if define class class someclass: def __init__(self): self.value = 0 and create instance someobject = someclass() someobject.value = 12 and try copy instance: anotherobject = someobject and try modify property, anotherobject.value = 10 the original property gets modified: print someobject.value #prints 10 is there way prevent happening? clarify, want anotherobject.value contain 10 , want someobject.value still contain original 12 . possible in python? thanks in advance. the problem is, anotherobject = someobject you don't copy object, add reference it. copy object, try this: from copy import copy anotherobject = copy(someobject)

windows phone 7 - WindowsPhone | How get file from isolated storage to my machine -

i need video has been recorded app isolated storage. is possible? or should save recorded video 'shared' place? if want file of app have deployed on device (that not installed windows store), can use command line tool isetool installed windows phone sdk, or if want user interface can use isostorespy .

android - How To Stop FrameAnimation And launch a new Activity ??(Intent) -

public class mainpage extends activity { // declaring image view , animation drawable imageview view; imageview view1; animationdrawable frameanimation; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.mainpage); // typecasting image view view = (imageview) findviewbyid(r.id.imageanimation); // setting animation_list.xml background of image view view.setbackgroundresource(r.drawable.animation_list); // typecasting animation drawable frameanimation = (animationdrawable) view.getbackground(); } // called when activity becomes visible or invisible user @override public void onwindowfocuschanged(boolean hasfocus) { super.onwindowfocuschanged(hasfocus); if (hasfocus) { // starting animation when in focus frameanimation.start(); } else { // stoping ani

javascript - .innerHTML not working -

i have stupid problem. change content of table cell. code: var x = ajax('...'); alert(x); alert(document.getelementbyid(tdid).innerhtml); document.getelementbyid(tdid).innerhtml = x; "x" has right content => ajax working , second alert(...) gives right (actual) content. when write x in cell, nothing happens. no error, nothing... i checked similar problems here, without success. i have realy no idea, can test further understand problem. have idea? lot help! i've got solution!!! this stupid: changed content of td clicking on td... new content has button click again... now, firefox starts beginning on , shows "second" content again... thats hard! :-) however, realy thank very help! sorry wasting time! :(

visual c++ - Is /nodefaultlib:msvcr100 the proper approach to handling msvcr100.dll vs msvcr100d.dll defaultlib issue -

for cross-platform software project builds on linux , windows have distinct ways handle third-party libraries. on linux build , link against versions distributed centos/rhel distribution, means link against release builds, whereas on windows maintain our own third-party library "packages" , on windows build 2 versions of every library - release version links msvcr100 , msvcp100 , debug version links msvcr100d , msvcp100d. my question whether necessary build debug version of third-party dependencies on windows or can use /nodefaultlib:msvcr100 when building debug builds of our own software. a follow question: can learn practices in regard. i've read msdn pages msvc runtime, there little there in terms of recommendations. edit: let me rephrase question more concisely. vs2010, problem using /nodefaultlib:msvcr100 link executable build /mdd when linking libraries compiled /md. my motivation avoid have build both release , debug version of third party libraries u

c++ - Clang links to different locations when referring a templated static variable from multiple compilation units -

in attempt compile existing (gcc developed) code base clang, we're facing interesting problem. result clang-compiled executable creates multiple instances of singletons . not sure if our usage , understanding in accordance standard, or if gcc an/or clang or c++ standard library , toolchain on linux have problem. we're using factory create singleton instances the actual creation delegated policy template at places, we're using variation of singleton factory, actual type of singleton can configured @ definition site, without necessity reveal concrete type client accessing singleton. client knows interface type the problem shows when referring "same" static variable through inlined function used different compilation units the following excerpt, omitting locking, lifecycle issues, initialisation , clean-up file-1 : clang-static-init.hpp #include <iostream> using std::cout; namespace test { /* === layer-1: singleton factory based on templ

java - JavaFX - runLater Runnable not called -

i'm using javafx project. during startup have prompt asks data , network class establishes connection server these data. network class working asynchronously , response in callback. depending on response want open new window (stage) callback. executing mainstage.setscene() triggers exception expected - not called javafx application thread, have use platform.runlater(). but: platform.runlater(new runnable() { @override public void run() { system.out.println("run"); } }); never prints "run". why? accountdataprompt.login() function @ end of javafx start-function and, said, network connection runs asynchronously. prompt custom javafx dialog ( https://github.com/marcojakob/javafx-ui-sandbox ). thanks. after scenes completed, javafx application thread stopped. next platform.runlater() not work. platform.setimplicitexit( false ); use above code. solve issue.

internet explorer 8 - atmosphere long-polling doesn't reconnect after connection loss -

after server crash or intermittent network failure, atmosphere web socket client able reconnect server , receive messages. however, atmosphere long-polling client(ie8) fails reconnect. my app live event browser subscribes topic , displays application events. chrome , firefox working great, but, unfortunately, still need support ie8, therefore consistent behavior between websocket , long-polling crucial. missing here? atmosphere bug?? how reproduce download atmosphere-chat example v2.0.3 http://search.maven.org/#artifactdetails%7corg.atmosphere.samples%7catmosphere-chat%7c2.0.0%7cwar modify application.js use long-polling , reconnect forever 5 seconds interval. transport: 'long-polling' reconnect: true, maxreconnectonclose: number.max_value start tomcat server , start chat stop tomcat abruptly start tomcat open browser , send message. original browser wouldn't receive message. [long polling: not-working] onopen called {"url":"ht

c++ class variables and default construction -

class classb { int option; public: classb(void){} //without default constructor, example not compile. classb(int option) { this->option = option; } }; class classa { classb objb; //initialize objb using default constructor. when occur? public: classa(int option) { objb = classb(option); //initialize objb again using constructor. } }; int main(void) { classa obja (2); return 0; } i'm new c++ (coming c#), , i'm bit confused how class variables initialized. in above example, classa declares class object of type classb, stored value. in order this, classb must have default constructor, implies classa first creates classb using default constructor. classa never uses default objb because it's overwritten in classa's constructor. so question: objb initialized twice? if so, isn't unnecessary step? faster declare objb pointer? if not, why classb need have default constructor? the reason

QML C++ application crash outside Qt Creator -

i using qt 5.1.1 visual studio 2012 compiler. have quick 2 application c++ backend. when i'm running application in qt creator looks good. when i'm trying launch application outside qt creator crashes. i have qt*.dll 's in folder, have d3dcompiler_46.dll. i tried access filed in qml file c++ part, , see after crash in visual studio debugger crash null pointer exception. qobject *openbutton = instanceroot->findchild<qobject*>("openfilebutton"); openbutton->setproperty("enabled",qvariant(enabled)); i have resources declared in qrc file, , included in .pro file resources += res.qrc by this article menas, qml files should emdeded in exe files. think shouldn't. how can find , fix problem? upd: here main function: int main(int argc, char *argv[]) { qguiapplication a(argc, argv); q_init_resource(res); qquickview view; decrypter dec; view.rootcontext()->setcontextproperty("decrypter", &a

php - Assetic is generating multiple files with same content -

i have class uses assetic generate css files disk. i'll jump right code. in layout header, i'm doing this: $assetify = new assetify(); $assetify->setdebug(true); $assetify->setassetdirectory(base_dir . '/public/assets'); $assetify->setoutputdirectory(base_dir . '/public/assets/generated'); $assetify ->addstylesheet('/assets/css/bootstrap-2.3.2.css') ->addstylesheet('/assets/css/select2-3.4.3.css') ->addstylesheet('/assets/css/main.css'); echo $assetify->dump(); my "assetify" class runs through assetic. i'll paste hope relevant portions dump() function: // asset factory allows not have hard work ourselves. $factory = new assetfactory($this->assetdirectory, $this->debug); $factory->setdefaultoutput('/generated/*.css'); // filter manager allows organize filters asset handling. // other filters, see: https://github.com/kriswallsmith/assetic $fm = new filtermanage

php - joomla JViewHTML constructor and "Layout Path Not Found" -

please read last line of question. jviewhtml constructor contains following statement $this->paths = isset($paths) ? $paths : $this->loadpaths(); i setting default path of myview using $path variable , passing constructor. $paths = new splpriorityqueue; $paths->insert(jpath_component . '/views/' . $viewname . '/tmpl', 'normal'); in net beans debugger when execute following statement of constructor $this->paths not showing value of $paths variable. although data type of both splpriorityque $this->paths = isset($paths) ? $paths : $this->loadpaths(); first statement of render render() $path = $this->getpath($this->getlayout()); $path returend false value. my main page shows error "layout path not found". solutions problem update: last line paths splpriorityque $abc=$paths; $this->paths=clone $paths after these 2 statement $abc showing correct value $this->paths has missin

python - creating and executing a Javascript function with Selenium -

i trying create , execute javascript function selenium. doing this: js_func = """ function blah(a, b, c) { . . . }; """ self.selenium.execute_script(js_script) self.selenium.execute_script("blah", 1,2,3) i don't errors first 1 (creating function), second 1 gives me: webdriverexception: message: u'blah not defined' is i'm doing valid? how can tell if function created? how can see errors (assuming there errors)? it's how selenium executes javascript : the script fragment provided executed body of anonymous function. in effect, code is: (function() { function blah(a, b, c) { ... } })(); (function() { blah(1, 2, 3); }); and due javascript's scoping rules, blah doesn't exist outside of anonymous function. you'll have make global function: window.blah = function(a, b, c) { ... } or execute both scripts in same function call.

android - Do I need to use PreferenceActivity or database or another? -

someone know here, i'm newbie android development. i'm trying create simple fitness application. first thing app getting data user. example; weight, height, age etc. , program return can change data got user. wonder, how need storage data? need use preferenceactivity , database or another? also want ask, need use term of preference suffix layout elements when create layout use preferenceactivity ? how many users support in app on 1 device? if one, go shared preferences: it's easy use , store little data. if support multiple users, may start thinking sqlite database. also, think whether want expand app in future , maybe add fitness goals, track weight progress on time, etc. in case, may want use database easier expand. as second question, if use preferenceactivity , don't need layout @ all. define preferences in xml file. check link more info: http://developer.android.com/guide/topics/ui/settings.html

mysql - Complex SQL query suggestions please -

i have 3 tables schema below: table: apps | id (bigint) | userid (bigint)| start_time (datetime) | ------------------------------------------------------------- | 1 | 13 | 2013-05-03 04:42:55 | | 2 | 13 | 2013-05-12 06:22:45 | | 3 | 13 | 2013-06-12 08:44:24 | | 4 | 13 | 2013-06-24 04:20:56 | | 5 | 13 | 2013-06-26 08:20:26 | | 6 | 13 | 2013-09-12 05:48:27 | table: hosts | id (bigint) | appid (bigint)| device_id (bigint) | ------------------------------------------------------------- | 1 | 1 | 1 | | 2 | 2 | 1 | | 3 | 1 | 1 | | 4 | 3 | 3 | | 5 | 1 |

c# - Dynamically added CheckBoxes to a CheckBoxList not showing Text -

Image
following code adding checkboxes dynamically checkboxlist: foreach (wcore.categoryfields cat in global.getcategories()) { checkbox c = new checkbox(); c.text = cat.categoryid; c.tag = cat.categoryname; if (ints != null) { if (ints.contains(c.tag)) invoke(new action(()=>checkedlistbox1.items.add(c, true))); else invoke(new action(()=>checkedlistbox1.items.add(c, false))); } else invoke(new action(()=>checkedlistbox1.items.add(c, false))); } the problem whenever run code, checkboxes added not text. this: i tried debug , found checkbox instance 'c' getting text not showing it. see here: please tell me what's wrong going on in code? update please note can't use this: invoke(new action(()=>checkedlistbox1.controls.add(c))); because better use panel instead of checkboxlist then. want 2 values 1 shown text , other hidden va

html - Resize image smaller so it can fit in the spans with the words -

Image
im trying image , sentence generate in same row as seen above looks that. want image right next information image. wouldnt take space. @foreach (var m in model.matches) { <div class="row-fluid" style="border: 1px solid blue; padding: 10px"> <div class="span2" style="border: 1px solid red; padding: 10px"> <img src="@m.photo.photourl" class="img-responsive" @*style="max-height:175px;max-width:100px;"*@/> </div> <div class="span2" style="border: 1px solid black; padding: 10px"> <h5>@m.username</h5> <h5>@m.age year old @m.gender.whatgender | seeking</h5> <h5>@m.city, @m.state.name,@m.state.country.name</h5> </div> </div> <hr /> } the above code generating image information. im not sure include make have image small enough on left side , informaiton fit right

java - Parallel arrays: how to initialize the length of the arrays when the input file is unknown -

this first time posting on here , new java. have assignment due week , i'm having trouble getting started, though think know after start it. ok teacher wants use parallel arrays , write program create bar chart. if gives input file contains: 4 sidney washington london new york 4 8 10 3 it print out: sidney **** wasington ********* london ********** new york ***` so have started write program. don't know how initialize length of arrays. giving how many elements in first line of file (so using example above length 4), not know number is, have write program read number. have import java.util.*; public class barchart { public static void main(string args[]) { scanner scan = new scanner(system.in); file file = input; // read in input file int n=input.readint(); // create array hold datalabels, , hold datavalues. string[] datalabels = new string[n]; int[] datavalues= new int[n];` it int n part don't know how write in o

ruby - Two sign_in forms each on own url in rails devise -

its possible create 2 sign in views / 2 forms each on own urls in devise ? need 1 web administrator (back administration) , 1 users (application), 1 model (with roles) web administration / admin.domain.tld/login user application / app.domain.tld/login (after unsucessful sign in must stay on url admin on admin.domain.tld/login , , user on app.domain.tld/login) is possible ? how ? i have it controllers/admin/sessions_controller.rb class admin::sessionscontroller < devise::sessionscontroller end controllers/app/sessions_controller.rb class app::sessionscontroller < devise::sessionscontroller end views/admin/sessions/new.html.erb <%= simple_form_for(resource, :as => resource_name, url: admin_login_path) |f| %> <div class="form-inputs"> <%= f.input :email, :required => false, :autofocus => true %> <%= f.input :password, :required => false %> </div> <div class="form-a

python - Semantic Analysis For Simple Compile-To-C Language -

so i'm working on creating simple, compile-to-c language has syntax similar python. here sample source code: # comments start pound signs # integer declaration speed = 4 motor = 69.5 text = "hey + guys!" junk = 5 +4 # move function def move(): speed = speed + 1 print speed # main function (program entry) def main(): localvar = 43.2 move() if true: print localvar like python, language emphasizes readability indentation policies. has loose type declaration system. types determined context. object = 5 // creates integer object_two = "stuff" // creates string object_three = 5.23 // creates float the sample source code have above internally represented such: [ [ "global", [ "speed = 4", "motor = 69.5", "text = \"hey + guys!\"", "junk = 5 +4" ], [ "scope", [ "speed",

mysqldump - Can not import large SQL dump into MySQL 5.6 -

i dumped large database sql file contains large blob attachments table. when doing dump turned on hex-blobs, , i've done dump many times before without problems. the dump done using mysql 5.1 database. i have clean install of mysql 5.6 , can not import sql file. file 13gb , fails each time @ same line. mysql --user=root --password=xxxx --database=budgets_3 < budgets_3.sql warning: using password on command line interface can insecure. error 2006 (hy000) @ line 3251: mysql server has gone away mysql not restarting or crashing. i've @ sql file using text large files , can not see wrong. except insert statement large. have run import on cli , in mysql workbench both fail. i've set max_allowed_packet=128m still not work (should more enough). here paste of top part of sql file. -- mysql dump 10.13 distrib 5.1.72, win64 (unknown) -- -- host: localhost database: nosweatbudgets_3 -- ------------------------------------------------------ -- server version

How do I deploy my java application onto a website? -

i complied java programs, consists of 4 classes , everything's working fine. have gui, client, server, , action listeners , image in same folder. don't know how put local java application debugged , tested in jgrasp software onto webpage. looked around , read need make jar file , compress of them, don't know how that, neither creating applet. tried simple way of doing attempting convert .java file "smtpserver", class used run application, , convert jnlp file , brought java webstart application, unable run it. first time trying port webpage. how do this? this basic example hybrid . jar contains single class. jar can deployed either applet or application. can build jar containing compiled class files in jgrasp shown here . <resources> <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/> <jar href="yourapplication.jar"/> </resources>

.net - C++/CLI, DllExport and /clr:pure -

here simple native dll: native.h : #ifdef building_native_dll #define dllapi __declspec(dllexport) #else #define dllapi __declspec(dllimport) #endif class dllapi native { public: void f(); }; native.cpp : #include "native.h" void native::f() { } build: cl /dbuilding_native_dll /ld native.cpp ... creating library native.lib , object native.exp now i'd use c++/cli application: managed.cpp : #include "native.h" int main() { native* native = new native(); native->f(); } i can build in clr mode "ijw" : cl /clr managed.cpp native.lib ... /out:managed.exe managed.obj native.lib but not in clr mode "pure" : cl /clr:pure managed.cpp native.lib microsoft (r) c/c++ optimizing compiler version 16.00.40219.01 microsoft (r) .net framework version 4.00.30319.18047 copyright (c) microsoft corporation. rights reserved. managed.cpp c:\users\...\native.h(9) : warning c42 72: 'native::f' : marked __