Posts

Showing posts from March, 2015

javascript - Make Text visible on grey rows in a table? -

Image
we have html code radio buttons in table: <div class="graytitle">wie oft nutzen sie whatsapp?</div> <ul class="pageitem"> <li class="radiobutton"><span class="name">sehr oft</span> <input name="frage10" type="radio" value="sehr oft" /></li> <li class="radiobutton"><span class="name">mittelmäßig</span> <input name="frage10" type="radio" value="mittel" /></li> <li class="radiobutton"><span class="name">ehr selten</span> <input name="frage10" type="radio" value="ehr selten" /></li> </ul> we want grey out rows without making text invisible, have googled lot couldn't find solution. used: for (var = 0; < document.umfrageform.frage10.length; i++) { document.umfrageform.frag

cloudfoundry - Rails production mode 'end' error? -

i've been trying project on cloud foundry while now, , narrowed problem down project going production mode. of errors when switching development mode production mode, somehow managed 'unexpected end' error. culprit in controller, seen below: companiescontroller < applicationcontroller skip_before_filter :require_login end #def new there load of comments below section of code, nothing else. skip_before_filter refers before filter in application controller, looks this: class applicationcontroller < actioncontroller::base protect_from_forgery include sessionshelper before_filter :require_login def current_company company.find_by_subdomain! request.subdomain end helper_method :current_company def scope_current_company company.current_id = current_company.id yield ensure company.current_id = nil end def require_login if current_user == nil flash[:failure] = "you must log in access resource" redirect_

C# WPF Load images from the exe folder -

Image
i want move program pc problem images not loaded on other pc (source problem) . wondering if create folder exe placed , name resources , load every image there. image2.source = new bitmapimage(new uri(@"res\startoh.png")); you may add images resources visual studio project. packed assembly of executable , don't need copy them separately. create folder in project (let's called images ) , add images folder. make sure build action images set resource . now can create bitmapimage such resource appropriate pack uri : var uri = new uri("pack://application:,,,/images/someimage.png"); image.source = new bitmapimage(uri);

python - Can't get a function to work -

i try create function end game message counting down until ends, , having repeat block of code lot in text adventure game, decided make function of sake of neatness, , efficiency. cannot figure out how define , call such function. code trying execute: print "that\'s real shame..." time.sleep(1) print 'exiting program in 5 seconds:' time.sleep(1) print '5' time.sleep(1) print '4' time.sleep(1) print '3' time.sleep(1) print '2' time.sleep(1) print '1' time.sleep(1) sys.exit('exiting game...') break so defining function this: def exit(): print "that\'s real shame..." time.sleep(1) print 'exiting program in 5 seconds:' time.sleep(1) print '5' time.sleep(1) print '4' time.sleep(1) print '3' time.sleep(1) print '2' time.sleep(1) print '1' time.sleep(1) sys.exit('exiting game...') b

oop - Are abstract members possible in PHP? -

i'd develop abstract class extended fit custom requirements. of methods implemented in base class. however, rely heavily on values set in members, child class should define. reason i'm saying "abstract" class want force extenders of class define values members. possible? i know can define methods abstract , force extenders implement those. i'm not sure members. furthermore, design practice? example: abstract class foo_bar { // want child class define these private $member1 = 0; private $member2 = 0; private $member3 = 0; // child class , instances can access public function foo() { return 'foo'; } // child class must implement abstract function bar(); } in short: no. there's no such thing abstract properties in php. you may declare properties protected in abstract class child inherits them. if you'd declare them abstract , there's no guarantee child implements them with us

mysql - PHP fetch_array() on a non-object -

i have php code. if (isset($user)){ if (is_object($user)) { if (!$result_paycon = $mysqli->query("call check_convention(" . $user->id . "," . $row_convention["idconvention"] . ")")){ printf("database error"); exit; } if (!$result_block = $mysqli->query("select * view_roomblock idconvention = " . $row_convention["idconvention"])){ var_dump($result_block); printf("database error"); exit; } } } no matter it, var dump of $result block bool(false). , when need use fetch_array on it, tells me $result_block non-object. however, changing first query procedure call regular select seems fix issue, removing entirely code. i echoed sql query both calls, , both return if plug them sql directly. is there i

Javascript console says: Invalid left-side assignment? -

so, make secure login. run through chrome's javascript console , 'uncaught referenceerror: invalid left-hand side in assignment '?! please help! function login() { string.prototype.hashcode = function() { for(var ret = 0, = 0, len = this.length; < len; i++) { ret = (31 * ret + this.charcodeat(i)) << 0; } return ret; }; var user = document.getelementbyid("username"), pass = document.getelementbyid("password"); if ((user = "fedora") && (pass.hashcode() = -976887139)) { window.alert("captain fedora: superuser"); } } if ((user = "fedora") && (pass.hashcode() = -976887139)) should be if ((user == "fedora") && (pass.hashcode() == -976887139)) so comparison, , not assignment

