• Breaking News

    Friday, May 10, 2019

    [C++] Linked List head is always null when trying to print contents of nodes Ask Programming

    [C++] Linked List head is always null when trying to print contents of nodes Ask Programming


    [C++] Linked List head is always null when trying to print contents of nodes

    Posted: 10 May 2019 06:59 PM PDT

    This is a homework question. I'm struggling with writing my linked list data structure. I think my problem is in my add function. It looks like I'm not managing to reassign the head pointer properly, but I'm not sure what I'm doing wrong.

    Add():

    template<class listType> void LinkedList<listType>::Add(int i, string n, listType h, listType r) { Node<listType>* newnode = new Node<listType>(i, n, h, r); head = newnode; newnode->SetNext(head); 

    But when call the display function (which passes the head to print) from main, the print function always displays the list is empty

    Print Function:

    template<class listType> void LinkedList<listType>::Display() { Print(head); } template<class listType> void LinkedList<listType>::Print(Node<listType>* temp) { if (temp == NULL) { cout << "\nEnd of list.\n"; return; } else { cout << temp->GetName() << "\n"; Print(temp->GetNext()); } } 

    I've tried passing the head by reference as well but to no avail.

    Full LinkedList source:

    template <class listType> class LinkedList { private: Node<listType>* head; public: LinkedList(); ~LinkedList(); void Add(int i, string n, listType h, listType r); void Display(); void Print(Node<listType>*); }; template<class listType> bool LinkedList<listType>::IsEmpty() const { return head == NULL; } template<class listType> LinkedList<listType>::LinkedList() { head = NULL; } template<class listType> LinkedList<listType>::~LinkedList() { } template<class listType> void LinkedList<listType>::Add(int i, string n, int h, int r) { Node<listType>* newnode = new Node<listType>(i, n, h, r); head = newnode; newnode->SetNext(head); cout << newnode->GetId() << "\t" << newnode->GetName() << "\t"; cout << newnode->GetHours() << "\t" << newnode->GetRate() << "\n"; } template<class listType> void LinkedList<listType>::Display() { Print(head); } template<class listType> void LinkedList<listType>::Print(Node<listType>* temp) { if (temp == NULL) { cout << "\nEnd of list.\n"; return; } else { cout << temp->GetName() << "\n"; Print(temp->GetNext()); } } 
    submitted by /u/Vulg4r
    [link] [comments]

    Where did the culture of "open-source" in programming and coding arise from?

    Posted: 10 May 2019 07:28 AM PDT

    Of all the industries that exist, it seems code is the only one that has a large faction of open-sourcedness.

    submitted by /u/mementomoriok
    [link] [comments]

    I've been learning C# for the last two years and I wanna keep learning after I finish school. If I want to learn another language (such as HTML) what's the best way to learn it if I already have an alright knowledge in C#

    Posted: 10 May 2019 12:47 PM PDT

    I know there's tons of basic tutorials for each language out there but I'm looking more for just general advice on quick ways or tips about learning a new language if I already know one. I always see multiple people here who have knowledge of multiple languages so just curious what was your method.

    Thanks :)

    submitted by /u/LiveAGoodStory
    [link] [comments]

    Is a class like "Object Oriented Programming and Data Structures CSC205AB" Something that may be usefull to a non-programmer getting into programming?

    Posted: 10 May 2019 04:27 PM PDT

    I am a technically inclined gamer that has an interest in possibly pursuing programming as a career.

    Would this class be good to take?

    Would this class be hard?

    Is this class something useful for business projects? or useful to employers?

    submitted by /u/canchesterunited
    [link] [comments]

    Need some help with using a Vue / nodejs library...

    Posted: 10 May 2019 03:49 PM PDT

    I'm trying to use: https://github.com/MisRob/vue-tree-navigation

    But I don't have npm, nodejs or anything like that. I'm running an MVC website and using complied javascript files. I tried adding just the .js and .css but it just generates a comment like this:

    <!--function(e,n,r,i){return Pt(t,e,n,r,i,!0)}--> 

    Same issue as this guy in another library: https://github.com/lkmadushan/vue-tuicalendar/issues/7

    My code is :

    Vue.component('vue-tree-navigation', VueTreeNavigation);

    <div id="app> <b-card-text> <vue-tree-navigation /> </b-card-text> </div> Vue.component('vue-tree-navigation', VueTreeNavigation); var App = new Vue({ el: '#app', data: { etc...... 

    Anyone tell me what I'm doing wrong? Can I use this library without nodejs?

    submitted by /u/stackoverflow1
    [link] [comments]

    How to start using formal verification?

    Posted: 10 May 2019 05:35 AM PDT

    Hi all!

    It's not a secret that programmers like other people make mistakes. And our programs often contain mistakes, everyday we read about lots of vulnerabilities, buffer overflows and etc. Testing can't prove that program contains no errors.

    But there are formal verification methods, and I'm interested in how ordinary programmer can use it if possible. Do these tools prove accordance with given specification automatically or do you need any manual actions? Do you need expertise in formal logic or math to use formal verification and how much of it? And, most interesting, what tools do you need and how hard are they to deploy? (most interested in Java and C, but others languages are welcomed too).

    I'm really excited about seL4 as the first OS with full formal verification. I understand that it makes development longer and more expensive but there are some field where the game is worth the candle, for example security libs or tools for mathematical researches. So, the question is how one can start using formal verification if he desires.

    submitted by /u/kamalist
    [link] [comments]

    Python ‘str’ object has no attribute ‘write error’

    Posted: 10 May 2019 09:14 AM PDT

    I was trying to do some code and i kept getting this error and after looking online and trying somethings i simply couldn't find a solution any help Here is the code in question mport random path="map values.txt" file=open( path, 'r') Tile_1=0 Tile_2=0 Tile_3=0

    game=0

    while game==0: new_path="map values.txt" new_file=open( new_path, 'w') random=random.randint(1, 100) counter=1 if counter==1: Tile_1=random/100 new_path.write(Tile_1+"/n") print(Tile_1) counter=counter+1 if counter==2: Tile_2=random/100 counter=counter+1 if counter==3: Tile_3=random/100 game=1 print(Tile_1) print(Tile_2) print(Tile_3)

    new_path.close() path.close()

    submitted by /u/sago1234
    [link] [comments]

    Firebase and Rest API (Android Studio)

    Posted: 10 May 2019 12:45 PM PDT

    Have an assignment in which I need to use a database (firebase) and connect using Rest API. How do I do this?

    submitted by /u/__om
    [link] [comments]

    Sending a notification from one user to another-android

    Posted: 10 May 2019 10:52 AM PDT

    Hey, I'm developing this app and would like the app to have the function of users being able to send notification to other users. The only tutorials I found were using FCM. But I wouldn't like to use Firebase in my app since I'm far along now and used Retrofit and REST api so far and would not want to need to change everything now. Could you please recommend other options to me? How can I achieve this?

    submitted by /u/la_la_oh_la_la
    [link] [comments]

    GitHub Pie-Chart

    Posted: 10 May 2019 08:49 AM PDT

    I was looking for somekind of tool that showed how many lines of code you have in total of a certain language in a GitHub repository and then sum the total lines of all languages/projects to give you a pie chart (or other kind of chart) of the percentage of each language of your profile

    submitted by /u/Skelozard1
    [link] [comments]

    Is there a method to reverse engineering a back end?

    Posted: 10 May 2019 08:36 AM PDT

    Doing job automation with access to front end only.

    Reading the source code is interesting, but I haven't gotten much success in writing my own Post requests.

    Basically my goal is to figure out how the back end system works, so I can create my own direct links.

    Front end seems to be JavaScript

    submitted by /u/nice1work1
    [link] [comments]

    Is there a way to custom configure the Brackets IDE?

    Posted: 10 May 2019 08:30 AM PDT

    https://snag.gy/kSMcIR.jpg

    I wish to remove every single option so that the only viewable element in the menu is "Auto-Fix with ES-Lint."

    However, the other options still need to be accessible - Example - CMD + Z still triggers undo.

    submitted by /u/mementomoriok
    [link] [comments]

    WordNet graph creation - need advices.

    Posted: 10 May 2019 08:07 AM PDT

    I have a project where i need to create a graph of the synset relations just like in WordNet, but for a different language. I have little to no idea where i must start and what should i research since i just started learning nltk and python.

    Any advices are welcome.

    submitted by /u/kotkatawe
    [link] [comments]

    Choosing the right technology for a custom "CRM"

    Posted: 10 May 2019 07:57 AM PDT

    Hi to all redditors!

    I need some suggestion for choosing the right technology/framework for the recreation of a big project:

    in my company we (me and my boss) built and maintained a custom CRM/software for orders analysis in MS Access with a SQL Server backend. Obviously at first was pretty light and fast, but today it outgrowed the MSAccess capability and now we are forced to migrate to another technology.

    We want to transform it to a web-app/portal. We already have experience in web development, we built various website for our costumers, but nothing so complex like our "CRM".

    The features we need are:

    • Data entry/completion
    • Data extraction (excel/csv)
    • Data visualization with reports
    • Analysis and post-processing of the orders (check if it can be applied custom promo/discounts, like 3x2, buy x and y and get a discount, etc..)

    The last one is the critical point.

    We searched a little and many suggest Django, or python in general to process large amounts of data . We don't have problems in learning a new language, but our everyday languages are VBA, PHP and Java.

    If you have some suggestion, even small ones, I will really appreciate :)

    If I forgot to specify something, let me know!

    Thanks!

    submitted by /u/Omnia1989
    [link] [comments]

    Should a Typical Backend Engineer Know To Secure a DB?

    Posted: 10 May 2019 01:55 AM PDT

    I would really appreciate it if you could take 15 seconds and answer this question here:

    https://forms.gle/4P7S33uRtyCz94Et7

    submitted by /u/westwhitesands
    [link] [comments]

    Filter Images by "alt" text.

    Posted: 10 May 2019 02:00 AM PDT

    Currently my personal project is getting rather cluttered, its essentially just a bunch of images of cars and fighter jets, cause who doesn't love fighter jets?, is it possible to filter them using a search bar and their alt text. so i could put like "red, car, street" and "blue, car, garage" in the alt text and search all the images with the alt text "car".

    I haven't tried anything specific and currently there is no search bar on it.

    submitted by /u/act_n0rma1
    [link] [comments]

    Cannot able to take screenshot of CameraPreview in flutter

    Posted: 09 May 2019 10:53 PM PDT

    pubspec.yaml (dependenices used) :

    dependencies: flutter: sdk: flutter # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^0.1.2 # camera camera: # package for saving the screenshot image_picker_saver: ^0.1.0 # packge for toast-msg fluttertoast: ^2.0.0 

    build.gradle (app module):

    android { compileSdkVersion 28 lintOptions { disable 'InvalidPackage' } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.using_camera" minSdkVersion 21 targetSdkVersion 28 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. signingConfig signingConfigs.debug } } } 

    main.dart

    import 'package:flutter/material.dart'; import 'package:using_camera/camera_view.dart'; import 'package:camera/camera.dart'; import 'dart:async'; List<CameraDescription> cameras; Future<Null> main() async { cameras = await availableCameras(); runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData( primaryColor: Colors.greenAccent, primarySwatch: Colors.green), home: CameraView(cameras), ); } } 

    camera_view.dart

    import 'dart:typed_data'; import 'package:camera/camera.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'dart:ui' as ui; import 'package:flutter/services.dart'; import "package:fluttertoast/fluttertoast.dart"; import 'package:image_picker_saver/image_picker_saver.dart'; class CameraView extends StatefulWidget { List<CameraDescription> cameras; CameraView(this.cameras); @override _CameraViewState createState() => _CameraViewState(); } class _CameraViewState extends State<CameraView> { CameraController controller; static GlobalKey previewContainer = new GlobalKey(); var filePath; @override void initState() { super.initState(); controller = CameraController(widget.cameras[0], ResolutionPreset.medium); controller.initialize().then((_) { if (!mounted) { return; } setState(() {}); }); } @override void dispose() { controller?.dispose(); // if controller is not null then dispose super.dispose(); } @override Widget build(BuildContext context) { if (!controller.value.isInitialized) { return Container(); } //CameraPreview(controller) return RepaintBoundary( key: previewContainer, child: Stack( children: <Widget>[ Positioned.fill( child: AspectRatio( aspectRatio: controller.value.aspectRatio, child: CameraPreview(controller), ), ), Center( child: Image.asset("assets/image.png"), // overlay image ), Positioned.fill( child: Opacity( opacity: 1.0, child: Image.asset( "assets/filter.png", // transparent background fit: BoxFit.fill, ), ), ), Align( alignment: Alignment.bottomCenter, child: RaisedButton( child: Text("Capture"), onPressed: (){ _takeScreenShot(); }, ), ) ], ), ); } Future _takeScreenShot() async { RenderRepaintBoundary boundary = previewContainer.currentContext.findRenderObject(); ui.Image image = await boundary.toImage(); ByteData byteData = await image.toByteData(format: ui.ImageByteFormat.png); Uint8List pngBytes = byteData.buffer.asUint8List(); print("pngBytes value : $pngBytes"); setState(() {}); filePath = await ImagePickerSaver.saveFile(fileData: pngBytes); toastMsg("Saved on ${filePath.toString()}"); print(filePath); print("inside _takeScreenShot"); } toastMsg(String msg) { var toast = Fluttertoast.showToast( msg: "$msg", toastLength: Toast.LENGTH_SHORT, gravity: ToastGravity.BOTTOM, timeInSecForIos: 3, backgroundColor: Colors.red, textColor: Colors.white, fontSize: 16.0); print("inside toastMsg"); return toast; } } 

    I have used RepaintBoundary widget which works great which i used other widgets and also able to save the image in my android device.

    I have overlayed the image widget in CameraPreview, but when i take the screenshot the saved screenshot image appear transparent with overlay image in the center of the screen.

    submitted by /u/yash36five
    [link] [comments]

    No comments:

    Post a Comment