Posts

Showing posts from March, 2013

c - redefinition; previous definition was 'typedef' error -

i got following error: error c2365: 'decimal' : redefinition; previous definition 'typedef' for following definition in header file: enum data_type {decimal, hexa, string}; i understood error occur duplicate definitions, there isn't known defintion that, , there aren't including files in header file. which other reasons can cause error? somewhere in included header files, or files include ad infinitum, there definition of decimal typedef. do not go looking it! well, if want aren't going able it. rename enum sensible dt_decimal. if want keep using decimal , avoid error there 2 strategies. 1 use namespaces, put names different namespace other pesky definition. the other (old school) way use masking macro definition.

c++ - Difference between Copy Constructor and Assigment Operator -

this question has answer here: what's difference between assignment operator , copy constructor? 8 answers i'm having little trouble copy constructor. i have class, contains 2 structures, , 2 pointers first structure ( let's i'm having linked list of first structure, , each contains linked list of second structure ). seem work fine. ... when make instance of class using copy constructor ( deep copy, every element copied, each instance has it's own linked lists ) using myclass a,b; // operations b ( ); it works ok. then... myclass a,b; // operations b = a; also seems work, destructor goes amok, , tries free element multiple times, sending this: * error in `./a.out': double free or corruption (!prev): 0x000000000258a540 * along ==backtrace== , ==memory map==, ending killing program sigabrt signal. so, when copy constructor work

r - Error in xy.coords(x, y, xlabel, ylabel, log) -

i getting error following execution : library(adegenet) library(ape) dat <- haplogen(seq.l=1e4, repro=function(){sample(1:4,1)}, gen.time=1, t.max=3) plot(dat, main="simulated data") #error in xy.coords(x, y, xlabel, ylabel, log) : # 'x' list, not have components 'x' , 'y' #calls: plot -> plot -> plot.default -> xy.coords same code works in rweb online !! i think problem package. tried updating package , following error. ** preparing package lazy loading error : object ‘renderprint’ not exported 'namespace:shiny' error: lazy loading failed package ‘adegenet’ * removing ‘~/r/x86_64-pc-linux-gnu-library/2.14/adegenet’ * restoring previous ‘~/r/x86_64-pc-linux-gnu-library/2.14/adegenet’ warning in install.packages : installation of package ‘adegenet’ had non-zero exit status also have similar problems other plots same packages loaded. code: dat <- haplogen(seq.l=1e4, repro=function(){sample(1:4,1)}, gen.time=1, t

javascript - How to assign speed parameter to callback functions -

i've been trying figure out how assign speed callback function, couldn't. in program. html: <button type="button" id="trigger">try</button> <div id="box"></div> <div id="bottom"></div> css: body { position: absolute; background-color: white; height: 1000%; } #box { position: absolute; height: 300px; width: 400px; top: 100px; left: 0px; margin: 0px; padding: 0px; border-color: black; background-color: black; opacity: 0; } #bottom { position: absolute; bottom: 0px; height: 100px; width: 100%; background-color: black; } js: $(document).ready(function () { $("#trigger").click(function () { var ele = document.getelementbyid('bottom'); var pos = ele.getboundingclientrect(); var x = pos.left; var y = pos.top; $("#box").animate({ left: "100px", opacity: "1" }, "slow&

php - Sef URL CSS Problems -

i try create search engine friendly urls this;: rewriterule ^m/([0-9]+)$ my.php?id=$1 however, gets page without css. if write this: rewriterule ^([0-9]+)$ my.php?id=$1 it gets page css without problem. how can solve it? when write css references this: <link rel="stylesheet" type="text/css" href="style.css"> it's relative url. on http://example.com/ , points http://example.com/style.css , on http://example.com/my/1 points http://example.com/my/style.css , doesn't exist. using absolute url fixes this: <link rel="stylesheet" type="text/css" href="/style.css">

c - How the expression evaluates? -

this question has answer here: evaluation of c expression 8 answers why isn't “k” incremented in statement “m = ++i && ++j || ++k” when “++i&&++j” evaluates true? [duplicate] 5 answers can 1 draw precedence tree expression , please explain side effects..values after expression evaluation in c. int i=-3, j=2, k=0, m; m= ++i || ++j&&++k; according me output should -2 3 1 1 gnu c compiler printing -2 2 0 1? want know how? because j won't evaluated due short circuit evaluation : m= ++i || ++j && ++k; ↑ at stage, m evaluated 1 regardless of right side of || . why? because 1 || anything 1.

vb.net - Entity Framework 6 Linq results for master-detail -

i'm trying create master-detail model using following tables: orders ordid date custid ======================================== 1 01.01.2014 1 2 02.02.2014 2 3 03.03.2014 2 4 01.01.2014 4 orderdetails id ordid prodid quantity ======================================== 1 1 1 2 2 1 2 1 3 2 3 3 4 2 4 5 now want have orders datagridview , orderdetails datagridview. orders dgv should this: orders ordid date customer status ============================================ 1 01.01.2014 custone 100% 2 02.02.2014 custtwo 62.5% and details dgv (filtered on selected order): orderdetails id prod quantity status ====================================== 1 prodone 2 100% 2 prodtwo 1 100% 3 prodthree 3 0% 4 prodfour 5 100% lets statu

Android AppWidget Vertical Swipe - How -

on android developers website, in section discussing appwidgets, there passage says available gestures appwidgets touch , vertical swipe ( link) : because widgets live on home screen, have co-exist navigation established there. limits gesture support available in widget compared full-screen app. while apps example may support view pager allows user navigate between screens laterally, gesture taken on home screen purpose of navigating between home panels. the gestures available widgets are: touch vertical swipe does mean possible listen vertical swipes on appwidget? i guess meant can scroll through listview or go through items of stackview (by doing vertical swipes). there no way how implement regular onscroll, nor ontouch listeners appwidget.

jquery - Open Toggle container on scroll -

i'm creating website university , toggle container open when scroll part. until can find solutions toggle container open on page load. this code <div class="toggle-wrap"> <span id="eindhoven" class="toggle-title"><a href="#">eindhoven</a></span> <div class="toggle_container">lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</div> <script> $(document).ready(function(){ $(".toggle_container").toggle(); }); </script> <div class="toggle-wrap"> <span id="eindhoven" class="toggle-title"><a href="#">eindhoven</a></span> <div class="toggle_container">lorem ipsum dolor sit amet, consectetuer adipiscing elit, ed diam nonummy nibh euismod tin

windows - Keep C++ Program to be always running -

i have c++ program written windows, uses sendinput() emulate keyboard keys. program works , sends space key, works fine in icy tower (game) , character keeps on jumping. when tried game counter strike didn't jump , when tried pressing alt+tab switch between program , game found game jump once , sendinput() makes it's way. guess when program in background doesn't send keys game, there way around this?

c# - How to set children Width for DockPanel to 100% inside ComboxItem? -

Image
<comboboxitem horizontalcontentalignment="stretch" width="auto"> <dockpanel background="red" horizontalalignment="stretch" lastchildfill="true" width="auto"> <label dockpanel.dock="left" name="lbname" ></label> <image dockpanel.dock="right" horizontalalignment="right" name="image" source="/test;component/images/cross.jpg" width="16" height="16" stretch="uniformtofill" /> <image dockpanel.dock="right" horizontalalignment="right" name="image2" source="/test;component/images/cross.jpg" width="16" height="16" stretch="uniformtofill" /> </dockpanel> </comboboxitem> like can see on image below dockpanel (marked red) doesn't take 100% width of comboboxitem . how stretch dockpanel size

php - phpUnit in netbeans -

i want have of pros help. well, i've been trying set phpunit in netbeans cannot run tests. whenever run tests error shows , cannot run tests indextest.php <?php class indextest extends phpunit_framework_testcase { // ... public function testcanbenegated() { // arrange $a = new index(1); // act $b = $a->negate(); // assert $this->assertequals(-1, $b->getamount()); } // ... } index.php <?php class index { private $amount; public function __construct($amount) { $this->amount = $amount; } public function getamount() { return $this->amount; } public function negate() { return new index(-1 * $this->amount); } // ... } for example, how test codes these?

mocking - Play Framework 2.2.2 - Java -Testing Controllers With Mock Objects -

is aware of examples of testing java based play framework controller setting mock objects? using spring in play project controller methods not static. testing tradional way, play shows controller having static methods , cant see way of how can inject mocks object result result = callaction( controllers.routes.ref.logincontroller.authenticate(), fakerequest().withformurlencodedbody(testutils.successful_login_map) ); i have number of services need called in logincontroller , set mocks any appreciated thanks damien i looking solution of same problem. far best result able achieve this: public class myobjectcontrollertest{ private final myobjectdao dao = mock(myobjectdao.class); private final myobjectcontroller controller = new myobjectcontroller(dao); public static fakeapplication fakeapplication; @beforeclass public static void startapp() { fakeapplication = helpers.fakeapplication(); helpers.start(fa

django-filer - upload button not working on Firefox but fine on Chrome and Opera -

i running django 1.6, django-storages , s3. of these seem working fine. when upload image goes s3 expected. trying use django-filer, can't upload images. when click upload, nothing happens @ in firefox, although in chrome , opera file upload dialog opens , able upload image. tried safe-mode well. here html , js button: <ul class="object-tools"> <li> <a id="id_upload_button" class="addlink" title="upload files" href="#">upload</a> </li> <script type="text/javascript"> //<![cdata[ $(function() { var uploader = new qq.fileuploaderbasic({ action: '/admin/filer/clipboard/operations/upload/', button: document.getelementbyid('id_upload_button'), onsubmit: function(id, filename) { $("#fileinputqueue .noitemsrow").hide(); $('#fileinputqueue').a

python - Make sentences with 1st|2nd|3rd|4th to XML according to a special specification -

i want make sentences xml i meet @ 1st. 5th... ok, 5th? today 2nd\n aug.3rd like this: <text valign="top" vposition="85.00"> meet @ 1<font script="super">st</font>. </text> <text valign="top" vposition="85.00"> 5<font script="super">th</font>... ok, 5<font script="super">th</font> </text> <text valign="top" vposition="85.00"> today 2<font script="super">nd</font>\n </text> <text valign="top" vposition="85.00"> aug.3<font script="super">rd</font>\n </text> i using minidom, after many posts , answers, don't mind rewrite code other parser. @ beginning, thought easy, replace st|nd|rd|th with <font script="super">st|nd|rd|th</font> , createtextnode() new string. however, sign <, > , &

scala - SBT unable to find sedis dependency -

i have play 2.2.2 app built scala 2.10.3. this build.scala file: import sbt._ import keys._ import play.project._ object applicationbuild extends build { val appname = "my-app" val appversion = "1.0-snapshot" val appdependencies = seq( "com.typesafe" %% "play-plugins-redis" % "2.2.0" ) val main = play.project(appname, appversion, appdependencies).settings( resolvers += resolver.url("sbt-plugin-releases", new url("http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/"))(resolver.ivystylepatterns), resolvers += resolver.url("typesafe repository", new url("http://repo.typesafe.com/typesafe/releases/"))(resolver.ivystylepatterns), resolvers += resolver.url("pk11 repo", new url("http://pk11-scratch.googlecode.com/svn/trunk")) ) } when run play idea attempts dependencies falls on when gets redis plugin, error: error] (*:upda

c++ - Trying to create UDP Server -

i'm trying create udp server ,though without client connecting it, recieves connection... (it writes in console - new connection lot, guess gets new connection suddenly...) #include <iostream> #include <string> #include <winsock2.h> #include <ws2tcpip.h> #include <windows.h> #pragma comment(lib, "ws2_32.lib") socket serveron() { socket listensocket; wsadata wsadata; int iresult = wsastartup(makeword(2, 2), &wsadata); if (iresult != no_error) { exit(0); } // create socket listening // incoming connection requests. listensocket = socket(af_inet, sock_dgram, ipproto_udp); if (listensocket == invalid_socket) { wsacleanup(); exit(1); } // sockaddr_in structure specifies address family, // ip address, , port socket being bound. sockaddr_in service; service.sin_family = af_inet; service.sin_addr.s_addr = inet_addr("0.0.0.0"); service.sin_port = htons(2583); if (bind(listensocket,(sockaddr *) & service, size

c# - How I send 2 integer arguments using a Timer.tick event handler -

i have constructor timer.tick event, public playme(int rows, int cols) { this.rows = rows; this.cols = cols; delay = new timer(); delay.enabled = false; delay.interval = 550; delay.tick += delay_tick; restart = new timer(); restart.enabled = false; restart.interval = 550; restart.tick += restart_tick(rows,cols); how fire both rows , cols arguments inside timer.tick method? void restart_tick(int rows, int cols) { restart.stop(); if (gameover && lbllose.visible) { clearboard(); createboard(rows,cols); } if (gameover && lblwin.visible) { (int = 0; < 5; i++) { clearboard(); rewrite: restart.tick += (object s, eventargs a) => restart_tick(s, a, rows, cols); and method: void restart_tick(object sender, eventargs e,int rows, int cols)

javascript - Google Maps Marker Not Appearing -

i trying center map @ calculated geographic center , add markers show original points, 1 center don't seem showing up. when submit data getdata.php shows blank screen. see problem javascript marker? great. thanks! did check value of location[i] ? if in default [latitude, longitude] , try: position: new google.maps.latlng(location[i]) edited try again: for(var = 0; i<(<?php echo json_encode($counter); ?>;); i++ ){ var marker = new google.maps.marker({ position: new google.maps.latlng(latitudesoflocation[i], longitudesoflocation[i]), map: map, title: ("point " + string.fromcharcode(94 + i)) });

php - Parse error: Unexpected T_STRING on line 7 -

i know these forums flooded dumb questions these has me stumped! ideas? define ("db_name”, ”downloa6”); // set database name parse error: syntax error, unexpected t_string on line 7 you using 2 different double quotes in code, 1 of php recognizes. define ("db_name”, ”downloa6”); // set database name ^ this quote correct character, others not , php interpreting them part of string rather end of string. use " instead. using ide syntax highlighting avoid problem in future.

java - Three exceptions for int -

i trying create code int supposed entered , have exceptions if int not between 9 , 99, exception if double entered instead of int , third exception if string entered. how do this? have below have far not sure how correct it. thanks public static void main(string[] args) { scanner input = new scanner(system.in); boolean correct = true; { try { system.out.println("enter integer between 9 , 99"); int number = input.nextint(); if (number >= 9 && number <= 99) { system.out.println("thank you, initialization completed"); correct = false; } else if (number < 9 || number > 99) { throw new exception("integer not within range"); } if (input.hasnextdouble()) { throw new exception("integer not entered"); } else { correct = false; }

cocos2d iphone - How to have a 3/4 full screen size ad in ios? -

Image
i able ad advertisment can make popup whenever desire not take entire screen, perfect example of desire visually below: i not looking exact code, more or less asking framework use. know iad not support type of advertisment, 1 will? before ad:                                                                             after ad: reposting comment answer: how creating own uialertview , display content want? think uialertview uses own window, mean add custom window on top of application window make modal , have delegate callback (or better... blocks!) dismiss custom window. approach edit: take @ how sam vermette did svprogresshud . should starting point.

javascript - Best design for user leaderboard scores in mongodb -

i'm having trouble design of database game, users of game have 3 score parameters weighted differently, scores results of specific actions (did p, or did q, or did l) within app. user this: { "_id": { "$oid" : "531f14324fe3ba6360335230" }, "p": 88, "q": 0, "l": 10, "totalscore":8.9 } where p, q, l different scores have different weights. i want query information based on weekly/monthly activity of user, means users got highest score in p, q, l scores top users of current week. i totally failing understand how make proper architecture both support date querying weeks/months , support weighted calculation of scores in efficient way assuming want make leaderboard surrounding users , have position of current user -----------------q--------p--------l------ 4. user121 25 5 0 5. currentuser 5 7 28 6. user77 3 2 43 ----- would appreciate lot.

iframe - Replace part of a url with jquery | Soundcloud player -

i want replace "visual=true" "visual=false" in each link starts " https://w.soundcloud.com/player/?url= ". possible? want force embedded soundcloud players in blog change style (example: http://jsfiddle.net/grey2/ ). <iframe width="100%" height="450" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3a//api.soundcloud.com/tracks/84808541&amp;auto_play=false&amp;hide_related=false&amp;visual=true"></iframe> is there way jquery? you can use txt.replace('search', 'replace') perform string replace , txt.indexof('search') find if string contains pattern search for. this code should work you: $("iframe").each(function() { var src = $(this).attr('src'); if(src.indexof('https://w.soundcloud.com/player/?url=') != -1 && src.indexof('visual=true') != -1) { $(t

php - Having trouble getting the last id in MySQL -

i'm trying last id added database using mysql_insert_id doesn't work. error is: mysql_insert_id() [function.mysql-insert-id]: can't connect local mysql server through socket '/var/tmp/mysql.sock' (2) in /proj/co639/assessment2/nicp3/public_html/book_create.php on line 46 warning: mysql_insert_id() [function.mysql-insert-id]: link server not established in /proj/co639/assessment2/nicp3/public_html/book_create.php on line 46 i've done connection this: $handle = new pdo( 'mysql:host=;dbname=', '', ''); what issue? you looking this: $handle->begintransaction(); // here execute query $handle->commit(); $id = $handle->lasinsertid(); your code won't work because mix 2 different classes. more information can found here: http://php.net/manual/en/pdo.lastinsertid.php

html - Contact form PHP shows blank -

i took standard form use included comments are. website don't need comments left email , url in it. when remove related comments in php file shows blank page, not error. here's code: <?php if(isset($_post['email'])) { // change 2 lines below $email_to = "email@email.com"; $email_subject = "new contact"; function died($error) { // error code can go here echo "we sorry, there error(s) found form submitted. "; echo "these errors appear below.<br /><br />"; echo $error."<br /><br />"; echo "please go , fix these errors.<br /><br />"; die(); } // validation expected data exists if(!isset($_post['email']) || !isset($_post['url'])) || { died('we sorry, there appears problem form submitted.'); } $email_from = $_post['email']; // r

why servlet hangs on auto refresh? -

i use response.setheader("refresh",10); ...to auto refresh servlet, after performing 9-8 refreshing next time page loading goes infinite stage i.e. loads continuously , nothing displayed. my guess problem seeing after refreshing 8-9 times has nothing refresh header. do same problem if manually refresh page 8-9 times using f5 key in browser? servlet code doing?

Apache rewrite issue with php parameters -

i access page in following format: mysite.com/parameter instead of mysite.com/index.php?param=parameter. played around httpd.conf file , best managed mysite.com/dir/parameter. my conf following: options indexes multiviews includes execcgi options followsymlinks allowoverride order allow,deny allow rewriteengine on rewriterule /(.*)$ index.php?hash=$1 [nc] how can rid of excessive directory? changing to: rewriteengine on rewriterule ^(.*) index.php?hash=$1 [nc] results in following error while trying open page forbidden you don't have permission access /Šw^Ƙi on server. if have configuration inside .htaccess style file, drop leading slash ( / ) , prevent rewriting of requests existing stuff: rewriteengine on rewritecond %{request_filename} !-f rewriterule ^(.*)$ index.php?hash=$1 [l,nc] you might want add addition qsa flag in case require additional parameters handed ov

node.js - How to do find() / where() in associated models -

i'm playing model associations in sails , i'm curious if it's possible make query base on associated field. example: user.js attributes:{ classes: { collection: 'class', via: 'students' } } class.js attributes: { type: ... students: { collection: 'user', via: 'classes'} } is there way retrieve specific classes of student base on type of class because right being returned when use .populate() . (maybe similar logic below) user .findone({name: 'studenta'}) .populate('classes') .where({'classes.type':['type1', 'type2']}) .then(....) thanks you can add where clause populate so: user .findone({name: 'studenta'}) .populate('classes', {where: {type: ['type1', 'type2']}}) .exec(...) in addition where , can use skip , limit , sort in second argument populate . keep in mind still (as of posting) in beta, if find issues seems not wor

javascript - POST array not receiving xhr data with JSON type -

i'm bit puzzled this. want hands via xhr, on client side, on contents of json file server , can't seem manage that. no jquery, plain xmlhttprequest. function getjson(user, value) { params = "user=" + user + "&value=" + value; request = new ajaxrequest(); //wrapper around xmlhttprequest request.open("post", "checksj.php", true); request.setrequestheader("content-type", "application/json"); request.setrequestheader("content-length", params.length); request.setrequestheader("connection", "close"); request.onload = function() { var status = request.status; if (this.readystate == 4) if (this.status == 200) if (this.responsetext != null) o('contents').innerhtml = this.responsetext; } request.send(params); } when print_r contents of $_post array empty array although when check out source in firebug parameters values b

mysql - Importing database to ms sql server -

i trying import database phpmyadmin sql server, getting error when trying execute sql code create it: msg 156, level 15, state 1, line 10 incorrect syntax near keyword 'if'. msg 102, level 15, state 1, line 10 incorrect syntax near 'nih_bw'. msg 911, level 16, state 1, line 11 database 'nih_bw' not exist. make sure name entered correctly. this database: set time_zone = "+00:00"; /*!40101 set @old_character_set_client=@@character_set_client */; /*!40101 set @old_character_set_results=@@character_set_results */; /*!40101 set @old_collation_connection=@@collation_connection */; /*!40101 set names utf8 */; -- -- database: "nih_bw" -- create database if not exists "nih_bw" default character set latin1 collate latin1_swedish_ci; use nih_bw; -- -------------------------------------------------------- -- -- table structure table "emps" -- create table "emps" ( "id" int not null, "user_n

python - Struggling with a series of variables -

to avoid tweets becoming caught in twitter spam filter have code goes tinyurl , creates new short url each time code run each of original urls. want each time 'u' printed, it's value should passed variable 'linkvar1', 'linkvar2', 'linkvar3' etc. passed tweet submission later in code: import simplejson import httplib2 import twitter import tinyurl print("python attempt submit tweets twitter...") try: api = twitter.api(consumer_key='', consumer_secret='', access_token_key='', access_token_secret='') u in tinyurl.create('http://audiotechracy.blogspot.co.uk/2014/03/reviewing-synapse-antidote-rack.html', 'http://audiotechracy.blogspot.co.uk/2014/03/free-guitar-patches-for-propellerhead.html', 'http://audiotechracy.blogspot.co.uk/2014/02/get-free-propellerhead-roc

javascript - Nav-bar not expanding after being collapsed? -

in simple expand/collapse navbar made, second navbar not re-expand once collapsed, though first 1 works fine. once collapse second section, stays collapsed , not expand, though first section continues work fine, expanding , collapsing thanks, appreciated. here code below: <script> var currentsec; var currentmenu; var currentlink; function change(sec, state) { currentsec = "sec-"+sec; currentmenu = "menu-"+sec; currentlink = "link-"+sec; if (state == 0) { document.getelementbyid(currentsec).src = "http://www.pirates-online-rewritten.com/images/collapsed.gif"; document.getelementbyid(currentmenu).style.display = "none"; document.getelementbyid(currentlink).href = "javascript:change("+sec+", 1)"; } else { document.getelementbyid(currentsec).src = "http://www.pirates-online-rewritten.com/imag

arraylist - java.util.ConcurrentModificationException Cant fix -

public game() { gamestate = overworld; objects = new arraylist<gameobject>(); remove = new arraylist<gameobject>(); battleobjects = new arraylist<gameobject>(); battleremove = new arraylist<gameobject>(); player = new player(display.getwidth() / 2 - player.size / 2, display.getheight() / 2 - player.size / 2); objects.add(player); objects.add(new circle(32, 32, player)); objects.add(new imp(300, 100, player)); } public void update() { if (gamestate == battle) { (gameobject : battleobjects) { if (!i.isremoved()) i.update(); else battleremove.add(i); } } else { (gameobject : objects) { if (!i.isremoved()) i.update(); else rem

Getting common value between two different string in Java -

i have 2 strings, , have same value between strings here how is: string temppath = "teb-mri-sud-krt-thb-du-psg-boi-rw"; string lewat = "dp-dpb-poc-ui-up-lna-tnt-psm-drn-cw-teb-mri-sud-krt-thb-du-kpb"; i want common value between 2 strings , make string variable this string passedpath = "teb-mri-sud-krt-thb-du-"; variable passedpath same value of 2 string, later used subtract temppath can new, unvisited path this temppath = temppath.replace(passedpath,""); // temppath valued "psg-boi-rw" so question is, how passedpath value 2 strings? i've tried searching case in stackoverflow directed string comparation questions. can me try achieve this? or direct me question same case mine? thank :) *ps: values in strings (teb,mri,sud etc) ordered is, there 1 occurence if there occurence of same substring in temppath , lewat seems need implement algorithm solving the "longest common substring" problem.

asp.net mvc - .Net MVC : unable to get ViewBag value in View -

as beginner doing simple example understand basic razor concepts , when set values using viewbag in controller class , try them in view not printed , neither shows insentience nor error , please hep me . doing mode class : product public class product { public int productid { get; set; } public string name { get; set; } public string description { get; set; } public decimal price { get; set; } public string catagoery { get; set; } } homecontroller (pasting specific method not working me ) public actionresult myproduct() { viewbag.productcount = 1; viewbag.productquality = "good"; return view(product); } productview @model razorapplication.models.product @{ viewbag.title = "demo"; layout = "~/views/_basiclayout.cshtml"; } <table> <tr> <td>name</td><td&

c# - EF5 Edmx / Code First vs EF6 Edmx / Code First -

i busy moving complex data model ef5 ef6 , in process noticed serious performance issues ef6 (v6.1.0). whether running complex data model or simple one, performance issues obvious. following test performed on simple data model containing 5 tables 5 columns each, queering single table containing 200 records. machine i7 3.4ghz 8gb ram, ssd. console application on .net 4.5. // first run var sw = system.diagnostics.stopwatch.startnew(); eftestcontext ctx = new eftestcontext(); var data = ctx.table1.tolist(); // table 200 records ctx.dispose(); // second run console.writeline(string.format("completed in {0}ms", sw.elapsedmilliseconds)); sw.restart(); ctx = new eftestcontext(); data = ctx.table1.tolist(); ctx.dispose(); console.writeline(string.format("completed in {0}ms", sw.elapsedmilliseconds)); results following: ef5 code first – 501ms / 2ms ef5 edmx – 226ms / 2ms ef6 code first – 1346ms / 3ms ef6 edmx – 1189ms / 3m generating views on ef6 improve pe

c# - Issues with Generics using Silverlight -

Image
i creating c# web application using silverlight 5 (vs 2010). i created console application works fine , adapting web app. even in web application working fine particularly set data type (say example int instead of <t> working fine) when use generic doesn't work. it compiles error free doesn't debug area set "toggle break point". gui this: but control passes error prone part, gui disappears and place kept break points replaced (see in left most) as result not able debug find problem . some explanation trying do: in given code below have binary file , stored inside "filecontents" of data type byte[] (i not disclosing method read file, can consider filecontents contains contents of binary file inside mainpage class). store symbols (of form 0 , 1 in binary file) , find frequency (by counting number of time repeats in file, has no problem not writing method it). processingvalue variable in code of generic type( <t> ) st

css - Fixed element below fixed element without JS -

is there way put fixed element below fixed element (which height not specified - determined size of text inside it) wihout using javascript? for example: <div id='1'></div> <div id='2'></div> #1 { position:fixed; width:100%; height:auto; } #2 { position:fixed; width:auto; height:auto; } so how put #2 below #1 without $('#2').css({'top':$('#1').outerheight()}); put 2 divs inside container div , set 1 fixed.

MySQL minimum CHAR storage for constant strings -

i have simple table has 2 values: id , type . longest string in type 11 characters ("directorate"). should using char(11) or char(12) in create command? mysql store 12 bytes char(11) 12th byte null character or not relevant storage? edit : joni pointed out, not use 11 or 12 bytes, uses 33 or 36 bytes because storing utf-8. however, question if should using 11 or 12 in char(x) the storage required char(m) m × w bytes, 0 <= m <= 255, w number of bytes required maximum-length character in character set. (source: https://dev.mysql.com/doc/refman/5.6/en/storage-requirements.html ) that is, if use ascii or other single byte encoding, char(m) stored in m bytes. if use utf8 stored in 3*m bytes.