html - Is there a painless way to make a "css sandbox"? -

by css sandbox mean section in layout have independent look. need because classes of mine need output "windows" of content in layout, don't want app's css mess them. they're debug related, printing var contents, benchmark graphs or displaying error/exception. until doing kind of local reset, gets annoying avoid collisions , fail if forget rules. ex: html body div.eh-box { margin: 0 !important; padding: 0 !important; border: 0 !important; font-size: 100% !important; vertical-align: baseline !important; background-color: #fff !important; font: 12px/12px 'helvetica neue', helvetica, arial, sans-serif !important; margin-bottom: 20px !important; } html body div.eh-box * { margin: 0 !important; padding: 0 !important; border: 0 !important; font-size: 100% !important; font: inherit !important; vertical-align: baseline !important; color: #333 !important; } html body div.eh-box .title { font-s

java - Local Applet Security Exception -

i'm trying run basic hello world java applet in browser, keep getting "application blocked security settings" following message: securityexception: security settings have blocked local application running i tried changing security settings through java control panel , there no slider, certificates. i same error when trying open .html file in other browsers. applet code: import javax.swing.*; import java.awt.*; public class helloworldapp extends japplet { public void init() { jlabel label = new jlabel("hello world"); add(label); } } html <!doctype html> <html> <head></head> <body> <applet code="helloworldapp.class" width="300" height="100"></applet> </body> </html> question : how can applet work? or rather, how can change security settings allow applet run locally, if issue , not else? okay, after del

Why does Ruby on Rails generate add a blank line to the end of a file? -

running rails generate controller foo home results in: class foocontroller < application controller def home end end (there's nothing on line in actual file, blank line) is there purpose blank line? it's common use newline indicate end of line, last line. many editors (like vi, use) add in newline silently. consensus text files (especially in unix world) should end in newline, , there have been problems historically if wasn't present. why should text files end newline? the tool used count lines in file "wc" counts newlines in file, without trailing newline show 3 instead of 4. it improves readability of templates used in generator. consider: https://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/controller/templates/controller.rb to remove trailing newline, template have last line of: end<% end -%> instead of: end <% end -%> that seems less readable me. the discussion below refers

core data - iOS UICollectionView and CoreData -

i'm new ios , still trying wrap head around basics (my newbie disclaimer). i'm starting play persistent data , presenting data uicollectionview. i can create cells , right number arrays, i'm having issues right number of cells interacting core data. i'll try example clarify: have entity person attributes first name , last name. have 1 person saved. when number of objects in section, 1 object 1 person. number used create # of cells 1 1 person. i'd create 2 cells (one first name , 1 last name) each person, can't figure out. tried putting each entity own section , using arithmetic return 2 * #of entities in section, hat crashes. this seems rather simple can't figure out? in numberofsectionsincollectionview:: return 1; in collectionview:numberofitemsinsection:: return fetcheddata.count*2; in collectionview:cellforitematindexpath:: person *p = fetcheddata[indexpath.row/2]; // integer division ... cell.textlabel = indexpath.row % 2 ?

c# - Can LINQ be used to pull keywords out of a string? -

if have long-ish string of text , wanted pull out words greater 4 characters in length , found more 4 times in string, can linq that? you may able tighten up, believe effect of var results = inputstring.split() .where(word => word.length > 4) .groupby(word => word) .where(grp => grp.count() > 4) .select(grp => grp.key); you will, of course, need decide how wish deal punctuation might present. so given input var inputstring = @"the quick brown fox jumped on lazy dog quick brown fox jumped on lazy dog quick fox jumped on lazy dog quick fox jumped on lazy dog quick brown fox jumped on lazy dog"; the results contain "quick" , "jumped" because other word greater 4 characters ("brown") appeared 3 times.

perl - How to fix error to add prefix and suffix to certain set of numbers from a text file -

how add prefix , suffix set of numbers obtained text file. have written coding it's showing bugs. my text file contain numbers like 1 2 3 4 5 6 and output should come 3r_1.pdb 3r_2.pdb . . 3r_6.pdb the program:- open(file,"text.txt"); open(out,">output.txt"); while($file=<file>) { $f= "3r_"; $e= ".pdb"; chomp($file); print out "$f$file$e\n"; } i unable understand bug actually. since pattern same here how it: use strict; use warnings; open(my $in, "<", "text.txt") or die $!; open(my $out, ">", "output.txt") or die $!; while (my $line = <$in>) { chomp ($line); print $out "3r_" . $line . ".pdb\n"; } close ($in); close ($out); you should use strict; use warnings

wordpress - Apache multiple virtual hosts user permissions -

i have webmin installed create new virtual hosts , new users manage sites. my process is: create new user. (/home/nameofuser/) ssh in new user, , create webroot folder (/home/nameofuser/www/) create virtual host pointed webroot (home/nameofuser/www/) the problem apache www-data user not owner of files. however, if let webmin create webroot me, user/group becomes www-data:www-data new user unable create files/folders. an example of why issue when try install wordpress, unable install plugins or create files such log files. how should set permissions on and/or within webroot folder in above scenario easiest add users need access folders/files webmin created www-data group, may have give user directories 664. should solve access issues, if list of users grows access webroot. true solution vhosts , multiple users apache2-mpm-itk better solution requires little reading.

c++ - How to get executables using premake? -

sorry if question naive i'm new using build tools used visual studio's default build tool( right click , select build ). now working linux, , want develop cross platform application.i'm using premake i've heard "insanely" cross platform compatible. made premake.lua unable find should appropriate name toolset parameter if want compile using g++( believe stands compiler ) in command: premake --target toolset i checked link: http://premake.sourceforge.net/what_is_premake , many others give toolset name gcc, code::blocks etc not g++.secondly if give toolset name cb-ow, cde::blocks. don't executables, .cbw files you don't need specify toolset @ all. do: premake4 gmake it use default toolset (which gcc on linux). oh, should mention using premake 3, way out of date @ point. check out 4.x stuff here: http://industriousone.com/premake .

unix - Read a sequence in reverse -

i have problem here: if have chain sequence below, how read strand in reverse (unix)? input : cctttatctttatctag desired output : gatctatttctatttcc thanks help. =) echo "cctttatctttatctag" | rev gatctatttctatttcc rev want. a related command tac reverses line order of file.

