Posts

Showing posts from 2014

c# - Selecting to View only certain rows in a DataGridView -

i have datagridview of set of data, , want choose 'see' rows on parameters form, shrinks list make choice easier.. i.e. combobox has 2 choices -> "aaa" , "bbb" ===== column1 | column 2 aaa | 123 aaa | 234 bbb | 345 bbb | 456 aaa | 567 bbb | 678 after choosing combobox "aaa", should results column1 | column 2 aaa | 123 aaa | 234 aaa | 567 this should allow me click row bring info row seperate form.. but original data has remain same.. don;t want change it, view differently.. if using linq datasource filter based on if combobox has selection. var result = in mydatacontext select i.col1, i.col2 if (! string.isnullorempty(cbcombobox1.text)) { result = in result i.col1 == cbcombobox1.text select i; } if not using linq datasource use linq apply filter databound datagridview using in indexchanged event. need write remove filter again when want show data. if (! string.i

Read integers from stdin and store in 2d array (C) -

i'm trying read text file containing integers via stdin , store values in 9x9 array (please note file must read via stdin , not arg) this have: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> int main() { int puzzle[9][9]; int i,j,count=0; char value[81]; for( = 0; < 9; i++ ) { for( j = 0; j < 9; j++ ) { scanf("%c", &value[count]); puzzle[i][j] = value[count] - '0'; count++; } } } but doesn't seem convert ascii characters scanf int, thought value[count] - '0' supposed do, end getting values this: -16-16-160-16-160-16-161 basically i'm trying whats described in thread, in c instead of c++: how convert 2d char array 2d int array? edit - the input file looks (contains both white space , new lines): 0 0 1 9 0 0 0 0 8 6 0 0 0 8 5 0 3 0 0 0 7 0 6 0 1

php - F3 return query result -

i try build rest interface using fat free framework. use following code query database: $product = new db\sql\mapper($this->db, 'product'); $product->load(array('id=?', $this->productid)); i can return instance title with echo json_encode($product->title); but how return whole row? following won't work echo json_encode($product); found it. had use echo json_encode($product->cast());

bash - script to compress user files via searching through folders for certain folder name -

i'm writing function 1 of programs need search through number of folders until find folder called "userfiles" tar folder giving filename of folder found in. below approach best way go? compress(){ name=$(cat $user_home/server.txt | sed -e "s/ //g") users=/var/www/home/user/area/*/*/*/ ids=${pwd##*/} # apache logs tar -zcvf logs-$name.tar.gz /var/log/apache2 # user logs in $users; if [ ! -d "userfiles" ]; tar -zcvf userfiles-$name-"$ids".tar.gz $users fi done; # linux logs tar -zcvf linux-logs-$name.tar.gz /var/log/auth.log* /var/log/syslog* /var/log/kern.log* /var/log/mail.log* } this code: for in $users; if [ ! -d "userfiles" ]; tar -zcvf userfiles-$name-"$ids".tar.gz $users fi done; won't described should do. instead, if folder userfiles not exist in current working direct

python - how to know if I'm decorating a method -

it seems mymethod not yet method when decorator called. import inspect class decorator(object): def __call__(self, call): if inspect.ismethod(call): #not working yet obj = "method" args = inspect.getargspec(call)[0][1:] elif inspect.isfunction(call): obj = "function" args = inspect.getargspec(call)[0] elif inspect.isclass(call): obj = "class" args = inspect.getargspec(call.__init__)[0][1:] args="(%s)" % repr(args)[1:-1].replace("'","") print "decorate %s %s%s" % (obj, call.__name__, args) return call @decorator() def myfunction (a,b): pass @decorator() class myclass(): def __init__(self, a, b): pass @decorator() def mymethod(self, a, b): pass if inspect.isfunction(myclass.mymethod): print "mymethod function" if inspect.ismethod(myclass.mymethod): pr

python - Interpolaton algorithm to correct a slight clock drift -

i have sampled (univariate) data - clock driving sampling process inaccurate - resulting in random slip of (less than) 1 sample every 30. more accurate clock @ approximately 1/30 of frequency provides reliable samples same data ... allowing me establish estimate of clock drift. i looking interpolate sampled data correct 'fit' high frequency data low-frequency. need 'real time' - no more latency of few low-frequency samples. i recognise there wide range of interpolation algorithms - and, among i've considered, spline based approach looks promising data. i'm working in python - , have found scipy.interpolate package - though see no obvious way use 'stretch' n samples correct small timing error. overlooking something? i interested in pointers either suitable published algorithm, or - ideally - python library function achieve sort of transform. supported scipy (or else)? update... i'm beginning realise what, @ first, seemed trivial pr

html - Javascript switch statement for menu drop list -

i'm working on doing switch statement menu drop list in javascript , have following code far (the script in head , rest in body, , map_img1, etc. url): <script> function selecttrafficcamera(inobj) { switch(inobj) { case "0": document.getelementbyid("trafficcams").innerhtml = "<p id="display2"><big><b>choose map</b></big></p>" break; case "1": document.getelementbyid("trafficcams").innerhtml = "<img src="map_img1"/>" break; case "2": document.getelementbyid("trafficcams").innerhtml = "<img src="map_img2"/>" break; case "3": document.getelementbyid("trafficcams").innerhtml = "<img src="map_img3"/>&

Roboto font for ios -

i feel of roboto(available android platform), , wish use app, i'm building. have 2 question 1). how roboto in ios? (seems, have no start with) 2). how set particular font default font entire app? get font here . add font app here . can't set font default entire app, appearance protocol you.

java - Not more than two colors of the same color -

i call method random colors 8 objects. if color same 3 objects in row, it's not valid. 1 or 2 colors besides each other of same color valid. thought code should work, still 3 objects in row of 8 sam color! have done wrong? perhaps done in better , simplier way? proposals welcome! part of loop 8 random numbers for (int j = 0; j < 8; j++) { // 8 objects in each column // call method random color int color = getrandomcolor(j); the method public int getrandomcolor(int j) { int color = randomnumber1.nextint(8); colors[j] = color; if(j>1 && colors[j-1] == color && colors[j-2] == color) { getrandomcolor(j); } return color; } try this: public int getrandomcolor(int j){ int color = randomnumber1.nextint(8); colors[j] = color; while(j>1 && colors[j-1] == color && colors[j-2] == color){ color = randomnumber1.nextint(8); colors[j] = color; } return color; }

intellij idea - Android Studio SDK issue -

i wanted try new android studio, when start error null java.lang.nullpointerexception @ com.android.ide.common.resources.resourceresolver.getstyle(resourceresolver.java:574) @ com.android.ide.common.resources.resourceresolver.computestyleinheritance(resourceresolver.java:503) @ com.android.ide.common.resources.resourceresolver.computestylemaps(resourceresolver.java:462) @ com.android.ide.common.resources.resourceresolver.create(resourceresolver.java:75) @ com.android.tools.idea.configurations.configuration.getresourceresolver(configuration.java:1059) @ org.jetbrains.android.androidcolorannotator.annotateresourcereference(androidcolorannotator.java:193) @ org.jetbrains.android.androidcolorannotator.annotate(androidcolorannotator.java:101) @ com.intellij.codeinsight.daemon.impl.defaulthighlightvisitor.runannotators(defaulthighlightvisitor.java:160) @ com.intellij.codeinsight.daemon.impl.defaulthighlightvisitor.visit(defaulthighlightvisitor.ja

qt - phantomjs compile with webGL -

i trying compile phantomjs add webgl. apparently possible because of: post on groups.google.com post on trac.webkit.org however, have no idea how this. have looked in configuration compiling , tried , found nothing. should compile qtwebkit separately necessary options , compile phantomjs webkit? btw i'm on mac osx lion i nice have bit of help. lot

c++ - File read and output bug -

i using bellow struct 'menu' store menu data; after able read file use loops load of menu data each menu. variable vector of char* used store options in each menu. used freetype library display menu options on menu buttons created using opengl. char n = 0, tempbuffer[32]; file * menu = fopen ("menudatum.txt","r"); fgets (tempbuffer , 32 , menu); menue[n].variable.push_back(tempbuffer);//"text here"); << fclose (menu); string literal commented '<<' work buffer outputs weird characters based on size of tempbuffer when used (as needed): if it's size 32 4c, or if it's 16 lk, etc; if output using cout displays in file properly... have neither problem input or output do? also, 'char* tempbuffer = "text here";' display '"text here"' library through struct;etc. string literal does. the text in file merely 'text here' here menu struct well; not pasting of code because ext

execute linux command and store the output in php array -

i making php website used monitor linux server, used linux commands memory usage (free) & (cat /proc/meminfo),for disk storage, network, users etc... can execute linux command php commands exec , shell_exec , back-tick, etc... how store output in php array ? , how move each element array string or int variable perform string or int functions on ? i try , // memort details array !!! $last_line = exec('cat /proc/meminfo', $retval); // return memory total echo $retval[1]; echo "<br> <br>"; // move memory total variable $memory_total=$retval[0]; echo "<br> <br> memory total variable $memory_total <br><br> "; implode($memory_total); //this give me memory total in kb echo substr($memory_total,9); echo "<br> <br>"; but want result in int variable , , if there better way that? your life easy regular expressions . <?php // why cat i

javascript - Does the Google Feed API support returning images from RSS feeds? -

i'm trying use google feed api return images rss feed available in xml. possible? if so, can provide example? i don't see discussed in respective dev documentation: https://developers.google.com/feed/v1/devguide the rss contain html links images unless images embed , nasty, need reference image display it.

python - Ipython tab completion - identifying methods vs properties -

when using interactive ipython tab completion, there way identify of returned values properties , methods ? i use os example below. don't see distinction of kind. know done dir wanted know if there way in ipython. seems time saver. os. display 203 possibilities? (y or n) os.ex_cantcreat os.confstr_names os.pardir os.ex_config os.ctermid os.path os.ex_dataerr os.curdir os.pathconf os.ex_ioerr os.defpath os.pathconf_names os.ex_nohost os.devnull os.pathsep ... i don't think possible current state of completion mechanism. have @ enhancement proposal completion machinery , suggest modifications if necessary.

php - RewriteEngine to hide extensions and GET -

how can rewrite url ? http://website.com/file.php?lang=en http://website.com/file/en file name , parameters can change, found lot of topics put did not found combination of both extensions , parameters update: work hide php extension how add parameters # turn mod_rewrite on rewriteengine on # hide .php extension # externally redirect /dir/file.php /dir/file rewritecond %{the_request} ^[a-z]{3,}\s([^.]+)\.php [nc] rewriterule ^ %1 [r=302,l] # internally forward /dir/file /dir/file.php rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ $1.php [l,qsa] from code , comment can 1 of answers :p in order new http://website.com/file.php?lang=en http://website.com/file/en in place have .htaccess this: options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{document_root}/$1.php -f rewriterule ^([^/]+)/([^/]+)/

javascript - angularjs: losing scope between 2 directives -

i'm pretty new angularjs , having scope-losing issue in project. simplified project minimum, in order focus on problem. i'm having "overlay" directive, appears html tag in code, render popup. inside overlay, i'd have list of various inputs, "inputs" array in model, should render textboxes, dropdowns, checkboxes, etc. according parameter named "type" in model. html simple this: <div ng-app="jsf"> <div ng-controller="myctrl"> <overlay inputs="inputs"> <div ng-repeat="input in inputs"> {{input.type}}: <userinput input="input"> </userinput> </div> </overlay> </div> </div> my directives following: .directive('overlay', function () { return { restrict: 'e', transclude: true,

sql - What data type is optimal for clustered index of a table published by using transactional replication? -

Image
we have application stores data in sql server database. (currently support sql server 2005 , higher). our db has more 400 tables. structure of database not ideal. biggest problem have lot of tables guids (newid()) primary clustered keys. when asked our main database architect “why?”, said: “it because of replication”. our db should support transactional replication. initially, primary keys int identity(1,1) clustered. later when came replication support, fields replaced uniqueidentifier default newid(). said “otherwise nightmare deal replication”. newsequentialid() not supported sql 7/2000 @ time. have tables following structure: create table table1( table1_pid uniqueidentifier default newid() not null, field1 varchar(50) null, fieldn varchar(50) null, constraint pk_table1 primary key clustered (table1_pid) ) go create table table2( table2_pid uniqueidentifier default newid() not null, table1_pid uniqueidentifier null, field1

How can I convert a short date to a long date in Javascript? -

i need convert 04/06/13 (for example) long date - tue jun 04 2013 00:00:00 gmt+0100 (bst) . how can using javascript? know how convert long date short date - not other way round. you try parsing functionality of date constructor , result can stringify : > new date("04/06/13").tostring() "sun apr 06 1913 00:00:00 gmt+0200" // or but parsing implementation-dependent, , there won't many engines interpret odd dd/mm/yy format correctly. if had used mm/dd/yyyy , recognized everywhere. instead, want ensure how parsed, have , feed single parts constructor: var parts = "04/06/13".split("/"), date = new date(+parts[2]+2000, parts[1]-1, +parts[0]); console.log(date.tostring()); // tue jun 04 2013 00:00:00 gmt+0200

c# - Datagridview and properties to Contained Objects -

i have bindinglist of objects. objects contain public properties displayed databindingview. unfortunately can't properties return field data of contained objects work. take instance contrived example below: public class chimpdiet { public string favoritefood; } public class chimpanzee { private chimpdiet diet; [displayname("chimp's favorite food")] public string favoritefood { { return diet.favoritefood; } } [displayname("chimp's nickname")] public string nickname { get; set; } public chimpanzee() { diet = new chimpdiet(); } } when set bindinglist of chimpanzees datasource of datagridview, property favoritefood causes errors pop up: the following exception occurred in datagridview: system.reflection.targetinvocationexception: property accessor.... threw following exception: 'object reference not set instance of object.'..... made sure instance created in constructor of container object, doesn't fix

c# - GetDrive Info into Combo Box but concatenate 2 display members -

i'm trying combo box not contains drive letter volume label. i'm able 1 or other changing displaymember. i understand need use .expression concatenate them before go combobox. i'm confused. should put getdrive table first , expression... load combobox? here's code have 1 display member: cmbdestdrive.datasource = driveinfo.getdrives() .where(d => d.drivetype == system.io.drivetype.removable).tolist(); cmbdestdrive.displaymember = "name"; this displays: f:\ i'd display f:\usb drive edit: removed useless line of code. you need select string want. var drives = driveinfo.getdrives() .where(d=>d.isready && d.drivetype == system.io.drivetype.removable) .select(d => d.name + " (" + d.volumelabel + ")" ) .tolist(); cmbdestdrive.datasource = drives; no need displayname

type conversion - Converting String to Date in java -

i programming in java , , little problem since yesterday in parsing date (converting string date) here exception : java.text.parseexception: unparseable date: "fri may 24 18:47:31 gmt+01:00 2013" string db= obj.getdebut(); // = "fri may 24 18:47:31 gmt+01:00 2013" string pattern2 = "eee mmm d hh:mm:ss zzzz yyyy"; date datedebutentree = new simpledateformat(pattern2).parse(db); thank help your application language appears french . if default locale likewise, throw parseexception when attempting parse english day , month fields. use locale.english instead: string pattern2 = "eee mmm d hh:mm:ss z yyyy"; date datedebutentree = new simpledateformat(pattern2, locale.english).parse(db);

visual studio 2010 - Building my project sets the database to read only? -

i have developed program in visual studio using vb connects .db database. when debug it, works fine database on computer not set read (i checked right clicking file , going properties). i use standard visual studio set project build , read property of database in set project set false. when build project , install on machine, database somehow gets set read , error "attempt write read-only database" does know how go solving this? thanks edit: hmm have checked , folder database , other program files gets added marked "read (only applies files in folder)". whilst database not marked read only, folder is. perhaps because in program files folder? the folders c:\program files or c:\program files (x86) protected operating system (vista , after) write operation security reasons. approved folder writing application wide data (settings or database file defined querying environment.specialfolder enum , retrieving value of commonapplicationdata the stan

PDF.js: how to save the HTML5 code? -

i use chrome pdf renderer based on pdf.js. pdf displayed, how save html5 code ? (sadly, tab's source display strange code not html5, html5 code ?)

C converting value char to string char -

how cast char=2 char="2" ? i need send via uart, when im trying send char 2 nothing, when send "2" 2 the point is, have int s=2; and need write char "2" not 2. tried few ways failure. when char = 2 message in terminal empty, when char signed "2" works fine. when tries convert int char , char signed 2, can't send int via uart becouse block sending function needs pointer. you can use itoa() convert integer char. http://www.jb.man.ac.uk/~slowe/cpp/itoa.html

c# - SqlDataSource Based Dropdown list -

i have created dropdown list fetched filtered data based on status. but inserted data may have entries not active @ moment. applied datasourceid dropdownlist <asp:dropdownlist id="ddl_country" runat="server" cssclass="roundddl" datasourceid="sds_country" datatextfield="descr" datavaluefield="code"> </asp:dropdownlist> now on click want change datasourceid per new sds_country_all ddl_country.datasourceid = "sds_country_all"; ddl_country.datavaluefield = "code"; ddl_country.datatextfield = "descr"; i have tried apply databound(); etc. it continuously giving me error. you're getting sql error. check select statement sds_country_all

class - C++ - Passing classes to other classes. How do i know when to use friend inheritance -

Image
i have game. game class. i have couple of lines in game dedicated showing debug information: rect rct; rct.left = 10; rct.right = 780; rct.top = 10; rct.bottom = screen.getwindowheight() - rct.top; std::string debugstringresult; std::stringstream debugstring; debugstring << "mouse x: " << mouse.getmousex() << ",\nmouse y: " << mouse.getmousey() << ",\nleft mouse down: " << mouse.leftmousedown() << ",\nright mouse down: " << mouse.rightmousedown() << ",\nscreen width: " << screen.getscreenwidth() << ",\nscreen height: " << screen.getscreenheight() << "\nsystem resolution: " << screen.getwindowwidth() << " x " << screen.getwindowheight(); debugstringresult = debugstring.str(); font.handle->drawtext( null, debugstringresult.c_str(), -1, &rct, 0, font.color ); this code in game drawing loop. lazy

android - How Log accelerometer Value -

what's best way log accelerometer values? i wrote program gets accelerometer , uses clock calculates velocity , acceleration of phone. possible store these values in .csv file every 0.1 < x <1 second. or there better options logging these numbers. how big file be? have considered kind of sql, , try consider how long data needs stored for, , data needs stored. example have private server setup data being sent it, , data older week old gets deleted.

jquery - why file json isn't read by the program? -

hi don't understand why if write in variable json right: var theui = { "nodes":{"progetto 1":{"color":"red", "shape":"dot", "alpha":1}, "demos":{"color":"#b2b19d", shape:"dot", "alpha":1}, "halfviz":{"color":"#a7af00", "alpha":0, "link":""}, "atlas":{"color":"#a7af00", "alpha":0, "link":""}, "echolalia":{"color":"#a7af00", "alpha":0, "link":""}, "docs":{"color":"#b2b19d", "shape":"dot", "alpha":1}, "reference":{"color":"#922e00", "alpha":0, "link":""}, "introduction":{"color":"#922e00", "alpha":0, "link":"&qu

javascript - prevent focus from leaving form fields -

in app, have login form this <div id="container"> <form name="login" id="login" method="post" action=""> <input name="email" type="text" class="label" id="email" placeholder="enter email..."> <input name="password" type="password" class="label" id="password" placeholder="enter password..."> <input type="submit" name="submit" id="submit" value="login"> <a href="register.html" class="sign">sign up</a> </form> </div> on touch devices, when tap screen, focus leaves form fields (input,button,links). happens on blackberry , android devices, haven't tried on iphone. how can prevent focus leaving form fields? i'm building app phonegap. i don't think can prevent user clicking/selecting

Checkbox input in python urllib -

how can check checkbox if html code looks like: <input type="checkbox" name="tos_understood" style="background:none; border:none" /> so, python code is: import urllib import urllib2 import cookielib authentication_url = 'http://test.com' # input parameters going send payload = { 'user': 'newuser', 'pass': '12345' 'tos_understood': ?????????? } # use urllib encode payload data = urllib.urlencode(payload) # build our request object req = urllib2.request(authentication_url, data) print req # make request , read response resp = urllib2.urlopen(req) contents = resp.read() print contents what should write in tos_understood section? there no way login without checked checkbox. this should work: payload = { 'user': 'newuser', 'pass': '12345', 'tos_understood': 'on', }

csrf - Site-wide form with Symfony2? -

i have simple form @ site pages: username, password, [sign in] i tried make with simple html, get the csrf token invalid. please try resubmit form idea make form in each action seems bad. practice of doing site-wide forms? you have way: first, guess have base template file layout.html.twig , other pages extend it. eg: // resources/views/layout.html.twig <doc ... bla blah> <title>my site</title> ...(js, css)... <body> <div id="top"> {% render url("site_wide_form") %} </div> {% block content %} {% endblock content %} </body> you need controller handle form: //controller/sitewidecontroller.php /** * @route("/some/url/here", name="site_wide_form") * @template("yourbudle:folder:site_wide_form.html.twig") */ public function someaction() { ..... code form, process submission etc ... return ["form"=>$form->createview()] ; } and tem

c++ - taglib : how to edit Album Artist? -

how modify "album artist" field of mp3 file library taglib ? there similar : f.tag()->setartist("blabla"); ? id3v2 doesn't support field called "album artist". itunes uses tpe2 frame, supposed be: tpe2 'band/orchestra/accompaniment' frame used additional information performers in recording. for complete list of frames see http://id3.org/id3v2.3.0#declared_id3v2_frames . to write taglib, trick: #include <mpegfile.h> #include <id3v2tag.h> #include <textidentificationframe.h> int main() { taglib::mpeg::file file("foo.mp3"); taglib::bytevector handle = "tpe2"; taglib::string value = "bar"; taglib::id3v2::tag *tag = file.id3v2tag(true); if(!tag->framelist(handle).isempty()) { tag->framelist(handle).front()->settext(value); } else { taglib::id3v2::textidentificationframe *frame = new taglib::id

javascript - setTimeout doesn't run synchronously -

i'm trying make function show messages after 2 seconds in 'for' function, seems isn't running in order @ all, if set 1 time higher, not wait until done , next task. how make settimeout wait finish before starting new one? time += 2000; (function(set, cname, time) { if (cname == "a" || cname == "b") { settimeout(function() { text.innerhtml = "somethibng <br />"+text.innerhtml; set.setattribute("class", "type"+cname ); }, time); } else { settimeout(function() { text.innerhtml = "something else <br />"+text.innerhtml; set.setattribute("class", "type"+cname ); }, time); settimeout(function() { text.innerhtml = "and text <br />"+text.innerhtml; }, time); } })(set, cname, time); it's async

errors on android, trying to link an activity to mapactivity and vice versa -

i got issue dont know how resolve it, can explain me how resolve ? think problem on linking activity mapactivity.. why ? because android application running before mapactivity , when try put more contents application, cannot run application , show me error on samsung galaxy s4 "unfortunately,lcidadao has stopped." 05-18 22:18:53.212: d/skia(23942): ---- fasset->read(2074) returned 0 05-18 22:18:53.252: w/resourcetype(23942): bad xml block: header size 18254 or total size 169478669 larger data size 6480 05-18 22:18:53.252: d/androidruntime(23942): shutting down vm 05-18 22:18:53.252: w/dalvikvm(23942): threadid=1: thread exiting uncaught exception (group=0x40fa1ac8) 05-18 22:18:53.252: e/androidruntime(23942): fatal exception: main 05-18 22:18:53.252: e/androidruntime(23942): java.lang.runtimeexception: unable start activity componentinfo{com.example.basicmaponline/com.example.basicmaponline.intro}: android.content.res.resources$notfoundexception: file res/drawable/in

jquery - Issues sending a form with ajax -

i'm having trouble self-submitting form call ajax code on document ready. want remain on index.php user clicks submit, code not seem live , takes me new_work.php instead. i've read don't need use preventdefault , stoppropagation ajaxform. var initajaxform = function() { ('#ajax_form').ajaxform({ success: function(data) { $('body').html(data); } }); } $(document).ready(function() { $('body').load("new_work.php", function() { initajaxform(); }); }); nothing important in html markup. empty skeleton form <form action="new_work.php" method="post" id="ajax_form"> i'm using ajaxform plugin because that's way know send files via ajax. if there's better solution, please let me know! thank you. edit: error is: uncaught typeerror: object #ajax_form has no method 'ajaxform' have loaded jquery form plugin ? aj

Working with video in actionscript -

i have small movie clips needs played, throughout game making. making them in aftereffets , exporting them flv files , embedding them timeline, making moviclip symbol play them. but disaster. way small movie clips don't garbage collect @ all. keeps getting stored in memory. if turn them swf, files become 10 times bigger, going high 24 mb 2.4 mb flv file. it's frustrating work way. can please suggest way work videos/clips in actionscript 3? don't need controls these movie clips, serve cut scenes. adobe introduced stagevideo , leveraging hardware acceleration high performance video playback. to mitigate performance impact of rendering video in video object, adobe has introduced stage video new way render video. approach takes full advantage of underlying video hardware. result lower load on cpu, translates higher frame rates on less powerful devices , less memory usage. example implementation thibault imbert : package { import flash.di

javascript - Loading map data from JSON using $.getJSON -

using gmap3 (a jquery plugin) display google maps interface. i'm trying load data json file reason it's not executing. map displays, addmarkers() function being called, if put console.log() anywhere inside function(data), doesn't display. i'm confused these anonymous functions , haven't worked asynchronous functions before. advice appreciated. javascript $(document).ready(function(){ displaymap(); addmarkers(); }); // create map options function displaymap(){ $('#map_canvas').gmap3({ map: { options: mapoptions } }); }; // load data , add markers each data point function addmarkers(){ $.getjson( dataurl, function(data) { $.each( data.markers, function(i, marker) { console.log( marker.lat + ':' + marker.lng + ':' + marker.data.category + ':' + marker.data.content ); }) }); }; json { markers: [ { lat:-30, lng:145, data: {title: "le resta

c# - windows forms power symbol -

using visual studio 2010, windows forms application. when creating click event button function parameters follows: (system::object^ sender, system::eventargs^ e) what meaning of power symbol? google isn't helping me search ignores special characters >< i know in c# exclusive or operator seems irrelevant here. that looks c++, not c#. did see in documentation? if so, switch documentation mode c# , things make lot more sense. if visual studio generating this, accidentally created c++ project.

Sharing PHP session from subdomain to TLD -

there session data being saved on sub.domain.com , i'd use data in domain.com . i confirmed both have same session save path (by echoing ini_get('session.save_path') in both) i've tried putting ini_set('session.cookie_domain', '.sub.domain'); on domain.com didn't work. (i have removed preceding . ). i tried adding session_set_cookie_params(0, '/', '.domain.com'); in front of each session_start() , didn't work either. i able use $_session data in domain.com set in sub.domain.com . what can work? thanks! update : figured out (at least 1 way) of how this, not sure why answer works. guess question be, why renaming session name solve this? using same session cookie domain (?) makes more sense me. seems setting domain creates new session $_session['domain'] (where 'domain' interchangeable in session_name('domain') function.) adding following each file fixed this: session_nam

c++ - Linked list to a file -

this question has answer here: c - serialization techniques 4 answers i have single linked list follows. /*nodetype definitions*/ #define int 1 #define float 2 #define double 3 typedef struct { int nodetype; void* node_data;//this field dynamically allocated node* next; }node; the data type of node changed according type of node ( nodetype ). how can store linked list in file. how can create structure new file type ? it depends on how want use data in file. in typical case, treat linked list sequence. when you're storing data in file, ignore links, , store sequence of data. when need read in, read in record, put in node, read record, put in next node, , on until reach end of file. the obvious alternative if want able treat data on disk linked list -- i.e., able insert records in middle of sequence minimum of modifications. in suc

c# - Why list show strange behaviour? -

work on vs2010 ef,c#. have 2 list(olistranitem,olisttaxitem) ,need copy 1 list properties values in list ,then need work on new list.problem after copy content element 1 list list type of changes impact on both list ,why happen ,i change on list changes occur in both list please check bellow syntax. list<transactionitem> olistranitem = new list<transactionitem>(); list<transactionitem> olisttaxitem = new list<transactionitem>(); olistranitem = _transactionitem; olisttaxitem = _transactionitemtax; transactionitem tmpitem = new transactionitem(); tmpitem = olistranitem.where(item => item.quotationdetailid == quotationdetailid && item.action != entity.actionmode.delete && item.isdeleted == false).firstordefault(); if (tmpitem.isnotnull()) { tmpitem.action = entity.actionmode.add; olisttaxitem.add(tmpitem);

php - How to pass parameters to event handlers in yii? -

i impressed flexibility of yii events. new yii , want know how pass parameters yii event handlers? //i have onlogin event defined in login model public function onlogin($event) { $this->raiseevent("onlogin", $event); } i have login handler defined in handler class. event handler method takes parameter: function loginhandler($param1) { ... } but here, confused how pass parameter login event handler: //i attach login handler this. $loginmodel->onlogin = array("handlers", "loginhandler"); $e = new cevent($this); $loginmodel->onlogin($e); am doing wrong? there approach this? now have answer own question. cevent class has public property called params can add additional data while passing event handler. //while creating new instance of event $params = array("name" => "my name"); $e = new cevent($this, $params); $loginmodel->onlogin($e); //adding second parameter allow me add data can accessed

java - Include A Properties File With A Jar File -

i've written small application. i've put database specific information in properties file. db.url=jdbc:mysql://localhost:3306/librarydb db.user=root db.passwd=pas$w0rd when build application executable jar file, properties file gets included inside. whole purpose of putting information in properties file allow user change making impossible. how can include properties file jar file not in it? kinda appsettings file in .net applications. i'm new java i'd appreciate if break down set of steps. thank you. edit : this how i'm getting values properties file in program. public class databasehandler { public static connection connecttodb() { connection con = null; properties props = new properties(); inputstream in = null; try { in = databasehandler.class.getresourceasstream("database.properties"); props.load(in); in.close(); string url = props.getproperty(&q

Connection to Oracle Database with Java -

i can't connect oracle database server . code : import java.util.*; import java.sql.*; import java.io.ioexception; public class knigi { public static void main(string[] args) { string baza_driver="oracle.jdbc.driver.oracledriver"; string baza_string="jdbc:oracle:thin:@localhost:1521:"; string baza_username="knigi"; string baza_password="knigi"; locale.setdefault(locale.english); // vazhno e bidejkji oracle treba da znae kakvi poraki da pojavuva try { driver driver = (driver)class.forname(baza_driver).newinstance(); connection conn = drivermanager.getconnection(baza_string,baza_username,baza_password); preparedstatement statement = conn.preparestatement("select * zhanrovi"); resultset zhanrovi = statement.executequery(); boolean isempty = !zhanrovi.next(); boolean hasdata = !isempty; while (hasdata) { system.out.println("zhanr: "+zhanrovi.getstring(&