httpwebrequest - Synchronous Call in Windows Phone 7 -

i know cannot make true synchronous call in windows phone 7. however, i'm trying @ least block threads processing until async call made or there timeout. i've tried following, seems app ignores it, abandons call, , doesn't return back. ideas why? i'm trying update value using value converter during binding. public manualresetevent _event; public void getsync() { _event = new manualresetevent(false); var wc = new webclient(); wc.openreadcompleted += new openreadcompletedeventhandler(readcompleted); wc.openreadasync(new uri("my url")); // block until async call complete _event.waitone(5000); } private void readcompleted(object sender, openreadcompletedeventargs e) { var serializer = new xmlserializer(typeof(myformatter)); // property below accessed in value converter binding stronglytypedobject = (stobject)serializer.deserialize(e.result); _event.set(); }

sql - How to retrieve records based on two equals condition for the same column? -

i have table columns id(primary key,number), name(varchar), value(number) , key(number).i want retrieve records have key=1 , key=2. can write query using not equals condition(!=) makes query long.this tried select * user_details name='sam' , key != 3 , key != 4 , key != 5 , key != 6 , key != 7 , key != 8 , so on.could suggest me oracle query can retrieve records have key=1 , key=2 rather checking not equals condition. update: suggested in answer want know if in supported in hibernate select * user_details key=1 or key=2 or select * user_details key in (1,2)

javascript - Having issue passing a localStorage value to an input field -

okay guys, i'm having issue trying pass value stored in local storage on input field. found other thread, ( pass javascript variable value input type hidden value ) showed how it, it's still not working me , have no idea i'm doing wrong. entire code down below, have separated out make easier parts matter. <html> <head> <title>location details</title> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <script type="text/javascript"> this i'm trying pass stored values fields have not luck. document.getelementbyid("plat").value = localstorage.latitude; document.getelementbyid("plon").value = localstorage.longitude; function fileselected() { var file = document.getelementbyid("fileupload").files[0]; if (file) { var filesize = 0; if (file.size > 1024 * 1024) {

opencv - How to get image uchar array's actual length opencv2 -

i trying use blur image gpu. shall write own gpu routine. using opencv2 library image reading. i want access image array (uchar *), figured out; can following cv::mat im = imread( 'lena.jpg'); i figure out can access uchar* array -- uchar * data = im.data; now problem that, there padded bytes put efficiency purpose. means size of array more (or equal to) width*height*channels. how a) actual size of array b) variable widthstep or incrementing row-wise?? you need called stride or step-width . can access im.step , in: cv::mat im = imread( 'lena.jpg'); uchar * data = im.data; int stepwidth = im.step;

How to get the current location,mouse position and current url using javascript browser detect -

i'm creating tool monitor website. for need current location, mouse position, , current url using javascript browser detection how can this? i know code below correct getting current position. var loc = navigator.geolocation.getcurrentposition; console.log(loc); to access property of object use . (period) not , (comma) getcurrentposition function , need call (with () ) getcurrentposition may have make network requests in order figure out result, asynchronous. have pass callback function first argument. such: function showpositiondata(result) { console.log(result); } navigator.geolocation.getcurrentposition(showpositiondata);

Method gets call on onBackPress in android -

i working on base adapter in android , want know overriden method gets call in baseadapter class if press onbackpress in activity. please me, have searched , didnt find solution. you have listview , have custom adapter set listview. listview in activity. class myactivity extends activity { @override public void oncreate(bundle savedinstancestate) { setcontentview(r.layout.main); listview lv= (listview) findviewbyid(r.id.listview); customadapter cus= new customadapter(myactivity.this); lv.setadapter(cus); } } class customadapter extends baseadapter { .................... } so when press button current activity popped form stack, destroyed , previous activity in stack takes focus.this default behaviour. http://developer.android.com/guide/components/tasks-and-back-stack.html you can override onkeydown(params) in activity @override public boolean onkeydown(int keycode, keyevent event) { if (keycode == key

social networking - Twitter authentication credentials -

i new social network analysis , twitter api.i wanted collect tweets on topic .so have written following code package com; import java.io.bufferedwriter; import java.io.file; import java.io.filewriter; import java.io.ioexception; import java.util.list; import twitter4j.query; import twitter4j.queryresult; import twitter4j.status; import twitter4j.tweet; import twitter4j.twitter; import twitter4j.twitterexception; import twitter4j.twitterfactory; public class twittersearchadvance { public static void main(string[] vishal) throws twitterexception, ioexception { // list<tweet> data = new arraylist<tweet>(); stringbuffer stringbuffer = new stringbuffer(); twitter twitter = new twitterfactory().getinstance(); (int page = 0; page <= 4; page++) { query query = new query("airtel"); // query.setrpp(100); // 100 results per page queryresult qr = twitter.search(query);

javascript - express, mongoose passing param from 1 app.get to another -

my problem cannot quite figure out how "name" parameter before run second app.get.. first (app.get /) lets me choose between collections, , pass "name" param second app can req.params.name within second app.get... problem need param before second app.get cuz need define schema , "compile" model, can done once. works when click once, "cannot owerwrite model, compiled" error when again. bypassed problem opening new connection everytime load second app.get (not know). so if knows how "name" param (the thing im passing req.param second app.get, before actual second app.get fires up, thankful) my code: (started learning node 2 days ago, alongside express , mongoose, not mention javascript sp go easy on me :p) var express = require('express') ,routes = require('./routes') ,user = require('./routes/user') ,http = require('http') ,path = require('path') ,mongoose = require("mongoose"

PHP Jquery onchange event -

i have selectbox filter featured in form, how use jquery replace onchange event avoid whole page refresh? want div block able reload callback data when option selected. <form name="form_filter" action="<?php echo $_server['php_self'].'?'.$_server['query_string'].'#network-programs' ?>" method="post" enctype="multipart/form-data"> genre: <select name="filtergenre" id="filtergenre" onchange="this.form.submit()" > <option value="all" selected="selected">all</option> <?php $query1 = "select * video vcat_id in(select category_id categories video_id in(select vid `video` vuser_id='8') , main_cat=1)"; $result = mysql_query($query1); while($row = mysql_fetch_assoc($result)) { $vcat_id = stripslashes($row['vcat_id']); $vcat_name = stripslashes($row['vcat_name']); echo "<option va

Android AVD Manager change density -

Image
i've installed new android sdk, question how change density (for example 265)? in density menu there isn't custom value.

Default value of $#ArrayName when there is no element (Perl) -

the code below display number of arguments entered in command line. #!/usr/bin/perl –w $myvar = $#argv + 1; print "hi " , $argv[0] , "\n"; print "you have $myvar arguments\n"; from perlintro, $#argv special variable tells index of last element of array. if case, when don't enter value in command line, how $myvar value end 0 ? is because when there no element in array, index of "no element" -1 ? -1 + 1 = 0. $#argv means "the index of last element of argv" - not array perlintro sentence seems imply. for array, if it's empty, $#array -1 , scalar @array 0. caveat: if has modified $[ ("index of first element"), that'll change $# well. should probably use scalar @array if you're after length, , $array[-1] last element. > cat demo.pl @array = (); print "size=", scalar @array, " items, last=", $#array, "\n"; $[ = 2; print "size=", scalar @

xml - How to redirect system out print to FileAppendar in apache log4j -

i have implemented log4j application, logs written in file.now, have system out have wanted printed in same log file.here have till now <!doctype log4j:configuration system "log4vj.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <!-- general application log --> <appender name="console" class="org.apache.log4j.consoleappender"> <param name="target" value="system.out"/> <layout class="org.apache.log4j.patternlayout"> <param name="conversionpattern" value="%d %-5p %30.30c - %m%n"/> </layout> </appender> <appender name="default" class="org.apache.log4j.rollingfileappender"> <param name="file" value="${log.dir}/logs/debug.txt" /> <param name =

java - How to crate BufferedImage from bitmap data -

after going through many similar looking questions had no way put own question here. i need display image on swing application. source of image bitmap data retrieved ms sql server. have tried following ways try 1 - have tried creating imageicon bytes retrieved. no results. try 2 - saved bytes in .png file , tried loading using imageio . works fine on local machine fails on test server. both windows machines. try3 - on step 2 tried saving in different formats .png. not work @ all. please let me know missing? note : have tried including jai jars referenced libraries also. you should have stored hint format data has in database. if not, can hope imageio can handle it. there no need write data files (which pitfall in itself, where write them? think of restricted process privileges , disk quotas). create inputstream accesses data directly (e.g. java.io.bytearrayinputstream), way can have imageio load directly using stream based methods.

How to translate Event-Condition-Action rules to Alloy -

how can translate event-condition-action rules alloy ( http://alloy.mit.edu/alloy/ ) you can @ following slides learn more event idiom in alloy http://people.csail.mit.edu/dnj/talks/lipari05/lectures/lipari-lecture4.pdf

c# - How to run SQL File having large number of lines? -

i having sql file(filenamescript) having more 10k lines of code. each block of sql starts go , ends go. while executing file c#, getting exception near go statements. when running same file in sql server working fine. con.connectionstring = sqlconn; fileinfo file = new fileinfo(filenamescript); string script = file.opentext().readtoend(); sqlcommand command = new sqlcommand(script, con); con.open(); command.executenonquery(); close(); i think executenonquerry not able handle many \n , \r ,and \t file read stored in single line many \n , \r . there other method same? in advance. no, issue not length of file, nor existence of \r and/or \n characters. because executing sql using method can run single batch, , script having go statements causes multiple batches. one possibility split text on keyword go , execute each individual part: con.connectionstring = sqlconn; var commands = file.readalltext(filenamescript).split(new []{"go"},stringsplitoption.rem

Liferay Exception Data while persistance update -

i'm using liferay servicebuilder trying read code file string , saving db, using update method, error: return irrulepersistence.update(rule, false); error: data exception error truncated left. i created column service.xml file: <column name="rulefile" type="string" /> is there other type required saving long strings? can save .drl file db? if yes, can do? there guide explaining that? thank much, oriol for storing long string , can have entry in portlet-model-hints.xml as <field name="description" type="string"> <hint-collection name="clob" /> <column name="file" type="blob" /> you can use type blob store file db. can refer dbstore.java -->updatefile detail

android - Layout: background picture streched -

i have difficulties layout. as first dev project, i'm trying make simple chronometer. want have picture of chronometer in background , start , stop button @ bottom of application, side side , filling width of screen. here best shot, i'm not satisfied. all widgets placed ... background streched , buttons seem vertically compressed, text @ bottom bit cropped. i found if change these lines android:layout_width="fill_parent" android:layout_height="fill_parent" by android:layout_width="wrap_content" android:layout_height="wrap_content" the background ok, buttons .. widgets placed in center of activity. how can fix ? by way if want have buttons side side, did choose better solution ? thanks ! charles. ... , xml .... <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout

java - Reference a jar within a jar -

i have jar file references 6 other jars through manifest file. i now, however, want try , compile jars 1 jar file, reasons being: want them cached applet not have long loading time 1 of jars required, rather 1 big waiting time download required files , store in cache. i have tried including referenced jar files in build, unfortunately, cause java.lang.noclassdeffounderror error, had add manifest file. what best/easiest way achieve this? using eclipse, , not building ant. using eclipse while exporting can create option of package required libraries generate jar by doing eclipse uses own class loader , reference files packed in single jar.

c# - How to generate and auto increment Id with Entity Framework -

revised entire post. i'm trying post following json post request via fiddler: {username:"bob", firstname:"foo", lastname:"bar", password:"123", headline:"tuna"} however i'm getting error: message "cannot insert value null column 'id', table 'xxx_f8dc97e46f8b49c2b825439607e89b59.dbo.user'; column not allow nulls. insert fails.\r\nthe statement has been terminated." string though if manually send random id along request good. so: {id:"1", username:"bob", firstname:"foo", lastname:"bar", password:"123", headline:"tuna"} why entity framework not generate , auto increment id's? poco class follows: public class user { [key] [databasegenerated(databasegeneratedoption.identity)] public string id { get; set; } public string username { get; set; } public string firstname { get; set; } public string lastnam

c++ - stored procedure float parameters being split into two int parameters -

as i'm calling stored procedure c++ code float parameters somehow split this: 34.555 => 34,555, , error arises number of parameters mismatch. this how add parameter _commandptr ... variant vtlon = {0}; vtlon.vt = vt_null; if(targinf.dwfields & ti_field_lon ) { vtlon.vt = vt_r8; vtlon.dblval = targinf.dlongitude; } param = pcommand_lognewevent->createparameter( _bstr_t( l"lon" ), addouble, adparaminput, sizeof( double ), vtlon ); pcommand_lognewevent->parameters->append( param ); ... i changed sql server default language russian english , problem gone. need way manage without such global setting.

web services - Security protocol to allow only one mobile app requests to server -

is there proven security protocol use ensure request sent web server comes specific mobile application (the mobile application should deployed in many phones)? if not, best practice? using https in server end , having access token in requests coming web server may allow restrict. you can have access token configured in mobile app. request coming web server without valid access token considered malicious.

c++ - Abstract class and object -

i got first class : namespace abstract{ class abstractclass{ public: virtual void setname(const std::string & _name) =0; virtual void print() =0; void dynamiccasttest(){}; }; } and second : class concreteclass : public abstract::abstractclass{ std::string type; public: concreteclass(); concreteclass(char* a); ~concreteclass(); static concreteclass* createconcreteclass(char* a); virtual void setname(const std::string & _name); virtual void print(); }; but when want define function createconcreteclass(char*): static concreteclass* createconcreteclass(char* a){ concreteclass a; } visual cant create object 'a' because tells me it's abstract object. why ? i have tried vc10. gives me error c2082 telling me redefinition of formal parameter (i have german installation error message may different). rename variable: concreteclass* concreteclass::createconcreteclass(char*

doctrine2 - Associations with entities (proxy error) -

i've follow entities: user address country my user connects address , address country. i've magic __setter , __getter, , when use $addresses = $user->__get('addresses'); , retrieves address(es). dump: array(1) { [0]=> object(stdclass)#463 (13) { ["__class__"]=> string(19) "user\entity\address" ["inputfilter"]=> null ["addressid"]=> int(21) ["street"]=> string(9) "lange heg" ["number"]=> int(19) ["addition"]=> string(1) "a" ["zipcode"]=> string(6) "7039ca" ["user"]=> string(16) "user\entity\user" ["country"]=> string(50) "doctrineormmodule\proxy\__cg__\user\entity\country" ["creator_id"]=> int(9) ["creation_date"]=> string(8) "datetime" ["la

How to update the mysql table using sql server table data in c#? -

so have table clienti in mysql , clientiimporti in sql server , want compare @ first elements of rows of clienti elements of rows of clientiimporti if equal have overwrite elements of rows of table clienti in mysql. thinking of using update not sure do. little thank you. newbie in c#. in advance int lengthclienti = mysqlsetclienti.tables["clienti"].rows.count; int columnclienti = 4;      //loop through rows of sql server data table , add mysql dataset      (int = 0; <= lengthclienti - 1; i++)//row { (int j = 0; <= columnclienti; j++)//column { if (sqldataset.tables["clientiimporti"].rows[i][j].tostring() == mysqlsetclienti.tables["clienti"].rows[i][j].tostring()) { } } }

Differences between Image and BitmapImage with Flex? -

in image 's asdoc, can see : flex includes bitmapimage class. class used embedding images skins , fxg components but can use image in skins , use @embed image ... therefore, , when should use image or bitmapimage please ? image skinnable class wraps bitmapimage . such bitmapimage more lightweight, image has more features. question when use boils down this: if features of bitmapimage suffice, use that; otherwise use image. in mobile environments try favor use of bitmapimage. now features image add exactly? image extends skinnablecomponent: means can assign images skin border or dropshadow or whatever consistently throughout application. it provides progress indicator can displayed while image loading. one more feature possibility queue loading of multiple images .

Using guard live reload and guard compass seems to conflict -

i'm trying use guard livereload , guard compass together. here file a sample guardfile # more info @ https://github.com/guard/guard#readme guard 'compass' watch('^sass/(.*)\.s[ac]ss') end guard 'livereload' watch(%r{.+\.(css|html|js)$}) end # concatenate javascript files specified in :files public/js/all.js #guard :concat, type: "js", files: %w(), input_dir: "public/js", output: "public/js/all" #guard :concat, type: "css", files: %w(), input_dir: "public/css", output: "public/css/all" #guard 'uglify', :destination_file => "public/javascripts/application.js" # watch (%r{app/assets/javascripts/application.js}) #end when begin guard, without enabling chrome live reload extension, sass files compiled , work well. but when enable livereload extension, terminal says browser connected, , when make changes in sass

c# - Convert Linq to regular function -

i have linq method how machine network card properties , don't want use linq, can have convert , not using linq ? public networkadapter[] getall() { return (from adapter in networkinterface.getallnetworkinterfaces() unicast in adapter.getipproperties().unicastaddresses !system.net.ipaddress.isloopback(unicast.address) && unicast.address.addressfamily != addressfamily.internetworkv6 let lastgatewayaddress = adapter.getipproperties().gatewayaddresses.lastordefault() select new networkadapter() { string name = adapter.name, string id = adapter.id, string description = adapter.description, string ipaddress = unicast.address.tostring(), string networkinterfacetype = adapter.networkinterfacetype.tostring(), string speed = adapter.speed.tostring("#,##0"), string macaddress = getmacaddress(ada

data structures - Java : Datastructure to stock lots of words -

Image
i have stock lots of word (+200k) in java program , want access them fast. need know if given word belongs "dictionary". don't need pair <word, smthg> . if possible i'm searching solution in standard library. ps : maybe using data structure not better way ? reading each time file containing words more efficient ? edit : it's small project. have deal effectiveness , memory last edit : choose hashset. use java sets because sets linear sorted data structure treeset. searching, techniques binary search can implemented , fast no repetition. this structure of java sets. also not going allow duplication hence reducing redundancy , save memory. if want know various searching algorithms complexities refer link. here is http://bigocheatsheet.com/

sonarqube - SONAR undocumented public API skewed by unit tests -

the sonar metrics include section evaluating documentation quality, having item public undocumented api . high in our project because reports each , every unit test. however, unit test methods have public junit. is there easy way remove unit test methods undocumented api metric ? i'm aware of these alternatives: we add javadoc comments each test method. not useful, pollutes code. the tests in eclipse test fragment projects. exclude test classes sonar analysis. however, want have same rules applied test code , production code (e.g. when checking violations). i have not found section in sonar configuration matching metric, may have missed it. this metric not fed unit test classes, must have missed in configuration. as example, check out sonar analysed sonar (on nemo) : you'll see no test class reported "public_undocumented_api".

javascript - Animation on jQuery only executes one time -

i trying make funny function rotates element 360. problem executes first time , don't know why! jquery.fn.circularfun = function() { this.stop().animate( {rotation: 360}, { duration: 500, step: function(now, fx) { $(this).css({"transform": "rotate("+now+"deg)"}); } } ); } thanks!! after first rotation, have been rotated 360 . need set 0 after you're finished.

On what basis ruby and ruby on rails versions are named -

i curious on basis ruby , ror versions named. example, after ruby 1.9.3, version 2.0 instead of 1.10 or 1.9.4, , in rails. there must convention or rule. ruby , rails, many other projects follow semantic versioning . they don't follow letter, though. example, ruby 1.9 backwards-incompatible ruby 1.8, whereas ruby 2.0 compatible ruby 1.9, ruby 1.9 should have been ruby 2.0 , ruby 2.0 should have been ruby 2.1. in particular case, there historic "marketing" reasons that: term "ruby 2.0" has been used in ruby community on 10 years mark specific "mythical" version specific, talked-about features scoped monkey patching , traits. releasing version without features still calling "2.0" have been more confusing breaking rules of semantic versioning. (actually, ruby 2.0 was released without traits , it has led confusion !) otoh, impossible call "1.10", because ruby_version constant returns version string , , lot of too

sqlite - Android On Delete Cascade not working properly -

i making android app in make 5 tables in 1 open helper class. facing problem while having on delete cascade in schema. know concept of on delete cascade. here copy 1 of 2 tables. private static final string medicine_table = "create table medicine_details (_mid integer primary key autoincrement, " + " medicine_name text, type text, take_with text, m_did integer not null," + "foreign key(m_did) references doctor_details(did)" + " on delete cascade" + ");"; private static final string sch_tab = "create table schedule_details(sid integer primary key autoincrement, " + "medi_stdate text,medi_end_date text,time_sch text,rept text, alarm_id number, " +

Passing string value after apply split function in asp.net c# -

i have fail pass string value label or text box after split function. question how store string value in label after applying split function. string strdata2 = "samsung,apple,htc"; char[] separator2 = new char[] { ',' }; string[] strsplitarr = strdata2.split(separator2); foreach (string arrstr in strsplitarr) { response.write(arrstr + "<br/>"); } (e.g. label.text = ""+ the split string value ) thanks you can use string.join : label.text = string.join("," , strsplitarr); concatenates elements of string array, using specified separator between each element.

ios - SBJson displays null -

Image
i trying parse json data sbjson show current temperature. example code tutorial works perfect: tutorial: fetch , parse json when change code json feed null. kind of new json followed every tutorial , documentation found. json source used: json source my code sbjson: nsstring *responsestring = [[nsstring alloc] initwithdata:responsedata encoding:nsutf8stringencoding]; self.responsedata = nil; nsarray* currentw = [(nsdictionary*)[responsestring jsonvalue] objectforkey:@"current_weather"]; //choose random loan nsdictionary* weathernow = [currentw objectatindex:0]; //fetch data nsnumber* tempc = [weathernow objectforkey:@"temp_c"]; nsnumber* weathercode = [weathernow objectforkey:@"weathercode"]; nslog(@"%@ %@", tempc, weathercode); and of course have implemented other sbjson code. there no current_weather key in json data posted. structure is: { "data": { "current_condition": [ { ..., "temp_c&quo

java - Trying to link two ArrayList objects together -

i've tried searching, haven't found me yet. here goes: i'm trying connect card customer via customerid, can't seem getting work (nullpointerexceptions). objects put in arraylists. i'm pretty sure problem in tostring() of liftcard(). import java.io.serializable; public class liftcard implements serializable { private int cardnumber, cardtype, cardprice, cardpassing; int cardbalance; private user user; liftcard next; public liftcard(int ct, int cn) { cardnumber = cn; cardtype = ct; next = null; }// end of konstruktqr public int getcardnumber() { return cardnumber; } public int getcardtype() { return cardtype; } public user getuser(){ return user; } public void setuser(user u){ user = u; } public string tostring() { return getuser().getcustomerid() + "\t" + cardnumber + "\t" + cardtype; //pretty sure problem here! } this user-class want link card-class import java.io.serializable; public class

osx - Aparapi add sample -

i'm studing aparapi ( https://code.google.com/p/aparapi/ ) , have strange behaviour of 1 of sample included. sample first, "add". building , executing it, ok. put following code testing if gpu used if(!kernel.getexecutionmode().equals(kernel.execution_mode.gpu)){ system.out.println("kernel did not execute on gpu!"); } and works fine. but, if try change size of array 512 number greater 999 (for example 1000), have following output: !!!!!!! clenqueuendrangekernel() failed invalid work group size after clenqueuendrangekernel, globalsize[0] = 1000, localsize[0] = 128 apr 18, 2013 1:31:01 pm com.amd.aparapi.kernelrunner executeopencl warning: ### cl exec seems have failed. trying revert java ### jtp kernel did not execute on gpu! here's code: final int size = 1000; final float[] = new float[size]; final float[] b = new float[size]; (int = 0; < size; i++) { a[i] = (float)(math.random()*100); b[i] = (float)(math.random()*10

mysql - Getting Max date from multiple table after INNER JOIN -

i have 2 following tables table 1) id | hotel id | name 1 100 xyz 2 101 pqr 3 102 abc table 2) id | booking id | departure date | amount 1 1 2013-04-12 100 2 1 2013-04-14 120 3 1 2013-04-9 90 4 2 2013-04-14 100 5 2 2013-04-18 150 6 3 2013-04-12 100 i want reault in mysql such take row table 2 max departure date. id | booking id | departure date | amount 2 1 2013-04-14 120 5 2 2013-04-18 150 6 3 2013-04-12 100 select b.id, b.bookingid, a.name, b.departuredate, b.amount table1 inner join table2 b on a.id = b.bookingid inner join ( select bookingid, max(departuredate) max_date table2 group bookingid ) c on b.bookingid = c.bo

php - how to get dynamic value by ajax function call -

Image
on web page have text area and suppose data in textarea when alternate value of select box( or onchange event), used ajax function <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script> function mycall() { var request = $.ajax({ url: "ajax.php", type: "get", datatype: "html" }); request.done(function(msg) { $("#mybox").html(msg); }); request.fail(function(jqxhr, textstatus) { alert( "request failed: " + textstatus ); }); } </script> and select box code, <select name="txtname" id="txtname" onchan

Django: How do I sort on date from two models? -

1.) have following models.py definition: django.db import models datetime import date class author(models.model): author = models.charfield(max_length=20) def __unicode__(self): return '%s' % (self.author) class systema(models.model): author = models.foreignkey(author) date = models.datefield() system = models.charfield(max_length=20, blank=false, default="system a") description = models.charfield(max_length=300) status = models.charfield(max_length=6) def __unicode__(self): return '%s, %s, %s, %s, %s' % (self.date, self.author, self.system, self.description, self.status) class systemb(models.model): author = models.foreignkey(author) date = models.datefield() system = models.charfield(max_length=20, blank=false, default="system b") description = models.charfield(max_le